Sources

▶ The official versions of the Linux kernel, as released by Linus Torvalds, are available at http://www.kernel.org ▶ These versions follow the development model of the kernel ▶ However, they may not contain the latest development from a specific area yet. Some features in development might not be ready for mainline inclusion yet.

▶ Many chip vendors supply their own kernel sources ▶ Focusing on hardware support first ▶ Can have a very important delta with mainline Linux ▶ Useful only when mainline hasn't caught up yet.

▶ Many kernel sub-communities maintain their own kernel, with usually newer but less stable features ▶ Architecture communities (ARM, MIPS, PowerPC, etc.), device drivers communities (I2C, SPI, USB, PCI, network, etc.), other communities (real-time, etc.) ▶ No official releases, only development trees are available.

Getting Linux sources

▶ The kernel sources are available from http://kernel.org/pub/linux/kernel as full tarballs (complete kernel sources) and patches (differences between two kernel versions). ▶ However, more and more people use the git version control system. Absolutely needed for kernel development! ▶ Fetch the entire kernel sources and history git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git ▶ Create a branch that starts at a specific stable version git checkout -b v3.11 ▶ Web interface available at http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/. ▶ Read more about Git at http://git-scm.com/

Linux kernel size

▶ Linux 4.6 sources: Raw size: 730 MB (53,600 files, approx 21,400,000 lines) gzip compressed tar archive: 130 MB xz compressed tar archive: 85 MB ▶ Linux 3.10 sources: Raw size: 573 MB (43,000 files, approx 15,800,000 lines) gzip compressed tar archive: 105 MB bzip2 compressed tar archive: 83 MB (better) xz compressed tar archive: 69 MB (best) ▶ Minimum Linux 3.17 compiled kernel size, booting on the ARM Versatile board (hard drive on PCI, ext2 filesystem, ELF executable support, framebuffer console and input devices): 876 KB (compressed), 2.3 MB (raw) ▶ Why are these sources so big? Because they include thousands of device drivers, many network protocols, support many architectures and filesystems... ▶ The Linux core (scheduler, memory management...) is pretty small!

As of kernel version 3.10. ▶ drivers/: 49.4% ▶ arch/: 21.9% ▶ fs/: 6.0% ▶ include/: 4.7% ▶ sound/: 4.4% ▶ Documentation/: 4.0% ▶ net/: 3.9% ▶ firmware/: 1.0% ▶ kernel/: 1.0% ▶ tools/: 0.9% ▶ scripts/: 0.5% ▶ mm/: 0.5% ▶ crypto/: 0.4% ▶ security/: 0.4% ▶ lib/: 0.4% ▶ block/: 0.2%

As of kernel version 4.6 (in lines). ▶ drivers/: 57.0% ▶ arch/: 16.3% ▶ fs/: 5.5% ▶ sound/: 4.4% ▶ net/: 4.3% ▶ include/: 3.5% ▶ Documentation/: 2.8% ▶ tools/: 1.3% ▶ kernel/: 1.2% ▶ firmware/: 0.6% ▶ lib/: 0.5% ▶ mm/: 0.5% ▶ scripts/: 0.4% ▶ crypto/: 0.4% ▶ security/: 0.3% ▶ block/: 0.1% ▶ ...

Full tarballs

▶ Contain the complete kernel sources: long to download and uncompress, but must be done at least once ▶ Example: http://www.kernel.org/pub/linux/kernel/v3.x/linux-3.10.9.tar.xz ▶ Extract command: tar xf linux-3.10.9.tar.xz

Incremental patches between versions

▶ It assumes you already have a base version and you apply the correct patches in the right order. Quick to download and apply. ▶ Examples: http://www.kernel.org/pub/linux/kernel/v3.x/patch-3.10.xz (3.9 to 3.10) http://www.kernel.org/pub/linux/kernel/v3.x/patch-3.10.9.xz (3.10 to 3.10.9) ▶ All previous kernel versions are available in http://kernel.org/pub/linux/kernel/

Patch

▶A patch is the difference between two source trees ▶ Computed with the diff tool, or with more elaborate version control systems ▶ They are very common in the open-source community ▶ Excerpt from a patch (content of patch): embedded-linux-slides page 144~145 ▶ patch command ..

Applying a Linux patch

▶ Two types of Linux patches: ▶ Either to be applied to the previous stable version (from 3. to 3.x) ▶ Or implementing fixes to the current stable version (from 3.x to 3.x.y) ▶ Can be downloaded in gzip, bzip2 or xz (much smaller) compressed files. ▶ Always produced for n=1 (that's what everybody does... do it too!) ▶ Need to run the patch command inside the kernel source directory ▶ Linux patch command line example: cd linux-3.9 xzcat ../patch-3.10.xz | patch -p1 xzcat ../patch-3.10.9.xz | patch -p1 cd ..; mv linux-3.9 linux-3.10.9

results matching ""

    No results matching ""