[<<][pool][>>][..]
Sun Feb 8 11:04:54 CET 2009

Boot script

Dirname and chroot are not available, so i had deviced a little trick
to boot it by adding a directory with a ".d" suffix.  It might be
possible to use basename from the boot/busybox but this seems simpler.



  # Trampoline to boot the debian system in a chrooted environment.
  # This can be run with Fritz' busybox that doesn't have chroot nor dirname.

  # cd to root directory
  cd $0.d/../..

  echo Starting debian in `pwd`

  # use a different busybox to execute the chroot command.
  exec `pwd`/boot/busybox chroot `pwd` /boot/rc.d/rcS


Now what's needed is a plug into the flash filesystem.  The complete
sequence of commands is:

 modprobe ext2
 mkdir /var/debian
 mount /dev/sda1 /var/debian
 /var/debian/boot/init

To unload:

 /var/debian/boot/chroot /var/debian /boot/shutdown
 umount /var/debian


So, let's add this to /var/flash/debug.cfg

  modprobe ext2
  mkdir /var/debian
  mount /dev/sda1 /var/debian
  /var/debian/boot/init
  echo '/var/debian/boot/chroot /var/debian /boot/shutdown ; umount  /var/debian' >>/var/post_install


This doesn't seem to work on boot.  My guess is that usb isn't active
yet, and the drive is not recognized.  There's no way to sync on this,
so we need to wait a bit.  In /etc/rc.S it can be seen the debug.cfg
is the last script to run (/usr/bin/ethnator doesn't exist).



  modprobe ext2
  mkdir /var/debian
  if ! mount /dev/sda1 /var/debian; then sleep 10; mount /dev/sda1 /var/debian; fi
  /var/debian/boot/init && \
  echo '/var/debian/boot/chroot /var/debian /boot/shutdown ; umount  /var/debian' >>/var/post_install


Hm... Doesn't work either..
Maybe we should just spawn a daemon that waits


modprobe ext2 sd_mod usb-storage
mkdir /var/debian

cat <<EOF >>/var/post_install
/var/debian/boot/chroot /var/debian /boot/shutdown
umount /var/debian
EOF

cat <<EOF >/var/mount-debian
while ! mount /dev/sda1 /var/debian; do sleep 3; done
exec /var/debian/boot/init
EOF
chmod +x /var/mount-debian

/var/mount-debian &


Hmmm.. Device is not recognized if it's left in the box.


# lsmod
Module                  Size  Used by    Tainted: P
ext2                   59392  0
mbcache                 8080  1 ext2
usblp                  11936  1
kdsldmod              630416  2
usbahcicore            26064  0
usbcore               113328  4 usblp,usbahcicore
isdn_fbox_fon4        933840  0
ubik2                  78608  1 isdn_fbox_fon4
tiatm                 109008  1 ubik2
Piglet                 10560  0


After plugging in these modules are loaded extra:

vfat                   11392  0
fat                    49072  1 vfat
nls_cp437               5248  0
nls_iso8859_1           3584  0
sd_mod                 14864  0
usb_storage            33296  0
scsi_mod               92560  2 sd_mod,usb_storage

modprobe usb-storage sd_mod
I've added these to the startup script..

Then I run into more interesting problems:

Warning: Reading the random source seems to have blocked.
If you experience problems, you probably need to find a better entropy source.

Will try with reboot now.


I can't get it to work.. Something is not initialized correctly: the
partion can be read (cat /dev/sda1) but it doesn't want to mount it:

# mount /dev/sda1 /var/debian
mount: Mounting /dev/sda1 on /var/debian failed: Invalid argument

I'm thinking about giving up: one more try: wait 15 seconds after
loading the modules..

Wtf now it mounts..
ext2 wasn't loaded.  Maybe it gets unloaded somewhere?
No, modprobe takes only one module argument.

I don't know what's going wrong..  Will try now with a script that
waits for 5 minutes to try to mount the stick.  Entering complete
dispair mood..

New script:

cat <<EOF >>/var/post_install
/var/debian/boot/chroot /var/debian /boot/shutdown
umount /var/debian
EOF

cat <<EOF >/var/mount-debian
sleep 300
modprobe usb-storage
modprobe sd_mod
modprobe ext2
mkdir /var/debian
while ! mount /dev/sda1 /var/debian; do
      sleep 10;
done
exec /var/debian/boot/init
EOF

chmod +x /var/mount-debian
/var/mount-debian &



Nope... Doesn't work either.  I'm going to give up, this is too much
hassle.  It works when you replug the device, and I currently don't
know how to force that in software..  Anyway.. learned a couple of
things though.

Feb  8 16:23:29 eventadd[1352]: EVENT(131): USB device 005, class 'storage', plugged in
Feb  8 16:23:38 eventadd[1546]: EVENT(142): The file sytem contained on the USB mass storage device 5 is not supported or the device has an invalid partition table. (device type: 0930:6545)


So, to get things running on the fritzbox, it might be easiest to just
prepare .tar archives and download them from a server.



[Reply][About]
[<<][pool][>>][..]