1 (edited by heruan 2009-01-30 01:58:55)

Topic: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Finally I've found how to mount USB stick at boot without patching /etc/preinit or anything else.
These the step I've followed (revision 14152):

* make menuconfig
** Target System -> Infineon/ADMtek ADM5120 [2.6]
** Target Profile -> Edimax BR-6104KP (Unofficial)
** busybox -> Configuration -> Coreutil -> stty (don't know if necessary)
** removed some packages (to fit firmware size): dnsmasq, dropbear, iptables (will be installed later with opkg)
* make kernel_menuconfig
** Machine selection -> Infineon/ADMtek ADM5120 SoC based machines
** Device drivers -> Memory Technology Device (MTD) support:
*** disable Automatically set 'rootfs' partition to be root filesystem
*** disable Automatically split 'rootfs' partition for squashfs
*** disable Automatically find and split TRX partitions
** Device drivers -> SCSI device support:
*** {*} SCSI device support
*** <*> SCSI disk support
** Device drivers -> [*] USB support:
*** <*> Support for Host-side USB
*** [*] USB device filesystem
*** <*> USB Storage support
*** <*> ADM5120 HCD support (EXPERIMENTAL)
** File systems -> <*> Ext3 journalling filsystem support
** Kernel hacking -> Default kernel command string (last setting): console=ttyS0,115200 root=/dev/sda1 init=/etc/preinit ro rootdelay=10

Then run make and wait for OpenWRT to be built. Then under bin/ you'll find:
* openwrt-adm5120-br-6104kp-squashfs-webui.bin
* openwrt-adm5120-br-6104kp-squashfs-xmodem.bin
* openwrt-adm5120-rootfs.tgz

Format a USB-stick with ext3 fs (assuming /dev/sdb1) and untar the rootfs:
# mkfs.ext3 /dev/sdb1
# mount /dev/sdb1 /mnt
# cd /mnt
# tar -xzf /path/to/openwrt/bin/openwrt-adm5120-rootfs.tgz

Then plug the usbstick and upload openwrt-adm5120-br-6104kp-squashfs-xmodem.bin to the board via xmodem (use the attached script). When upload is done, watch the board booting with minicom.

Hope this helps, I'm available for troubleshooting on this.

Attachments:
xmodem-upload:
########################################
#!/usr/bin/expect -f

set dev "/dev/ttyUSB0"
set file "openwrt-adm5120-br-6104kp-squashfs-xmodem.bin"

system "stty 115200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke < $dev"

spawn -open [ open $dev r+ ]
send_user "* Waiting for the prompt, please turn on the router\n"
expect "ADM5120 Boot:"
send_user "\n* Got prompt, waiting for the second prompt\n"
send "   "
expect "Please enter your key : "
send_user "\n* Got second prompt, uploading firmware $dev\n"
send "a"
close
system "sx -vv $file > $dev < $dev"
spawn -open [ open $dev r+ ]
expect "Please enter your key : "
send_user "\n* Got second prompt, booting\n"
send "c"
########################################

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

hi, first I got kernel panic because he didn't find /dev/sda1 (tried two usb-sticks), and with an fresh checkout of revision 14152 I couldn't do ** Machine selection -> Infineon/ADMtek ADM5120 SoC based machines any more.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Make sure you have the command `quilt' installed (on Debian/*buntu: apt-get install quilt) before make kernel_menuconfig.

4 (edited by rxgknpbo 2009-01-26 15:54:04)

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Hi,
turned out that quilt was not neccessary. I found that in make kernel_menuconfig

<*> USB Mass Storage support

is not selected by default - but needed ;-)
So thanks, it works, and could someone move this thread to howto section?

(using r14177)

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Nice!

OpenWrt on x86/alix/nslu2/rb750/rb4xx/rb1xx/angw100/wp54-6e/6104-kp/mini2440

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

It would not be too hard to change Squidge to work this way, if zero changes to /etc/preinit is a design objective.
This file:  https://squidge.svn.sourceforge.net/svnroot/squidge/mksquidge_usbroot.py

Can be altered to programatically perform the instructions in the above guide, and I've no problem if someone wants to do that.  PM me if interested.

The design objective of Squidge was to remove all traces of MTD from the kernel, to free up the maximum possible RAM for executing programs, but if that's not what people want then it can easily be changed.  I'm not really supporting it any more, so it can go any direction people want now.

I'm glad someone else is using the expect script, but with fdexpect under Python it's more flexible, because you can interact with the terminal at the end of the upload, and there's no need to launch minicom at all.  See https://squidge.svn.sourceforge.net/svnroot/squidge/adm_upload

Finally, I never got around to changing it in Squidge but rootwait, is better than rootdelay=10.  It waits, if necessary until the stick is plugged in (can't remember who told me about this).

rgds,
biff.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

@rxgknpbo, you wrote

I couldn't do ** Machine selection -> Infineon/ADMtek ADM5120 SoC based machines any more.

I have the same problem with actual r14251.
How did you solve the problem ?
Regards
Reinhard

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Hi, i deleted everything and started with a fresh debian virtualbox :-/ I don't know whether it's important to run make menuconfig and make before make kernel_menuconfig.

9 (edited by nick_colog 2009-01-30 07:51:20)

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Hi,
thank you rxgknpbo, I did it the same way. New install of Sidux in Virtualbox and the last tar-file from http://downloads.openwrt.org/kamikaze/8.09_RC2/.
1. make menuconfig
2. make
3. make kernel_menuconfig
Then I got the adm5120 in the Machine Selection.

I configured everything the way heruan wrote, run make a second time, but I got kernel panik.
I am working with a BR6104K with USB mod from http://spritesmods.com/?art=sweexusb. I don't know if this is different from the BR6104KP ?

ADM5120 Boot:
jump to linux code!!


LZMA loader for BR-6104KP, Copyright (C) 2007-2008 OpenWrt.org

Looking for TRX header... found at 00012000, kernel:0000001C len:000D2BE4
decompressing kernel... done!
launching kernel...

Linux version 2.6.26.5 (reinhard@siduxbox) (gcc version 4.1.2) #2 Thu Jan 29 22:21:27 CET 2009
console [early0] enabled
CPU revision is: 0001800b (MIPS 4Kc)
SoC      : ADM5120P revision 8, running at 175MHz
Bootdev  : NOR flash
Prom     : Generic
Determined physical RAM map:
memory: 01000000 @ 00000000 (usable)
Initrd not found or empty - disabling initrd
Zone PFN ranges:
  Normal          0 ->     4096
Movable zone start PFN for each node
early_node_map[1] active PFN ranges
    0:        0 ->     4096
Built 1 zonelists in Zone order, mobility grouping off.  Total pages: 4064
Kernel command line: console=ttyS0,115200 root=/dev/sda1 init=/etc/preinit ro rootdelay=10
Primary instruction cache 8kB, VIPT, 2-way, linesize 16 bytes.
Primary data cache 8kB, 2-way, VIPT, no aliases, linesize 16 bytes
PID hash table entries: 64 (order: 6, 256 bytes)
Dentry cache hash table entries: 2048 (order: 1, 8192 bytes)
Inode-cache hash table entries: 1024 (order: 0, 4096 bytes)
Memory: 13552k/16384k available (2067k kernel code, 2832k reserved, 367k data, 136k init, 0k highmem)
SLUB: Genslabs=6, HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
Mount-cache hash table entries: 512
net_namespace: 484 bytes
NET: Registered protocol family 16
ADM5120: board is 'Edimax BR-6104KP'
PCI: not available on ADM5120P
SCSI subsystem initialized
usbcore: registered new interface driver usbfs
usbcore: registered new interface driver hub
usbcore: registered new device driver usb
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 512 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 512 bind 512)
TCP reno registered
NET: Registered protocol family 1
squashfs: version 3.0 (2006/03/15) Phillip Lougher
Registering mini_fo version $Id$
JFFS2 version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.
yaffs Jan 29 2009 22:02:43 Installing.
msgmni has been set to 26
io scheduler noop registered
io scheduler deadline registered (default)
Serial: AMBA driver $Revision: 1.41 $
APB:UART0: ttyS0 at MMIO 0x12600000 (irq = 9) is a AMBA
console handover: boot [early0] -> real [ttyS0]
APB:UART1: ttyS1 at MMIO 0x12800000 (irq = 10) is a AMBA
ADM5120 built-in ethernet switch driver version 0.1.1
Driver 'sd' needs updating - please use bus_type methods
adm5120-flash.0: probing at 0x1FC00000, size:2048KiB, width:16 bits
adm5120-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
Amd/Fujitsu Extended Query Table at 0x0040
adm5120-flash.0: CFI does not contain boot bank location. Assuming top.
adm5120-flash.0: Macronix chip detected, id:0x2249, boot location forced to bottom
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
adm5120-flash.0: found at 0x1FC00000, size:2048KiB, width:16 bits
adm5120-flash.0: adding static partitions
Creating 3 MTD partitions on "adm5120-flash.0":
0x00000000-0x00008000 : "admboot"
0x00008000-0x00010000 : "config"
0x00010000-0x00200000 : "firmware"
admhc-hcd: ADMtek USB 1.1 Host Controller Driver version 0.25.0
admhc-hcd: block sizes: ed 64 td 64
adm5120-hcd adm5120-hcd: ADM5120 built-in USB 1.1 Host Controller
adm5120-hcd adm5120-hcd: new USB bus registered, assigned bus number 1
adm5120-hcd adm5120-hcd: irq 11, io mem 0x11200000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
adm5120_wdt: Watchdog Timer version 0.1
TCP vegas registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
Waiting 10sec before mounting root device...
usb 1-2: new low speed USB device using adm5120-hcd and address 2
VFS: Cannot open root device "sda1" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the available partitions:
1f00         32 mtdblock0 (driver?)
1f01         32 mtdblock1 (driver?)
1f02       1984 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

I am not sure if the USB-Port is working properly. Is there any possibilty to test basic functions of the port ?
regards
Reinhard

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

hi, if you really "configured everything the way heruan wrote", you missed <*> USB Mass Storage support in kernelconfig.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

You were right - this option was still missing.
But unfortunately I still get the kernel panic.

.......
0x00000000-0x00008000 : "admboot"
0x00008000-0x00010000 : "config"
0x00010000-0x00200000 : "firmware"
admhc-hcd: ADMtek USB 1.1 Host Controller Driver version 0.25.0
admhc-hcd: block sizes: ed 64 td 64
adm5120-hcd adm5120-hcd: ADM5120 built-in USB 1.1 Host Controller
adm5120-hcd adm5120-hcd: new USB bus registered, assigned bus number 1
adm5120-hcd adm5120-hcd: irq 11, io mem 0x11200000
usb usb1: configuration #1 chosen from 1 choice
hub 1-0:1.0: USB hub found
hub 1-0:1.0: 2 ports detected
Initializing USB Mass Storage driver...
usb 1-2: new low speed USB device using adm5120-hcd and address 2
usb 1-2: device descriptor read/64, error -145
usb 1-2: device descriptor read/64, error -145
usb 1-2: new low speed USB device using adm5120-hcd and address 3
usb 1-2: device descriptor read/64, error -145
usb 1-2: device descriptor read/64, error -145
usb 1-2: new low speed USB device using adm5120-hcd and address 4
usb 1-2: device not accepting address 4, error -145
usb 1-2: new low speed USB device using adm5120-hcd and address 5
usb 1-2: device not accepting address 5, error -145
hub 1-0:1.0: unable to enumerate USB device on port 2
usbcore: registered new interface driver usb-storage
USB Mass Storage support registered.
adm5120_wdt: Watchdog Timer version 0.1
TCP vegas registered
NET: Registered protocol family 17
802.1Q VLAN Support v1.8 Ben Greear <greearb@candelatech.com>
All bugs added by David S. Miller <davem@redhat.com>
Waiting 10sec before mounting root device...
VFS: Cannot open root device "sda1" or unknown-block(0,0)
Please append a correct "root=" boot option; here are the ava32 mtdblock1 (driver?)
1f02       1984 mtdblock2 (driver?)
Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)

I am still in doubt about the (modded) USB Interface if it's working as it should.
Is it possible that you place your working bin-file and the stick-image somewhere to download for me, just to be sure I have a working Image.
I will give it a last try.
Regards
Reinhard

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

hi, just try squidge ;-)
http://sourceforge.net/projects/squidge (bin-file under boot in the .tar.bz2)

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Hi,

I'm a newbie and just trying to follow this steps to get a first build but unfortunately I should me missing some things:

I tried the Kamikaze 8.09 RC2 source because don't know where(or if I should) to get revision 14152.
Using that I encounter this problems:

* make menuconfig
** busybox -> Configuration -> Coreutil -> stty (don't know if necessary)
----> Cant find busybox menu! 

* make kernel_menuconfig
** Machine selection -> Infineon/ADMtek ADM5120 SoC based machines
----> Cant find Infineon/ADMtek ADM5120 SoC based machines entry!

What am I doing wrong?

Nuno

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Thanks to rxgknpbo, but the Squidge image is producing the same kernel panic.
I checked the mod again, but didn't find any visible failure in the soldering. I capitulate !

@nunojpg: Read all posts ! You wil have the correct machine selection after the first run of "make". Be patient, teh first run took me more than one hour.  Then you can do "make kernel_menuconfig" and after that you have to run "make" a second time for the final image.
You will find "busybox" - starting make menuconfig, then
Base system->busybox->configuration->coreutils->(scroll down, down)(*)stty
regards
Reinhard

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

I'm also getting the Kernel Panic with Omnima board.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

@biff: sounds like squidge is somehow "deprecated" ? squidge was cool as it worked out-of-the box and brought all packages. But as its never sure how long those high specialiced distributions are maintenanced, I prefer a way using original OpenWrt. Is there an easy way that any "end-user" can config his OpenWrt squidge like?

@nick_colog: Is your USB crystal oscillating? Is your USB-stick partitioned as /dev/sda oder /dev/sda1 ?

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

That was my problem! The usb stick partition was /dev/sdb.
Used fdisk to create /dev/sdb1 and it now boots OK.

Thanks!

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

rxgknpbo wrote:

@biff: sounds like squidge is somehow "deprecated" ? squidge was cool as it worked out-of-the box and brought all packages. But as its never sure how long those high specialiced distributions are maintenanced, I prefer a way using original OpenWrt. Is there an easy way that any "end-user" can config his OpenWrt squidge like?

Squidge is broken, and doesn't work at the moment :-(.  I'm not sure when I will be able to fix it.  The problem is Squidge builds were always using the latest version of packages, so although it baselined against specific kamikaze trunk version that wasn't good enough to keep it working!  My bad.

biff.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

replacing "rootdelay=10" with "rootwait" works great smile

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

Well...the router is working...but not the ethernet interface! I cannot ping it from the computer...I can only access by the serial port console...
I put Squidge back and it worked again.

Any option missing in the kernel configuration?

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

hm now as you say it - have the same problem, but I won't have time for further testing the next days.

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

After all I can ping but only to the WAN port, same as Squidge.

My test was not very scientific tongue

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

It's all working.
Only problem is that it appears to have to few RAM.

For example, if I run "opkg update" two times, the second will fail because there is not enough memory available any more.
I don't why the first time leaves things in memory, but it happens...

So I can only imagine to create a swap partition...

Nuno

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

nunojpg wrote:

It's all working.
Only problem is that it appears to have to few RAM.

For example, if I run "opkg update" two times, the second will fail because there is not enough memory available any more.
I don't why the first time leaves things in memory, but it happens...

So I can only imagine to create a swap partition...

Nuno

Swap won't help.  This is opkg, it incorrectly reports lack of memory, when in fact it's config files are messed up.

I'm getting Deja-vu now, from when I first made Squidge!

Re: USB-rootfs on boot on Edimax BR-6104KP (ADM5120) [WORKS]

So...is there any thing that helps?