Skip to contentSkip to conversation

Beginners Questions on modding a NAS

U-Boot JPT 4 participants 8 messages Mar 4, 2013 – Mar 8, 2013

lore
Share & tools
lore

JPT

author
#0 lore raw

Hi,

I've got a NAS which uses uboot:
U-Boot 1.1.4 (Feb 6 2012 - 14:40:46) Marvell version: 3.4.27

It's a Netgear ReadyNAS Duo V2, and the original sofware sucks. ;)

I would like to start with the original kernel (because it contains some patches) and a custom debian made with multistrap.

Where do I start?

I'll add some information about the config.

I believe these are the most important boot options.

standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;

bootcmd=nand read.e 0x1200000 0x200000 0x600000;nand read.e 0x2000000 0x800000 0x1000000;bootm 0x1200000 0x2000000

bootargs=console=ttyS0,115200 reason=normal
mtdparts=nand_mtd:0x180000 at 0(u-boot),0x20000 at 0x180000(u-boot-env),0x600000 at 0x200000(uImage),0x1000000 at 0x800000(minirootfs),0x6800000 at 0x1800000(jffs2);

there are 5 mtds:
1,5M mtd0 - ?
128K mtd1 - ?
6,0M mtd2 - kernel
2,2M mtd3 - initrd (gzipped)
89M mtd4 - jffs2 image, I think it contains a rescue image of the
filesystem which is applied to the harddisks.

I dumped the kernel from mtd2, it is:
u-boot legacy uImage, Linux-2.6.31.8.duov2, Linux/ARM, OS Kernel Image (Not compressed), 3442208 bytes, Tue Aug 28 05:21:43 2012, Load Address:
0x00008000, Entry Point: 0x00008000, Header CRC: 0xDA1ECA31, Data CRC:
0x269C27DE

I tried to load the kernel through tftp, but it crashed:

Marvell>> dhcp

BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 28
*** Unhandled DHCP Option in OFFER/ACK: 28
DHCP client bound to address 192.168.20.35
Marvell>> set serverip 192.168.20.24

Marvell>> tftpboot 0x02000000 /boot/kernel.img

Using egiga0 device
TFTP from server 192.168.20.24; our IP address is 192.168.20.35 Filename '/boot/kernel.img'.
Load address: 0x2000000
Loading: #################################################################
...
done
Bytes transferred = 3442272 (348660 hex)
Marvell>> go 0x02000000

## Starting application at 0x02000000 ...
software interrupt

pc : [<0200001c>]	   lr : [<00633cac>]

sp : 005fef68 ip : ffffffff fp : 005ff7de
r10: 005ff3de r9 : ffffe804 r8 : 005fffcc
r7 : 005ff388 r6 : 00000001 r5 : 005ff38c r4 : 02000000
r3 : 30383101 r2 : f1012000 r1 : 005ff38c r0 : c0c0e0c4
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...

thanks for any help,

JPT

#1 lore raw
Quoted 3 lines · JPT

It's a Netgear ReadyNAS Duo V2, and the original sofware sucks. ;)
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000; bootcmd=nand read.e 0x1200000 0x200000 0x600000;nand read.e 0x2000000 0x800000 0x1000000;bootm 0x1200000 0x2000000

Strange for a NAS to have a u-boot environment variable called "mvPhoneConfig". But anyway...

Quoted 5 lines

I dumped the kernel from mtd2, it is:
u-boot legacy uImage, Linux-2.6.31.8.duov2, Linux/ARM, OS Kernel Image (Not compressed), 3442208 bytes, Tue Aug 28 05:21:43 2012, Load Address: 0x00008000, Entry Point: 0x00008000, Header CRC: 0xDA1ECA31, Data CRC: 0x269C27DE

I tried to load the kernel through tftp, but it crashed:
Marvell>> go 0x02000000

You're likely are off the rails here. Note the last command in your standalone and bootcmd variables: bootm.

If your kernel is in a uImage (a u-boot wrapper) you have to use bootm to start it. Further, Linux kernels expect hardware information either as an ATAG list or a device tree. bootm sets this up before passing control but a bare "go" doesn't.

Try bootm instead of go.

HTH,
-Mike

#2 lore raw

Hi Michael,

Quoted 7 lines · Michael Cashwell
Quoted 3 lines · JPT

It's a Netgear ReadyNAS Duo V2, and the original sofware sucks. ;)
standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000; bootcmd=nand read.e 0x1200000 0x200000 0x600000;nand read.e 0x2000000 0x800000 0x1000000;bootm 0x1200000 0x2000000

Strange for a NAS to have a u-boot environment variable called "mvPhoneConfig". But anyway...

OT: that's (older) Marvell/LaCie U-Boots for you. They have lots of these weird ad hoc env vars, which exist across a whole range of products even when they make sense only for a few.

Amicalement,

Signature · 1 line
Albert.
#3 lore raw
In reply to JPT

Hi JPT,

Quoted 54 lines · JPT

Hi,

I've got a NAS which uses uboot:
U-Boot 1.1.4 (Feb 6 2012 - 14:40:46) Marvell version: 3.4.27

It's a Netgear ReadyNAS Duo V2, and the original sofware sucks. ;)

I would like to start with the original kernel (because it contains some patches) and a custom debian made with multistrap.

Where do I start?

I'll add some information about the config.

I believe these are the most important boot options.

standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;

bootcmd=nand read.e 0x1200000 0x200000 0x600000;nand read.e 0x2000000 0x800000 0x1000000;bootm 0x1200000 0x2000000

bootargs=console=ttyS0,115200 reason=normal
mtdparts=nand_mtd:0x180000 at 0(u-boot),0x20000 at 0x180000(u-boot-env),0x600000 at 0x200000(uImage),0x1000000 at 0x800000(minirootfs),0x6800000 at 0x1800000(jffs2);

there are 5 mtds:
1,5M mtd0 - ?
128K mtd1 - ?
6,0M mtd2 - kernel
2,2M mtd3 - initrd (gzipped)
89M mtd4 - jffs2 image, I think it contains a rescue image of the
filesystem which is applied to the harddisks.

I dumped the kernel from mtd2, it is:
u-boot legacy uImage, Linux-2.6.31.8.duov2, Linux/ARM, OS Kernel Image (Not compressed), 3442208 bytes, Tue Aug 28 05:21:43 2012, Load Address:
0x00008000, Entry Point: 0x00008000, Header CRC: 0xDA1ECA31, Data CRC:
0x269C27DE

I tried to load the kernel through tftp, but it crashed:

Marvell>> dhcp

BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 28
*** Unhandled DHCP Option in OFFER/ACK: 28
DHCP client bound to address 192.168.20.35
Marvell>> set serverip 192.168.20.24

Marvell>> tftpboot 0x02000000 /boot/kernel.img

Quoted 9 lines

Using egiga0 device
TFTP from server 192.168.20.24; our IP address is 192.168.20.35 Filename '/boot/kernel.img'.
Load address: 0x2000000
Loading: #################################################################
...
done
Bytes transferred = 3442272 (348660 hex)
Marvell>> go 0x02000000

Is this load address for kernel is correct? likely to have 8000 multiples.. check it once.

Quoted 10 lines

## Starting application at 0x02000000 ...
software interrupt

pc : [<0200001c>]          lr : [<00633cac>]

sp : 005fef68 ip : ffffffff fp : 005ff7de
r10: 005ff3de r9 : ffffe804 r8 : 005fffcc
r7 : 005ff388 r6 : 00000001 r5 : 005ff38c r4 : 02000000
r3 : 30383101 r2 : f1012000 r1 : 005ff38c r0 : c0c0e0c4
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...

Try to debug the value from pc.
Use the pc value using the instructions from doc/README.arm-unaligned-accesses

Thanks,
Jagan.

Quoted 10 lines

thanks for any help,

JPT

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

#4 lore raw

Hi Jagan,

Quoted 67 lines · Jagan Teki

Hi JPT,

Quoted 54 lines · JPT

Hi,

I've got a NAS which uses uboot:
U-Boot 1.1.4 (Feb 6 2012 - 14:40:46) Marvell version: 3.4.27

It's a Netgear ReadyNAS Duo V2, and the original sofware sucks. ;)

I would like to start with the original kernel (because it contains some patches) and a custom debian made with multistrap.

Where do I start?

I'll add some information about the config.

I believe these are the most important boot options.

standalone=fsload 0x2000000 $(image_name);setenv bootargs $(console) root=/dev/mtdblock0 rw ip=$(ipaddr):$(serverip)$(bootargs_end) $(mvPhoneConfig); bootm 0x2000000;

bootcmd=nand read.e 0x1200000 0x200000 0x600000;nand read.e 0x2000000 0x800000 0x1000000;bootm 0x1200000 0x2000000

bootargs=console=ttyS0,115200 reason=normal
mtdparts=nand_mtd:0x180000 at 0(u-boot),0x20000 at 0x180000(u-boot-env),0x600000 at 0x200000(uImage),0x1000000 at 0x800000(minirootfs),0x6800000 at 0x1800000(jffs2);

there are 5 mtds:
1,5M mtd0 - ?
128K mtd1 - ?
6,0M mtd2 - kernel
2,2M mtd3 - initrd (gzipped)
89M mtd4 - jffs2 image, I think it contains a rescue image of the
filesystem which is applied to the harddisks.

I dumped the kernel from mtd2, it is:
u-boot legacy uImage, Linux-2.6.31.8.duov2, Linux/ARM, OS Kernel Image (Not compressed), 3442208 bytes, Tue Aug 28 05:21:43 2012, Load Address:
0x00008000, Entry Point: 0x00008000, Header CRC: 0xDA1ECA31, Data CRC:
0x269C27DE

I tried to load the kernel through tftp, but it crashed:

Marvell>> dhcp

BOOTP broadcast 1
*** Unhandled DHCP Option in OFFER/ACK: 28
*** Unhandled DHCP Option in OFFER/ACK: 28
DHCP client bound to address 192.168.20.35
Marvell>> set serverip 192.168.20.24

Marvell>> tftpboot 0x02000000 /boot/kernel.img

Quoted 9 lines

Using egiga0 device
TFTP from server 192.168.20.24; our IP address is 192.168.20.35 Filename '/boot/kernel.img'.
Load address: 0x2000000
Loading: #################################################################
...
done
Bytes transferred = 3442272 (348660 hex)
Marvell>> go 0x02000000

Quoted 2 lines

Is this load address for kernel is correct? likely to have 8000 multiples.. check it once.

Just about any address can be used to load and bootm (as Michael notes) a kernel image. And 2000000 is a multiple of 8000, as we are talking hex here. :)

Quoted 10 lines
Quoted 9 lines

## Starting application at 0x02000000 ...
software interrupt

pc : [<0200001c>]          lr : [<00633cac>]

sp : 005fef68 ip : ffffffff fp : 005ff7de
r10: 005ff3de r9 : ffffe804 r8 : 005fffcc
r7 : 005ff388 r6 : 00000001 r5 : 005ff38c r4 : 02000000
r3 : 30383101 r2 : f1012000 r1 : 005ff38c r0 : c0c0e0c4
Flags: nZCv IRQs off FIQs off Mode SVC_32
Resetting CPU ...

Quoted 2 lines

Try to debug the value from pc.
Use the pc value using the instructions from doc/README.arm-unaligned-accesses

doc/README.unaligned-accesses is about data aborts, not SW interrupts.

Quoted 2 lines

Thanks,
Jagan.

Amicalement,

Signature · 1 line
Albert.
author
#5 lore raw
In reply to JPT

Hi,

wow, thanks. bootm worked fine. :)

*** Next step, booting from disk
I created a root fs on USB drive and tried to boot it.

usb start
ext2load usb 0:1 0x02000000 /boot/kernel-DUO-1.0.22 bootm

this works, but the kernel doesn't know where to find the root partition. how do I have to pass the root= parameter to linux kernel?

this didn't work:
set bootargs console=ttyS0,115200 root=/dev/sda1

How do I find out the correct root device?

Or do I have to boot the "real" system after booting from initrd?

*** Last step: save settings setting for automated boot up.

I tried to save, it writes something, but after issuing "reset" it's back to initial values. what's wrong?

Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done

thanks,

JPT

#6 lore raw
Quoted 3 lines · JPT

Hi,

wow, thanks. bootm worked fine. :)

Spiffy.

Quoted 7 lines

*** Next step, booting from disk
I created a root fs on USB drive and tried to boot it.

usb start
ext2load usb 0:1 0x02000000 /boot/kernel-DUO-1.0.22 bootm

Quoted 5 lines

this works, but the kernel doesn't know where to find the root partition. how do I have to pass the root= parameter to linux kernel?

this didn't work:
set bootargs console=ttyS0,115200 root=/dev/sda1

bootargs is how you pass arguments to the kernel, so you're on track there.

The trick is what to pass. Your root= item is in the right direction. But the kernel needs to be configured appropriately. By that I'm talking about things like what bus (ATA, SATA, USB, etc.), what partitioning (MBR, GUID, MTD, etc.) and what file system (FAT*, ext2/3/4, etc.) the root fs will have. You have to have the supporting kernel configs enabled for those things.

You also need /dev to be setup early or the root argument will hit a dead end. I use these often:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

Quoted 1 line

How do I find out the correct root device?

One trick is to look at the console log of the device booting whatever came with it. That will show you many of the kernel args. And if you have the matching kernel source and config it will make changes much easier than starting from nothing.

Quoted 1 line

Or do I have to boot the "real" system after booting from inited?

You need to decide that. It can be done either way, either a small initrd that then does a pivot root or will it just directly mount. Both are possible but a kernel/rootfs setup for one will likely be unhappy trying to do the other.

Quoted 7 lines

*** Last step: save settings setting for automated boot up.

I tried to save, it writes something, but after issuing "reset" it's back to initial values. what's wrong?

Marvell>> saveenv
Saving Environment to NAND...
Erasing Nand...Writing to Nand... done

Sorry but I don't know about this one. I avoid raw NAND like the plague.

I don't know why it would write the env but not then read it back the next time.

When u-boot starts does it complain about the environment CRC being bad even after what appears to be a successful saveenv? That would sounds like a basic NAND flash problem (wrong part or geometry).

One last trick is to define DEBUG early in your config.h file and rebuild. Such a u-boot will spew enormous amounts of stuff to the console but it often will show what's happening in a case like that.

HTH,
-Mike

author
#7 lore raw

Hi Mike,

Sorry, I am partly off-topic.
but since cross compiling and uboot images are still close to uboot, i'll stay here.

Am 05.03.2013 21:30, schrieb Michael Cashwell:

Quoted 3 lines · JPT
Quoted 2 lines

*** Next step, booting from disk

...

Quoted 6 lines
Quoted 5 lines

this works, but the kernel doesn't know where to find the root partition. how do I have to pass the root= parameter to linux kernel?

this didn't work:
set bootargs console=ttyS0,115200 root=/dev/sda1

Quoted 7 lines

bootargs is how you pass arguments to the kernel, so you're on track there.

The trick is what to pass. Your root= item is in the right direction.
But the kernel needs to be configured appropriately.
By that I'm talking about things like what bus (ATA, SATA, USB, etc.),
what partitioning (MBR, GUID, MTD, etc.) and what file system (FAT*, ext2/3/4, etc.) the root fs will have. You have to have the supporting kernel configs enabled for those things.

If I boot using the initrd, the USB drive is /dev/sda1 Since it's the same kernel, I guessed I have to use /dev/sda1 as well.

Quoted 3 lines

You also need /dev to be setup early or the root argument will hit a dead end. I use these often:
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

I am rather sure missing DEVTMPFS is the problem.

after hours and days of searching I found out:
DEVTMPFS is not available in kernel 2.6.31.*, it's included from 2.6.34 on.

Way 1: Upgrade to longterm kernel 2.6.34.14
A) build kernel
Tries to crosscompile but fails:
"arm-mv5sft-linux-gnueabi-gcc: not found"
did hardly find anything on this file in the internet.

Since I haven't got any experience with crosscompiling, I set up a ARM machine in QEMU... but it still tries to crosscompile, same error.

B) patch new kernal with duov2 patches. boy, its a 20 MB patchfile! a lot of patches failed.
I don't believe this is going to work!

Way 2: Patch original kernel with DEVTMPFS. No idea, did not try yet. where do I get a patch from? Still need a way to compile the kernel.

Way 3: Create a new uboot initrd.img
is there any way to unpack the original image into it's pieces? Would be far easier to just exchange those parts that have to be changed.

Way 4: see below.

Quoted 3 lines
Quoted 1 line

Or do I have to boot the "real" system after booting from initrd?

You need to decide that.

How do I boot "linux from linux"?
could you give a keyword to search for?

thanks,

Jan