beady
Inactive User
Introduction
This is the first part, and is about setting up the required server(s). A second part will follow, discussing how to actually get the filesystem from a dreambox image onto your server for booting, and then actually booting it.
First of all, you should have a bit of linux experience (or be willing to learn), and be prepared for this to take a while. It's impossible to provide a tutorial suitable for everyone, due to the different hardware and software available to each of us. So the code I show is fairly specific to my set up. Please don't expect things to work as-is on your system. It's supposed to provide examples of a working system, and show what you'll need to set up for your system. This is certainly not 'plug and play'. Good luck It's really not too hard once you understand things.
Acknowledgements
First of all, I must point out that this tutorial is heavily based on the work of other people. I got the original idea after reading an old thread by yrdel. He's talking about the dbox2, but the principles are the same. Also, have a look at this page, which discusses the dreambox, and contains some useful hints.
Dreambox Boot Process
As I understand it, the boot procedure of a dreambox has the following steps:
- Immediately after power on, a hardware bios gets control, initializes some hardware and then loads and runs whatever is contained in the bootloader partition of the flash chip.
- The bootloader code (OpenBios) runs some more initialization, then looks for a linux kernel to load. This is the first point at which we can influence the dreambox externally. If you've ever had to get a boot log through hyperterminal, you stop the boot process towards the end of the boot loader code, just before it passes control of the kernel.
There are three options available for the bootloader. By default it will look on the flash for a CramFS block containing a valid kernel. If it can't find that, it'll send out 'bootp' requests over the network interface to see if anything is going to send it a kernel, and finally, there is the option to recieve a kernel over a serial port. It's the serial port method that's used by dreamup when you reflash with a null modem cable. Once it's got a kernel, it proceeds to unpack, then trandfers control over to it.
- From here on, the bootprocess is standard linux. The kernel does things like initializing hardware, mounting the root filesystem, and starting the various high level programs that run on the dreambox like enigma or neutrino.
What we need to do for network booting is set up a system to send answers to the dreambox's bootp requests.
What you need
Hardware:
You need a linux based machine to run the various servers, and also somewhere to store the kernel(s) and root filesystem(s). In my case, I've got a Linksys WRT54GS which acts as my main router, and which runs dnsmasq (see below), and an Asus WL-500g router with a 256mb usb stick attached to act as both the file server for the dreambox, and a wireless bridge to the rest of the network. Both routers are running OpenWRT
Software:
- A BOOTP server to reply to the OpenBIOS requests.
- A DHCP server sending out ip addresses to the local LAN. On most home networks, this'll be your router.
- A TFTP server to supply the kernel to the dreambox. TFTP is the protocol that OpenBIOS uses to download the kernel.
- An NFS server which exports the remote filesystem to the dreambox. For those that don't know, NFS can be thought of as the equivalent of a 'Shared Folder' in windows.
While technically you need all the above, many programs support more than one function. For instance, the dnsmasq program commonly used in embedded routers can act as both a DHCP, BOOTP and TFTP server (as well as being a DNS server as well!). In the case I'll discuss in detail, I've got the following programs running:
- dnsmasq: Acting as the DHCP and BOOTP server.
- atftpd: A TFTP server supplying the kernel.
- nfsd and support programs: This is the standard linux nfs server.
Installation
The guide for installing the various requirements is going to be sparse, and solely based on my machines. I know that OpenWRT can be a bit scary for some, since it's command line only. I'm sure you can do exactly the same things with DD-WRT or other open source firmware, but I've never tried. Feel free to ask questions about them though.
Okay, the installation procedure for the above on an OpenWRT router is as follows:
dnsmasq is the default dhcp and dns server in OpenWRT, so it's installed already. Installing the tftp server is easy
. The xinetd above is used because I didn't want to have tftpd running all the time. So I installed xinetd (which is basically a server which starts other servers as required) as well. Since I've also got ftp and ssh servers running, both starting through xinetd, it save memory when things aren't in use. If you're just testing, don't bother with xinetd. Anyway, I digress.To install nfsd, just type
.
Configuration
dnsmasq
Here's a copy of my /etc/dnsmasq.conf configuration file:
For the most part, it's the same as the default configuration that OpenWRT installs. You can safely ignore the dhcp-script line, (since that's just my way of setting up custom port forwarding rule). The important lines for our purpose are the last three. Firstly, the 'dhcp-host=' line tells dnsmasq that I want the device with MAC address 00:09:34:25:01:41 to be called dreambox, and to always assign it an ip address of 192.168.1.105. So you should change this line to reflect you dreambox's MAC address, what you want to call it, and what i.p. you want it to get.
The dhcp-boot line tells dnsmasq about the kernel we're going to supply via TFTP.'net:dreambox' identifies which device we're talking about (you can send different kernels to different devices by defining more lines like this).Next, 'root/platform/kernel/os' defines the path to the kernel on the tftp server, while 'asus,192.168.1.137' identifies the name and address of the tftp server.
The last line, 'dhcp-option=' is a little confusing, but it basically identifies an extra option (in this case number 17), detailing what to send the client for the mount line for the nfs server. You want to replace the '192.168.1.137:/mnt/storage/.....' with the ip and path of the nfs mount. The nolock after the comma is the options to the mount command. I recommend using nolock, since some nfs clients and servers will take a VERY long time to mount without it.
Configuring the nfs server is easy, simply select a directory to share and add it to your /etc/exports file. Mine only has one line
/mnt/storage/dreambox is the path to my usb mounted storage directory I want to share, * shows I want to share it with everyone (bad idea in a insecure environment, but not really a problem at a home LAN, provided you've got a firewall), and the last bit specifies mount options. rw for read/write support, while sync slows things down a bit but makes things a bit safer, and no_root_squash allows root clients to have root status on the server. This is needed for exported clients.
Finally, configuring atftpd is different depending on whether you're using xinetd. If not, you can simply type 'aftfpd --daemon --port 69 <path to kernel storage area>'. This'll kick off atftpd in daemon mode (i.e. in the background) and start accepting requests (for some reason this only works properly if you specify port 69. Go figure?).
Okay, now I think we need a specific example to test atftpd with. The following session shows a successful test. First I create a directory, populate it with a file, then start up the tftp server. Then, from another machine, I grab that file via tftp.
On the server:
Now to test it,
If you want it to start at boot, create a file in /etc/rc.d that looks like:
Don't forget to chmod +x it so it's executable.
I won't go into how to get xinetd to start atftpd. You can find the info on various places on the web, and I don't think may will use it anyway.
Closing remarks
I think that's about enough for now. I'd like to make sure at least one person trying this can get this far before specifying how to add the required dreambox files (in fact I've written a script for stripping an image file, so it's dead easy).
Good luck everyone. Please add comments and questions. I'm sure there'll be loads .
This is the first part, and is about setting up the required server(s). A second part will follow, discussing how to actually get the filesystem from a dreambox image onto your server for booting, and then actually booting it.
First of all, you should have a bit of linux experience (or be willing to learn), and be prepared for this to take a while. It's impossible to provide a tutorial suitable for everyone, due to the different hardware and software available to each of us. So the code I show is fairly specific to my set up. Please don't expect things to work as-is on your system. It's supposed to provide examples of a working system, and show what you'll need to set up for your system. This is certainly not 'plug and play'. Good luck It's really not too hard once you understand things.
Acknowledgements
First of all, I must point out that this tutorial is heavily based on the work of other people. I got the original idea after reading an old thread by yrdel. He's talking about the dbox2, but the principles are the same. Also, have a look at this page, which discusses the dreambox, and contains some useful hints.
Dreambox Boot Process
As I understand it, the boot procedure of a dreambox has the following steps:
- Immediately after power on, a hardware bios gets control, initializes some hardware and then loads and runs whatever is contained in the bootloader partition of the flash chip.
- The bootloader code (OpenBios) runs some more initialization, then looks for a linux kernel to load. This is the first point at which we can influence the dreambox externally. If you've ever had to get a boot log through hyperterminal, you stop the boot process towards the end of the boot loader code, just before it passes control of the kernel.
There are three options available for the bootloader. By default it will look on the flash for a CramFS block containing a valid kernel. If it can't find that, it'll send out 'bootp' requests over the network interface to see if anything is going to send it a kernel, and finally, there is the option to recieve a kernel over a serial port. It's the serial port method that's used by dreamup when you reflash with a null modem cable. Once it's got a kernel, it proceeds to unpack, then trandfers control over to it.
- From here on, the bootprocess is standard linux. The kernel does things like initializing hardware, mounting the root filesystem, and starting the various high level programs that run on the dreambox like enigma or neutrino.
What we need to do for network booting is set up a system to send answers to the dreambox's bootp requests.
What you need
Hardware:
You need a linux based machine to run the various servers, and also somewhere to store the kernel(s) and root filesystem(s). In my case, I've got a Linksys WRT54GS which acts as my main router, and which runs dnsmasq (see below), and an Asus WL-500g router with a 256mb usb stick attached to act as both the file server for the dreambox, and a wireless bridge to the rest of the network. Both routers are running OpenWRT
Software:
- A BOOTP server to reply to the OpenBIOS requests.
- A DHCP server sending out ip addresses to the local LAN. On most home networks, this'll be your router.
- A TFTP server to supply the kernel to the dreambox. TFTP is the protocol that OpenBIOS uses to download the kernel.
- An NFS server which exports the remote filesystem to the dreambox. For those that don't know, NFS can be thought of as the equivalent of a 'Shared Folder' in windows.
While technically you need all the above, many programs support more than one function. For instance, the dnsmasq program commonly used in embedded routers can act as both a DHCP, BOOTP and TFTP server (as well as being a DNS server as well!). In the case I'll discuss in detail, I've got the following programs running:
- dnsmasq: Acting as the DHCP and BOOTP server.
- atftpd: A TFTP server supplying the kernel.
- nfsd and support programs: This is the standard linux nfs server.
Installation
The guide for installing the various requirements is going to be sparse, and solely based on my machines. I know that OpenWRT can be a bit scary for some, since it's command line only. I'm sure you can do exactly the same things with DD-WRT or other open source firmware, but I've never tried. Feel free to ask questions about them though.
Okay, the installation procedure for the above on an OpenWRT router is as follows:
dnsmasq is the default dhcp and dns server in OpenWRT, so it's installed already. Installing the tftp server is easy
Code:
You don't have permission to view the code content. Log in or register now.
Code:
You don't have permission to view the code content. Log in or register now.
Configuration
dnsmasq
Here's a copy of my /etc/dnsmasq.conf configuration file:
Code:
You don't have permission to view the code content. Log in or register now.
The dhcp-boot line tells dnsmasq about the kernel we're going to supply via TFTP.'net:dreambox' identifies which device we're talking about (you can send different kernels to different devices by defining more lines like this).Next, 'root/platform/kernel/os' defines the path to the kernel on the tftp server, while 'asus,192.168.1.137' identifies the name and address of the tftp server.
The last line, 'dhcp-option=' is a little confusing, but it basically identifies an extra option (in this case number 17), detailing what to send the client for the mount line for the nfs server. You want to replace the '192.168.1.137:/mnt/storage/.....' with the ip and path of the nfs mount. The nolock after the comma is the options to the mount command. I recommend using nolock, since some nfs clients and servers will take a VERY long time to mount without it.
Configuring the nfs server is easy, simply select a directory to share and add it to your /etc/exports file. Mine only has one line
Code:
You don't have permission to view the code content. Log in or register now.
Finally, configuring atftpd is different depending on whether you're using xinetd. If not, you can simply type 'aftfpd --daemon --port 69 <path to kernel storage area>'. This'll kick off atftpd in daemon mode (i.e. in the background) and start accepting requests (for some reason this only works properly if you specify port 69. Go figure?).
Okay, now I think we need a specific example to test atftpd with. The following session shows a successful test. First I create a directory, populate it with a file, then start up the tftp server. Then, from another machine, I grab that file via tftp.
On the server:
Code:
You don't have permission to view the code content. Log in or register now.
Code:
You don't have permission to view the code content. Log in or register now.
Code:
You don't have permission to view the code content. Log in or register now.
I won't go into how to get xinetd to start atftpd. You can find the info on various places on the web, and I don't think may will use it anyway.
Closing remarks
I think that's about enough for now. I'd like to make sure at least one person trying this can get this far before specifying how to add the required dreambox files (in fact I've written a script for stripping an image file, so it's dead easy).
Good luck everyone. Please add comments and questions. I'm sure there'll be loads .
Last edited by a moderator: