[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Ubiquity Routerstation Pro?



>>>>> "Tim" == Tim Nelson <tnelson@fudnet.net> writes:

> ----- Original Message -----
>> Why not just use the kernel that comes with the OpenWRT image that
>> runs on the nanostation? As long as it has FPU emulation compiled in,
>> it shouldn't be difficult to make it boot the Debian rootfs that you
>> created using debootstrap. You would have to touch the bootloader
>> config (i.e. the kernel command line) to achieve that.
>> 
>> If you can't configure the bootloade, maybe you can replace the
>> /sbin/init (or /etc/preinit?) in the OpenWRT filesystem with a shell
>> script that does
>> 
>> exec chroot /path/to/sd/card /bin/init
>> 
>> Make sure you use 'exec' so you inherit the PID of the original init
>> process.
>> 
>> Of course for full hardware support you should also compile the
>> /lib/modules directory of the OpenWRT rootfs to the debian rootfs.
>> 
>> For the Qi Nanonote booting Debian on an OpenWRT kernel works. I also
>> used similar hacks on other hardware.
>> 

> Thank you for the great ideas. I'm running into an issue with the
> Redboot boot loader not accepting the kernel command line parameters
> I'm trying to pass. Apparently, it is an issue with the OpenWRT
> kernel. Additional details here [1].

You forgot to tell us what [1] was :)

> I'm happy to try the option you mentioned about replacing /etc/preinit
> with something that performs a chroot or similar function but I'm a
> bit leary of doing so. If the script does not work, I'm unable to boot
> the old OpenWRT system or the potential debootstrapped
> system. Restoring proper boot to the board could be tricky. 

Is there a way to re-flash your openwrt system without first booting
into openwrt?  Reading [1], it looks like the openwrt has a failsafe
mode entered by pressing some switch while booting.  This failsafe mode
cleans any changes you made to the filesystem (AFAIR all changes go to a
unionfs overlay over a non-writable squashfs)

Ok, have a look at the openwrt boot sequence [2].  Maybe you shouldn't
touch /etc/preinit.  But overwriting /sbin/init should be pretty safe,
as /etc/preinit runs first, checks for failsafe mode which allows you to
revert any changes before running your hacked /sbin/init.

> Do you have an example of how you'd do the /etc/preinit replacement?
> Maybe one could have a selection of booting OpenWRT or the chroot'ed
> environment?

Try the following:  Download the Debian Mips installer image from 

http://ftp2.de.debian.org/debian/dists/squeeze/main/installer-mipsel/current/images/malta/netboot/initrd.gz

this is a cpio archive.  Extract its contents onto the second, small
ext2-formatted partition of an sd-card (the first partition later to be
used by your full debian rootfs), then put that card into your
routerstation.

Boot the routerstation and mount the sd card.  Maybe something like
'mount /dev/sda2 /mnt'.  Now try whether you can execute the Debian
installer utilities on top of openwrt:

  chroot /mnt /bin/ls

Does it work?

Well then you might try to run debootstrap (or debian-installer)
natively from /mnt.  I once wrote a documentation about using that
installation method for the mips-based Nanonote, see [3].

When you got full debian root filesystem onto /dev/sda1, test it from
within openwrt via chroot, i.e.

   mount /dev/sda1 /mnt
   chroot /mnt /bin/ls
   chroot /mnt /bin/bash

etc.  Then build your "proxy" init script:

  ---
  #! /bin/sh

  # todo: check which modules are needed for sd card to work
  modprobe ...
  mount /dev/sda1 /mnt
  exec chroot /mnt /sbin/init
  ---

Test that script first before overwriting openwrt's /sbin/init.

'init' should execute but report an error due to invalid PID.  Init
expects to be executed with pid 1 (i.e. directly after boot).  Well, now
copy it over /sbin/init and reboot.

If it doesn't work, you should be able to revert to your openwrt's
'init' by entering failsafe mode.

Well of course all of this might still brick your routerstation, so be
careful and don't blame me.  You asked :)

I'd be interested if you reported how it worked out.

Using this chroot hack I once was able to boot a full Ubuntu system from
inside IBM's Cell system simulator, which only shipped with a crippled
busybox-based ramdisk image.

cheers,

David

[1] http://wiki.openwrt.org/toh/ubiquiti/routerstation.pro
[2] http://wiki.openwrt.org/doc/techref/preinit_mount
[3] http://en.qi-hardware.com/wiki/Debian/Installer
-- 
GnuPG public key: http://user.cs.tu-berlin.de/~dvdkhlng/dk.gpg
Fingerprint: B17A DC95 D293 657B 4205  D016 7DEF 5323 C174 7D40

Attachment: pgpGPVoFXSXMs.pgp
Description: PGP signature


Reply to: