{"id":727,"date":"2010-05-16T00:47:18","date_gmt":"2010-05-15T22:47:18","guid":{"rendered":"http:\/\/raftaman.net\/?p=727"},"modified":"2022-01-29T23:20:40","modified_gmt":"2022-01-29T21:20:40","slug":"netboot-centos-using-attansic-l1-gigabit-ethernet","status":"publish","type":"post","link":"https:\/\/possiblelossofprecision.net\/?p=727","title":{"rendered":"Netboot CentOS using Attansic L1 Gigabit Ethernet"},"content":{"rendered":"\n<p>To update the <code>initrd.img<\/code> to load additional drivers early in the boot process, normally you would simply run <code>\/sbin\/mkinitrd<\/code> and let the script do the work. But what if the <code>initrd.img<\/code> used during the installation of CentOS lacks an important driver? Maybe you want to netboot CentOS, but the initial ramdisk CentOS provides doesn&#8217;t have the right modules for you NIC.<\/p>\n<p>This article gives an example, how to modify the <code>initrd.img<\/code> 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 <a href=\"https:\/\/possiblelossofprecision.net\/?p=281\">CentOS and Attansic L1 Gigabit Ethernet<\/a>)<\/p>\n<p><!--more--><\/p>\n<h2>1. Get the modules<\/h2>\n<p>First, we need to get the modules from <a href=\"http:\/\/www.hogchain.net\/attansic\/attansic.html\">Jay Cliburn&#8217;s page<\/a>. Since you probably don&#8217;t know, <a href=\"http:\/\/www.hogchain.net\/attansic\/attansic.html#variants\">which version of L1<\/a> you have, we just pull both rpms:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\r\n$ wget ftp:\/\/ftp.hogchain.net\/pub\/linux\/attansic\/atl1e\/centos5.2\/kmod-atl1e-1.0.1.0-1.i686.rpm\r\n$ wget ftp:\/\/ftp.hogchain.net\/pub\/linux\/attansic\/atl1\/centos5.2\/kmod-atl1-2.1.3-1.i686.rpm\r\n$ rpm2cpio kmod-atl1e-1.0.1.0-1.i686.rpm | cpio -id\r\n$ rpm2cpio kmod-atl1-2.1.3-1.i686.rpm | cpio -id\r\n<\/pre>\n<h2>2. Modify initial ramdisk<\/h2>\n<h2>2.1. Get <code>initrd.img<\/code><\/h2>\n<p>Next we&#8217;ll extract the <code>initrd.img<\/code> from a CentOS mirror.  The <code>initrd.img<\/code> is a gzip&#8217;ed cpio archive.<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\r\n$ wget http:\/\/mirror.centos.org\/centos-5\/5.4\/os\/i386\/images\/pxeboot\/initrd.img\r\n$ mkdir \/tmp\/initrd\r\n$ cd \/tmp\/initrd\r\n$ gzip -dc \/tmp\/initrd.img | cpio -id\r\n<\/pre>\n<h2>2.2. Extract modules.cgz<\/h2>\n<p>In the <code>modules\/<\/code> subdirectory, you&#8217;ll see <code>modules.cgz<\/code> which is yet another gzip&#8217;ed cpio archive.  Let&#8217;s extract it next.<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/initrd\/modules\r\n$ gzip -dc modules.cgz | cpio -id\r\n<\/pre>\n<h2>2.3. Add *.ko to modules.cgz<\/h2>\n<p>Now we can copy the kernel modules from the rpms into our custom <code>initrd.img<\/code><\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/initrd\/modules\r\n$ find \/tmp\/lib\/ -name *.ko | xargs -i cp {} 2.6.18-164.el5\/i686\/\r\n<\/pre>\n<h2>2.4. Modify module-info<\/h2>\n<p><code>module-info<\/code> is a text file used by the installation program to gain informations about the modules. Append in this file the following rows:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\natl1e\r\n\teth\r\n\t&quot;Atheros 1000M Ethernet Network Driver&quot;\r\natl1\r\n\teth\r\n\t&quot;Atheros L1 Gigabit Ethernet Driver&quot;\r\n<\/pre>\n<h2>2.5. Modify modules.alias<\/h2>\n<p>This file maps a driver to the PCI device data, so it\u2019s possible to call the kernel module with the alias. So we have to add the right alias to <code>modules.alias<\/code> to make the system autoload the driver:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ modinfo \/tmp\/lib\/modules\/2.6.18-92.1.18.el5.centos.plus\/extra\/atl1\/atl1.ko\r\n&#x5B;...]\r\nalias:          pci:v00001969d00001026sv*sd*bc*sc*i*\r\n&#x5B;...]\r\n<\/pre>\n<p>You can get the alias for atl1e likewise. So we add the following lines to <code>modules.alias<\/code>:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\nalias pci:v00001969d00001026sv*sd*bc*sc*i* atl1e\r\nalias pci:v00001969d00001048sv*sd*bc*sc*i* atl1\r\n<\/pre>\n<p>Alternatively, we can use <code>sed<\/code> to automate this task (see also <a href=\"http:\/\/kbase.redhat.com\/faq\/docs\/DOC-17742\">Red Hat Knowledgebase<\/a>)<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/lib\/modules\/2.6.18-92.1.18.el5.centos.plus\/extra\/atl1\/\r\n$ modinfo -F alias atl1.ko | sed -e 's\/^\/alias \/' -e 's\/$\/ atl1\/' &gt;&gt; \/tmp\/initrd\/modules\/modules.alias\r\n$ cd \/tmp\/lib\/modules\/2.6.18-92.1.18.el5.centos.plus\/extra\/atl1e\r\n$ modinfo -F alias atl1e.ko | sed -e 's\/^\/alias \/' -e 's\/$\/ atl1e\/' &gt;&gt; \/tmp\/initrd\/modules\/modules.alias\r\n<\/pre>\n<h2>2.6. Modify modules.dep<\/h2>\n<p>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 <code>modinfo -F depends atl1.ko<\/code>, to build a list of dependencies), we simply add <code>atl1: mii<\/code><\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/initrd\/modules\r\n$ echo atl1: mii &gt;&gt; modules.dep\r\n<\/pre>\n<h2>2.7. Get new pci.ids<\/h2>\n<p><code>pci.ids<\/code> is a database of all known pci IDs and since the CentOS&#8217; <code>pci.ids<\/code> lacks information about our devices, we simply overwrite it with the latest one from the <a href=\"http:\/\/pciids.sourceforge.net\/\">PCI ID Repository<\/a>:<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/initrd\/modules\r\n$ wget http:\/\/pciids.sourceforge.net\/v2.2\/pci.ids -O pci.ids\r\n<\/pre>\n<h2>3. Re-package initrd.img<\/h2>\n<p>Finally, we can package everything back up into our new custom <code>initrd.img<\/code>.  Be careful when creating the cpio archives because the <code>modules.cgz<\/code> file uses the <strong>crc<\/strong> format whereas <code>initrd.img<\/code> uses the <strong>newc<\/strong> format!  If you use the wrong format, the installation will not be able to read the <code>initrd.img<\/code>.<\/p>\n<pre class=\"brush: plain; light: true; title: ; notranslate\" title=\"\">\r\n$ cd \/tmp\/initrd\/modules\r\n$ find 2.6.18-164.el5 | cpio -o -H crc | gzip -9 &gt; modules.cgz\r\n$ rm -rf 2.6.18-164.el5\r\n$ cd ..\r\n$ find . | cpio -o -H newc | gzip -9 &gt; \/tmp\/initrd.img\r\n<\/pre>\n<p>Now copy your new <code>\/tmp\/initrd.img<\/code> onto your PXE boot server, or burn a new installation DVD with this replacement <code>initrd.img<\/code>.<\/p>\n<p>Resources:<br \/>\n<a href=\"http:\/\/kbase.redhat.com\/faq\/docs\/DOC-17783\">http:\/\/kbase.redhat.com\/faq\/docs\/DOC-17783<\/a><br \/>\n<a href=\"http:\/\/kbase.redhat.com\/faq\/docs\/DOC-17742\">http:\/\/kbase.redhat.com\/faq\/docs\/DOC-17742<\/a><br \/>\n<a href=\"http:\/\/osl.uniparthenope.it\/2009\/07\/netinstalling-centos-using-attansic-l1-gigabit-ethernet-aka-howto-modify-red-hat-based-isos-bootkernel\/\">http:\/\/osl.uniparthenope.it\/2009\/07\/netinstalling-centos-using-attansic-l1-gigabit-ethernet-aka-howto-modify-red-hat-based-isos-bootkernel\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>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&#8217;t have the right modules for you&#8230; <a href=\"https:\/\/possiblelossofprecision.net\/?p=727\">Read more &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13,58,85],"class_list":["post-727","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-centos","tag-hardware","tag-pxe"],"_links":{"self":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/727","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=727"}],"version-history":[{"count":31,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions"}],"predecessor-version":[{"id":737,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=\/wp\/v2\/posts\/727\/revisions\/737"}],"wp:attachment":[{"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=727"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=727"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/possiblelossofprecision.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=727"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}