Dreambox Ethernet boot and NFS root mount howto

Dreambox Ethernet boot and NFS root mount howto ?
Guide by Scarto


1. Why?

2. What's needed?

3. Setting it all up.
3.1 DHCP
3.2 TFTP
3.3 NFS

4. "Doing it!"
4.1 Extracting the image
4.2 Retrieve and unpack the tools
4.3 Unpack the Dreambox image with undreamboxfs
4.4 Preparing the Dreambox file system root

5. Booting the Dreambox over Ethernet
5.1 Dreambox boot menu.
5.2 Connecting to the Dreambox via nullmodem and booting over Ethernet
5.3 Saving your flash...

This HOWTO describes how to boot a Dreambox over Ethernet. It is written
for users using GNU/Linux as OS. I will be describing how to set up DHCP,TFTP and NFS on Debian GNU/Linux (http://www.debian.org)

Sorry M$ guys, i cant help you, your doomed...

1. Why?
A little while ago I fucked up my d500s by uploading a corrupt image via manual/ftp upload. No kernel booted.. No DreamUp worked.. I thought I had "bickified" it..

After surfing the web for a solution I discovered a site that had information on
how to become a Dreambox developer. On this site I saw a post mentioning how to
boot the Dreambox over ethernet for development purposes like image testing and
so on. I thought "thank you, I'll try that!" As im a network technician i am
fairly familiar with the consept og booting stuff over Ethernet.

2. What's needed?
Well, booting stuff over network has been doen for quite a while. its a well
tested solution for a lot of things f.exs: Routers/switches, thin clients,
terminals and so on.

To do this you need a cuple of things;
1. A DHCP server (http://en.wikipedia.org/wiki/DHCP) with configurabel
DHCP extensions 66 (tftp server) and 67 (boot file)

2. A NFS server (http://en.wikipedia.org/wiki/Network_File_System) for
storing the file system.

3. A TFTP server (http://en.wikipedia.org/wiki/TFTP) for the Dreambox to
fetch bootimage.

4. A null modem cable, the same cable as used for DreamUP.

5. A Dreambox

You also need a couple of tools for extracting Dreambox images, and fair
linux/network skillz.

You also need a Linux kernel with squashfs module or support for squashfs
compiled in. Go to: http://squashfs.sourceforge.net/ to download
the kernel patch and info.

3. Setting it all up.
I will not be covering the kernel stuff..
You will probably need to compile a new kernel with squachfs support.
There are plenty of howtos describing kernel patching and building on
the web, use Google.

3.1 DHCP
First off, you need to install a dhcp server.
Be suer to turn off any other dhcp server in the network or else you
might run into problems.

Su to root:
code: 1:
r00ted:~# apt-get install dhcp

This command installs the dhcp server.

Then make the dhcpd.conf file to fit your network:
code:
r00ted:~# cat /etc/dhcpd.conf

# DNS server address point to your broadband
# router or an external DNS server.
option domain-name-servers 192.168.0.1;

#Global netmask option
option subnet-mask 255.255.255.0;

#lease-times, no editing needed..
default-lease-time 600;
max-lease-time 7200;

#setup for local network:
subnet 192.168.0.1 netmask 255.255.255.0 {

# Range of the net delivered by the dhcp server:
range dynamic-bootp 192.168.0.10 192.168.0.99;

# Broadcast address for the network:
option broadcast-address 192.168.0.255;

# Default gateway for the network, point to your
# broadband router or other gateway to the Internet.
option routers 192.168.0.1;
}

# Fixed address settup for the Dreambox :
host Dreambox {

# hardware ethernet 00:00:de:ad:be:ef; should
# reflect your Dreambox 's MAC address.
# The mac adress is written underneath the
# Dreambox or you can check the arp table of
# your switch/router.
hardware ethernet 00:00:de:ad:be:ef;

# The file you want to boot, in this case a
# Dreambox kernel image extracted from a
# Dreambox image.
filename "dbox-kernel.image";

# The address of your TFTP server
next-server 192.168.0.2;

# allow the client/dreambox to use bootp
allow bootp;

# Shows the Dreambox where to look for the
# root file system
option root-path "192.168.0.2:/dreamboxfs";

# give the Dreambox a fixed ip address. its easyer
# to find afterwards that way.
fixed-address 192.168.0.10;
}
r00ted:~# cat /etc/dhcpd.conf

# DNS server address point to your broadband
# router or an external DNS server.
option domain-name-servers 192.168.0.1;

#Global netmask option
option subnet-mask 255.255.255.0;

#lease-times, no editing needed..
default-lease-time 600;
max-lease-time 7200;

#setup for local network:
subnet 192.168.0.1 netmask 255.255.255.0 {

# Range of the net delivered by the dhcp server:
range dynamic-bootp 192.168.0.10 192.168.0.99;

# Broadcast address for the network:
option broadcast-address 192.168.0.255;

# Default gateway for the network, point to your
# broadband router or other gateway to the Internet.
option routers 192.168.0.1;
}

# Fixed address settup for the Dreambox :
host Dreambox {

# hardware ethernet 00:00:de:ad:be:ef; should
# reflect your Dreambox 's MAC address.
# The mac adress is written underneath the
# Dreambox or you can check the arp table of
# your switch/router.
hardware ethernet 00:00:de:ad:be:ef;

# The file you want to boot, in this case a
# Dreambox kernel image extracted from a
# Dreambox image.
filename "dbox-kernel.image";

# The address of your TFTP server
next-server 192.168.0.2;

# allow the client/dreambox to use bootp
allow bootp;

# Shows the Dreambox where to look for the
# root file system
option root-path "192.168.0.2:/dreamboxfs";

# give the Dreambox a fixed ip address. its easyer
# to find afterwards that way.
fixed-address 192.168.0.10;
}

Restart the dhcp server with:

r00ted:~# /etc/init.d/dhcp restart
Stopping DHCP server: dhcp.
Starting DHCP server: dhcpd.

If the server wont start, check your dhcp server config in /etc/dhcpd.conf
and your log files (/var/log/messages & syslog).

If everything worked out you should be able to see the bootps service by
executing:

r00ted:~# netstat -ua
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 *:bootps *:*

Moving allong..

3.2 TFTP

Install the tftp server:

#This command installs the atftpd package:
r00ted:~# apt-get install atftpd

# Edit /etc/default/atftpd to fit your needs.
r00ted:~# cat /etc/default/atftpd

USE_INETD=true
OPTIONS="--daemon --port 69 --tftpd-timeout 300 --retry-timeout 5
--mcast-port 1758 --mcast-addr 239.239.239.0-255 --mcast-ttl 1 --maxthread 100
--verbose=5 /tftpboot"

r00ted:~# mkdir /tftpboot

(OBS! the OPTIONS lien should be enterd in one line!)
The last command makes the directory in witch you want to keep the boot files.

You should now be able to se the tftp service by executing:

r00ted:~# netstat -ua
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State
udp 0 0 *:bootps *:*
udp 0 0 *:tftp *:*

3.3 NFS

Now we need to set up the nfs server for holding the root filesystem:

#The following command installs the needed nfs server.
r00ted:~# apt-get install nfs-kernel-server
#Now we must edit the /etc/exports file for exporting some file system
r00ted:~# cat /etc/exports
# /etc/exports: the access control list for filesystems which may be exported
# to NFS clients. See exports(5).

# /dreamboxfs is where we will be extracting the filesystem of the
# Dreambox image. 192.168.0.10 is the Dreambox , you probably dont want others
# to be able to mount this direcroy for security reaseons...

/dreamboxfs 192.168.0.10(rw,insecure)

# restart the nfs daemon:
r00ted:~# /etc/init.d/nfs-kernel-server restart

# Check that the service started:
r00ted:~# netstat -ta | grep nfs
tcp 0 0 *:nfs *:* LISTEN

# Check that the directory is exported:
r00ted:~# showmount --exports localhost
Export list for localhost:
/dreamboxfs 192.168.0.10

Now we have the 3 main components set up.

4. "Doing it!"

Now we need to extract a Dreambox image.
I will be using a standard image, you may use whatever image you prefer..

4.1 Retrive the image:

r00ted:~# wget http://www.dream-multimedia-tv.de/dm...500_rel108.img
--20:52:26-- http://www.dream-multimedia-tv.de/dm...500_rel108.img
=> `dm500_rel108.img'
Resolving www.dream-multimedia-tv.de... 82.149.226.170
Connecting to www.dream-multimedia-tv.de|82.149.226.170|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5.939.200 (5.7M) [text/plain]

100% [====================================>]524.220 915.64K/s ETA 00:00

20:52:27 (915.64 KB/s) - `dm500_rel108.img' saved [5939200/5939200]

4.2 Retrive and unpack the tools:

# modpprobe squashfs module if not kopiled in kernel:
r00ted:~# modprobe squashfs

# get and unpack the undreamboxfs tools:
#(currently this site - is unavaliable, here is my mirror of undreamboxfs.tgz)

r00ted:~# wget http://t-hydron.verkoyen.be/uploads/...boxfs-0.01.tgz

--21:01:43-- http://t-hydron.verkoyen.be/uploads/...boxfs-0.01.tgz
=> `undreamboxfs-0.01.tgz'
Resolving t-hydron.verkoyen.be... 193.190.155.64
Connecting to t-hydron.verkoyen.be|193.190.155.64|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 26.329 (26K) [application/x-tar]

100%[====================================>] 26.329 33.63K/s

21:01:45 (33.57 KB/s) - `undreamboxfs-0.01.tgz' saved [26329/26329]

r00ted:~# tar xzf undreamboxfs-0.01.tgz
r00ted:~# cd undreamboxfs/bin/
r00ted:~/undreamboxfs/bin# ls
squashfs.o uncramfs undreamboxfs

4.3 Unpack the Dreambox image with undreamboxfs:

r00ted:~/undreamboxfs/bin# ./undreamboxfs
Simple undreamboxfs script/tool
http://t-hydron.verkoyen.be

Usage:
undreamboxfs Dreambox .img outputdir
Example:
undreamboxfs rel106.img output

r00ted:~/undreamboxfs/bin# ./undreamboxfs ~/dm500_rel108.img /dreamboxfs
512+0 records in
512+0 records out
512 bytes transferred in 0,002924 seconds (175100 bytes/sec)
9295+0 records in
9295+0 records out
4759040 bytes transferred in 0,083909 seconds (56716697 bytes/sec)
Done!
r00ted:~/undreamboxfs/bin# cd
r00ted:~#ls
dm500_rel108.img Dreambox fs undreamboxfs undreamboxfs-0.01.tgz

You now have a Dreambox file system extracted to your home folder.
NOTE: ./undreamboxfs ~/dm500_rel108.img /dreamboxfs, this command extracts the Dreambox image to the root of your file system. /dreambox fs is exported via nfs in /etc/exports.

We now need to copy the kernel to the tftp server:
code: 1:
2:
3:
r00ted:~# cp /dreamboxfs/root/platform/kernel/os /tftpboot/dbox-kernel.image
r00ted:~# ls -l /tftpboot/dbox-kernel.image
-rw-r--r-- 1 root root 1046048 2006-03-28 21:16 /tftpboot/dbox-kernel.image

NOTE: the filename "dbox-kernel.image", this is the same filename as defined in
/etc/dhcpd.conf. This is the kernel the Dreambox uses to boot.

4.4 Preparing the Dreambox filesystem root:

code: 1:
2:
3:
r00ted:~# cd /dreamboxfs/
r00ted:/dreamboxfs# ls
bin dev etc hdd lib mnt proc root sbin share tmp var var_init

Looks familiar?
NOTE: /dreamboxfs is the same path as entered for root-path in /etc/dhcpd.conf and the same path as exported in /etc/exports.
NOTE: There will be broken symlinks in the path /dreambox. this is normal! When the Dreambox boots it will see /dreambox as / and the links will be correct.

Now you have a copy of the root file system of the Dreambox to /dreamboxfs.
We are now ready to boot the Dreambox over Ethernet!

5. Booting the Dreambox over Ethernet.

When a Dreambox is booted and has no flash/hd to boot from it defaults to network boot. So in my case the Dreambox booted over the network automatically.

You can invoke a Ethernet boot by halting the Dreambox 's normal boot by pressing enter as soon as you have power sycle the box. This is convenient when trying out new images or just for testing.

5.1 Terminal tools:

Using Linux as my main os I use a program called "minicom" to speak to switches and routers. The same program can be used to talk to the Dreambox over a serial line.

Installing and executing minicom:

# getting and installing the cu package
r00ted:/dreamboxfs# apt-get install minicom

#connecting minicom to a serial port
r00ted:/dreamboxfs# minicom -s

Edit the settings in "Serial port setup"
change the baud rate to 115200 and set the appropriate serial port.
Save the setup as dfl.

Execute minicom:

r00ted:/dreamboxfs# minicom

Welcome to minicom 2.1

OPTIONS: History Buffer, F-key Macros, Search History Buffer, I18n
Compiled on Nov 4 2005, 18:10:30.

Press CTRL-A Z for help on special keys

5.2 Connecting to the Dreambox via serialport and booting over ethernet

Connect the nullmodem cable to the comport you configured in minicom and then connect it to the rs232 interface of the Dreambox .
Plug the power into the Dreambox and pres enter a few times when you se this:
code: 1:
Dreambox DM500

You will get the boot menu:

Dreambox DM500 - Bootloader V.1.01 - 04.06.2004

------- System Info --------
Processor speed = 252 MHz
EBIU speed = 63 MHz
Amount of RAM = 48 MBytes
Unable to read configuration data

--- Device Configuration ---
Power-On Test Devices:
000 Enabled System Memory [RAM]
----------------------------
Boot Sources:
001 Enabled Application in Flash [FLASH]
002 Enabled Ethernet [ENET]
local=0.0.0.0 remote=255.255.255.255 hwaddr=0000deadbeef
003 Disabled Serial Port 1 [S1]
Baud = 9600
----------------------------
Automatic Boot: Enabled
----------------------------
1 - Toggle Power-On Tests
2 - Change a Boot Device
3 - Change IP Addresses
4 - Ping test
5 - Change Baud Rate for S1 Boot
D - Display Configuration
0 - Exit Menu and Boot Application
->2

Enter 2 to change boot device.

==== ENABLE A BOOT DEVICE ====
Boot Sources:
001 Enabled Application in Flash [FLASH]
002 Enabled Ethernet [ENET]
local=0.0.0.0 remote=255.255.255.255 hwaddr=0000deadbeef
003 Disabled Serial Port 1 [S1]
Baud = 9600
----------------------------
select device to enable (Enter to return to main menu)->002

Enter "002" to enable Ethernet boot:

[ENET] boot is enabled

--- Device Configuration ---
Power-On Test Devices:
000 Enabled System Memory [RAM]
----------------------------
Boot Sources:
001 Disabled Application in Flash [FLASH]
002 Enabled Ethernet [ENET]
local=0.0.0.0 remote=255.255.255.255 hwaddr=0000deadbeef
003 Disabled Serial Port 1 [S1]
Baud = 9600
----------------------------
Automatic Boot: Enabled
----------------------------
1 - Toggle Power-On Tests
2 - Change a Boot Device
3 - Change IP Addresses
4 - Ping test
5 - Change Baud Rate for S1 Boot
D - Display Configuration
0 - Exit Menu and Boot Application
->0

NOTE: 002 Enabled Ethernet [ENET]

Enter "0" to boot:

Installed RAM: 48 MB

System RAM check complete
Booting from [ENET] Ethernet...
Sending bootp request ...

Got bootp response from : 192.168.0.2
My ip address is : 192.168.0.10

Loading file "dbox-kernel.image" by TFTP for net boot ...
Transfer completed, 1046048 bytes received
Loaded successfully ...
Entry point at 0x500000 ...

loaded at: 00500000 0060016C
relocated to: 00400000 0050016C
board data at: 004FE124 004FE16C
relocated to: 00405194 004051DC
zimage at: 004058D1 004FD660
avail ram: 00501000 02000000

Linux/PPC load: console=null root=/dev/mtdblock5 rootfstype=squashfs ro

NOTE: You MUST edit the boot options! Be quick, the timeout of teh boot loader is short, just a couple of seconds.

Edit the boot string to this (OBS! use backspace, cursor keys do not wok, even if they aper to):

Linux/PPC load: console=ttyS0,115200 root=192.168.0.2:/dreamboxfs rw ip=dhcp

Boot the Dreambox by pressing enter.

You will now see lots of stuff roiling over the terminal
This is your Dreambox booting!

After a while you should be able to login to the Dreambox via telnet,ftp and web.

5.3Saving your flash...

If you did as I did, uploaded a corrupt image, you can now erase the flash and upload a new image to the Dreambox .

r00ted:/dreamboxfs# telnet 192.168.0.10
Trying 192.168.0.10...
Connected to 192.168.0.10.
Escape character is '^]'.

welcome on your Dreambox ! - Kernel 2.6.9 (01:05:59).
dreambox login: root
Password:

BusyBox v1.00 (2005.08.05-13:28+0000) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ >eraseall

The eraseall command does the trick.

Now you should be able to upload a new image via ftp.
Please use images that are verified.. It saves you a lot of trouble..

Via dream-zone.dk