Welcome! Log In Create A New Profile

Advanced

Boot uboot-original-mtd0.kwb from USB into Pogoplug

Posted by nguyen 
nguyen
Boot uboot-original-mtd0.kwb from USB into Pogoplug
September 19, 2010 10:49PM
My boot sequence is USB -> USB (uboot-original-mtd0.kwb on USB for recovery) -> mtd3 (openwrt) -> mtd1 (original Pogoplug)

If openWRT network is not accessible then I plug USB in with uboot-original-mtd0.kwb then it should boot into original Pogoplug.

I know this may be possible but can you help me to setup uboot parameters.
I found the way to boot openWRT on mtd3

setenv bootargs console=$console root=/dev/mtdblock3 rootfstype=jffs2
setenv partition nand0,3
fsload /boot/uImage
bootm 0x800000

And boot uboot-original-mtd0.kwb from USB into Pogoplug on mtd1
usb_init
ext2load usb $usb_device 0x800000 /uboot-original-mtd0.kwb
go 0x800200
Remember copy uboot-original-mtd0.kwb to USB root.

Install openWRT on mtd3
flash_eraseall /dev/mtd3
mkdir /tmp/openwrt
mount -t jffs2 /dev/mtdblock3 /tmp/openwrt
cd /tmp/openwrt
tar -xzvf openwrt-kirkwood-rootfs.tar.gz
mkdir boot
cp openwrt-kirkwood-uImage boot/uImage

Cheers
Here is a complete environment dump for the above settings:

bootdelay=3
baudrate=115200
preboot=
arcNumber=2097
mainlineLinux=yes
console=ttyS0,115200
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
led_init=green blinking
led_exit=green off
led_error=orange blinking
stdin=serial
stdout=serial
stderr=serial
ethact=egiga0
ethaddr=00:00:00:11:22:33
usb_start=usb start
usb_stop=usb stop
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_load_uimage=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts
usb_boot=if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd_usb=run usb_load_uimage; run set_bootargs_usb; run usb_boot
usb_load_uboot=ext2load usb $usb_device 0x800000 uboot-original-mtd0.kwb
usb_uboot_boot=go 0x800200
bootcmd_usb_pogo=run usb_load_uboot; run usb_uboot_boot
linux_partition=setenv partition nand0,3
linux_root=/dev/mtdblock3
linux_rootdelay=1
linux_rootfstype=jffs2
linux_load_uimage=fsload 0x800000 /boot/uImage
linux_boot=bootm 0x800000
set_bootargs_linux=setenv bootargs console=$console root=$linux_root rootdelay=$linux_rootdelay rootfstype=$linux_rootfstype
bootcmd_linux=run linux_partition; run linux_load_uimage; run set_bootargs_linux; run linux_boot
pogo_partition=setenv partition nand0,2
pogo_load=fsload uboot-original-mtd0.kwb
pogo_boot=go 0x800200
bootcmd_pogo=run pogo_partition; run pogo_load; run pogo_boot
bootcmd=run usb_start; run bootcmd_usb; run bootcmd_usb_pogo; run usb_stop; run bootcmd_linux; run bootcmd_pogo; reset

Here are the commands for those interested.
fw_setenv partition
fw_setenv usb_init
fw_setenv usb_start 'usb start'
fw_setenv usb_stop 'usb stop'
fw_setenv usb_device '0:1'
fw_setenv usb_root '/dev/sda1'
fw_setenv usb_rootfstype ext2
fw_setenv usb_rootdelay 10

fw_setenv usb_load_uimage 'mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage'
fw_setenv set_bootargs_usb 'setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts'
fw_setenv usb_boot 'if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
fw_setenv bootcmd_usb 'run usb_load_uimage; run set_bootargs_usb; run usb_boot'

fw_setenv usb_load_uboot 'ext2load usb $usb_device 0x800000 uboot-original-mtd0.kwb'
fw_setenv usb_uboot_boot 'go 0x800200'
fw_setenv bootcmd_usb_pogo 'run usb_load_uboot; run usb_uboot_boot'

fw_setenv linux_partition 'setenv partition nand0,3'
fw_setenv linux_root '/dev/mtdblock3'
fw_setenv linux_rootdelay 1
fw_setenv linux_rootfstype jffs2
fw_setenv linux_load_uimage 'fsload 0x800000 /boot/uImage'
fw_setenv linux_boot 'bootm 0x800000'
fw_setenv set_bootargs_linux 'setenv bootargs console=$console root=$linux_root rootdelay=$linux_rootdelay rootfstype=$linux_rootfstype'
fw_setenv bootcmd_linux 'run linux_partition; run linux_load_uimage; run set_bootargs_linux; run linux_boot'

fw_setenv pogo_partition 'setenv partition nand0,2'
fw_setenv pogo_load 'fsload uboot-original-mtd0.kwb'
fw_setenv pogo_boot 'go 0x800200'
fw_setenv bootcmd_pogo 'run pogo_partition; run pogo_load; run pogo_boot'

fw_setenv bootcmd 'run usb_start; run bootcmd_usb; run bootcmd_usb_pogo; run usb_stop; run bootcmd_linux; run bootcmd_pogo; reset'
Re: Boot uboot-original-mtd0.kwb from USB into Pogoplug
October 02, 2010 11:22AM
nguyen Wrote:
-------------------------------------------------------
> flash_eraseall /dev/mtd3

Cheers for this mate. I've been wanting to format mtd3 to jffs2 for some time but haven't been able to find out how. Turns out flash_eraseall does the jffs2 formatting when it erases it.
This is the final one:
bootdelay=3
baudrate=115200
preboot=
arcNumber=2097
mainlineLinux=yes
console=ttyS0,115200
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
led_init=green blinking
led_exit=green off
led_error=orange blinking
stdin=serial
stdout=serial
stderr=serial
ethact=egiga0
ethaddr=00:00:00:11:22:33
usb_start=usb start
usb_stop=usb stop
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_load_uimage=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts
usb_boot=if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd_usb=run usb_load_uimage; run set_bootargs_usb; run usb_boot
bootcmd_usb_pogo=if ext2load usb $usb_device 0x800000 uboot-original-mtd0.kwb; then go 0x800200; fi
linux_partition=setenv partition nand0,3
linux_root=/dev/mtdblock3
linux_rootdelay=1
linux_rootfstype=jffs2
set_bootargs_linux=setenv bootargs console=$console root=$linux_root rootdelay=$linux_rootdelay rootfstype=$linux_rootfstype
linux_boot=if fsload 0x800000 /boot/uImage; then bootm 0x800000; fi
bootcmd_linux=run linux_partition; run set_bootargs_linux; run linux_boot
pogo_partition=setenv partition nand0,2
pogo_boot=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
bootcmd_pogo=run pogo_partition; run pogo_boot
bootcmd=run usb_start; run bootcmd_usb; run bootcmd_usb_pogo; run usb_stop; run bootcmd_linux; run bootcmd_pogo; reset

Here are the commands:
fw_setenv partition
fw_setenv usb_init
fw_setenv usb_start 'usb start'
fw_setenv usb_stop 'usb stop'
fw_setenv usb_device '0:1'
fw_setenv usb_root '/dev/sda1'
fw_setenv usb_rootfstype ext2
fw_setenv usb_rootdelay 10

fw_setenv usb_load_uimage 'mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage'
fw_setenv set_bootargs_usb 'setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts'
fw_setenv usb_boot 'if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi'
fw_setenv bootcmd_usb 'run usb_load_uimage; run set_bootargs_usb; run usb_boot'

fw_setenv bootcmd_usb_pogo 'if ext2load usb $usb_device 0x800000 uboot-original-mtd0.kwb; then go 0x800200; fi'

fw_setenv linux_partition 'setenv partition nand0,3'
fw_setenv linux_root '/dev/mtdblock3'
fw_setenv linux_rootdelay 1
fw_setenv linux_rootfstype jffs2
fw_setenv set_bootargs_linux 'setenv bootargs console=$console root=$linux_root rootdelay=$linux_rootdelay rootfstype=$linux_rootfstype'
fw_setenv linux_boot 'if fsload 0x800000 /boot/uImage; then bootm 0x800000; fi'
fw_setenv bootcmd_linux 'run linux_partition; run set_bootargs_linux; run linux_boot'

fw_setenv pogo_partition 'setenv partition nand0,2'
fw_setenv pogo_boot 'if fsload uboot-original-mtd0.kwb; then go 0x800200; fi'
fw_setenv bootcmd_pogo 'run pogo_partition; run pogo_boot'

fw_setenv bootcmd 'run usb_start; run bootcmd_usb; run bootcmd_usb_pogo; run usb_stop; run bootcmd_linux; run bootcmd_pogo; reset'
Ranganadh
Re: Boot uboot-original-mtd0.kwb from USB into Pogoplug
January 23, 2012 07:19PM
Hi,

I didnt understand the idea behind "go 0x800200" in the below command. why is it not "go 0x800000" like in other args?
"pogo_boot=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi"

I couldnt boot to original Pogoplug parition. It always reboots as show below. Any ideas?

$ nc -l -u -p 6666


U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
Marvell-Dockstar/Pogoplug by Jeff Doozan
Hit any key to stop autoboot: 8
0
(Re)start USB...
USB: Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 2 USB Device(s) found
scanning bus for storage devices... 0 Storage Device(s) found
** Block device usb 0 not supported

** Invalid boot device **
Creating 1 MTD partitions on "nand0":
0x000002500000-0x000020000000 : "mtd=3"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size: 131072 bytes (128 KiB)
UBI: logical eraseblock size: 129024 bytes
UBI: smallest flash I/O unit: 2048
UBI: sub-page size: 512
UBI: VID header offset: 512 (aligned 512)
UBI: data offset: 2048
UBI: attached mtd1 to ubi0
UBI: MTD device name: "mtd=3"
UBI: MTD device size: 475 MiB
UBI: number of good PEBs: 3797
UBI: number of bad PEBs: 3
UBI: max. allowed volumes: 128
UBI: wear-leveling threshold: 4096
UBI: number of internal volumes: 1
UBI: number of user volumes: 0
UBI: available PEBs: 3756
UBI: total number of reserved PEBs: 41
UBI: number of PEBs reserved for bad PEB handling: 37
UBI: max/mean erase counter: 1/1
UBIFS error (pid 0): ubifs_get_sb: cannot open "ubi:rootfs", error -19
Error reading superblock on volume 'ubi:rootfs'!
** Block device usb 0 not supported
** Block device usb 1 not supported
** Block device usb 2 not supported
** Block device usb 3 not supported
** Block device usb 0 not supported
** Block device usb 0 not supported
Wrong Image Format for bootm command
ERROR: can't get kernel image!
stopping USB..
### JFFS2 loading 'uboot-original-mtd0.kwb' to 0x800000
Scanning JFFS2 FS: .......... done.
### JFFS2 load complete: 524288 bytes loaded to 0x800000
## Starting application at 0x00800200 ...

U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
Marvell-Dockstar/Pogoplug by Jeff Doozan
Hit any key to stop autoboot: 5 punt!

Thanks
Ranganadh
http://jeff.doozan.com/debian/uboot/build_uboot.htm

Notice that we load the image at 0x800000 but start running it from 0x800200. This is because the first 0x200 bytes of are the kirkwood image header, and the real executable starts after the header.
Ranganadh
Re: Boot uboot-original-mtd0.kwb from USB into Pogoplug
January 23, 2012 07:37PM
Thanks for the quick response. Can you give some pointers on why my dockstar couldnt boot to original installation? Any ideas to correct the problem?

Thanks
Ranganadh
mtd3 no longer contains pogo partition? did you flash_erase mtd3 in the process of installing ubifs?
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: