OpenWrt Forum Archive

Topic: Kamikaze WGT634U USB BOOT / ROOT

The content of this topic has been archived on 16 Nov 2014. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi there,
I just wanted to ask the question,
how to get Openwrt to use my Usb Stick as Root and Boot Medium.

The Usb is 128 Mb big, so plenty of space for many things
(compared to the 8 mb of the wgt634u XD), and is directly connected
it is formated with ext3.

How to get my WGT634U booting from there?

I know there is a how to in the OpenWrt Wiki,
but it is kind of hard to understand,
because of the need to fit somethings there,
and before I do something wrong,
I just wanted some one if he could maybe explain me,
how to do it right.

(the usb stick has only one main partition, so its not parted ^^)

If I'm right, I first need the usb package of openwrt from our beloved yasha.

So, and then? ^^

DeusExMachina

On a seperate OS partition your usb stick the way you want it.  With only 128 MB you probably want to use the entire stick as one partition although you might want to consider a swap partition if you're going to be using your unit for anything memory intensive (like ctorrent in my case), and then follow the directions in the wgt634u section.  The key steps are:

1. Create a textfile called linuxrc in the root directory with the script i provided in the wgt634u section.
2. Modify this script accordingly to reflect the partitions on your flash stick ... in particular to these three lines:

boot_dev="/dev/discs/disc0/part1"
swap_dev="/dev/discs/disc0/part2"
usb_dev="/dev/discs/disc0/part3"

Since you're likely going to use just one partition you can remove all references in the script that refer to part2 and part3 (swap_dev and usb_dev respectively).

3. Create a /usb directory in the root directory.
4. Add this line to /etc/init.d/S99done:
[ -f /linuxrc ] && . /linuxrc
5. Reboot & Enjoy


Oh, and of course make sure that you've got the proper modules respective to the filesystem type you choose.  i believe that yasha has these compiled into the usb images but just in case test out your stick by trying to mount it before following the above instructions. e.g:

$ mount -t fstype /dev/discs/disc0/part1 /mnt

with fstype obviously the fstype you're using, in your case ext3 and see if it allows you to mount the first partition in your stick (assuming you did not make your first partition swap) and if works then great, you can reboot after step 5.  If not, find the kmod ipkg in yasha's repo and install it, then try again the mount command.

(Last edited by Ydef on 20 Mar 2006, 22:19)

Be careful wgt634u is not supported and especially not when booting from anything else but the firmware.
In some situations IT WILL KILL your WGT. (CFE WILL BE ALTERED)
the problem is known, i'm not sure the developpers know exactly what's wrong.
If by misfortune you encounter this problem, it would be very nice to keep the logs.
The developpers would able then to gather more information about this critical problem.

This process is supported because it's not actually booting from the usb image but chroot's to it after booting from flash.

Ydef wrote:

This process is supported because it's not actually booting from the usb image but chroot's to it after booting from flash.

Yep,
thought the same way,
thats the magic XD.

And also, OpenWGT uses same technic...
^^

Ok will try this, when I got time! ^^

Thanks
DeusExMachina

The solution presented above works reasonably well (up to and including 3535, 3553 and 3554) but requires a jffs filesystem still exist to hold all the init and configuration data.

On Flyashi's Kamikaze wiki ( http://openwrt.pbwiki.com/WGT634U_USB_root ), I present an alternative method that boots the kernel from flash, loads USB device modules and filesystem modules from a squashfs on flash, searches for acceptable USB device partitions, determines the filesystem's type, runs a filesystem check and them mounts the new filesystem. Then, a pivot_root is performed making the usb device / and the squashfs /rom .  In this appraoch no jffs filesystem is ever mounted and all of the init scritps (post /etc/preinit) and the init binary itself are loaded from the USB device. I also describe a way of cleanly shutting down the system by unmounting filesystems and remounting root read-only before /sbin/halt is called by init.

- dacb

The discussion might have continued from here.