Hi,

many moons ago, there was a solution posted here for upgrading a cdromless /
floppyless system. (Last August, thread title "Floppy-less, CDROM-less RH7.1
INSTALL"). Gordon Messmer gave the best answer, using an existing dos partition
and loadlin.

I recently wanted to upgrade an embedded router running Linux RH7.2 to
RH7.3, so I dug up the article, and started from there. In my case, the network
card I have in the router is not on the netboot.img image, but IS on the drvnet
drivers floppy. Little good that does you if you don't have a floppy though.
However, the process of updating the initrd image to integrate an extra network
(or other) module is fairly painless (if not initially obvious), so I though I
would post a step-by-step procedure here, in the hopes that this will be useful
to someone else.

Enjoy,

                ---------------------------------------------

                Floppyless / cdromless upgrade for Linux

        (or How I Upgraded my embedded device, which has no floppy/cdrom)

This document describes the relatively painless process of upgrading a
device (laptop/embedded/etc) that has no floppy/cdrom.

Assumption: There is an installed working Linux OS, any version, any Distro.
Assumption: You have a Linux supported network device.

The details given here are for upgrading from X (X can be any Linux distro)
to Y (Y can be any Linux distro). The examples used herein are given for
RedHat - other distros will probably be quite similiar.)

The distro you are upgrading to needs to have a bootable NFS (or FTP
or HTTP) floppy. This is a prerequisite.

1) Mount the disc1 cd, and locate the boot floppy image for the NFS (or FTP
   or HTTP), and also the floppy that contains additional network drivers.
   For RedHat distributions, the files will be:

       /mnt/cdrom/images/bootnet.img
       /mnt/cdrom/images/drvnet.img

   You will definately need the bootnet.img file. You might or not need the
   drvnet.img file (depends on whether or not the bootnet floppy contains the
   driver for your network card).

2) the bootnet.img is a floppy image, and can be mounted as follows. You
   need to copy 2 files from it.

        # mount -r -o loop bootnet.img /mnt/floppy/
        # cp /mnt/floppy/initrd.img .
        # cp /mnt/floppy/vmlinuz .
        # umount /mnt/floppy

3) If your network card is one of:

        3c59x     "3Com 3c590/3c595/3c90x/3cx980"
        8139too   "RTL8139, SMC EZ Card Fast Ethernet"
        eepro100  "Intel EtherExpress Pro 100B"
        ne2k-pci  "PCI NE2000 clones"
        pcnet32   "AMD PCnet32"
        tulip     "DEC 21040, most 21*40 Ethernet"

   Then you are almost done. Skip to step 12. If your NIC is not listed
   above, you will need to copy your network driver from the drvnet.img
   image, and integrate it into a modified initrd.img file. Proceed with
   steps 4 thru 11.

4) The initrd.img file is a compression of a ext2fs file system. The 
   drvnet.img is an uncompressed ext2fs file system, You need to mount
   both of these and copy/update the initrd.img with files from the
   drvnet.img image.

        # mkdir /mnt/drvnet
        # mkdir /mnt/initrd
        # mv initrd.img initrd.img.gz
        # gzip -dc initrd.img.gz > initrd.img
        # mount -t ext2 -o loop initrd.img /mnt/initrd
        # mount -t ext2 -r -o loop drvnet.img /mnt/drvnet

5) There are 3, possibly 4, files which need to be updated on initrd. They
   are:

        /mnt/initrd/modules/module-info
        /mnt/initrd/modules/modules.cgz
        /mnt/initrd/modules/modules.dep
        /mnt/initrd/modules/pcitable

    modules.dep probably does not need to be updated, unless your NIC driver
    has dependencies (in which case you need to copy/integrate not only the
    NIC driver, but the dependency modules as well).

6) know your NIC driver. In the below example, where I use natsemi you should
   use your driver instead.

7) update /mnt/initrd/modules/pcitable as follows:

        # grep natsemi /mnt/drvnet/pcitable >> /mnt/initrd/modules/pcitable

   I do not know if pcitable needs to be ordered or not. It is presently
   sorted, so I vi'ed the file, and moved the new (last) entry into a
   sorted position. (the purists will use sort to sort the file :)

8) update /mnt/initrd/modules/module-info as follows:

        # cp /mnt/drvnet/modinfo .
        # vi modinfo

   then delete the lines above and below the entry for your driver. In the
   case of natsemi, this is what is left:

        # cat modinfo
        natsemi
            eth
            "NatSemi DP83815 Fast Ethernet"

   note that there are 3 lines in the file. Integrate this into
   /mnt/initrd/modules/module-info as follows:

        # cat modinfo >> /mnt/initrd/modules/module-info

   (this file does not need to be sorted).

9) check if your module is in /mnt/drvnet/modules.dep - if it is, you need
   to note down the dependencies, and you need to add the dependency lines
   to /mnt/initrd/modules/modules.dep (use grep and >> to do the dependency
   update).

10) Next is the tricky part. You need to copy the actual module(s) from the
   drvnet /mnt/drvnet/modules.cgz file to the initrd
   /mnt/initrd/modules/modules.cgz file. Note that these 2 files are cpio
   archives, created with crc:

   Note: you can determine the type of archive by doing this:

        # gzip -dc /mnt/drvnet/modules.cgz > modules.foo
        # file modules.foo
        modules.foo: ASCII cpio archive (SVR4 with CRC)

   This tells you the type of archive, and the man page will tell you
   the necessary switchs for extraction/recreation.

   First unpack the the drvnet archive:

        # gzip -dc /mnt/drvnet/modules.cgz | cpio -idmuv

   Then delete all files except your driver. In the case of natsemi, there
   is only one driver file I need. This is what I did. (note the cpio archive
   is unpacked into the directory 2.4.18-3BOOT for RH7.3 - for your distro
   this might be different).

        # cd 2.4.18-3BOOT/
        # mkdir tmp 
        # mv -i * tmp
        mv: cannot move `tmp' to a subdirectory of itself, `tmp/tmp'
        # mv -i tmp/natsemi.o .
        # rm -rf tmp/
        # cd ..

   Next unpack the initrd modules cpio archive on top of this:

        # gzip -dc /mnt/initrd/modules/modules.cgz | cpio -idmuv

   Finally, create a replacement modules.gz as follows. This will
   pack up a cpio archive, and compress it.

        # find 2.4.18-3BOOT/ | cpio -o -H crc | gzip -9 > modules.cgz

   Now replace the original /mnt/initrd/modules/modules.cgz with this
   new archive:

        # cp modules.cgz /mnt/initrd/modules/modules.cgz

11) unmount the floppy images, and compress the initrd.

        # umount /mnt/initrd
        # umount /mnt/drvnet

        # gzip -9c initrd.img > my_initrd.img

12) Finally copy the vmlinuz and initrd.img files to the target system.
   (If you had to create an updated initrd image, be sure to use that one
   instead.)

   Create a boot entry.  A lilo entry would look like this:

       image=/boot/vmlinuz-RH7.3_install
                label=RH73_Install
                initrd=/boot/initrd_nc.img-RH7.3_install

   note that I renamed the vmlinuz & initrd images to something more
   appropriate for me.

   A grub entry will be similar.

   don't forget to run lilo, if you are using lilo.


-Greg Hosler


----------------------------------
E-Mail: Gregory Hosler <[EMAIL PROTECTED]>
Date: 10-May-02
Time: 12:23:39

  If each of us have one object, and we exchange them,
     then each of us still has one object.
  If each of us have one idea,   and we exchange them,
     then each of us now has two ideas.

----------------------------------



_______________________________________________
Redhat-list mailing list
[EMAIL PROTECTED]
https://listman.redhat.com/mailman/listinfo/redhat-list

Reply via email to