Welcome! Log In Create A New Profile

Advanced

8/22/2010 - New uBoot for mtd0 that can still boot original Pogoplug

Posted by Jeff 
8/22/2010 - New uBoot for mtd0 that can still boot original Pogoplug
August 22, 2010 01:40PM
I've built a new uBoot for mtd0 that supports booting the original Pogoplug installation. This will fix all of the 'dual boot' problems that some of your are experiencing and will fix the boot problems related to a bad environment CRC.

The installer saves a copy of the pogoplug uboot image to the root directory of the pogoplug environment (mtd2). When the new uBoot runs, it tries to boot from the USB devices, but if they're not found or unbootable, it will load the old uBoot image and let that run to boot into the original Pogoplug installation.

To upgrade (from the instructions for installing mtd0 uBoot):

cd /tmp
wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh
chmod +x install_uboot_mtd0.sh
./install_uboot_mtd0.sh

I believe this should be a safe and flexible solution for everyone.

-- Jeff



Edited 2 time(s). Last edit at 08/23/2010 11:13AM by Jeff.
Re: New uBoot for mtd0 that can still boot original Pogoplug
August 22, 2010 02:32PM
Hey Jeff Thanks for your nice and great Work!

Do you mean this Part:

OPTIONAL: Replacing the uBoot on /dev/mtd0

WARNING: Writing to /dev/mtd0 can brick your device.

Remove your USB drive, boot into the default Pogoplug environment, and run the following commands:
cd /tmp wget http://jeff.doozan.com/debian/uboot/install_uboot_mtd0.sh chmod +x install_uboot_mtd0.sh ./install_uboot_mtd0.sh

NOTE: After flashing the new uBoot on /dev/mtd0, the green light will no longer blink while booting. The light will be OFF during the entire boot process.

If, for some reason, you want to revert back to the original bootloader, you can use the following instructions to restore the original bootloader:
# Restore original uBoot wget http://jeff.doozan.com/debian/uboot/uboot-original-mtd0.kwb flash_erase /dev/mtd0 0 4 nandwrite /dev/mtd0 uboot-original-mtd0.kwb


Maybe it would be fine if you write reorder the Page and put the Method up and Write some Informations.

syro
Re: New uBoot for mtd0 that can still boot original Pogoplug
August 22, 2010 02:33PM
Thanks a bunch, Jeff.
We'll try it down at plugapps, too.
BTW, you could join us there on the irc channel, once in a while ;).
Cheers
Re: New uBoot for mtd0 that can still boot original Pogoplug
August 22, 2010 02:40PM
Syro,

Yes, that's the section. I'm going to wait a few days to make sure that this works well for everyone on here and then I'll probably update the page and the installers to use the new mtd0 uBoot and mark the mtd3 stuff as the "old way." I think the new uBoot will fix 90% of the problems that are being reported in the forums.

-- Jeff
Hi and thanks a lot Jeff,

Today I got my DockStar and used your way to install squeeze on a usb-stick. Then I used install_uboot_mtd0.sh to replace the old uboot.

If no usb-stick is plugged in, it boots the old "Pogoplug" from internal flash. If I add the usb-stick, it boots squeeze. So far it works and this is very fine ;-)

But when I add, in addition to the usb-stick (with the squeeze system), an external usb harddisk - it takes a long time to boot and will finally end up in Pogoplug. Will this be fixed?
Because if there is a power-failure the device would not boot into squeeze any more when an external usb-harddisk is still plugged in.

Thanks,
-- crunshy
Re: New uBoot for mtd0 that can still boot original Pogoplug
August 23, 2010 09:19AM
Quote

But when I add, in addition to the usb-stick (with the squeeze system), an external usb harddisk - it takes a long time to boot and will finally end up in Pogoplug. Will this be fixed?

There's probably something funky with your USB harddisk. I've found that there are a number of USB devices with either old or cheap controllers that can cause boot problems.

You should connect a serial cable or configure netconsole and watch the uBoot output to see exactly what is failing.

-- Jeff
Sorry for that - to quote myself:

Quote
crunshy
If no usb-stick is plugged in, it boots the old "Pogoplug" from internal flash. If I add the usb-stick, it boots squeeze.

Does this only work if I do

fw_setenv usb_init 'usb start; if ext2ls usb 0:1 /boot/uImage; then setenv usb_device 0:1; elif ext2ls usb 1:1 /boot/uImage; then setenv usb_device 1:1; elif ext2ls usb 2:1 /boot/uImage; then setenv usb_device 2:1; elif ext2ls usb 3:1 /boot/uImage; then setenv usb_device 3:1; fi;'

after every boot?

And yes, I'll need to set up netconsole to have a look at uboot.


Thanks
-- crunshy
Re: New uBoot for mtd0 that can still boot original Pogoplug
August 23, 2010 09:58AM
That command is old and doesn't work: ext2ls was wrong, it should have been ext2load.

You can try the updated command that uses ext2load instead of ext2ls. You only have to run it once, not after every boot.

-- Jeff
So here is everything ok?

Pogoplug:/tmp$ fw_printenv
bootcmd=run bootcmd_usb; usb stop; run bootcmd_pogo; reset
bootdelay=3
baudrate=115200
preboot=
arcNumber=2097
mainlineLinux=yes
console=ttyS0,115200
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
bootcmd_pogo=fsload uboot-original-mtd0.kwb; go 0x800200
usb_load_uimage=ext2load usb $usb_device 0x800000 /boot/uImage
usb_boot=if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000;else bootm 0x800000;fi;
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype
bootcmd_usb=run usb_init; run usb_load_uimage; run set_bootargs_usb; run usb_boot;
stdin=serial
stdout=serial
stderr=serial
ethact=egiga0
ethaddr=00:10:75:1A:CE:DB
usb_init=usb start; if ext2load usb 0:1 0x800000 /boot/uImage; then setenv usb_device 0:1; setenv usb_root /dev/sda1; elif ext2load usb 1:1 0x800000 /boot/uImage; then setenv usb_device 1:1; setenv usb_root /dev/sdb1; elif ext2load usb 2:1 0x800000 /boot/uImage; then setenv usb_device 2:1; setenv usb_root /dev/sdc1; elif ext2load usb 3:1 0x800000 /boot/uImage; then setenv usb_device 3:1;setenv usb_root /dev/sdd1;fi;
Thanks Jeff for the new uBoot.
Is working fine for me with Debian on USB-Stick and additional USB-Harddisk.

But I get an error while booting, but Debian and original Pogoplug boots fine.

Hit any key to stop autoboot:  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
** 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: .......  read_nand_cached: error reading nand off 0xff6000 size 8192 bytes                                                                 . done.
read_nand_cached: error reading nand off 0xff5200 size 8192 bytes
off = 0xff4e30 magic 0x1985 type 0xe002 node.totlen = 1437
### JFFS2 load complete: 524288 bytes loaded to 0x800000
## Starting application at 0x00800200 ...

Is this normal?
Re: 8/22/2010 - New uBoot for mtd0 that can still boot original Pogoplug
August 27, 2010 08:45AM
Flip, that's exactly what you should see if you do not have a USB drive attached. It will always try loading USB first, and if that fails (the error message), then it will boot into Pogoplug.
Hi Jeff,
Have you ever experience this problem?

I have successfully flash your Uboot to mtd0 and boot the Debian many times, however, the Seagate Dockstar can not pass this step for this particular USB thumb drive (Transcend 2GB JF V30), I have worked with this system for 1 month and now it can not boot, just stuck here...

U-Boot 2010.06-00695-gbd23130-dirty (Aug 25 2010 - 01:20:45)
Marvell-Dockstar/Pogoplug by Jeff Doozan
Marvell>> ΓΏ

U-Boot 2010.06-00695-gbd23130-dirty (Aug 25 2010 - 01:20:45)
Marvell-Dockstar/Pogoplug by Jeff Doozan

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 3 USB Device(s) found
       scanning bus for storage devices...

BTW, may I have your configuration source for this Uboot version?

Thanks....
Hi Jeff

On loading the uBoot about a month back, something went wrong and my Dockstar no longer boots into the original OS ever. If there is a bootable USB stick, it boots, else nothing happens.

If I have to update the uBoot, can I do it from my current USB stick running Plugbox Linux? As I can't get into the original environment at all.

Do let me know.

msuri

Jeff Wrote:
-------------------------------------------------------
> I've built a new uBoot for mtd0 that supports
> booting the original Pogoplug installation. This
> will fix all of the 'dual boot' problems that some
> of your are experiencing and will fix the boot
> problems related to a bad environment CRC.
>
> The installer saves a copy of the pogoplug uboot
> image to the root directory of the pogoplug
> environment (mtd2). When the new uBoot runs, it
> tries to boot from the USB devices, but if they're
> not found or unbootable, it will load the old
> uBoot image and let that run to boot into the
> original Pogoplug installation.
>
> To upgrade (from the instructions for installing
> mtd0 uBoot):
>
>
> cd /tmp
> wget
> http://jeff.doozan.com/debian/uboot/install_uboot_
> mtd0.sh
> chmod +x install_uboot_mtd0.sh
> ./install_uboot_mtd0.sh
>
>
> I believe this should be a safe and flexible
> solution for everyone.
>
> -- Jeff
I have the same issue here. I can't boot into the original OS, but my debian boots fine from the stick. It wouldn't disturb if I haven't to update the uboot. When my USB-soundcard is plugged in, the Dockstar won't boot. If I plug it off, it boots debian.

Thanks for any help!
One thing I forgotten:

I run following command in the debian OS, found in this forum (should try to boot from first USB stick):

fw_setenv usb_init 'usb start; if ext2load usb 0:1 0x800000 /boot/uImage; then setenv usb_device 0:1; setenv usb_root /dev/sda1; elif ext2load usb 1:1 0x800000 /boot/uImage; then setenv usb_device 1:1; setenv usb_root /dev/sdb1; elif ext2load usb 2:1 0x800000 /boot/uImage; then setenv usb_device 2:1; setenv usb_root /dev/sdc1; elif ext2load usb 3:1 0x800000 /boot/uImage; then setenv usb_device 3:1;setenv usb_root /dev/sdd1;fi;'

I don't know, if this caused the problem.
Re: 8/22/2010 - New uBoot for mtd0 that can still boot original Pogoplug
September 14, 2010 01:06PM
If you are very careful, you can edit the uBoot installer and comment out the Pogoplug environment check. Then you can try running the script from Plugbox.

-- Jeff
Thanks Jeff for your work and fast response!

Am I missunderstand you? I just can boot into debian, not into the original OS or into the uboot (or I don't know how). I can just connect via ssh to the box when it's booted into debian.

Do you mean your mtd0 installer script? I'm a little bit confused, sorry!
Hello again,

I backed up the complete DockStar and I have 3 files named mtd0...mtd2. Is there a chance to write the old mtd0 out of debian to the nand? So I can restore factory settings and install the new uboot via the script!

But I will wait for your answer, because I don't know, how to flash back the backup. ;)
Hi,

hope you can help me.

I tried to use your dual boot uboot loader to boot OpenWRT from flash and Debian from USD HD.

Booting Debian still works fine but OpenWRT won't boot from flash.

Here is the console output:

U-Boot 2010.06-00695-gbd23130-dirty (Aug 30 2010 - 23:04:56)
Marvell-Dockstar/Pogoplug by Jeff Doozan

SoC:   Kirkwood 88F6281_A0
DRAM:  128 MiB
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  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
** 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.
find_inode failed for name=uboot-original-mtd0.kwb
load: Failed to find inode
### JFFS2 LOAD ERROR<0> for uboot-original-mtd0.kwb!
## Starting application at 0x00800200 ...

.g23
Jeff... I'm sorry I also didn't understand what you meant by this suggestion. How can one carefully upgrade to the new uBoot only from the Plugbox Linux environment?

UltraZ.. did you mange any resolution?

-msuri
@msuri: No, up to now I have no idea. I'm looking for a solution to flash back the old uboot (but I'm scared, when the flash fails no booting will be possible)

Here's the printout of fw_printenv. How it helps.

root@debian:~# fw_printenv
bootcmd=run bootcmd_usb; usb stop; run bootcmd_pogo; reset
bootdelay=3
baudrate=115200
preboot=
arcNumber=2097
mainlineLinux=yes
console=ttyS0,115200
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
bootcmd_pogo=fsload uboot-original-mtd0.kwb; go 0x800200
usb_boot=if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000;else bootm 0x800000;fi;
set_bootargs_usb=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts
bootcmd_usb=run usb_init; run usb_load_uimage; run set_bootargs_usb; run usb_boot;
ethact=egiga0
stdin=serial
stdout=serial
stderr=serial
usb_load_uimage=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage
ethaddr=00:10:75:1A:CE:E6
usb_init=usb start; if ext2load usb 0:1 0x800000 /boot/uImage; then setenv usb_device 0:1; setenv usb_root /dev/sda1; elif ext2load usb 1:1 0x800000 /boot/uImage; then setenv usb_device 1:1; setenv usb_root /dev/sdb1; elif ext2load usb 2:1 0x800000 /boot/uImage; then setenv usb_device 2:1; setenv usb_root /dev/sdc1; elif ext2load usb 3:1 0x800000 /boot/uImage; then setenv usb_device 3:1;setenv usb_root /dev/sdd1;fi;

@g23: It appears that you have erased/modified the mtd2 partition. That's where the u-boot update script stored the backup of the original boot loader. The boot procedure of the new boot loader is to try USB first. If that fails, it doesn't boot the internal flash: It loads the original boot loader from the jffs2 filesystem in mtd2 and starts it. The original boot loader then reads its old environment and boots accordingly, which means it loads 3MB from mtd1 to be used as a kernel image and passes root=/dev/mtdblock2 to it.

If you don't want to mess with the bootloaders, you have to make your alternative OS match that setup, i.e. u-boot Linux kernel image in mtd1 and root filesystem in mtd2, no initial ram disk. Otherwise you have to modify the boot scripts in one of the boot loaders to load your kernel image (and initial ram disk) differently and pass appropriate parameters to it. To be on the safe side, have a working USB-installed system with the tools for modifying the boot loader environments handy and don't touch the boot order (in "bootcmd") or the USB boot scripts (in "bootcmd_usb" and "usb_...") in the new boot loader environment. Only change the secondary boot script ("bootcmd_pogo"), and only do it this way because you've already cut the old boot loader off anyway.
@g23: Here is my fix to use OpenWRT on the DockStar.

Add this line to the environment:

bootargs_root=root=/dev/mtdblock2 ro

Change the variable bootcmd_pogo to look like this:

bootcmd_pogo=nand read.e 0x800000 0x100000 0x300000; setenv bootargs $(bootargs_root); bootm 0x800000

This copies 3 MByte from Flash memory 0x100000 (kernel image) to RAM at 0x800000, sets the bootargs environment variable to use /dev/mtdblock2 as the (read-only) root filesystem and starts the kernel at 0x800000.

This way you can boot OpenWRT without a USB memory stick or HD plugged in and Debian (or any other OS) from USB. It would have been easier to find this out if the original bootcmd would have been saved in the environment when the new U-Boot was installed.

Hope it helps.

BTW: I haven't found out why I can't restore mtd1 and mtd2 with the original Pogoplug software which I have saved prior to installing the new U-Boot in mtd0 via nanodump. As I am only using netconsole and not a serial connection, I only see that the kernel gets started and then nothing more happens. No DHCP request, no LED blinking, it's just dead. With the OpenWRT images in place, everything works fine. Any ideas?
Hi
After Install uBoot i can`t Boot from the Dockstar Nand :/
Only from USB Stick can i Boot.

Error Outputt
=~=~=~=~=~=~=~=~=~=~=~= PuTTY log 2011.08.05 18:22:00 =~=~=~=~=~=~=~=~=~=~=~=

U-Boot 2010.09 (Oct 23 2010 - 11:49:22)
Marvell-Dockstar/Pogoplug by Jeff Doozan

SoC: Kirkwood 88F6281_A0
DRAM: 128 MiB
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot: 3 2 1 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-0x000010000000 : "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 error: vtbl_check: volume table check failed: record 0, error 9
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
UBI init error -22
** 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.

find_inode failed for name=uboot-original-mtd0.kwb

load: Failed to find inode

### JFFS2 LOAD ERROR<0> for uboot-original-mtd0.kwb!
### JFFS2 loading 'uboot-original-mtd0.kwb' to 0x800000
Scanning JFFS2 FS: done.

find_inode failed for name=uboot-original-mtd0.kwb

load: Failed to find inode

### JFFS2 LOAD ERROR<0> for uboot-original-mtd0.kwb!
resetting ...
Re: 8/22/2010 - New uBoot for mtd0 that can still boot original Pogoplug
December 25, 2011 10:57AM
Attempted to install Debian using the instructions http://jeff.doozan.com/debian onto the Pogoplug Biz

First, some sysinfo....

Pogoplug:/tmp$ uname -a
Linux Pogoplug 2.6.22.18 #81 Tue Oct 19 16:05:00 PDT 2010 armv5tejl unknown

Pogoplug:/tmp$ mount
rootfs on / type rootfs (rw)
/dev/root on / type jffs2 (ro)
none on /proc type proc (rw)
none on /sys type sysfs (rw)
none on /dev/pts type devpts (rw)
none on /tmp type tmpfs (rw)
none on /proc/bus/usb type usbfs (rw)

Pogoplug:/tmp$ cat /etc/fstab
proc            /proc   proc    defaults    0   0
devpts         /dev/pts    devpts     gid=4,mode=620 0    0

Pogoplug:/tmp$ /sbin/fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 2004 MB, 2004877312 bytes
62 heads, 62 sectors/track, 1018 cylinders
Units = cylinders of 3844 * 512 = 1968128 bytes

   Device Boot      Start         End      Blocks  Id System
/dev/sda1               1         759     1458767  83 Linux
/dev/sda2             760        1018      497798  82 Linux swap


When I attempted to run the shell script, it did not look pretty as almost every file appears to have been corrupted that was downloaded.

After the Debian installation failed, I tried to reboot back into the Cloud Engine software to recognize a FAT16 or FAT32 drive, but that fails too.

Thankfully the device is not bricked, but how can I restore the original settings so that it acts like a normal Pogo again.

You'd think finding the way to restore the uboot would be easier that this. Talk about unmerry-xmas to me.
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: