Build Process for different Linux distributions


4 posts
by mohsin455 » Sun Jun 24, 2012 9:05 pm
Hi All,

I am new to linux but have worked on wondows and many diffrent microporcessor processors in the past.

I am a bit confused with the different version of Linux (i.e. Arch, Debian, Raspbian etc). I want to know how are they branched (specially for the raspberry pi).

- Does all the different Linux versions use the same firmware from https://github.com/raspberrypi ?

- Also if I want to make any changes to drivers etc, where do I start ?

- Do they use the same kernel (if yes, whats the kernel repository) ?

Can anyone please provide me some details into the build process for the device drivers, kernel etc.

Thanks,
Mohsin
Posts: 3
Joined: Sat Dec 24, 2011 1:21 am
by jecxjo » Sun Jun 24, 2012 10:51 pm
Distros
From a general stand point, most differences between Linux distribution revolve around project philosophy. Some (like Debian) are geared towards a stable platform. They use slightly older versions of software which reduces the possibility of problems arising you get from new, untested code. Others (like Arch) are bleeding edge distros. They focus on maintaining the latest versions of software, allowing for the newest features as soon as they become public. Some focus on Free, Libre Open Source Software Only, while others allow for "tainted" systems by providing non-free software in their repos. Some are community driven, others have a benevolent dictator. Some have huge communities for support, some have business built around support.

Another major difference between distros is how code maintenance is performed both up and down stream. Arch tends to stick to vanilla software, not introducing Arch specific patches. Debian on the other hand points more towards Debian versions of patches when building code. Sometimes it small things like branding a package, sometimes its to add or remove functionality that follows Debian's philosophies.

Every distro will have some sort of package management system, Debian uses apt-get, Arch uses pacman. Though they have different flags and commands, at the end of the day they do the same thing.

In the end all Linux Distributions are is a way to package a full OS. They all have Firefox (for example) which is made by Mozilla. Maybe some icons change but Firefox is still Firefox no matter which distro you run.

If you want to get a comparison between Arch and Debian here is a link with some info https://wiki.archlinux.org/index.php/Arch_Compared_to_Other_Distributions#Debian_GNU.2FLinux

Raspberry Pi Specifics
When it comes to the firmware, all the distros use the same versions. The firmware is compiled and packaged for each distro and then sent to their individual repository servers. For the most part I think everyone seems to get the latest versions around the same time. Firmware is handled like security updates. Regardless of a distro's philosophy on stable vs bleeding-edge, these updates will occur on an as-needed basis.

Driver Development
Driver development is sort of a strange beast. The Linux Kernel is maintained by a group of developers who work independent of the distros. Some developers might work for Debian, Canonical (Ubuntu), Red Hat, etc but Kernel Source is still very much an upstream development process. Drivers are developed at a personal use/distro release/hardware vendor/etc level and eventually submitted to be added into the mainstream kernel.

This is the basis for how the Linux Kernel can be completely open source and still provide so much functionality. For example, lets say Seagate comes out with a new Hard Drive that has some super special feature. Red Hat wants to use this new HDD in their server so they write a driver for it and submit it to the Kernel maintainers. Once accepted, all distros will be able to use this new driver. What does Red Hat get in return? Some other group will write a driver for some other piece of hardware that Red Hat uses which also gets added to the main kernel branch. Everyone submits new drivers and gets access to each other's hard work.

Kernel Versions
Like we went over with software in a distro, kernel versions and patches are typically handled the same way. Some want a more vanilla kernel and do minimal modifications, others want to add new features, in-house modifications, etc and produce a highly patched kernel. Usually once a distro has released a patch to add some new support the rest of them will get the patch soon after or atleast someone will document how to add the support manually (build your own kernel).

The main branch of the Linux Kernel can be found at http://kernel.org/.

Building the Kernel and Drivers
Kernel compilation info can be found here http://elinux.org/RPi_Kernel_Compilation. Info on Kernel Driver development can be found all over the web. Quick Google Search found this http://www.cyberciti.biz/tips/build-linux-kernel-module-against-installed-kernel-source-tree.html though most will just cover the basics for building. A lot more info can be found in the kernel source and documentation. There are tons of books out there (I own many of them) and even though the source may change a lot, much of the functionality doesn't. Its like working with a C/C++ library when new versions come out, just need to read up on the changes.
IRC (w/ SSL Support): jecxjo.mdns.org
Blog: http://jecxjo.motd.org/code
ProjectEuler Friend: 79556084281370_44d12dd95e92b1d9453aba2bdc94101b
User avatar
Posts: 157
Joined: Sat May 19, 2012 5:22 pm
Location: Ames, IA (USA)
by mohsin455 » Tue Jun 26, 2012 12:04 am
Thanks very much for the detailed explanation. Now it makes things much clearer.

Thanks,
Mohsin455
Posts: 3
Joined: Sat Dec 24, 2011 1:21 am
by alexeames » Tue Jun 26, 2012 9:13 pm
Great post gecxjo :D
Alex Eames RasPi.TV HDMIPi.com RasP.iO
User avatar
Posts: 2054
Joined: Sat Mar 03, 2012 11:57 am
Location: UK