Differences

This shows you the differences between two versions of the page.

Link to this comparison view

tips [2012/01/16 09:45]
mika drop very deprecated tips [mika]
tips [2013/10/20 19:57] (current)
guy howto debianise Intel NIC drivers and include them in grml
Line 279: Line 279:
 </code> </code>
  
-  * It's sensitive to use 44.1 khz for the output file and "vc null -vo null" does tell mplayer to not display video at all which makes it faster to encode.+  * It's sensible to use 44.1 khz for the output file and "vc null -vo null" does tell mplayer to not display video at all which makes it faster to encode.
  
 [Tip by [[http://grml.org/team/|Matthias Kopfermann]]] [Tip by [[http://grml.org/team/|Matthias Kopfermann]]]
Line 350: Line 350:
 Acquire::http::Proxy "http://localhost:3142/"; Acquire::http::Proxy "http://localhost:3142/";
 </code> </code>
 +
 +===== Remastering grml with out-of-tree NIC drivers and zfsonlinux =====
 +
 +Some Intel network cards have out-of-tree drivers at http://sourceforge.net/projects/e1000/ which often support recent NICs better than the in-kernel drivers.
 +
 +In some cases, the in-kernel driver works very poorly or not at all. If you have a box that's affected, running (especially netbooting) grml on it is a pain.
 +
 +This tip explains how to create your custom grml iso that includes these NIC drivers (with zfsonlinux thrown in as a bonus).
 +
 +1. grab some tarballs from http://sourceforge.net/projects/e1000/, e.g.:
 +
 +<code>
 +-rw-r--r-- 1 root root   269997 Sep  5 16:25 e1000e-2.5.4.tar.gz
 +-rw-r--r-- 1 root root   303648 Sep 17 02:23 igb-5.0.6.tar.gz
 +-rw-r--r-- 1 root root   362747 Sep 30 23:21 ixgbe-3.18.7.tar.gz
 +-rw-r--r-- 1 root root   140096 Sep 30 23:31 ixgbevf-2.11.3.tar.gz
 +</code>
 +
 +2. Extract them.
 +
 +3. In each resulting directory, create a dkms.conf file; this will allow you to package up the module source as a .deb. I only have a superficial understanding of dkms, so what I did is probably not the best possible approach, but it seemed to mostly work (with the exception of e1000e, which appeared to build correctly but whose module was not installed by dkms for some reason; corrections welcome).
 +
 +3.1. Move the contents of src/ to "." (see below for a possible way of avoiding this).
 +
 +3.2. Create a dkms.conf saying (I'll use igb-5.0.6 as the example here):
 +
 +<code>
 +AUTOINSTALL="yes"
 +BUILT_MODULE_NAME[0]="igb"
 +CLEAN="make clean"
 +DEST_MODULE_LOCATION="/updates"
 +DEST_MODULE_NAME[0]="igb"
 +PACKAGE_NAME="igb"
 +PACKAGE_VERSION="5.0.6-1"
 +</code>
 +
 +I have not tried, but I think you should be able to avoid moving the source files from src/ to . by using a slightly different dkms.conf, such as:
 +
 +<code>
 +AUTOINSTALL="yes"
 +BUILT_MODULE_NAME[0]="igb"
 +CLEAN="'make' -C src/ clean"
 +MAKE="'make' -C src/ all"
 +BUILT_MODULE_LOCATION="src/"
 +DEST_MODULE_LOCATION="/updates"
 +DEST_MODULE_NAME[0]="igb"
 +PACKAGE_NAME="igb"
 +PACKAGE_VERSION="5.0.6-1"
 +</code>
 +
 +3.3. Make sure the Makefiles of the modules get the kernel version to build for from the KERNELRELEASE environment variable instead of e.g. BUILD_KERNEL (which the Intel drivers use by default), because that's what dkms sets:
 +
 +<code>
 +sed -i 's/BUILD_KERNEL/KERNELRELEASE/g' Makefile
 +</code>
 +
 +3.4. Optional: if you're using a custom kernel (not the grml default kernel), you may want to change the module source to use #ifdef CONFIG_PM instead of #ifdef CONFIG_PM_SLEEP as per https://sourceforge.net/p/e1000/patches/24/.
 +
 +3.5. In each module directory, do (again, using igb-5.0.6 as an example; modify as necessary):
 +
 +<code>
 +dkms add -m igb -v 5.0.6           
 +dkms mkdeb -m foo -v 5.0.6 --source-only
 +</code>
 +
 +The second command will create a .deb and dump it somewhere under /var/lib/dkms/.
 +
 +4. Import the .debs into your private repository (I manage mine using reprepro, fwiw). I suppose you can skip this step and instead use a different mechanism to inject the .debs into the grml build.
 +
 +5. Install grml-live.
 +
 +5.1. Create a new FAI "class" called e.g. EXTRANIC (and one called ZFSONLINUX, if you want). This involves creating the following files:
 +
 +/etc/grml/fai/config/hooks/instsoft.EXTRANIC (mode 755):
 +
 +<code>
 +#!/bin/bash
 +set -u
 +set -e
 +. "$GRML_LIVE_CONFIG"
 +$ROOTCMD apt-get --yes --force-yes install \
 + dkms build-essential linux-headers-3.10-1-grml-amd64
 +</code>
 +
 +(You'll note this is inelegant because it hardcodes the kernel version; the point here is to make sure the kernel-headers are already installed by the time the driver packages are installed.)
 +
 +/etc/grml/fai/config/scripts/EXTRANIC/50-dkms (mode 755):
 +
 +<code>
 +#!/bin/zsh
 +set -u
 +set -e
 +. "$GRML_LIVE_CONFIG"
 +for kernelversion in $(${=ROOTCMD} sh -c 'ls -1 /boot/vmlinuz-*' \
 + | sed 's@.*boot/vmlinuz-@@'); do
 + echo "Building dkms modules for kernel $kernelversion."
 + ${=ROOTCMD} /etc/kernel/postinst.d/dkms "$kernelversion"
 +done
 +</code>
 +
 +(This may not be necessary. It attempts to build all dkms modules once more, after all requested packages have been installed.)
 +
 +/etc/grml/fai/config/package_config/EXTRANIC:
 +
 +<code>
 +e1000e-dkms
 +igb-dkms
 +ixgbe-dkms
 +ixgbevf-dkms
 +broadcom-sta-dkms
 +r8168-dkms
 +</code>
 +
 +(Some of these are from stock Debian; the first four are the ones I built in step 3.)
 +
 +Optional: /etc/grml/fai/config/package_config/ZFSONLINUX:
 +
 +<code>
 +spl-dkms
 +zfs-dkms
 +zfsutils
 +libnvpair1
 +libzfs1
 +libzpool1
 +libuutil1
 +</code>
 +
 +/etc/grml/fai/config/files/etc/apt/sources.list.d/myrepo.list/EXTRANIC:
 +
 +(Contains the deb http://... line for your repository.)
 +
 +/etc/grml/fai/config/package_config/EXTRANIC.asc:
 +
 +(Contains the public key of the repository signing key; I'm not sure this is
 +really the correct way of injecting it in the build process.)
 +
 +Optional: also create a ZFSONLINUX.asc with the zfsonlinux signing key inside. As of 2013-10, you can obtain it by running
 +
 +<code>
 +gpg --keyserver subkeys.pgp.net --recv-keys 9A55B33CA71C1E00
 +gpg --armor --export 9A55B33CA71C1E00 >/etc/grml/fai/config/package_config/ZFSONLINUX.asc
 +</code>
 +
 +6. Configure grml-live. In /etc/grml/grml-live.local, I have:
 +
 +<code>
 +OUTPUT=/tmp/grml/grml-live
 +SUITE="sid"
 +FAI_DEBOOTSTRAP="sid http://cdn.debian.net/debian"
 +VERSION=$(date +%F)
 +RELEASENAME="grml64-extranic+zfs"
 +GRML_NAME="grml64-extranic+zfs"
 +HOSTNAME="grml-extranic+zfs"
 +ARCH="amd64"
 +DISTRI_NAME="grml-extranic+zfs"
 +NO_ADDONS_BSD4GRML='1'
 +EXIT_ON_MISSING_PACKAGES='1'
 +DEFAULT_BOOTOPTIONS="ssh=sekrit" # Be sure you understand what this does before using it
 +</code>
 +
 +7. Build your iso.
 +
 +<code>
 +echo 'y\nn\ny\ny'\
 + | env -u TMPDIR -u TMP \
 + nice -n 20 \
 + grml-live -A -u -e /path/to/grml64-full_sid_20131001.iso \
 + -c DEBORPHAN,GRMLBASE,GRML_FULL,RELEASE,AMD64,IGNORE,EXTRANIC,ZFSONLINUX
 +</code>
 +
 +(Obviously omit ",ZFSONLINUX" if you don't want it.)
 +
 +The resulting image is larger than regular grml as it includes build-essential and its dependencies; if that's a problem, I suppose you can add a script after 50-dkms that purges now-unneeded packages.
 +
 +[Tip by AndrĂ¡s Korn]
  
 
tips.txt · Last modified: 2013/10/20 19:57 by guy
 
Recent changes RSS feed Creative Commons License Valid XHTML 1.0 Valid CSS Grml homepage Driven by DokuWiki