4 ms·
Seven easy steps to get acquainted with the Linux kernel: Step 1: Build gnu binutils, gcc and gdb from source for the correct target architecture Step 2: Setu
by exDM69 15y ago
Seven easy steps to get acquainted with the Linux kernel:
Step 1: Build gnu binutils, gcc and gdb from source for the correct target architecture
Step 2: Setup qemu, some kind of virtualization or get a gadget that can run linux so that you can run and debug the kernel without repeated rebooting. (in the early days, Linus actually used to reboot to test the kernel, booting from floppy disks. I wouldn't have the patience)
Step 3: Configure and build the linux kernel from git master branch
Step 4: Make an initrd root filesystem, e.g. uClibC + busybox.
Step 5: If applicable, install a bootloader. Boot to your new kernel.
Step 6: Hack with the source and/or compile time or runtime kernel configuration
Step 7: Start over from the beginning but do something differently.
Steps 1-5 takes about one saturday afternoon. The faster your CPU, the less there will be waiting.
You have to start somewhere, so pick an area of interest and work your way around from there. Don't start in the beginning of the boot code, that's arcane magic that's not very useful for learning.
There are several books written about the Linux kernel, so you might want to pick one of those. Of course, printed material about the kernel gets old fast but the basic foundations have been pretty solid.
- 4ad 15y ago> in the early days, Linus actually used to reboot to test the kernel, booting from floppy disks. I wouldn't have the patience. Still required all the time if you develop drivers for physical hardware. Still required at some point if you develop other kernel mode components because you can get bugs reproducible only on physical hardware because of different timings, cache coherency bugs (rare, but more often than you think) or broken ACPI routing tables (Every motherboard in existence has a broken ACPI table and the kernel has to deal with it).
- tuukkah 15y agoYou're not required to boot from floppy disks these days :-) You can even test on another machine without installing the new kernel by using network boot.
- 4ad 15y agoOf course, I was just saying the reboot - test cycle on a physical machine is still required, details are insignificant :-).
- exDM69 15y ago> Still required all the time if you develop drivers for physical hardware. Thankfully, this is not quite true. Most Linux drivers are implemented as kernel modules, which can be loaded and unloaded at runtime. No rebooting necessary. The guys who develop drivers for hardware that cannot be implemented as a kernel module (like some motherboard chipsets) probably have another machine for debugging or have some kind of dev boards to make their workflow more efficient.
- 4ad 15y agoThanks for telling me how to do my job, I'm a kernel developer :-). A bug in kernel code means you panic the machine, so you have to do a reboot. Whether you load the modules at runtime, on demand, or the driver is statically compiled into the kernel has nothing to do with it. The decision of when to do linking does not influence development a bit. Also, having multiple machines is required, not optional, because you use the dev machine to connect with a kernel debugger through a serial/firewire link to the test machine.