Netboot CentOS using Attansic L1 Gigabit Ethernet

To update the initrd.img to load additional drivers early in the boot process, normally you would simply run /sbin/mkinitrd and let the script do the work. But what if the initrd.img used during the installation of CentOS lacks an important driver? Maybe you want to netboot CentOS, but the initial ramdisk CentOS provides doesn’t have the right modules for you NIC.

This article gives an example, how to modify the initrd.img to include the drivers for the Attansic L1 Gigabit Ethernet Adapter by hand. (If you just want to know, how to get CentOS working with the L1 without caring about netboot etc., have a look at CentOS and Attansic L1 Gigabit Ethernet)

1. Get the modules

First, we need to get the modules from Jay Cliburn’s page. Since you probably don’t know, which version of L1 you have, we just pull both rpms:

$ cd /tmp
$ wget ftp://ftp.hogchain.net/pub/linux/attansic/atl1e/centos5.2/kmod-atl1e-1.0.1.0-1.i686.rpm
$ wget ftp://ftp.hogchain.net/pub/linux/attansic/atl1/centos5.2/kmod-atl1-2.1.3-1.i686.rpm
$ rpm2cpio kmod-atl1e-1.0.1.0-1.i686.rpm | cpio -id
$ rpm2cpio kmod-atl1-2.1.3-1.i686.rpm | cpio -id

2. Modify initial ramdisk

2.1. Get initrd.img

Next we’ll extract the initrd.img from a CentOS mirror. The initrd.img is a gzip’ed cpio archive.

$ cd /tmp
$ wget http://mirror.centos.org/centos-5/5.4/os/i386/images/pxeboot/initrd.img
$ mkdir /tmp/initrd
$ cd /tmp/initrd
$ gzip -dc /tmp/initrd.img | cpio -id

2.2. Extract modules.cgz

In the modules/ subdirectory, you’ll see modules.cgz which is yet another gzip’ed cpio archive. Let’s extract it next.

$ cd /tmp/initrd/modules
$ gzip -dc modules.cgz | cpio -id

2.3. Add *.ko to modules.cgz

Now we can copy the kernel modules from the rpms into our custom initrd.img

$ cd /tmp/initrd/modules
$ find /tmp/lib/ -name *.ko | xargs -i cp {} 2.6.18-164.el5/i686/

2.4. Modify module-info

module-info is a text file used by the installation program to gain informations about the modules. Append in this file the following rows:

atl1e
	eth
	"Atheros 1000M Ethernet Network Driver"
atl1
	eth
	"Atheros L1 Gigabit Ethernet Driver"

2.5. Modify modules.alias

This file maps a driver to the PCI device data, so it’s possible to call the kernel module with the alias. So we have to add the right alias to modules.alias to make the system autoload the driver:

$ modinfo /tmp/lib/modules/2.6.18-92.1.18.el5.centos.plus/extra/atl1/atl1.ko
[...]
alias:          pci:v00001969d00001026sv*sd*bc*sc*i*
[...]

You can get the alias for atl1e likewise. So we add the following lines to modules.alias:

alias pci:v00001969d00001026sv*sd*bc*sc*i* atl1e
alias pci:v00001969d00001048sv*sd*bc*sc*i* atl1

Alternatively, we can use sed to automate this task (see also Red Hat Knowledgebase)

$ cd /tmp/lib/modules/2.6.18-92.1.18.el5.centos.plus/extra/atl1/
$ modinfo -F alias atl1.ko | sed -e 's/^/alias /' -e 's/$/ atl1/' >> /tmp/initrd/modules/modules.alias
$ cd /tmp/lib/modules/2.6.18-92.1.18.el5.centos.plus/extra/atl1e
$ modinfo -F alias atl1e.ko | sed -e 's/^/alias /' -e 's/$/ atl1e/' >> /tmp/initrd/modules/modules.alias

2.6. Modify modules.dep

This file lists dependencies that modules may have. The format is simple: the driver name with a colon followed by a space delimited list of other drivers. Since atl1 depends on mii (use modinfo -F depends atl1.ko, to build a list of dependencies), we simply add atl1: mii

$ cd /tmp/initrd/modules
$ echo atl1: mii >> modules.dep

2.7. Get new pci.ids

pci.ids is a database of all known pci IDs and since the CentOS’ pci.ids lacks information about our devices, we simply overwrite it with the latest one from the PCI ID Repository:

$ cd /tmp/initrd/modules
$ wget http://pciids.sourceforge.net/v2.2/pci.ids -O pci.ids

3. Re-package initrd.img

Finally, we can package everything back up into our new custom initrd.img. Be careful when creating the cpio archives because the modules.cgz file uses the crc format whereas initrd.img uses the newc format! If you use the wrong format, the installation will not be able to read the initrd.img.

$ cd /tmp/initrd/modules
$ find 2.6.18-164.el5 | cpio -o -H crc | gzip -9 > modules.cgz
$ rm -rf 2.6.18-164.el5
$ cd ..
$ find . | cpio -o -H newc | gzip -9 > /tmp/initrd.img

Now copy your new /tmp/initrd.img onto your PXE boot server, or burn a new installation DVD with this replacement initrd.img.

Resources:
http://kbase.redhat.com/faq/docs/DOC-17783
http://kbase.redhat.com/faq/docs/DOC-17742
http://osl.uniparthenope.it/2009/07/netinstalling-centos-using-attansic-l1-gigabit-ethernet-aka-howto-modify-red-hat-based-isos-bootkernel/

4 thoughts on “Netboot CentOS using Attansic L1 Gigabit Ethernet

  1. Pingback: YargerDesigns.org » How to install ubuntu linux via a network the super easy way

  2. avatarJolynn

    I like this for so many reasons. Thanks for all the details. The tip on using modinfo to get the pci device data was key.

  3. avatarjef

    Great article, I was able to make my boards atheros NIC work, but after downloading stage2.img I’m having the following error–> The anaconda installtion tree in that directory does not seem to match your boot media. Any suggestion, TIA

  4. avatarJohnX

    Thanks a lot ,but the driver you’re advice is not the good for me . I must use another one, but the procedure for the installation in the initrd.img is the same than you’re tutorial …
    Thank’s a lot , i was block , and with you i can finally install my distrib on my Foxconn ….

    Thank’s

    PS: sorry for my very bad english

Leave a Reply

Your email address will not be published.