The Linux Kernel/System

System means general functions used to support and manage other kernel functionality. Synonym: infrastructure.

Booting and HaltingEdit

Booting


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


sys_reboot calls machine_restart or machine_halt or machine_power_off

Userspace communicationEdit

syscall, /proc, /dev, /sys
linux/proc_fs.h
create_proc_entry etc

DevicesEdit

ls /dev
cat /proc/devices

Char devicesEdit

Chapter 13. I/O Architecture and Device Drivers

DMAEdit

SAC Single Address Cycle

ModulesEdit

lsmod
cat /proc/modules

Hardware interfacesEdit

I/O ports and registersEdit

Modern functions for port I/O:

ioport_map

ioread8 iowrite8

ioread16 iowrite16

ioread32 iowrite32

#include <linux/ioport.h>

Functions for memory mapped registers:

ioremap

readb writeb

readw writew

readl writel

The {in,out}[bwl] macros are for emulating x86-style PCI/ISA IO space:

inb outb

inw outw

inl outl

Hardware Device DriversEdit

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, USBEdit

Input bus: keyboard and mouse

cat /proc/bus/input/devices

PCI bus

pci_register_driver
lspci
cat /proc/pci
cat /proc/bus/pci/devices

USB bus

lsusb
cat /proc/bus/usb/devices

Building and UpdatingEdit

DebuggingEdit

  • git bisect ...

oops

printk

linux/arch/i386/kernel/traps.c
[1]

KDB (Built-in Kernel Debugger) Local debugging.

Other

KGDB Remote GDB debugging.

# gdb -q vmlinux
(gdb) target remote /dev/ttyS0
Last modified on 9 November 2012, at 18:15