This guide explains how to build and set up a DDE-based network card driver with Debian GNU/Hurd, if your (wired) network card is not supported by the old in-kernel drivers shipped with gnumach.
NOTE: As of hurd package 20120520-1, all that is already done for you, do not do anything mentioned below, and you just need to configure your TCP/IP stack by using settrans on /servers/socket/2, or dhclient /dev/eth0.
This guide assumes that you have an installation of Debian GNU/Linux on the same machine, which helps in fetching the required packages in absence of working networking in the Hurd. The whole process is much more cumbersome otherwise. It also assumes that apart from networking, your Hurd system is already installed and operational.
Debian now already includes dde support in both gnumach (>= 2:1.3.99.dfsg.git20120219-1) and hurd (>= 20120219-1), so in the steps below, building gnumach will not be needed. Also, be sure to use the dde-debian branch instead of dde.
We start by booting into Debian GNU/Linux, so we can download everything we will need for building DDE. If you have already a way to download things from the Hurd image, skip to "Get DDE code" below.
Once there, first mount the Hurd partition (as root):
$ mount /dev/hdd1 /mnt -t ext2 # assuming your Hurd partition is hdd1 -- replace with whatever matches your setup
Prepare apt offline configuration so we can get necessary packages:
$ cd /mnt/etc/apt $ echo "deb http://ftp.debian-ports.org/debian unreleased main" >> sources.list # if you don't have sources.list set up yet on the Hurd system $ echo "deb-src http://ftp.debian-ports.org/debian unreleased main" >> sources.list $ echo "deb http://ftp.uk.debian.org/debian unstable main" >> sources.list $ echo "deb-src http://ftp.uk.debian.org/debian unstable main" >> sources.list $ wget http://www.gnu.org/software/hurd/hurd/running/debian/DebianAptOffline/apt.conf.offline
Download the packages for offline installation:
$ cd /mnt $ apt-get -c etc/apt/apt.conf.offline update $ apt-get -c etc/apt/apt.conf.offline build-dep hurd gnumach $ apt-get -c etc/apt/apt.conf.offline install git-core build-essential libpciaccess-dev libpcap0.8-dev hurd-dev zlib1g-dev
Get DDE code:
$ cd /mnt/home/me # assuming your user name on the Hurd system is "me" $ mkdir dde && cd dde
Note: here, use dde-debian instead of dde if you have gnumach >= 2:1.3.99.dfsg.git20120219-1 already installed and running. Otherwise you will get "vm_allocate_contiguous: (ipc/mig) bad request message ID" error messages.
$ git clone git://git.sv.gnu.org/hurd/incubator.git -b dde hurd $ git clone git://git.sv.gnu.org/hurd/gnumach.git -b master-user_level_drivers
Now comes the tricky part: you need to find out whether there is already a driver for your card in the DDE source tree, and otherwise get the driver code from the official Linux source tree.
For this, you have to find out which Linux driver
is responsible for your network card.
In this guide we will use the forcedeth driver
(for Nvidia nForce chipsets) as example.
We check whether there is already a
in the newly cloned
If there isn't, we have to find and download
the right source file from Linux:
(Note: you have to use some 2.6.29.y (whatever the y, prefer the latest), as this is the version DDE is currently based on.)
Find the right file to download (forcedeth.c in this example); then hit the "raw" link, and save the resulting file (page) to /mnt/home/me/dde
(If you happen to need one of the few drivers that consist of more than one source file, the process will be more complicated, and can't be covered in this guide...)
Now everything should be in place, so we can boot into Hurd to do the actual work.
Once there, install the packages previously downloaded (again as root):
$ apt-get build-dep hurd gnumach $ apt-get install git-core build-essential libpciaccess-dev libpcap0.8-dev hurd-dev zlib1g-dev
Make sure we can build stuff as normal user:
$ chown -R me ~me/dde
Now you can log in with the normal user account to build stuff.
Build a DDE-enabled Mach. Not needed if you have gnumach >= 2:1.3.99.dfsg.git20120219-1 already installed and running:
$ cd ~me/dde/gnumach $ autoreconf -i && ./configure --enable-kdb --enable-device-drivers=none --enable-lpr --enable-floppy --enable-ide $ make
If not already present in DDE, we need to prepare the driver for the network card (else, skip to "Having prepared the driver" below):
$ cd ~me/dde/hurd $ cp -r dde_pcnet32 dde_forcedeth # using pcnet32 as template $ cd dde_forcedeth $ rm pcnet32.c # don't want the actual pcnet32 code here... $ cp ~me/dde/forcedeth.c . # ...but rather the forcedeth code $ sed -i 's/pcnet32/forcedeth/g' Makefile # adapt Makefile accordingly $ sed -i 's/pcnet32/forcedeth/g' .gitignore $ sed -i 's:-lhurd-slab:../libhurd-slab/libhurd-slab.a:' Makefile # fix up build system... XXX I guess this part is obsolete $ sed -i 's:-I/include:-I..:' Makefile # same $ nano forcedeth.c # Near the top of the file, there will be many #include lines. After the last one, add this: #include <ddekit/timer.h> $ cd ..
Commit the new driver with git. This will be helpful if we update the DDE code later; as well as for creating a patch for later reuse and/or upstream submission:
$ git add dde_forcedeth $ git commit -a -m 'Add forcedeth driver'
Having prepared the driver, we can now build the necessary Hurd and DDE bits:
$ autoreconf -i && ./configure $ make libddekit libmachdev devnode pfinet # Hurd components. This is not needed if you have the Debian hurd-dev >= 20120219-1 package already installed. $ make -C libdde_linux26 # common DDE driver code -- uses a different Makefile system than the Hurd components! This is not needed if you have the Debian hurd-dev >= 20120219-2 package already installed.
If you have the Debian hurd-dev >= 20120219-2 package already installed (and thus skipped the previous steps), run:
$ make -C dde_forcedeth PKGDIR=/usr/share/libdde_linux26 # actual driver
otherwise, after doing the previous steps, use:
$ make -C dde_forcedeth # actual driver
Install the various built components to their final destinations (as root). You only need to install dde_forcedeth if you are already running the Debian gnumach >= 2:1.3.99.dfsg.git20120219-1 and hurd-dev >= 20120219-1 packages:
$ cd ~me/dde/ $ cp gnumach/gnumach /boot/gnumach_dde $ cp hurd/devnode/devnode hurd/pfinet/pfinet hurd/dde_forcedeth/dde_forcedeth /hurd
Now everything should be ready. Before we can use the driver, we have to boot with the newly built gnumach_dde instead of the standard kernel. (Adapt your grub configuration; or manually edit the entry in the boottime grub menu while testing.)
Once there, set up the translators for the driver (as root):
$ settrans -cap /dev/forcedeth /hurd/dde_forcedeth
If that spews error "vm_allocate_contiguous: (ipc/mig) bad request message ID", you are mixing things: either use the debian kernel and the dde-debian incubator branch, or use your kernel built from the master-user_level_drivers branch and the dde incubator branch, but don't make any mixture.
$ settrans -cap /dev/eth0 /hurd/devnode -M /dev/forcedeth eth0
Finally, we can set up the actual network translator, using something like:
$ settrans -cap /servers/socket/2 /hurd/pfinet -i /dev/eth0 -a 192.168.1.194 -g 192.168.1.254 -m 255.255.255.0
For the exact syntax, see the normal network setup documentation. The only differences here are the different location of the pfinet binary, and the different syntax for the -i option.
Check Arch/Hurd recipe on git://projects.archhurd.org/packages.git