summaryrefslogtreecommitdiff
path: root/hurd/dde/guide.mdwn
blob: 1418638ca0ab7a09f80a91956d45f78700a3fa23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
[[!meta copyright="Copyright © 2010,2011 Free Software Foundation, Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

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.

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.


We start by booting into Debian GNU/Linux,
so we can downloading everything we will need for building DDE.

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

Get DDE code:

> $ cd /mnt/home

> $ git clone git://git.sv.gnu.org/hurd/incubator.git -b dde hurd_dde

> $ git clone git://git.sv.gnu.org/hurd/gnumach.git -b master-user_level_drivers gnumach_dde

Now you need to get the actual driver from the Linux source tree.
You have to find out which Linux driver
is responsible for your network card,
and which source file corresponds to this driver.
In this guide we will use the forcedeth driver
(for Nvidia nForce chipsets) as example.

Point a (JavaScript-capable) web browser at

> http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.29.y.git;a=tree;f=drivers/net;hb=HEAD

Find the right file to download (e.g. forcedeth.c),
hit the "raw" link,
and save the resulting file (page) to /mnt/home


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

Build a DDE-enabled Mach (this and following parts can be done as normal user):

> $ cd /home/gnumach_dde

> $ autoreconf -i && ./configure --enable-kdb --enable-device-drivers=none --enable-lpr --enable-floppy --enable-ide

> $ make

Prepare the driver for your network card:

> $ cd ../hurd_dde

> $ 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 /home/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 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'

Build the necessary Hurd and DDE bits:

> $ autoreconf -i && ./configure

> $ mkdir -p hurd/include/ddekit # workaround for a buildsystem bug... XXX I'm pretty sure this is not necessary anymore

> $ make libddekit libmachdev devnode pfinet # Hurd components

> $ cd libdde_linux26 # common DDE driver code -- uses a different Makefile system than the Hurd components!

> $ make

> $ cd ../dde_forcedeth # actual driver

> $ make

If the make fails it might be necassary to replace some of the -l options (or all) in Makefile with the real path to the library objects (example: change *-lhurd-slab* to *../libhurd-slab/libhurd-slab.a*) XXX

Install the various built components to their final destinations (as root):

> $ cp /home/gnumach_dde/gnumach /boot/gnumach_dde

> $ mkdir /hurd/dde

> $ cp /home/hurd_dde/devnode/devnode /hurd/dde

> $ cp /home/hurd_dde/pfinet/pfinet /hurd/dde

> $ cp /home/hurd_dde/dde_forcedeth/dde_forcedeth /hurd/dde/forcedeth


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 -c /dev/forcedeth /hurd/dde/forcedeth

> $ settrans -c /dev/eth0 /hurd/dde/devnode -M /dev/forcedeth eth0

Finally, we can set up the actual network translator,
using something like:

> $ settrans -c /servers/socket/2 /hurd/dde/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.