• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

DBOX2 Network Linux boot..

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#1
[I got this working - see other posts in this thread]

I use Linux and IFA crashes on my wine. I figured since all the tools are already there, i'll try to boot/flash the dbox from Linux directly. Afterall digging around IFA I see it uses Cygwin.. and most of the tools originate from *NIX...

Anyway...

Many hours later ...


It boots using u-boot 1.2.0 and a nice 'Booting Linux' logo appears on the telly...

Almost there but it wont mount the remote partition.

My linux box reports
mountd[3924]: bad path in mount request from 192.168.168.206: "u-boot/yaddroot/
I'm using the RARPD+DHCPD/BOOTP+TFTP method outlined
http://www.dietmar-h.net/linux_en.html
and
http://www.lug-kr.de/wiki/DBoxLinux [just look at quoted bits if your German's like mine]

I've got latest yadd from http://remote-admin.de/ [ yadd_Head_20.März_2007-1517.tar.bz2]

It must be the dhcp file that tells it where to mount the yaddroot (via option root-path)..
Here is mine
ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;

subnet 192.168.168.0 netmask 255.255.255.0 {
}

host dbox {

#-------
#range dynamic-bootp 192.168.168.5 192.168.168.10;
#-- OR
fixed-address 192.168.168.206;
hardware ethernet 00:50:9C:XX:XX:XX;
#--------


allow bootp;
server-name "192.168.168.203";
if exists vendor-class-identifier {
filename "kernel-yadd";
option root-path "/home/ydrol/dbox2/linux/yadd/yaddroot";
} else {
filename "u-boot";
}
option domain-name-servers 192.168.168.1; #optional
option routers 192.168.168.1;
}
Everything seems to go fine right up to the mount, then it goes pear shaped :(
So I've got past all the BOOTP/TFTP shenanigans.

Any ideas?
I'm gonna try to shorten my root path and report back...

I'm also checing the traffic with wireshark and the 'u-boot/yaddroot' path is coming over the wire from the dbox.
 
Last edited:

Devilfish

DW Regular
Joined
Oct 22, 2005
Messages
14,269
Likes
194
#2
Sorry...but what exactly are you trying to do?

I fear you may be trying to do things that are way over my head but I thought I'd ask anyway ;)
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#3
Sorry...but what exactly are you trying to do?
I'm trying to boot the dbox into a mini-linux filesystem thats sitting on my PC.
ie as if the dbox had no internal storage. This is what IFA does in the background, but it hides the details from the user.

From there I can use the fcp command to flash images..

This would also allow me to try out images without having to re-flash the box. (so my settings are restored next power cycle)

I know I can flash images using the FTP method, but I want to be able to do it from a 'KEINE SYSTEM' or whatever.. just like IFA (but I dont run Windows and IFA doesnt run on my version of wine)
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#5
I
I'm using the RARPD+DHCPD/BOOTP+TFTP method outlined
http://www.dietmar-h.net/linux_en.html
and
http://www.lug-kr.de/wiki/DBoxLinux

I'm gonna try to shorten my root path and report back...
Ok it looks like the dhcpd.conf config is not right for the latest version of u-boot/yadd.

Doing a strings in u-boot gives
bootcmd=setenv bootargs console=$(console) root=/dev/nfs rw nfsroot=$(serverip):$(rootpath)/yaddroot/ ip=$(ipaddr):$(serverip):$(gatewayip):$(netmask):$(hostname)::eek:ff; tftp "kernel-yadd"; protect off 10020000 107fffff; bootm
ie mount the remote file system at $(serverip):$(rootpath)/yaddroot/
and then get the kernel-yadd file.
For some reason the rootpath is stuck at 'u-boot' and not picking up the dhcpd options.
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#6
ie mount the remote file system at $(serverip):$(rootpath)/yaddroot/
and then get the kernel-yadd file.
For some reason the rootpath is stuck at 'u-boot' and not picking up the dhcpd options.
Blimey, I got there in the end but I had to hack it. I'm pretty sure I'm doing something wrong, as I should have to do what I did! but I just got a binary editor and changed u-boot to mount the corrent export :) Now at least I have a rough'n' ready way to flash a KIENE SYSTEM, but I think there was something in my dhcpd.conf that u-boot didnt like.
u-boot was completely ignoring my root-path setting, and also there was no vendor-string being set as expected by the example dhcpd.confs on various web pages. But the subnet-mask was present at the 2nd BOOTP request, so I used that in the test instead.
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#8
Good to hear you achieved your goal! Don't think anyone's done it that way before. :)
Cheers, I think I know where the problem lies. The TFTP server I have seems work either will absolute paths or relative ones but not both. But uboot uses relative path to get the logos and absoluate path to get the main boot file and kernel.

I'll call it a night (whats left of it) !!
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#9
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:DBOX: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:

sudo exportfs -a
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 :pORTMAP V2 GETPORT CALL NFS
linux :reply
dbox :pORTMAP V2 GETPORT CALL MOUNT
linux :reply
dbox: :MOUNT /ROOT/yaddroot/
linux :reply

Then squillions of NFS packets..
Ydrol
 
Last edited:

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#10
Still working on a dynamic version. (ie not using rarpd and /etc/ethers.

I can assign IP address, and the u-boot transfers but then tftp fails when it tries to get more files.
Weird..

Heres dhcpd file so far
ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client true;

allow bootp;
subnet 192.168.168.0 netmask 255.255.255.0 {
range 192.168.168.225 192.168.168.226;
range dynamic-bootp 192.168.168.222 192.168.168.222;
boot-unknown-clients true;
server-name "192.168.168.203";
option root-path "/dbox2/yaddroot";
filename "/dbox2/tftpboot/u-boot";
option domain-name-servers 192.168.168.1; #optional
option routers 192.168.168.1;
}
Also the 'allow dynamic bootp clients' is not recognized?
 

Devilfish

DW Regular
Joined
Oct 22, 2005
Messages
14,269
Likes
194
#11
I don't think these posts should be in New To Cable but in the DBOX section but I know you can't access that yet so when you can, I'll move them. :)
 

ydrol

Inactive User
Joined
Jan 26, 2007
Messages
47
Likes
0
#14
Re Dynamic address boot -

Thanks to that last guide, I found some missing info that allowed the dynamic boot to work.
The 'next-server' keyword.
But because DNS is not updated you should keep the range very small - 1 to 3 hosts etc. This allows you to boot without putting MACs in dhcpd.conf.


So here is my dhcpd.conf...
Replace 192.168.168.203 with your Linux box IP
Replace 192.168.168.250 with your DBOX IP

ddns-update-style none;
ddns-updates off;
option T150 code 150 = string;
deny client-updates;
one-lease-per-client false;

# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# uncomment these lines for dynamic Boot
#
#subnet 192.168.168.0 netmask 255.255.255.0 {
#
# option domain-name-servers 192.168.168.1; #optional
# option routers 192.168.168.1; #optional
#
# #range 192.168.168.250 192.168.168.252;
# range dynamic-bootp 192.168.168.250 192.168.168.252;
# dynamic-bootp-lease-length 86400;
# boot-unknown-clients true;
# allow bootp;
# server-name "192.168.168.203";
# next-server 192.168.168.203;
# option root-path "/dbox2/yaddroot";
# filename "/dbox2/tftpboot/u-boot";
#}
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
# %%% OR uncomment these lines for fixed IP address boot.
#
subnet 192.168.168.0 netmask 255.255.255.0 {
option domain-name-servers 192.168.168.1; #optional
option routers 192.168.168.1; #optional
}
host dbox {
fixed-address 192.168.168.250;
hardware ethernet 00:50:9C:1A:F4:6F;
allow bootp;
server-name "192.168.168.203";
next-server 192.168.168.203;
option root-path "/dbox2/yaddroot";
filename "/dbox2/tftpboot/u-boot";
}
# %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
There's no need to run rarpd nor edit /etc/ethers
I just have to go over this once more and I'll re-post in the DBOX forum - at last :):)