The Linux Kernel/System
System means general functions used to support and manage other kernel functionality. Synonym: infrastructure.
Booting and Halting
Booting
- Article about booting of the kernel
- wikipedia:Booting
- http://tldp.org/HOWTO/Linux-i386-Boot-Code-HOWTO/
- http://www.tldp.org/LDP/lki/lki-1.html
- http://www.tldp.org/HOWTO/KernelAnalysis-HOWTO-4.html
cat /proc/cmdline arch/i386/boot/bootsect.S arch/i386/kernel/head.S: calls start_kernel In init/main.c: start_kernel, rest_init, init, run_init_process
Halting and rebooting
- Softdog Driver
- wikipedia:Shutdown
- "Linux for PowerPC Embedded Systems HOWTO: Boot Sequence" by Boas Betzler
- "Embedded Linux Howto" by Sebastien Huet
- "Migrating from x86 to PowerPC, Part 2: Anatomy of the Linux boot process" by Lewin Edwards
- "Inside the Linux boot process" by M. Tim Jones
- "Reducing OS Boot Times for In-Car Computer Applications" by Damien Stolarz
sys_reboot calls machine_restart or machine_halt or machine_power_off
Userspace communication
syscall, /proc, /dev, /sys
linux/proc_fs.h create_proc_entry etc
DMA
- Documentation/DMA-mapping.txt
- DMA-able memory: pci_alloc_consistent __get_free_page kmalloc kmem_cache_alloc
- pci_pool
- LDD3:Memory Mapping and DMA
- http://www.xml.com/ldd/chapter/book/ch13.html mmap and DMA
SAC Single Address Cycle
Modules
lsmod cat /proc/modules
- kernel/kmod.c
- LDD3: Building and Running Modules
- http://www.xml.com/ldd/chapter/book/ch02.html
- http://www.tldp.org/LDP/tlk/modules/modules.html
- http://www.tldp.org/LDP/lkmpg/2.6/html/ The Linux Kernel Module Programming Guide
I/O ports and registers
Modern functions for port I/O:
#include <linux/ioport.h>
Functions for memory mapped registers:
The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space:
Hardware Device Drivers
Hardware Device Drivers are different from char and block devices.
or just Device Drivers
Keywords: kobjects, sysfs, buses, devices, drivers, classes, firmware, hotplug
Busses: input, PCI, USB
Input bus: keyboard and mouse
cat /proc/bus/input/devices
PCI bus
pci_register_driver
lspci cat /proc/pci cat /proc/bus/pci/devices
- #include <linux/pci.h>
- Documentation/pci.txt
USB bus
lsusb cat /proc/bus/usb/devices
Debugging
- printk
- dump_stack
- show_registers
- dmesg --console-level <level>
- gdb /usr/src/linux/vmlinux /proc/kcore
- Magic SysRq key
- git bisect ...
oops
- http://lxr.linux.no/source/Documentation/oops-tracing.txt
- http://www.urbanmyth.org/linux/oops/ Good presentation
- http://www.mulix.org/lectures/kernel_oopsing/kernel_oopsing.pdf
printk
linux/arch/i386/kernel/traps.c [1]
KDB (Built-in Kernel Debugger) Local debugging.
- http://www-106.ibm.com/developerworks/linux/library/l-kdbug/?ca=dgr-wikiaKDB
- http://oss.sgi.com/projects/kdb/
- ftp://oss.sgi.com/www/projects/kdb/download/
Other
- http://user-mode-linux.sourceforge.net/
- CONFIG_MAGIC_SYSRQ, handle_sysrq
- http://lkcd.sourceforge.net/ Linux Kernel Crash Dump
KGDB Remote GDB debugging.
# gdb -q vmlinux (gdb) target remote /dev/ttyS0