How to boot/flash a 'keine system' DBOX2 from linux - static IP version
First , if you have network connectivity, use the Web Interface or FTP/Remote method. It's much easier!
However benefits of using a network boot are
1) Ability to boot/flash a DBOX that has been badly flashed and has no network connectivity (using Linux tools instead of IFA).
2) Ability to boot an image without having to flash at all (useful for development, you can make changes
to files on your Linux box and test them without re-flashing. You can also have more diskspace to play with)
This is based on the guides at
http://www.dietmar-h.net/linux_en.html
and
http://www.lug-kr.de/wiki/DBoxLinux.
http://www.bengt-martensson.de/dbox2/dboxserver.html
This looks like a lot of work but you only have to set it all up once. After than just start you dhcp server (disable any others or use Xover cable), and away you go..
But first we have to set it all up...
I use Mandriva so Debian/Ubuntu people should replace 'urpmi' with 'apt-get' or whatever...
DISCLAIMER
If you break your dbox2 doing this, I'm not responsible , try again or try ebay
NETWORK CONFIG
Either get a cross-over cable OR disable all DHCP servers in routers/hubs etc. Remember to re-enable servers when you've finished.
[It's easy to forget to switch back on your router dhcp!]
NETWORK PACKAGES
Get the following packages:
dhcp-server - ISC DHCP is a BOOTP capable dhcp server (I dont think udhcpd does BOOTP)
atftp - TFTP Server - This allows full and relative paths at the same time - unlike the default mandriva tftpd.
nfs-utils - NFS Daemons so the DBOX can mount yout remote filesystem,
So urpmi dhcp-server atftp-server atftp nfs-utils
Also you'll find it useful to get 'wireshark' (aka etherreal - a Network Sniffer) for troubleshooting.
Ensure dhcpd is NOT set to start at boot in MCC->services, otherwise whenever you reboot your Linux box it may conflict with other DHCP servers in your routers etc.
[ If your linux dox doubles as your dhcp server you may have to create an alternate dhcpd.conf file or something, as you dont want your DBox network booting whenever it is switched on at the mains, do you? ]
YADD LINUX
Get latest YADD from
http://dboxupdate.info/yadd/?C=M;O=D
and unpack to some path we'll call /ROOT from now on. Replace /ROOT with this path when
you see it.
cd /ROOT
chmod -R 777 tftboot
chown -R nobody:nobody tftpboot [not sure if this is needed]
chmod -R 777 yaddboot
TFTP SETUP
The tftp server must support both absolute and relative path names.
I didn't have any joy with the standard tftpd but the atftp server ('a' for advanced) worked fine.
By default Mandriva does not set this to start via xinet.d (which is good for our temporary needs)
However it doest really matter if it starts at boot, as long as your dhcp server doesnt.
I start it as follows:
sudo /usr/sbin/atftpd --daemon /ROOT/tftpboot
Dont add a trailing slash to that path!
Test both absolute and relative paths: (You only need to do this once)
$ atftp localhost 69
tftp> get u-boot
tftp> get /ROOT/tftpboot/u-boot
Overwite local file [y/n]? y
tftp> quit
DHCP SETUP
The DHCP server must support bootp. I dont think udhcpd does, but the ISC dhcp server did.
Mandriva does install this as start at boot, so disable that now if you dont
use it normally (via mcc->services on Mandriva). Then configure
/etc/dhcpd.conf as follows (the guides on the net are a bit out of date here -
many hours sleep lost ! )
For a Dynamic Boot have a dhcpd.conf as follows:
ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;
subnet YOUR.NETWORK.HERE.0 netmask YOUR.SUBNET.HERE.0 {
option domain-name-servers YOUR.DNS.HERE; #optional
option routers YOUR.GATEWAY.ROUTER.HERE; #optional
range dynamic-bootp DBOX.START.IP.RANGE DBOX.END.IP.RANGE;
dynamic-bootp-lease-length 86400;
boot-unknown-clients true;
allow bootp;
server-name "YOUR.LINUX.IP.HERE";
next-server YOUR.LINUX.IP.HERE;
option root-path "/ROOT/yaddroot";
filename "/ROOT/tftpboot/u-boot";
}
For a Static IP - have dhcpd.conf as follows:
ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;
subnet YOUR.NETWORK.HERE.0 netmask YOUR.SUBNET.HERE.0 {
option domain-name-servers YOUR.DNS.HERE; #optional
option routers YOUR.GATEWAY.ROUTER.HERE; #optional
}
host dbox {
fixed-address YOUR.DBOX.IP.HERE;
hardware ethernet 00:YOUR
BOX:MAC:HERE;
allow bootp;
server-name "YOUR.LINUX.IP.HERE";
next-server YOUR.LINUX.IP.HERE;
option root-path "/ROOT/yaddroot";
filename "/ROOT/tftpboot/u-boot";
}
Note keep the range of the dynamic boot small. [ie the maximum different dboxes
you are likely to boot in 24 hours
] Then you can also put them in your
hosts file if you want , dbox1 , dbox2 etc.
Now restart dhcpd:
sudo /etc/init.d/dhcpd restart
EXPORTS
Export the Yadd-Linux directory, so the dbox will have permission to mount it.
EDIT /etc/exports and add
/ROOT/yaddroot *(sync,rw,no_root_squash)
Or for the security conscious, only export to dbox hosts or IPs.
Then apply the changes:
LET'S DO IT
Powercycle the dbox at the mains. You should see a newer u-boot (assuming you
have an old one flashed) then TV will show 'Loading Linux'. Once its up up can
telnet, ftp etc.
FLASHING
To flash copy the flash image to /ROOT/yaddroot/tmp
Then telnet in and the command to flash is 'fcp'
ie fcp -v flash.img /dev/mtd/PARTITIONNUMBER
You can find the partition number either by
copying 'getmtd' executable from IFA install directory into your yaddroot/tmp/ and running it
(IFA installs under wine it just doesnt run)..
OR run the command
dmesg | grep '0x.* :'
This should display something like
<5>0x00000000-0x00020000 : "BR bootloader"
<5>0x00020000-0x00040000 : "FLFS (U-Boot)"
<5>0x00040000-0x006a0000 : "root (Cramfs)"
<5>0x006a0000-0x00800000 : "var (JFFS2)"
<5>0x00020000-0x00800000 : "Flash without bootloader"
<5>0x00000000-0x00800000 : "Complete Flash"
I assume, the first row is partition 0, next is 1 and so on. We want the number of 'Flash without bootloader'
which in my case is 4..
And that is what IFA does
To windows users this might seem complicated, but this is what IFA is doing under the hood. The chap that wrote IFA,
bundled TFTP and BOOTP and NFS servers in a nice GUI, suitably configured to boot your dbox.
Linux has enterprise strength versions of these tools, that are generic and can do a lot more than boot dboxs, however,
you need to apply the right configuration to do it.
FINISHED
Once you are done, remember to stop your dhcp server and re-enable your router server. (or remove the cross-over etc.)
Once the configuration is done, you dont need to go through it again, simply toggle your dhcp servers, start your TFTP server
and power-cycle your dbox.
TROUBLESHOOTING
If things go wrong, check you logs. I didnt use a null modem, (probably essential for hardware errors), but I had
wireshark running. Wireshark (formerly ethereal ) is a network sniffer. Set it to capture
capture IP traffic. Especially filter for BOOTP and TFTP messages. (It has to run as root)
A good boot has the following traffic: [Filter=bootp tftp mount]
Source Packet
dbox :BOOTP Request
linux :BOOTP Reply (includes Boot file name: /ROOT/tftpboot/u-boot )
dbox :FTP Read Request (Source File: /ROOT/tftpboot/u-boot ) then approx 275 packets TFTP transfer)
dbox :BOOTP Request
linux :BOOTP Reply (includes Boot file name: /ROOT/tftpboot/u-boot )
dbox :TFTP Read Request (Source File: logo-lcd ) then ~16 packets TFTP transfer.
dbox :BOOTP Request
linux :BOOTP Reply (includes Boot file name: /ROOT/tftpboot/u-boot )
dbox :TFTP Read Request (Source File: logo-fb ) then ~139 packets TFTP transfer.
dbox :TFTP Read Request (Source File: kernel-yadd ) then ~1609 packets TFTP transfer.
dbox
ORTMAP V2 GETPORT CALL NFS
linux :reply
dbox
ORTMAP V2 GETPORT CALL MOUNT
linux :reply
dbox: :MOUNT /ROOT/yaddroot/
linux :reply
Then squillions of NFS packets..
Ydrol