Differences between revisions 2 and 3
Revision 2 as of 2006-06-29 05:50:12
Size: 6092
Editor: ?ilgiz
Comment: Some explanations.
Revision 3 as of 2006-06-29 05:59:48
Size: 8170
Editor: ?ilgiz
Comment: Sample netinst patch to include a third party driver adm8211.
Deletions are marked like this. Additions are marked like this.
Line 23: Line 23:
 # See a sample list of modifications in this file:
 #  ~/work/d-i/packages_kernel_linux-kernel-di-i386-2.6.patch
 # See a sample list of modifications under the "Custom Netinst Patch"
 # section below.
Line 140: Line 140:

== Custom Netinst Patch ==

Here, a wireless driver adm8211 is added to the nic-modules udeb. Modules ieee* and arc4 are required by adm8211. Other changes are due to the difference in modules available through the regular Debian linux-image package.

{{{
Index: kernel-versions
===================================================================
--- kernel-versions (revision 37792)
+++ kernel-versions (working copy)
@@ -1,2 +1,2 @@
 # arch version flavour installedname suffix build-depends
-i386 2.6.16-2 486 2.6.16-2-486 - linux-image-2.6.16-2-486
+i386 2.6.16-2 k7 2.6.16-2-k7 - linux-image-2.6.16-2-k7
Index: modules/i386/nic-modules
===================================================================
--- modules/i386/nic-modules (revision 37792)
+++ modules/i386/nic-modules (working copy)
@@ -1,3 +1,8 @@
 #include <nic-modules>
 # And 2.6 has ethernet over firewire.
 eth1394
+adm8211
+ieee80211
+ieee80211_crypt
+ieee80211_crypt_wep
+
Index: modules/i386/crypto-modules
===================================================================
--- modules/i386/crypto-modules (revision 37792)
+++ modules/i386/crypto-modules (working copy)
@@ -1 +1,3 @@
 #include <crypto-modules>
+arc4
+
Index: modules/i386/scsi-modules
===================================================================
--- modules/i386/scsi-modules (revision 37792)
+++ modules/i386/scsi-modules (working copy)
@@ -1,4 +1,6 @@
 #include <scsi-modules>
+aha1740 -
+sim710 -
 # And some that are new in 2.6:
 ipr
 qlogicfas408
Index: modules/i386/nic-extra-modules
===================================================================
--- modules/i386/nic-extra-modules (revision 37792)
+++ modules/i386/nic-extra-modules (working copy)
@@ -1,4 +1,10 @@
 #include <nic-extra-modules>
+3c523 -
+3c527 -
+es3210 -
+lne390 -
+ne2 -
+smc-ultra32 -
 # Others that are only here in 2.6:
 arlan
 atmel_pci
@@ -10,7 +16,7 @@
 e1000
 hp
 ixgb
-ne3210
+# ne3210
 orinoco_tmd
 pcnet32
 prism54
}}}

This is a sample lengthy procedure of integrating a third party network driver with DebianInstaller's netinst. See the question on driver disk in the [http://wiki.debian.org/DebianInstaller/FAQ#head-2522460048fd92cb8a53c3c0f176ca741033be57 DebianInstaller/FAQ] and the TODO list referred to by ["DebianInstaller/Contrib"].

Supplying a floppy disk with the network driver is already implemented in netinst. One has to select the "another driver" option in the list of network drivers shown by the installer and insert the floppy disk. The installer will be expecting an archive (tar.gz? udeb?) with the pre-compiled driver on the floppy.

Compiling a driver disk can be confusing because the installer doesn't currently ship its own kernel headers on the CD. The procedure below will re-package the installer with the running Debian kernel from the development machine and the third party driver compiled against that kernel.

I believe the procedure below should be thrown away in favour of automatic (install time) compilation of the driver's source code by the installer against its own kernel headers. When implementing this better approach, existing tools such as module-assistant might be of benefit.

 apt-get install kernel-wedge
 cd ~/download
 svn co debian-installer http://alioth.debian.org/...
 cd debian-installer
 cd packages/kernel/linux-kernel-di-i386-2.6

 # Add the third party module and its dependent modules such as
 # ieee80211, ieee80211_crypt, ieee80211_crypt_wep, arc4 and so on.
 # It is implied that the third party module is already compiled
 # against the current kernel.
 vi modules/i386/nic-modules

 vi kernel-versions     # Update the version and flavour.
 # See a sample list of modifications under the "Custom Netinst Patch"
 # section below.
 # To apply the patch, run "patch -i FILE.patch".
 
 kernel-wedge gen-control > debian/control
 kernel-wedge build-all
 # If the above command fails on "kernel-wedge copy-modules ...", edit the
 # respective file under modules/i386/ until kernel-wedge copy-modules
 # succeeds.  Then restart kernel-wedge build-all.

 cd /var/tmp
 su
   mount -o loop,ro ~/download/debian-net-install.iso /mnt
   cp -a /mnt .
   mv mnt di
   chown -R USER di
   chmod -R u+rw di
   umount /mnt
 mkdir di-rd ; cd di-rd
 gzip -dc ../di/install/2.6/initrd.gz | cpio -ivd

 cd lib/modules
 mkdir -p 2.6.$NEW/kernel
 cd 2.6.$OLD/kernel
 
 find -type f | \
     while read f ; do \
        n="${f##*/}" ; \
        d="${f%/*}" ; \
        k="/lib/modules/2.6.$NEW/kernel/$f" ; \
        test -f "${k}" && { \
           cp -av "${k}" \
            "../../../../../di-rd/lib/modules/2.6.$NEW/kernel/${d}/" ; \
        } || echo "-- ${f}" ; \
     done

 cd ../..
 rm -rf 2.6.$OLD
 cd ../..
 vi var/lib/dpkg/status  # Replace 2.6.$OLD with 2.6.$NEW.

 # Without libgcc_s.so.1, "retrieving libc6-udeb" fails.  Perhaps, this
 # dependency is not recognized automatically because apt-ftparchive below
 # re-writes dpkg files.
 cp -a /lib/libgcc_s.so.1 lib/

 # Now create the new compressed RAM disk image.
 # find . -depth -print0 | cpio -0 -H newc -ov | gzip -c > ../di/install/2.6/initrd.gz
 # The -depth option is to specify restrictive permissions.  It prevents
 # the Linux kernel from mounting the image.  For testing, try 
 #   cpio -iv < /tmp/initrd 
 # without the "d" option.  A cpio image created without the find -depth 
 # option will create a full tree while the one created with -depth will
 # generate file creation errors.
 find . -print0 | cpio -0 -H newc -ov | gzip -c > ../di/install/2.6/initrd.gz

 cd ../di
 cd pool/main/l/linux-kernel-di-i386-2.6/
 # Copy .udeb's created in ~/download/debian-installer/packages/kernel.
 # Delete kernel-image-2.6.$OLD and respective module .udeb's.
 cd -

 cd ~/work/d-i/release
 vi config # according to http://wiki.debian.org/DebianInstaller/Modify
 apt-ftparchive generate config
 cd -   # Back to /var/tmp/di.

 cp -a /root/driver .  
 # Keep the third party driver's source code on CD to compile it later
 # against the installed kernel headers.

 # Update md5sums.txt and Packages.
 md5sum $(find -follow -type f) > md5sum.txt

 vi md5sum.txt  # Remove the line with md5sum.txt (?)
 cd ..
 mkisofs -o test.iso -r -J -no-emul-boot -boot-load-size 4 \
   -boot-info-table -b isolinux/isolinux.bin -c isolinux/boot.cat di
 qemu -net user -cdrom test.iso
 # For serial emulation, run Linux from isolinux prompt with
 #   install console=ttyS0
 # Then switch to the serial console with Ctrl-Alt-3.

 sudo cdrecord -dev /dev/cdrw -v test.iso  # Burn this to a CD-RW or CD-R.

 # Boot the real computer from the new image, pause between
 # the dialogs, press Alt-2 and Enter to start the shell.
 # Check if the disk is already mounted by running "mount".
 # If it is, the mount point will be /cdrom.  Otherwise, mount the disk:
 mount -o ro -t iso9660 /dev/hdb /mnt/
 udpkg -i /mnt/pool/main/l/linux-kernel-di-i386-2.6/crypto-modules*.udeb
 modprobe arc4   # or insmod /lib/modules/*/kernel/crypto/arc4.ko
 modprobe ieee80211_crypt_wep
 modprobe adm8211
 # Similarly, make sure iwconfig can be launched.  If not, install
 # libiw*.udeb from w/wireless-tools.
 iwconfig eth0 key s:XXXXXXXXXXXXX
 iwconfig eth0 key open
 iwconfig eth0 channel 6
 ifconfig eth0 up
 ifconfig eth0 A.B.C.D  # Assign an unused address from the LAN.
 
 udpkg -i /...l/linux-kernel-di-i386-2.6/sata-modules*.udeb
 modprobe ahci  # For SATA AHCI drives.
 modprobe sata-uli  # Or another driver for the SATA controller according
                    # to the list in lspci.

 # In case the "Detect hard disk" or "Partition the disk" steps of d-i fail,
 # one should load an appropriate driver.
 ls -la /proc/ide /proc/scsi
 udpkg -i /.../p/parted/libparted*.udeb
 parted /dev/sda print
 # If parted complains about the missing library libparted$n.so.0:
 cd /lib
 ln -s libparted*.so.1 libparted$n.so.0
 # Go back to the d-i menu and choose "Detect hard disks" again.

Custom Netinst Patch

Here, a wireless driver adm8211 is added to the nic-modules udeb. Modules ieee* and arc4 are required by adm8211. Other changes are due to the difference in modules available through the regular Debian linux-image package.

Index: kernel-versions
===================================================================
--- kernel-versions     (revision 37792)
+++ kernel-versions     (working copy)
@@ -1,2 +1,2 @@
 # arch   version  flavour       installedname        suffix build-depends
-i386     2.6.16-2 486           2.6.16-2-486         -      linux-image-2.6.16-2-486
+i386     2.6.16-2 k7           2.6.16-2-k7         -      linux-image-2.6.16-2-k7
Index: modules/i386/nic-modules
===================================================================
--- modules/i386/nic-modules    (revision 37792)
+++ modules/i386/nic-modules    (working copy)
@@ -1,3 +1,8 @@
 #include <nic-modules>
 # And 2.6 has ethernet over firewire.
 eth1394
+adm8211
+ieee80211
+ieee80211_crypt
+ieee80211_crypt_wep
+
Index: modules/i386/crypto-modules
===================================================================
--- modules/i386/crypto-modules (revision 37792)
+++ modules/i386/crypto-modules (working copy)
@@ -1 +1,3 @@
 #include <crypto-modules>
+arc4
+
Index: modules/i386/scsi-modules
===================================================================
--- modules/i386/scsi-modules   (revision 37792)
+++ modules/i386/scsi-modules   (working copy)
@@ -1,4 +1,6 @@
 #include <scsi-modules>
+aha1740 -
+sim710 -
 # And some that are new in 2.6:
 ipr
 qlogicfas408
Index: modules/i386/nic-extra-modules
===================================================================
--- modules/i386/nic-extra-modules      (revision 37792)
+++ modules/i386/nic-extra-modules      (working copy)
@@ -1,4 +1,10 @@
 #include <nic-extra-modules>
+3c523 -
+3c527 -
+es3210 -
+lne390 -
+ne2 -
+smc-ultra32 -
 # Others that are only here in 2.6:
 arlan
 atmel_pci
@@ -10,7 +16,7 @@
 e1000
 hp
 ixgb
-ne3210
+# ne3210
 orinoco_tmd
 pcnet32
 prism54