%Introduction %Thadeu Cascardo # Linux History # What is Linux? Linux is a POSIX-compatible modern operating system developed since 1991, released under the GPLv2, with contributions by thousands of people. It is mostly written in C, with some assembly code. It has grown from a non-portable Intel 386 code with thousands lines to a portable code with support for dozens of architectures and hundreds machines and millions of code. # When there was no Linux * The GNU system * Minix * The Usenet * Intel 386 * Finnish student Linus Torvalds # The beginning * Licensing * Torvalds and Tanenbaum flamewar * People's contributions # Evolution Since version 1.2, it has supported more than only Intel x86 architectures, including now SPARC, PowerPC, ARM, Alpha, M68K, MIPS, S/390, and many others. Since version 2.0, it has supported SMP systems, now running in systems with hundreds of processors, multi-core processors, etc. Since then, its SMP support has put to scale, with most bottlenecks removed. # Version control * CVS * Bitkeeper - controversy - Andrew Tridgell starts reverse-engineering the storage and saves the day * Linus creates git # GregKH presentations * Linux's growth in the 2.6 cycle # Development model # The old development model * X.Y.Z * Major and minor versions and releases * Even minor versions are stable * Odd minor versions are for development # There is no Linux 2.7 * Development cycles were getting long * Sometimes, people talk about 3.0 and breaking stuff * A new development model # The new versioning model * After a given release, there are stable point releases: 2.6.33.X * Release candidates are published by Linus: 2.6.34-rcX * There is a linux-next tree that will help development for the next version: 2.6.35 # The development model (or how Linus gets all those changes) * There are subsystems and there are maintainers for those * People Linus trusts who asks for pulls or send patches * People send patches to maintainers and to LKML for review * Andrew Morton does the "missing patches" collection # The documentation * Documentation/SubmittingPatches * Documentation/CodingStyle * Documentation/SubmitChecklist * MAINTAINERS # The tools people use * git * quilt * scripts/checkpatch.pl * scripts/get\\_maintainer.pl # Tools # ketchup * kernel.org distributes tarballs, patches and "subpatches" * ketchup makes it easier to get the right files * Reduces download time * Do not forget to import GPG keys or disable signature verification # diff * Compare two files or two trees * Recursive: -r * Include new files: -N * Unified diff: -u * Show C function: -p # patch * Apply changes in a patch file using standard input * patch file is generated using diff * Strip directory prefix: -p N * Reverse patch: -R # quilt * Organize patch series into a directory * QUILT\\_PATCHES environment variable * quilt new name.patch * quilt add src/file * quilt refresh * quile edit src/file * quilt top * quilt pop [-a] * quilt push [-a] * Never forget to do 'quilt add' before editing a file # Linux Tree Layout # Architecture * arch/ARCH/ * arch/ARCH/include/asm/ * arch/ARCH/kernel/ * arch/ARCH/mm/ * arch/ARCH/lib/ * arch/ARCH/boot/ * arch/ARCH/mach-MACH/ # Headers * include/linux/ * arch/ARCH/include/asm/ * include/asm-generic/ * include/OTHER/ # Main system * kernel/ * mm/ * lib/ * init/ * ipc/ * fs/ # Drivers and Filesystems * drivers/BUS/ * drivers/SUBSYSTEM/ * block/ * sound/ * fs/* * fs/FILESYSTEM/ # Other subsystems * net/ * crypto/ * security/ * virt/ # Others * Documentation/ * scripts/ * samples/ * usr/ * tools/ * firmware/ # Browsing code # Your editor of choice * vim works with ctags * emacs works with etags * make tags # cscope * -k (kernel mode) ignores /usr/include/ * make cscope * vim support # lxr * http://lxr.linux.no/ # Coding Style * Documentation/CodingStyle * scripts/checkpatch.pl * scripts/Lindent # git # Configuration # First configuration * make allnoconfig/allyesconfig/allmodconfig * make ranconfig * make defconfig * make config * make menuconfig (requires ncurses) * make xconfig/gconfig # Default configurations * make XXX\\_defconfig * arch/ARCH/configs # Updating configuration * make oldconfig * make silentoldconfig # Kconfig * Menus * Help * Dependencies # Configuring for another architecture * ARCH=x86\\_64 make menuconfig # Building Linux # Makefile rules * make *image * make bzImage (for x86) * make vmlinux * make modules * make all # Installing * make modules\\_install - uses INSTALL\\_MOD\\_PATH * make install - uses INSTALL\\_PATH # Building out-of-tree * make O=BUILDDIR # Building packages * make deb-pkg * make rpm-pkg * make binrpm-pkg * make tar-pkg * make targz-pkg # Booting Linux # Kernel parameters * Documentation/kernel-parameters.txt * Bootloader configuration * qemu append # Init ramdisk * Necessary for user space to setup root * filesystem initrd until 2.6.12 * initramfs: uses cpio (-H newc) # Linux init * init/* * /dev/console * init process * kthreadd