Netinstalling CentOS using Attansic L1 Gigabit Ethernet (aka HOWTO modify Red Hat based iso's bootkernel)

I needed to install CentOS 5.3 on a workstation with an “Attansic Technology Corp. L1 Gigabit Ethernet Adapter”, the driver for this kind of adapter (atl1e) was introduced in the version 2.6.26 of the kernel but CentOS 5.3 uses the 2.6.18 one. ElRepo provides an rpm with the atl1e.ko module backported for using with the 2.6.18 provided in CentOS so what I’m going to do is to insert the module taken from ElRepo on the CentOS netinstall iso.

First of all the netinstall iso and the rpm containing the module are needed (I created a directory to store all the files related to this thing):

[root@anestethize centos-net]# wget http://mirrors.bevc.net/CentOS/5.3/isos/x86_64/CentOS-5.3-x86_64-netinstall.iso
[root@anestethize centos-net]# wget http://elrepo.org/linux/elrepo/el5/x86_64/RPMS/kmod-atl1e-1.0.1.0-1.el5.elrepo.x86_64.rpm

Now we can extract the module from the rpm (note that because the rpm is done to be installed on a system the module is contained in the … subdirectory, we move it from that subdirectory to the top directory):

[root@anestethize centos-net]# rpm2cpio kmod-atl1e-1.0.1.0-1.el5.elrepo.x86_64.rpm | cpio -id
177 blocks
[root@anestethize centos-net]# mv lib/modules/2.6.18-92.el5/extra/atl1e/atl1e.ko .
[root@anestethize centos-net]# rm -rf lib/

Then we need to extract the files from the iso to modify them: we mount the iso then we copy the file in a newly created directory:

[root@anestethize centos-net]# mount -o loop CentOS-5.3-x86_64-netinstall.iso /mnt/
[root@anestethize centos-net]# mkdir iso.d
[root@anestethize centos-net]# cp -a /mnt/. iso.d/

The kernel modules are contained in the initrd.img image found in the isolinux/ directory of the iso. initrd.img is a gzipped cpio archive, we exctract it in a newly creted directory (initrd.d):

[root@anestethize centos-net]# mkdir initrd.d
[root@anestethize centos-net]# cd initrd.d/
[root@anestethize initrd.d]# zcat ../iso.d/isolinux/initrd.img | cpio -id
16523 blocks

The extracted archive looks like:

[root@anestethize initrd.d]# ls
bin  dev  etc  init  modules  proc  sbin  selinux  sys  tmp  var

Now we have to focus our attention on the modules/ directory:

[root@anestethize initrd.d]# ls modules/
module-info  modules.alias  modules.cgz  modules.dep  pci.ids

module-info is a text file used by the installation program to gain informations about the modules, we can consider that this file is divided in sections, each section starts with the name of the module (starting from the first column) and then the content of the section is contained on the following rows indented by a tab; the first content entry specify the kind of driver (scsi or eth) and the second is an human readable description. So we have to append in this file the following rows:

atl1e
	eth
	"Atheros 1000M Ethernet Network Driver"

modules.alias is a text file that contains a lookup table that basically associates an abitrary text a module name, so it’s possible to call the kernel module (for example using modprobe) with the alias. Each line of the file specifies an alias, the syntax is:

alias [alias_text] [module_name]

When “Module Autoload” is enabled (and for the CentOS kernel it is) when a new device is attached the kernel generates an uevent that announces the identity of the newly inserted device, the identity of the device is contained in the “MODALIAS” variable; then udevd captures the event and invokes modprobe with the content of MODALIAS. So we have to add the right alias to modules.alias to make the system autoload the driver, to obtain the right alias to add we use modinfo:

[root@anestethize initrd.d]# modinfo ../atl1e.ko
filename:       ../atl1e.ko
version:        1.0.1.0
license:        GPL
description:    Atheros 1000M Ethernet Network Driver
author:         Atheros Corporation,
srcversion:     1C61E431138A92D0D438FDA
alias:          pci:v00001969d00001026sv*sd*bc*sc*i*
depends:
vermagic:       2.6.18-92.el5 SMP mod_unload gcc-4.1
parm:           TxRingSz:Transmit Ring Sizen (array of int)
parm:           RxfMemSize:memory size of rx buffer(KB) (array of int)
parm:           MediaType:MediaType Select (array of int)
parm:           IntModTimer:Interrupt Moderator Timer (array of int)

Then we can the following row to modules.alias:

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

modules.alias usually is compiled automatically by depmod in the same way we have just done.

modules.cgz is a gzipped cpio archive that contains the modules; is where we have to add the atl1e.ko module. First of all we need to extract it in a new directory:

[root@anestethize initrd.d]# cd ..
[root@anestethize centos-net]# mkdir modules.d
[root@anestethize centos-net]# cd modules.d/
[root@anestethize modules.d]# zcat ../initrd.d/modules/modules.cgz | cpio -id
41082 blocks

The modules are contained in the 2.6.18-128.el5/x86_64/ subdirectory, we copy atl1e.ko in this subdirectory

[root@anestethize modules.d]# cp ../atl1e.ko 2.6.18-128.el5/x86_64/

Now we remake the gzipped archive:

[root@anestethize modules.d]# find ./ | cpio -H newc -o | gzip > ../initrd.d/modules/modules.cgz
41258 blocks

modules.dep contains the dependencies of each module, ie the modules that the actual module needs to work, atl1e has no dependencies (as we could see when we invoked modinfo above) so we can skip this file.

pci.ids is a database of all known pci IDs, we can leave it unchenged.

Our rework on the modules subdirectory is done, so we can rebuild the initrd archive and the netinstall iso:

[root@anestethize modules.d]# cd ../initrd.d
[root@anestethize initrd.d]# find ./ | cpio -H newc -o | gzip > ../iso.d/isolinux/initrd.img
16643 blocks
[root@anestethize initrd.d]# cd ../
[root@anestethize centos-net]# mkisofs -o CentOS-5.3-x86_64-atl1e-netinstall.iso 
-b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table iso.d/

That’s all! Now we can use CentOS-5.3-x86_64-atl1e-netinstall.iso to do the installation.

One thought on “Netinstalling CentOS using Attansic L1 Gigabit Ethernet (aka HOWTO modify Red Hat based iso's bootkernel)

  1. Pingback: peter

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s