Monthly Archives: October 2011

PXE: Network Booting Into Debian Setup

I just installed Debian on a 2002-ish desktop: Intel Celeron 1.7GHz, 256 SDRAM, 10 GB HDD, an aging floppy drive alongside a dodgy CD drive; just another you-wont-see-me-using-this-on-a-daily-basis desktop PC. I hostnamed it vindauga.

BIOS Setup

First of all, I have to make vindauga to look forward to booting from network. On BIOS I’ve set its boot order to LAN and then HDD, I also have to set it’s “On-board LAN” to “Enabled”.

Connect It To Network

Luckily, I already have a Debian server up and sharing its internet connection. This server is going to bootstrap the installation for vindauga.

The thing about booting from network, is to make vindauga to join my network. Luckily I already run a dhcp server (package name: isc-dhcp-server) on my Debian server, this is my setup:

# this is an excerpt from my /etc/dhcp/dhcpd.conf
subnet 192.168.77.224 netmask 255.255.255.248 {
    # this subnet is for wired LAN at eth2
    range 192.168.77.226 192.168.77.230;

    option subnet-mask          255.255.255.248;
    # broadcast address to nodes in this subnet
    option broadcast-address    192.168.77.231;

    # set resolver & gateway to this computer/my Debian-server (192.168.77.225)
    option domain-name-servers  192.168.77.225;
    option routers              192.168.77.225;

    host VINDAUGA { # assign fixed IP address for vindauga for now
        hardware ethernet       00:E0:4C:99:DF:E7;
        fixed-address           192.168.77.226;
    }

    # this is the most important of all; with this, dhcp server will provide
    # NOT ONLY network details (address, gateway, etc.) but also a bootstrap
    # program for vindauga to run
    filename "pxelinux.0";
}

The filename "pxelinux.0"; part is to make vindauga to expect a program named pxelinux.0 for booting. As you might already know a dhcp server does not transfer file, basically it just giving the client a hint about the file, the one who actually transfer that file over the wire is another program called tftp-hpa, basically it is a simplified-ftp server. In Debian you can find its package named as “tftpd-hpa“.

Get tftp-hpa To Deliver

This tftp-hpa program —by default— uses UDP on port 69 so I punched a hole in my firewall to allow this traffic.

Now, its configuration file:

# /etc/default/tftpd-hpa

TFTP_USERNAME="tftp"
TFTP_DIRECTORY="/srv/tftp"
TFTP_ADDRESS="192.168.77.225:69"
TFTP_OPTIONS="-v -s"

As you can see, on TFTP_ADDRESS I set it to listen on 192.168.77.255 port 69. This is the IP address on my Debian server for eth1, which is connected to vindauga. The TFTP_OPTIONS is to make tftp-hpa to be verbose (the “-v” part), and to serve on a specific root (the “-s”).

The “-s” part is significant because it allows the dhcp server to say just pxelinux.0 and tftp-hpa would resolve it as /srv/tftp/pxelinux.0.

What To Deliver

This (highly-anticipated :)) pxelinux.0 file can be found in the netboot distribution of Debian:

http://kambing.ui.ac.id/debian/dists/stable/main/installer-i386/current/images/netboot/

Since I’m in Indonesia it is the fitting Debian mirror for me, feel free to use another mirror.

I download pxelinux.0, all files under debian-installer/ and pxelinux.cfg/ directory and put them in /srv/tftp/. I skipped the debian-installer/i386/pxelinux.0 because its a symlink to pxelinux.0 and end up with this:

/srv/tftp/
├── pxelinux.cfg
│   └── default
├── pxelinux.0
└── debian-installer
    └── i386
        ├── linux
        ├── initrd.gz
        └── boot-screens
            ├── xfce
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── vesamenu.c32
            ├── txt.cfg
            ├── syslinux.cfg
            ├── stdmenu.cfg
            ├── splash.png
            ├── rqtxt.cfg
            ├── prompt.cfg
            ├── menu.cfg
            ├── lxde
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── kde
            │   ├── txtdt.cfg
            │   ├── txt.cfg
            │   ├── prompt.cfg
            │   ├── prmenu.cfg
            │   ├── menu.cfg
            │   ├── adtxtdt.cfg
            │   └── adtxt.cfg
            ├── f9.txt
            ├── f8.txt
            ├── f7.txt
            ├── f6.txt
            ├── f5.txt
            ├── f4.txt
            ├── f3.txt
            ├── f2.txt
            ├── f1.txt
            ├── f10.txt
            ├── exithelp.cfg
            ├── dtmenu.cfg
            └── adtxt.cfg

Boot It Up

I restart my dhcp server to make configuration changes into effect and start tftpd-hpa on my Debian server:

$ sudo /etc/init.d/isc-dhcp-server restart
$ sudo /etc/init.d/tftpd-hpa start

I turn on vindauga and lo, it boot into Debian’s setup menu.

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan

TP-LINK TF-3200 On Debian

So I bought a FastEthernet NIC, a cheap TP-LINK PCI card, somewhere around $3,5. Here’s the box:
TP-LINK TF-3200

The model is TF-3200, and I want to install it alongside my D-LINK .. something.

Installation

The hardware installation is boring, I unwrap it, put it on one of the empty PCI slots and fasten its screw to the casing.

Get My Debian To Use It

Strangely at first boot my Debian didn’t recognize it. Yay!! There is only one way to install a PCI card and I could swear even a brick couldn’t get it wrong, so knowing hardwares love-hate relationship with Linux I have to suspect it’s more down to modules and stuff.

Fortunately, for a $3.5 LAN card, it also comes with a “Resource CD”; it’s a driver CD. In short, there is a driver for Linux located in TF-3200/LinuxDriver/ and it comes in source form.

Aww, that’s cute!

I did try to compile but somehow I cant get it to work:

$ make
make -C /lib/modules/2.6.39-2-486/build SUBDIRS=/tmp/LinuxDriver modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.39-2-486'
  CC [M]  /tmp/LinuxDriver/sundance_main.o
/tmp/LinuxDriver/sundance_main.c: In function ‘sundance_probe1’:
/tmp/LinuxDriver/sundance_main.c:712: error: implicit declaration of function ‘SET_MODULE_OWNER’
/tmp/LinuxDriver/sundance_main.c:735: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:762: error: ‘struct net_device’ has no member named ‘open’
/tmp/LinuxDriver/sundance_main.c:763: error: ‘struct net_device’ has no member named ‘hard_start_xmit’
/tmp/LinuxDriver/sundance_main.c:764: error: ‘struct net_device’ has no member named ‘stop’
/tmp/LinuxDriver/sundance_main.c:765: error: ‘struct net_device’ has no member named ‘get_stats’
/tmp/LinuxDriver/sundance_main.c:766: error: ‘struct net_device’ has no member named ‘set_multicast_list’
/tmp/LinuxDriver/sundance_main.c:767: error: ‘struct net_device’ has no member named ‘set_mac_address’
/tmp/LinuxDriver/sundance_main.c:768: error: ‘struct net_device’ has no member named ‘do_ioctl’
/tmp/LinuxDriver/sundance_main.c:769: error: ‘struct net_device’ has no member named ‘tx_timeout’
/tmp/LinuxDriver/sundance_main.c:771: error: ‘struct net_device’ has no member named ‘change_mtu’
/tmp/LinuxDriver/sundance_main.c: In function ‘mdio_read’:
/tmp/LinuxDriver/sundance_main.c:1029: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘mdio_write’:
/tmp/LinuxDriver/sundance_main.c:1059: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_open’:
/tmp/LinuxDriver/sundance_main.c:1088: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1094: error: ‘SA_SHIRQ’ undeclared (first use in this function)
/tmp/LinuxDriver/sundance_main.c:1094: error: (Each undeclared identifier is reported only once
/tmp/LinuxDriver/sundance_main.c:1094: error: for each function it appears in.)
/tmp/LinuxDriver/sundance_main.c:1141: error: ‘SPIN_LOCK_UNLOCKED’ undeclared (first use in this function)
/tmp/LinuxDriver/sundance_main.c: In function ‘check_speed’:
/tmp/LinuxDriver/sundance_main.c:1195: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_timer’:
/tmp/LinuxDriver/sundance_main.c:1242: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘tx_timeout’:
/tmp/LinuxDriver/sundance_main.c:1258: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘init_ring’:
/tmp/LinuxDriver/sundance_main.c:1311: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘tx_poll’:
/tmp/LinuxDriver/sundance_main.c:1354: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘start_tx’:
/tmp/LinuxDriver/sundance_main.c:1381: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘reset_tx’:
/tmp/LinuxDriver/sundance_main.c:1423: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘intr_handler’:
/tmp/LinuxDriver/sundance_main.c:1487: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘rx_poll’:
/tmp/LinuxDriver/sundance_main.c:1621: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1677: error: implicit declaration of function ‘eth_copy_and_sum’
/tmp/LinuxDriver/sundance_main.c: In function ‘refill_rx’:
/tmp/LinuxDriver/sundance_main.c:1718: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_error’:
/tmp/LinuxDriver/sundance_main.c:1749: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘get_stats’:
/tmp/LinuxDriver/sundance_main.c:1772: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘set_rx_mode’:
/tmp/LinuxDriver/sundance_main.c:1801: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c:1811: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1816: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1822: error: ‘struct net_device’ has no member named ‘mc_list’
/tmp/LinuxDriver/sundance_main.c:1822: error: ‘struct net_device’ has no member named ‘mc_count’
/tmp/LinuxDriver/sundance_main.c:1823: error: dereferencing pointer to incomplete type
/tmp/LinuxDriver/sundance_main.c:1824: error: dereferencing pointer to incomplete type
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_ethtool_ioctl’:
/tmp/LinuxDriver/sundance_main.c:1869: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_ioctl’:
/tmp/LinuxDriver/sundance_main.c:1953: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘netdev_close’:
/tmp/LinuxDriver/sundance_main.c:2001: error: ‘struct net_device’ has no member named ‘priv’
/tmp/LinuxDriver/sundance_main.c: In function ‘sundance_remove1’:
/tmp/LinuxDriver/sundance_main.c:2118: error: ‘struct net_device’ has no member named ‘priv’
make[4]: *** [/tmp/LinuxDriver/sundance_main.o] Error 1
make[3]: *** [_module_/tmp/LinuxDriver] Error 2
make[2]: *** [sub-make] Error 2
make[1]: *** [all] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-2.6.39-2-486'
make: *** [all] Error 2

Anyway, after a quick glance at the Makefile it seems it (supposed to) generate sundance.o and to install it to /lib/modules/$(KernelVersion)/kernel/drivers/net/ as sundance.ko. Fortunately a quick ls -lh /lib/modules/$(uname -r)/kernel/drivers/net/ | grep sundance told me that I already have it. So I hope I can skip it, now that I know my Debian already have its sundance.ko.

About sundance.ko

Of course, the next step is to get to know this sundance.ko thing. I query that driver by running:

$ sudo modinfo /lib/modules/$(uname -r)/kernel/drivers/net/sundance.ko
filename:       /lib/modules/2.6.39-2-486/kernel/drivers/net/sundance.ko
license:        GPL
description:    Sundance Alta Ethernet driver
author:         Donald Becker 
alias:          pci:v000013F0d00000200sv*sd*bc*sc*i*
alias:          pci:v000013F0d00000201sv*sd*bc*sc*i*
alias:          pci:v00001186d00001002sv*sd*bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001040bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001012bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001003bc*sc*i*
alias:          pci:v00001186d00001002sv00001186sd00001002bc*sc*i*
depends:        mii
intree:         Y
vermagic:       2.6.39-2-486 mod_unload modversions 486
parm:           media:array of charp
parm:           debug:Sundance Alta debug level (0-5) (int)
parm:           rx_copybreak:Sundance Alta copy breakpoint for copy-only-tiny-frames (int)
parm:           flowctrl:Sundance Alta flow control [0|1] (int)

I found the author (Donald Becker) match with the information found at sundance_main.c. Another interesting information I found is the dependency of this module, it says it depends on another module named mii, so I ran a check on that one too:

$ sudo modinfo mii
filename:       /lib/modules/2.6.39-2-486/kernel/drivers/net/mii.ko
license:        GPL
description:    MII hardware support library
author:         Jeff Garzik 
depends:
intree:         Y
vermagic:       2.6.39-2-486 mod_unload modversions 486

This sundance depends on mii, where we also have mii.c and mii.h lying on the source directory too, so this DEFINITELY it.

I already have it! So now it should be working after I enable those two modules, okay then:

$ sudo modprobe mii; sudo modprobe sundance;

And then I want to see if anything happened:

$ dmesg | grep -i eth | tail
.. unrelated texts ..
[53251.562523] eth1: IC Plus Corporation IP100A FAST Ethernet Adapter at 00019800, 54:e6:fc:83:12:72, IRQ 19.
[53251.563050] eth1: MII PHY found at address 0, status 0x7849 advertising 01e1.
.. unrelated texts ..

It seems my card finally recognized by Linux! One final check just to make sure :

$ ip link show
1: lo:  mtu 16436 qdisc noqueue state UNKNOWN
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: eth0:  mtu 1500 qdisc pfifo_fast state UP qlen 1000
    link/ether 00:19:5b:5b:cb:22 brd ff:ff:ff:ff:ff:ff
3: eth1:  mtu 1500 qdisc pfifo_fast state DOWN qlen 1000
    link/ether 54:e6:fc:83:12:72 brd ff:ff:ff:ff:ff:ff
4: wlan0:  mtu 1500 qdisc mq state UP qlen 1000
    link/ether 00:11:09:be:fe:0d brd ff:ff:ff:ff:ff:ff

Yep, it’s there.

Okay, Now What?

I put it into use, duh! I update my shorewall configurations and make dhcpd to serve on that interface too, etc.. all is well until I get to reboot.

I forgot that I have to automatically load those two modules at boot, so I add sundance.conf to /etc/modprobe.d:

# /etc/modprobe.d/sundance.conf
alias eth1 sundance
options sundance debug=3

Now everything works as it should be.

Leave a comment

Filed under Ilmu, Orang bego punya kegiatan