OpenWrt Forum Archive

Topic: mipsel rb532 kamikaze build - compact flash help needed

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

compiled kernel for rb532, dd'd kernel to 1st CF partition, cp'd unpacked rootfs to 2nd CF partition, kernel boots semi-ok and fails at:

VFS: Mounted root (yaffs2 filesystem) readonly.                                 
Freeing unused kernel memory: 120k freed                                       
Please be patient, while OpenWrt loads ...                                     
Failed to execute /etc/preinit.  Attempting defaults...                         
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

I'm kind of at a loss here, but I suspect the bootloader (or the kernel?) needs to be told where the root filesystem can be found?

Also kind of think something should go in /boot - but not sure what.

Any and all pointers greatly appreciated. :-)

Thanks.

more info---

High level summary of install steps taken - if any other info needed, please ask!

setup type 27 partition on cf card for linux kernel

did "dd if=openwrt-rb532-vmliux of=/dev/sdc1" (my build box cf card slot = sdc)

setup type 83 partition on cf card for linux filesystem.

unpacked openwrt-rb532-2.6-rootfs.tgz into a directory on build box, and did cp -rp <all directories in unpacked rootfs> /dev/sdc2

put cf card in rb532, powered up and get:

RouterBOOT booter 2.10                                                         
                                                                               
RouterBoard 532A                                                               
                                                                               
CPU frequency: 399 MHz                                                         
  Memory size:  64 MB                                                           
                                                                               
Press any key within 5 seconds to enter setup.....                             
Booting CF                                                                     
Loading kernel... done                                                         
setting up elf image... OK                                                     
jumping to kernel code                                                         
Linux version 2.6.23.14 (dmooney1@somebox.dom.net) (gcc version 4.1.2) #3 Tue F8
CPU revision is: 0001800a                                                       
Determined physical RAM map:                                                   
memory: 03fffa00 @ 00000400 (usable)                                           
Wasting 32 bytes for tracking 1 unused pages                                   
Initrd not found or empty - disabling initrd                                   
Built 1 zonelists in Zone order.  Total pages: 16256                           
Kernel command line: console=ttyS0,115200 gpio=16383 kmac=00:0C:42:20:07:FE boa
korina mac = 00:0C:42:20:07:FE                                                 
Primary instruction cache 8kB, physically tagged, 4-way, linesize 16 bytes.     
Primary data cache 8kB, 4-way, linesize 16 bytes.                               
Synthesized TLB refill handler (20 instructions).                               
Synthesized TLB load handler fastpath (32 instructions).                       
Synthesized TLB store handler fastpath (32 instructions).                       
Synthesized TLB modify handler fastpath (31 instructions).                     
Initializing IRQ's: 168 out of 256                                             
PID hash table entries: 256 (order: 8, 1024 bytes)                             
calculating r4koff... 001e846c(1999980)                                         
CPU frequency 400.00 MHz                                                       
Using 199.998 MHz high precision timer.                                         
console [ttyS0] enabled                                                         
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)                   
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)                   
Memory: 61180k/65528k available (2132k kernel code, 4288k reserved, 332k data, )
Mount-cache hash table entries: 512                                             
NET: Registered protocol family 16                                             
PCI: Initializing PCI                                                           
registering PCI controller with io_map_base unset                               
NET: Registered protocol family 2                                               
Time: MIPS clocksource has been installed.                                     
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)                 
TCP established hash table entries: 2048 (order: 2, 16384 bytes)               
TCP bind hash table entries: 2048 (order: 1, 8192 bytes)                       
TCP: Hash tables configured (established 2048 bind 2048)                       
TCP reno registered                                                             
squashfs: version 3.0 (2006/03/15) Phillip Lougher                             
JFFS2 version 2.2. (NAND) (SUMMARY)  �© 2001-2006 Red Hat, Inc.                 
yaffs Feb  5 2008 09:23:27 Installing.                                         
io scheduler noop registered                                                   
io scheduler deadline registered (default)                                     
Serial: 8250/16550 driver $Revision: 1.90 $ 2 ports, IRQ sharing disabled       
serial8250: ttyS0 at MMIO 0x0 (irq = 104) is a 16550A                           
Using NAPI with weight 64                                                       
eth0: Rx IRQ 40, Tx IRQ 41, 00:0c:42:20:07:fe                                   
via-rhine.c:v1.10-LK1.4.3 2007-03-06 Written by Donald Becker                   
PCI: Enabling device 0000:00:02.0 (0080 -> 0083)                               
io_map_base of root PCI bus 0000:00 unset.  Trying to continue but you better   
fix this issue or report it to linux-mips@linux-mips.org or your vendor.       
eth1: VIA Rhine III at 0xb8800000, 00:0c:42:20:07:ff, IRQ 142.                 
eth1: MII PHY found at address 1, status 0x7849 advertising 05e1 Link 0000.     
PCI: Enabling device 0000:00:03.0 (0080 -> 0083)                               
eth2: VIA Rhine III at 0xb8800100, 00:0c:42:20:08:00, IRQ 143.                 
eth2: MII PHY found at address 1, status 0x7849 advertising 05e1 Link 0000.     
block2mtd: version $Revision: 1.30 $                                           
NAND device: Manufacturer ID: 0xad, Chip ID: 0x76 (Hynix NAND 64MiB 3,3V 8-bit)
Scanning device for bad blocks                                                 
Creating 2 MTD partitions on "NAND 64MiB 3,3V 8-bit":                           
0x00000000-0x00400000 : "Routerboard NAND boot"                                 
0x00400000-0x04000000 : "rootfs"                                               
mtd: partition "rootfs" set to be root filesystem                               
split_squashfs: error occured while reading from "NAND 64MiB 3,3V 8-bit"       
input: gpio-keys as /devices/platform/gpio-keys/input/input0                   
rc32434_wdt: Watchdog Timer version 0.1, timer margin: 15 sec                   
Registered led device: rb500led:amber                                           
nf_conntrack version 0.5.0 (1024 buckets, 4096 max)                             
ip_tables: (C) 2000-2006 Netfilter Core Team                                   
TCP vegas registered                                                           
NET: Registered protocol family 1                                               
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>                           
yaffs: dev is 32505857 name is "mtdblock1"                                     
yaffs: passed flags ""                                                         
yaffs: Attempting MTD mount on 31.1, "mtdblock1"                               
yaffs: auto selecting yaffs1                                                   
VFS: Mounted root (yaffs2 filesystem) readonly.                                 
Freeing unused kernel memory: 120k freed                                       
Please be patient, while OpenWrt loads ...                                     
Failed to execute /etc/preinit.  Attempting defaults...                         
Kernel panic - not syncing: No init found.  Try passing init= option to kernel.

I haven't tried OpenWrt on an rb532, so take this with a grain of salt.

The "yaffs" messages seem to imply that the kernel is successfully mounting the rootfs.  Is there an /etc/preinit file in the rootfs?  That's what the kernel is looking for.

unpacked openwrt-rb532-2.6-rootfs.tgz into a directory on build box, and did cp -rp <all directories in unpacked rootfs> /dev/sdc2

This step looks like the problem.  Instead of doing this, do as follows:

Make sure you have yaffs compiled into the kernel on your desktop.
mount /dev/sdc2 /mnt
cd /mnt
tar xzvf /path/to/openwrt-rb532-2.6-rootfs.tgz
cd /
umount /mnt

Then try booting the board again.

Wodin,

Thanks for suggestion, but no joy. There is /etc/preinit, it IS executable. I even went so far as to change line 1 of that script to "#!/bin/sh -x" (assuming the -x flag works the same as for csh, ksh, bash, etc. and turns trace/debug on for the script) just to see if the script is getting launched and failing or just not executing at all.

Since output is same, I assume the kernel can't find my rootfs, but it knows what to look for...

Any other ideas?

-d-

have tried Wodin's suggestion of unpacking rootfs tarball directly on CF instead of copy. No joy.

have tried making /dev/cfa2 bootable via fdisk flag. No joy.

have tried:

echo root=/dev/cfa2 > kernel.params
echo init=/bin/sh >> kernel.params
mipsel-linux-objcopy --add-section kernparms=kernel.params

No Joy.

Any other suggestions / links to howto's that DON'T involve netbooting?

Thanks,

-drew-

dmooney1 wrote:

compiled kernel for rb532, dd'd kernel to 1st CF partition, cp'd unpacked rootfs to 2nd CF partition, kernel boots semi-ok and fails at:

Here is a HowTo.

dmooney1 wrote:

did "dd if=openwrt-rb532-vmliux of=/dev/sdc1" (my build box cf card slot = sdc)

setup type 83 partition on cf card for linux filesystem.

unpacked openwrt-rb532-2.6-rootfs.tgz into a directory on build box, and did cp -rp <all directories in unpacked rootfs> /dev/sdc2

try to dd a full jffs2 image:

dd if=openwrt-rb532-jffs2-128k.bin of=/dev/sdc

Well now don't I feel silly.

After I did:

dd if=openwrt-rb532-jffs2-128k.bin of=/dev/sdc

I did:

cfdisk /dev/sdc, just to see what things looked like, and noticed the /dev/sdc1 had the boot flag set.

I went back to another CF disk I had, with a vmlinux on it that I'd compiled yesterday, and set the boot flag on 1st partition, and what do you know...a bootable linux.

But that's not why I feel silly. In my frustration, I'd decided that starting from scratch was the thing to do, so I deleted my old kamikaze svn tree and checked it out again.

In doing so, I lost all progress on souce code downloads, and I'm trying to build a "proper" kernel today...as luck would have it, none of the mirrors are letting me have the openssl-0.9.8e.tar.gz, so I either have to wait, or maybe some kind soul will post it on a website like they did yesterday with the dtc sources...

(please?)

Thanks all for the moral support through this bit of operator error...I was setting the bootflag on 2nd partition, not first.

-drew-

This works for me:
http://www.openssl.org/source/openssl-0.9.8e.tar.gz

By the way, there's an option in menuconfig to point at a different dl directory.  If you keep the dl directory separate from your trunk checkout you can wipe the checkout without losing the downloaded source tarballs.

Also, in theory, "make distclean" should be the same as removing and checking out again and saves a bit of bandwidth.

Good to know Wodin (make distclean). Thanks.

Yes - grabbing it by hand worked fine for me as well. For whatever reason, ALL of the repositories of just the openssl sources were non-responsive to wgets, but openssl.org worked fine 'manually'...go figure. I just assumed I had same problem as with the dtc sources yesterday.

So now I've got a bootable vmlinux - which boots into a <virtual?> root filesystem.

I've done the unpacking of the rootfs tarball on my second partition, and setup an /etc/fstab in the "builtin" rootfs that's available on booting the kernel...for some reason (ignorance I'm sure) I'm not able to mount the / on /dev/cfa2 - any ideas?

I have done the kernparm thing with root=/dev/cfa2 and mipsel-linux-objcopy, and this appears as a kernel command line option at boot time.

So how do I 'get rid of' the tiny little rootfs that lives in the first petition (or is it in NAND?) and "trade up" to the nice full-featured one on /dev/cfa2?

Thanks to anyone for help with this bit!

-drew-

I would mount the cf under openwrt.
Openwrt boots pretty well. I installed the rootfs and the image on the cf and then load into memory.
But at linux shell, there is no way to mount the cf.
I would use it to store modify data.
Regards

It is very strange that nobody reply to my question.
Is it to trivial? Or this forum has been closed?
G

giusepped wrote:

Openwrt boots pretty well.

Do you mean that OpenWrt boots from the cf?

giusepped wrote:

I installed the rootfs and the image on the cf and then load into memory.

What do you mean by "and then load into memory"?

giusepped wrote:

But at linux shell, there is no way to mount the cf.

Why not?  How did you try?  What happened when you tried?

Does something like this not work:

mount /dev/cfa2 /mnt

Well, initially I put the image and the rootfs on the flash card, along with the script to load them into the flash chip on board.
Now I am doing all from tftp.
Then
1) I download the image and the rootfs via tftp at boot time (Redboot), and I created correctly the two partition (kernel and rootfs)
1') I load the image and the roots into the flash chip on board. And then go -n xxxxxxx
2) I see the prompt from OpenWRT
3) I cannot see any cfa2 device in /dev

So, what I am missing?

My objective is
1) At very first boot, let RedBoot download the image and the rootfs. Create the partition into the flash chips and load the image and the rootfs into the partitions.
2) Since at the next reboot, I have not to re-create the partiotions (otherwise I will lose data), I would create a script into the flash card which only load the image and the rootfs into memory. Is it right?

Any reply will really very appreciated

can you post the results of a:

cat /proc/mtd

root@OpenWrt:/# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00060000 00020000 "RedBoot"
mtd1: 00100000 00020000 "kernel"
mtd2: 00e80000 00020000 "rootfs"
mtd3: 00d80000 00020000 "rootfs_data"
mtd4: 0001f000 00020000 "FIS directory"
mtd5: 00001000 00020000 "RedBoot config"
root@OpenWrt:/#

also paste the output of:

cat /proc/version

you may want to try your luck with one of the following images here

Linux version 2.6.21.6 (nbd@ds10) (gcc version 4.1.2) #2 Sun Sep 30 20:44:34 CEST 2007

acoul wrote:

also paste the output of:

cat /proc/version

you may want to try your luck with one of the following images here

here is the output of the /proc/mtd using the above image and a cf on a RB532a:

cat /proc/mtd

dev:    size   erasesize  name
mtd0: 01020000 00020000 "/dev/cfa2"
mtd1: 00400000 00020000 "Routerboard NAND boot"
mtd2: 07c00000 00020000 "rootfs"

Sorry for my elementary questions, but which image should I load?
By far, I used squashfs and a rootfs image.
G

you can use this one and:

dd if=openwrt-rb532-jffs2-128k.bin of=/dev/cd-device

The discussion might have continued from here.