building/rebuilding the kernel
install kernel source or download the newest source
kernel source is usually located in /usr/src/linux/
do a "make xconfig"
then "make bzImage"
if there are modules then do a "make bzImage && make modules && make modules_install"
there should be a .config (hidden) file in the src directory which also can be edited manually.
the new kernel will be located in /usr/src/linux/arch/i386/boot
copy bzImage to /boot and rename it to whatever you would like.
then add appropriate entries to grub/lilo configs
modules are in /lib/modules
modules
lsmod - list modules
rmmod <module name> - remove module
insmod <module name> - install module
insmod -k
depmod -a ??
modprobe <module name> - load or unload module
booloaders (lilo & grub)
lilo (grub is the current preferred boot loader. this lilo information is for historical purposes)
at LILO: prompt the <tab> key will list available kernels, asterisk next to default boot.
lilo command must be ran each time there are changes in the boot configuration
lilo options:
-b
sets boot device
-C <config file>
use this config file instead of default /etc/lilo.conf
-D <label>
boot specified kernel
-m <map file>
use this map file instead of default
-q
display current list of bootable kernels (query)
-R <command>
runs specified command at next boot
-v
increase verbosity
example lilo.conf:
# WARNING: do not forget to run lilo after modifying this file
default="linux"
boot=/dev/hda <----drive with boot sector
map=/boot/map <----location of map file
install=menu
keytable=/boot/us.klt
prompt <---prompt user ... can also be done with key combo Shift+Ctrl+Alt
nowarn
timeout=100 <----user input timeout in tenths of a second
message=/boot/message <---- text file displayed during boot
menu-scheme=wb:bw:wb:bw
image=/boot/vmlinuz <----kernel image
label="linux" <---description of kernel
root=/dev/hda6 <----location of root partition
initrd=/boot/initrd.img
append="acpi=ht resume=/dev/hda5 splash=silent"
vga=788
read-only <---root system initially mounted as read-only
image=/boot/vmlinuz
label="linux-nonfb"
root=/dev/hda6
initrd=/boot/initrd.img
append="splash=silent acpi=ht resume=/dev/hda5"
read-only
other=/dev/hda1
label="windows"
table=/dev/hda
image=/boot/vmlinuz
label="failsafe"
root=/dev/hda6
initrd=/boot/initrd.img
append="failsafe splash=silent acpi=ht resume=/dev/hda5 devfs=nomount"
read-only
grub
example grub.conf (/boot/grub/grub.cfg in ubuntu, /boot/grub/menu.lst in mandriva)
timeout 10
color black/cyan yellow/cyan
default 0
title linux
kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux root=/dev/hda6 resume=/dev/hda5 vga=788
initrd (hd0,0)/initrd.img
title linux-nonfb
kernel (hd0,0)/vmlinuz BOOT_IMAGE=linux-nonfb root=/dev/hda6 resume=/dev/hda5
initrd (hd0,0)/initrd.img
title 2.6.17-5
kernel (hd0,0)/vmlinuz-2.6.17-5mdv BOOT_IMAGE=2.6.17-5 root=/dev/hda6 resume=/dev/hda5 vga=788
initrd (hd0,0)/initrd-2.6.17-5mdv.img
title alt_linux-nonfb
kernel (hd0,0)/vmlinuz-2.6.17-5mdv BOOT_IMAGE=alt_linux-nonfb root=/dev/hda6 resume=/dev/hda5
initrd (hd0,0)/initrd-2.6.17-5mdv.img
title failsafe
kernel (hd0,0)/vmlinuz BOOT_IMAGE=failsafe root=/dev/hda6 failsafe
initrd (hd0,0)/initrd.img
installing grub:
grub-install /dev/sda (MBR)
booting to single user:
edit boot configuration and type in "single"
resolving lost root password:
edit boot configuration and type in "init=/bin/sh"
run passwd
boot process
loads initrd (initial ram disk)
initrd=/boot/initrd.img
mounts root system
root=/dev/hda#
init process loads (PID 1)
/sbin/init
init reads /etc/inittab
/etc/rc.d/rc.sysinit script is run
startup scripts are located in /etc/rc.d/init.d/
various ordered scripts for runlevels are located in...
/etc/rc.d/rc0.d
/etc/rc.d/rc1.d
/etc/rc.d/rc2.d
/etc/rc.d/rc3.d
/etc/rc.d/rc4.d
/etc/rc.d/rc5.d
/etc/rc.d/rc6.d
runlevels:
0 - system halt
1 - single user
2 - undefined/user configurable
3 - multiuser mode, networking, text-login
4 - undefined/user configurable
5 - multiuser mode, networking, gui-login
6 - reboot