Jim's (mis)adventures replacing the linux kernel, on ubuntu/debian: Wed Jan 3 07:41:52 PST 2007 NOTE: YMMV you have to download the kernel src ... 32 cd /usr/src 42 tar xjvf *bz2 # ls linux - symlink to make this, so you can cd /usr/src/linux linux-patches linux-source-2.6.XX <----------------------------- linux-source-2.6.XX.tar.bz2 rpm 44 ln -s *10 linux 45 cd linux 48 vi READ* 54 ls /usr/share/doc | more 60 make help > x 61 more x 63 ntpdate clock1.cat.pdx.edu 66 make config note: make menuconfig may be easier to get going (curses-based) 67 gcc - oops - you need a compiler 76 apt-cache search gcc | more 78 apt-get install gcc 82 make mrproper 83 make config 84 make menuconfig <---- this didn't work BECAUSE 85 apt-cache search ncurses 86 apt-get install libncurses5 87 make menuconfig 88 apt-get install ncurses-devel 89 apt-cache search ncurses-devel 90 apt-cache search ncurses 91 apt-get install libncurses5-dev generates .config which ends up in /boot note: make mrproper destroys any .config probably want to define: local version in general config, say .XXX under modules forced module support 92 make menuconfig 93 vi .config 94 vi Makefile 100 make 102 make modules_install 103 ls /boot 104 make install 107 cd /boot 108 ls -l 110 cd grub 113 vi menu.lst add entries to boot kernel but wait this is incomplete 114 man update-grub 115 man kernel-img.conf OLD 120 man 4 initrd 123 man mkinitrd 124 ls /boot 127 mkinitrd -o /boot/foo 2.6.10xxx 128 cd /boot 131 mv foo initrd.img-2.6.10xxx NEW mkinitramfs -o /boot/initrd_img.VERSION# /lib/modules/VERSION# 133 update-grub 137 vi menu.lst make sure it is right 138 sync 140 reboot # uname -a Linux virginia 2.6.10xxx #1 Tue Mar 15 16:22:35 PST 2005 i686 GNU/Linux Exhibits: # uname -a Linux virginia 2.6.15.7-ubuntu1XXX #1 PREEMPT Tue Jan 2 11:38:06 PST 2007 i686 GNU/Linux # ls /boot abi-2.6.15-26-386 abi-2.6.15-27-386 config config-2.6.15-26-386 config-2.6.15-27-386 config-2.6.15.7-ubuntu1XXX doit.sh grub initrd.img-2.6.15-26-386 initrd.img-2.6.15-27-386 initrd.img-2.6.15.7-ubuntu1XXX memtest86+.bin System.map System.map-2.6.15-26-386 System.map-2.6.15-27-386 System.map-2.6.15.7-ubuntu1XXX vmlinuz vmlinuz-2.6.15-26-386 vmlinuz-2.6.15-27-386 vmlinuz-2.6.15.7-ubuntu1XXX # cat /boot/grub/menu.lst # menu.lst - See: grub(8), info grub, update-grub(8) # grub-install(8), grub-floppy(8), # grub-md5-crypt, /usr/share/doc/grub # and /usr/share/doc/grub-doc/. title Ubuntu, kernel 2.6.15.7-ubuntu1XXX Default root (hd0,0) kernel /boot/vmlinuz root=/dev/hda1 ro quiet splash savedefault boot title Ubuntu, kernel 2.6.15.7-ubuntu1XXX Default (recovery mode) root (hd0,0) kernel /boot/vmlinuz root=/dev/hda1 ro single boot # ls /lib/modules 2.6.15-26-386 2.6.15-27-386 2.6.15.7-ubuntu1XXX # now for examples # cd /home/jrb/examples # make for n in misc-progs misc-modules skull scull scullc sculld scullp scullv sbull snull short shortprint pci simple usb tty lddbus; do make -C $n || exit 1; done make[1]: Entering directory `/home/jrb/examples/misc-progs' make[1]: Nothing to be done for `all'. make[1]: Leaving directory `/home/jrb/examples/misc-progs' make[1]: Entering directory `/home/jrb/examples/misc-modules' make -C /lib/modules/2.6.15.7-ubuntu1XXX/build M=/home/jrb/examples/misc-modules modules make[2]: Entering directory `/home/jrb/linux-source-2.6.15' Building modules, stage 2. MODPOST make[2]: Leaving directory `/home/jrb/linux-source-2.6.15' make[1]: Leaving directory `/home/jrb/examples/misc-modules' make[1]: Entering directory `/home/jrb/examples/skull' make[1]: Leaving directory `/home/jrb/examples/skull' make[1]: Entering directory `/home/jrb/examples/scull' make -C /lib/modules/2.6.15.7-ubuntu1XXX/build M=/home/jrb/examples/scull LDDINC=/home/jrb/examples/scull/../include modules make[2]: Entering directory `/home/jrb/linux-source-2.6.15' Building modules, stage 2. MODPOST make[2]: Leaving directory `/home/jrb/linux-source-2.6.15' make[1]: Leaving directory `/home/jrb/examples/scull' make[1]: Entering directory `/home/jrb/examples/scullc' make -C /lib/modules/2.6.15.7-ubuntu1XXX/build M=/home/jrb/examples/scullc LDDINC=/home/jrb/examples/scullc modules # cd misc-modules # insmod hello.ko # tail /var/log/syslog Jan 3 07:31:01 virginia /USR/SBIN/CRON[13896]: (root) CMD (/home/mrourmon/bin/omupdate.sh) Jan 3 07:32:01 virginia /USR/SBIN/CRON[14647]: (root) CMD (/home/mrourmon/bin/omupdate.sh) Jan 3 07:32:30 virginia dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 6 Jan 3 07:32:36 virginia dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 21 Jan 3 07:32:57 virginia dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 20 Jan 3 07:33:01 virginia /USR/SBIN/CRON[15247]: (root) CMD (/home/mrourmon/bin/omupdate.sh) Jan 3 07:33:17 virginia dhclient: DHCPDISCOVER on eth0 to 255.255.255.255 port 67 interval 14 Jan 3 07:33:31 virginia dhclient: No DHCPOFFERS received. Jan 3 07:33:31 virginia dhclient: No working leases in persistent database - sleeping. Jan 3 07:33:45 virginia kernel: [17239076.824000] Hello, world # rmmod hello # tail /var/log/syslog Jan 3 07:33:45 virginia kernel: [17239076.824000] Hello, world Jan 3 07:33:58 virginia kernel: [17239090.128000] Goodbye, cruel world