User Tools

Site Tools


adding_kernel_modules_to_a_red_hat_installer_s_kernel

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

adding_kernel_modules_to_a_red_hat_installer_s_kernel [2008/06/26 10:03]
adam created
adding_kernel_modules_to_a_red_hat_installer_s_kernel [2016/11/25 22:38]
Line 1: Line 1:
-===== How to Add Kernel Modules to a Red Hat Installer'​s Kernel ===== 
- 
-The following was copied verbatim from http://​linux.duke.edu/​~mstenner/​docs/​add-driver. I admit this freely, the reason for doing this is that I've had to do this a lot recently and academic pages have a habit of going away eventually. 
- 
-These instructions still seem to be valid for current RHEL/​Fedora/​Centos versions as of June 2008. On with the show... 
- 
- 
- 
-Adding a driver to a RedHat install floppy 
- 
-Michael D. Stenner 
-last modified 27-February-2002 
- 
-OK... This was my experience with adding a driver to the RedHat 
-bootnet disk image. ​ In my specific case, I was making a kickstart 
-floppy, and so couldn'​t really use the normal "​insert driver disk now" 
-method. ​ I was also unable (for irrelevant reasons) to put the driver 
-disk contents onto the hard drive. ​ Anyway, here were my specifics: 
- 
-RedHat Linux 7.1   (Seth Vidal has made this work for 7.2) 
-I needed to add the 3c509 driver 
- 
-Notes: ​   ​ 
-    (these may not make sense until you actually start the stuff below) 
- 
-  1) Don't edit files in place on the loopback device. ​ Copy out the 
-     thing you want to edit, then edit it.  When done editing, DELETE 
-     the original from the loopback device. ​ Finally, copy your edited 
-     file back in. 
- 
-     If you don't care about WHY you should do it this way, skip to 
-     the next item. 
- 
-     The problem is this: you don't care about the used space on the 
-     ​(loopback mounted) filesystem, you care about how big it is after 
-     ​filesystem (as a single file) is gzipped.  ​ 
- 
-     For a dramatic example, imagine the following. ​ If I fill my hard 
-     drive with a bunch of files containing random data, and delete 
-     those files, the hard drive is still filled with that data, it's 
-     just flagged as free (i.e. over-writable). ​ If I were to gzip my 
-     disk image, it would still be roughly the size of the total disk 
-     ​capacity. 
- 
-     In contrast, if instead of deleting (with rm) those files, I 
-     ​overwrite them all with zeros, the compressed disk image will be 
-     ​really small. 
- 
-     You want to make sure that your edited files take up the same 
-     place in your (loopback mounted) filesystem as the originals, 
-     ​leaving as little unused data laying about as possible. 
- 
-     ​Thanks to Seth Vidal for the tip about deleting the old files. 
- 
-  2) If you add more than I did, you may need to trim things down a 
-     ​little. ​ That shouldn'​t be hard: just remove some drivers that 
-     you don't need.  Be sure to edit the appropriate files to  
-     ​reflect the modules absence. 
- 
-  3) I didn't actually _try_ what I suggest in (2).  You may get 
-     ​burned by the fact that you are actually working on a 
-     ​loopback-mounted filesystem: simply rm-ing something won't really 
-     ​remove it.  gzip will still include the data (as discussed in 
-     ​(1)). ​ Sorry if this isn't clear. ​ Since I didn't really have 
-     this problem, I don't want to spout off too much about it.  I 
-     would love to hear from people who know about these issues. 
- 
-  4) I typed this up after figuring it all out.  As a result, the  
-     ​commands I have here have not actually been tested verbatim. ​ There 
-     may be typos. ​ Please let me know if you find any :) 
- 
-Below are the commands you need to use.  All of these should be ready 
-for cut and paste. ​ Do not just cut and paste the whole thing, though, 
-since you need to do things like swap floppies and do the happy-bit ​ 
-dance in the middle. 
- 
-I hope that you find this useful! 
- 
-                                    -Michael 
-                                    mstenner@phy.duke.edu 
- 
-============================================================ 
-###################################################​ 
-# First, get the drivers we need 
-###################################################​ 
- 
-# download driver image to drivers.img 
-# insert blank disk 
-cat drivers.img > /dev/fd0 
- 
-mount /mnt/floppy 
-mkdir drivers 
-cp /​mnt/​floppy/​* drivers/ 
-umount /mnt/floppy 
- 
-cd drivers 
-gzip -d < modules.cgz | cpio -i --make-directories 
-# now look in modules.dep to see if you're going to  
-# need to get any other modules. 
-# find the entries for each of the modules you need  
-# in modules.dep,​ modinfo and pcitable 
-# the actual modules should be in a dir called 2.4.2-2BOOT 
-# (or something similar - will vary with version) 
-cd .. 
- 
-###################################################​ 
-# Now, get the files from the bootnet image  
-# that we must edit 
-###################################################​ 
- 
-# download bootnet image to bootnet.img 
-# insert blank disk 
-cat bootnet.img > /dev/fd0 
-mount /mnt/floppy 
-mkdir initrd-mod 
-cp /​mnt/​floppy/​initrd.img initrd-mod/​initrd.img.orig.gz 
-cd initrd-mod/ ​               # pwd = initrd-mod 
-gzip -d < initrd.img.orig.gz > initrd.img.orig 
-cp initrd.img.orig initrd.img.working 
-mkdir loop 
-mount -t ext2 -o loop initrd.img.working loop 
-cd loop/​modules ​              # pwd = initrd-mod/​loop/​modules 
-mkdir ../​../​modules-mod 
-cp * ../​../​modules-mod/​ 
-cd ../​../​modules-mod/ ​        # pwd = initrd-mod 
- 
-###################################################​ 
-# Back up these files and edit them 
-###################################################​ 
- 
-for FILE in *; do cp $FILE $FILE.orig; done 
-# now edit each of (module-info modules.dep pcitable) that you 
-# need to, adding the entries from the corresponding files on the 
-# driver disk 
-gzip -d < modules.cgz | cpio -i --make-directories 
-# this should make a directory called 2.4.2-2BOOT (depending on 
-# version). ​  Put each of the modules that you need from the driver 
-# disk into this directory. ​ For example: 
-cp ../​../​drivers/​2.4.2-2BOOT/​3c509.o 2.4.2-2BOOT/​ 
- 
-# rebuild the modules.cgz file with 
-find 2.4.2-2BOOT | cpio -o -H crc | gzip -9 > modules.cgz 
- 
-###################################################​ 
-# Put our changes back into the floppy 
-###################################################​ 
- 
-# copy each of the files that you changed back into 
-# initrd-mod/​loop/​modules/​ 
-# this includes, of course, modules.cgz 
- 
-cd ..     # pwd = initrd-mod 
-umount loop 
-gzip -9 < initrd.img.working > initrd.img.new 
-cp initrd.img.new /​mnt/​floppy/​initrd.img 
-umount /mnt/floppy 
-============================================================ 
  
adding_kernel_modules_to_a_red_hat_installer_s_kernel.txt ยท Last modified: 2016/11/25 22:38 (external edit)