That's no moon... that's a budong!

 Subscribe in a reader

Installing Debian on D-Link DNS-323

Tags: debian, dns-323, installer

Advice and update: If you want to install Debian Lenny on your D-Link DNS-323 I suggest you reading HOWTO's on Martin Michlmayr site and consider this post as an example of building installer.

Big thanks are going to Matthew Palmer and Martin Michlmayr for their part in bringing native Debian support on D-Link DNS-323.

Alas, the patches for debian-installer with support of DNS-323 were too late to include in Lenny. But right now they are integrated in d-i codebase already.

There is another obstacle: debian-installer's build scripts are strictly against cross-compilation (making d-i cross-compile is an effort comparable to making the sun go down faster with own bare hands).

So, my little Debian lovers, if you're going to install Debian on D-Link DNS-323 you need:

  1. Create qemu-based virtual machine.
  2. Install Debian Armel there.
  3. Get debian-installer build dependencies and sources.
  4. (Optional) Patch d-i's and regular kernel for the DNS-323 to get a fan/LED control.
  5. (Optional) Prepare preseed file if you're going to install Debian without a serial console cable attached to the device.
  6. Build a debian-installer firmware image for the DNS-323.
  7. Install Debian.

Creating QEMU virtual machine

Create directory to store all files and disk images for virtual machine.

$ mkdir debian-armel
$ cd debian-armel

Next we should create hard disk image for QEMU.

$ qemu-img create dns_debian.img 10G

Then we need a kernel and initrd images: one for starting installed system and another with Debian installer for versatile platform.

$ wget http://people.debian.org/~aurel32/qemu/armel/vmlinuz-2.6.26-1-versatile
$ wget http://people.debian.org/~aurel32/qemu/armel/initrd.img-2.6.26-1-versatile
$ wget http://ftp.nl.debian.org/debian/dists/unstable/main/installer-armel/current/images/versatile/netboot/initrd.gz

Installing Debian on virtual machine

Everything is ready to start installation. We'll run qemu virtual machine in headless mode emulating a serial connection (to save a framebuffer rendering overhead). For this we'll add -append "console=ttyAMA0" -nographic to the qemu command line.

$ qemu-system-arm -M versatile -kernel vmlinuz-2.6.26-1-versatile \
  -initrd initrd.gz -hda dns_debian.img -m 256 -append "console=ttyAMA0"\
  -nographic

Installation will take some time and in process installer will ask standard questions. After that you can lauch your Debian armel system with following command.

$ qemu-system-arm -M versatilepb -kernel vmlinuz-2.6.26-1-versatile \
  -hda dns_debian.img -m 256 -append "console=ttyAMA0 root=/dev/sda1"\
  -nographic

Getting debian installer sources

First we'll install d-i build dependencies.

# apt-get build-dep debian-installer

Process will take some time as there are lots of packages.

Also Subversion is needed for getting the sources of installer.

# aptitude install subversion ssh

Go to the debian-installer/installer directory and run dpkg-checkbuilddeps to find is there any more dependencies need to be installed.

# cd debian-installer/installer
# dpkg-checkbuilddeps
dpkg-checkbuilddeps: Unmet build dependencies: dns323-firmware-tools

Install everything from the list.

# aptitude install dns323-firmware-tools

Creating preseed file

If you don't have serial console attached to DNS-323 you can use network-console to access installer interface. For this create file preseed.cfg with following contents in home directory (Update: looks like the logic of installer changed and these password entries have no effect.).

# Following lines to install and configure network-console:
d-i   network-console/password             password       12345
d-i   network-console/password-again       password       12345

# Locale sets language and country.
d-i debian-installer/locale string en_US

# Any hostname and domain names assigned from dhcp take precedence over
# values set here. However, setting the values still prevents the questions
# from being shown, even if values come from dhcp.
d-i netcfg/get_hostname string dns323
d-i netcfg/get_domain string unassigned-domain

For this to work you need working DHCP server in your network.

With your favorite editor (I think the only one available will be Vim) open file debian-installer/installer/build/config/armel/orion5x/netboot.cfg and add a string PRESEED = /root/preseed.cfg to the top of the file.

Building installer

Change current dir to debian-installer/installer/build/ and issue a following command.

# make build_orion5x_netboot

This will take some time. After build scripts finish their work you'll have binary installer image called netboot.img available in debian-installer/installer/build/dest/orion5x/netboot/d-link/dns-323/ directory (or in the debian-installer/installer/build/dest/orion5x/netboot/conceptronic/ch3snas/ if you're building for Conceptronic CH3SNAS).

Installing Debian on device

Flash the image through standard Web-interface and reboot device.

If you have serial console hooked up you'll see network detection messages and then a window with suggestion to run command ssh installer@<assigned_ip_address> on your workstation.

You can do that or just push Continue button to access installer interface through serial console.

If you don't have serial console just wait a couple of minutes and then run command ssh installer@<assigned_ip_address> on your workstation.

The password to access installer interface was defined in the file preseed.cfg earlier. (Update: current installer code sets the word "install" as a password to network console.)

After that install process is straightforward.

Published: 2009, March 10
Leschinsky Oleg