Title: Andrews Notes Subject: Compiling a kernel and X configuration. ###################################################### # Andrew Scott (http://tathata.org/~andrew/) # is is a FRIENDLY GURU who helped me LEARN about # modules, initrd, lilo, and compiling my own kernels # all in one night. Good person to have on your team. ###################################################### ###################################################### # Summery: # This linux computer has a root and boot scsi drive # who's controler card driver does not load when the kernel # image is loaded from the MBR, resuling in a message: # kernel panic, cant mount root file system. # # Two Solutions: # 1. Compile a kernel with this module include. # 2. Make an initrd image that loads the module. # 3. Uncompress and mount an initrd image, and verify modules. ###################################################### # Solution 1 would look something like this: cd /usr/src/linux make menuconfig specify the scsi driver to be loaded staticly make mrproper make cloneconfig make menuconfig make dep make kernel vi /etc/lilo.conf specify the new kernel name ####################################################### # Solution 2 would look like this # Every kernel has a .config file used # when compiling the current or new kenrel, # specifying what will be a module, or # compiled into the kenrel. # # We need to see how our scsi driver is # listed, and make it a module for this # senario find / -name ".config" grep -i ncr53c8xx /usr/src/linux-2.4.4.SuSE/.config CONFIG_SCSI_NCR53C8XX=m CONFIG_SCSI_NCR53C8XX_DEFAULT_TAGS=8 CONFIG_SCSI_NCR53C8XX_MAX_TAGS=32 CONFIG_SCSI_NCR53C8XX_SYNC=80 CONFIG_SCSI_NCR53C8XX_PROFILE=y # CONFIG_SCSI_NCR53C8XX_IOMAPPED is not set CONFIG_SCSI_NCR53C8XX_PQS_PDS=y # CONFIG_SCSI_NCR53C8XX_SYMBIOS_COMPAT is not set ####################################### # Now search for module dependencies ####################################### cat /lib/modules/2.4.4-64GB-SMP/modules.dep ####################################### # To make a initial ram disk (initrd) image # one needs to run mkinitrd, excetp on SuSE. # On SuSE, they call it mk_initrd. # Normal syntax is something like: # mkinitrd 2.4.4-4GB /dev/sda3 ####################################### # prints the help message mk_initrd -h # This will make the image /boot/initrd.suse mk_initrd cd /boot/ ######################################## # Anderw found the initrd image, which # is actually a gziped file system. # then he mounted it to see if our module was present # and it was. ######################################## # this shows us that initrd.suse is realy a gziped file system file initrd.suse initrd: gzip compressed data, deflated, original filename, `initrd2120_small', last modified: Mon Oct 15 05:32:25 2001, max compression, os: Unix # make a temp dir to uncompress the image mkdir tmp cd tmp # copy the initrd image to the temp dir, rename with gz extention # and uncompress into the temp dir. cp /boot/initrd.suse ../tmp/initrd.suse.gz gunzip -d initrd.suse.gz # Now this shows us that it is a file system. # Pretty wild!! file initrd.suse initrd: Linux rev 1.0 ext2 filesystem data # Make another temp dir, and mount the 'file system' file # This file system is acutally just a charater # device (unlike a hard drive which is a block dev. mkdir tmp mount -o loop -t ext2 initrd.suse tmp/ # Now we go in and make sure our scsi module # for the controler drivng the boot and root # drives is loaded in this compressed image cd tmp/lib/modules/2.4.4-4GB/kernel/drivers/scsi/ -rw-r--r-- 1 root root 65180 May 18 07:36 ncr53c8xx.o # our module is loaded. Now we need to clean up. # unmount the temp file system we creaed # delete the directory where we mounted it. cd /boot/tmp umount tmp rm -rf tmp # make sure lilo knows to load the image vi /etc/lilo.conf insert the line into one boot mode, to be safe image = /boot/vmlinuz label = linux root = /dev/sda3 initrd = /boot/initrd.suse lilo -v -v -v reboot # see what loaded lsmod # remove any modules that are not being used # this exercises the auto-clean feature of modules rmmod -h ########################################### # EXTRA INFO on something else: # messing with xwindows setup # there are far to many ways to configure X ########################################### sax2 yast xf86cfg XF86Setup ########################################### # this detects your monitor/vidio card # hardware ########################################### /usr/X11R6/bin/SuperProbe XF86Setup X -showconfig vi XF86Config xf86cfg XFree86 -configure XFree86 --configure XF86Setup xf86config ############################################ # ok, now now try to start x ############################################ startx ########################################################### # http://www.scyld.com/expert/modules.html # MO EXTRA INFO on something else: # compiling the driver modules: # gcc -DMODULE -D__KERNEL__ -O6 -c driver.c # Test the module: # insmod driver.o # Install the module if it all worked # install -m 644 driver.o /lib/modules/`uname -r`/net/ #############################################################