Welcome! Log In Create A New Profile

Advanced

Pogoplug Mobile - Booting default Pogoplug OS in NAND

Posted by grayman4hire 
Pogoplug Mobile - Booting default Pogoplug OS in NAND
July 16, 2014 12:11PM
Hello,

Quick disclaimer, I'm new to uBoot and Linux booting so please bare with me.

I've been looking into booting the default Pogoplug OS from davygravy's uboot. Basically I'm looking for similar functionality of the Pogoplug E02, where if you don't have anything plugged in, the Pogoplug will boot back into its default OS. This feature is useful for rebuilding a corrupt usb drive, but more importantly I'm just looking to better understand the uboot process.

I found the original thread where Jeff explains the method he uses for the Pogoplug E02 - http://forum.doozan.com/read.php?3,210,214

Quote

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.

Here is "pogo_bootcmd" uboot environment variable/command used to boot the "copy of the pogoplug uboot image"
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi

I got a few questions:

1) How do I create the "uboot-original-mtd0.kwb" file (containing the original Pogoplug Mobile uboot)? From looking at Jeff's installation script, the uboot-original-mtd0.kwb file is downloaded from his server.

Using my E02 as a base test unit, I tried the following command. However the md5 on the kwb file didn't match the one Jeff provides and my Pogoplug E02 failed to boot into the default Pogoplug OS.
nanddump --noecc --omitoob -l 0x80000 -f /uboot-original-mtd0_2.kwb /dev/mtd0

I got the command from Jeff's uBoot installation script
# dump the first 512k of mtd0 to /tmp
$NANDDUMP --noecc --omitoob -l 0x80000 -f /tmp/uboot-mtd0-dump /dev/mtd0

I'm a little confused why he doesn't use this mtd0 backup versus downloading the kwb file, so I suspect there is a difference between the nand dump and kwb file he provides.

2) In the "pogo_bootcmd", how does the fsload command ("fsload uboot-original-mtd0.kwb") know where (what mtd partition) to load the kwb file from? Also, what does the address "0x800200" mean or referring to?

Thanks



Edited 1 time(s). Last edit at 07/16/2014 01:09PM by grayman4hire.
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
July 16, 2014 01:21PM
Hi gray,

I have not looked at moonman's approach to run Pogoplug services from ALARM at Arch site, but I suspect that he did not run stock u-boot. The problem with trying to load and run stock u-boot from a much newer u-boot (ie. davygravy's image) in NAND is most likely it won't work or works inconsistently. The binaries are too different in structure.

- "fsload uboot-original-mtd0.kwb" simply searches for a rootfs in NAND partitions and load from one with this file in the root directory.
- the address "0x800200" is where the actual u-boot binary starts (200 is for the Kirkwood header). All Kirkwood u-boot images have this header, which was written by mkimage when we build it from a vanila u-boot executable.

So the bottom line is if you've installed newer u-boot in NAND mtd0, it is best to look at moonman's approach.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
July 16, 2014 04:39PM
Thanks for the reply @bodhi.

Sorry, I'm a little confused what moonman's approach to running the my.pogoplug.com service has anything to do with this thread (I did ask about porting it to Debian in another thread though - http://forum.doozan.com/read.php?2,16449 - should be possible too i think). Moonman's my.pogoplug.com service is just a Arch Linux package which wraps up some binaries from CloudEngine and has nothing to do with the uBoot (expect that you need a newer/modified uboot to boot ALARM on the Pogoplug).

I was very surprise to learn that Jeff's solution (to booting the default Pogoplug OS on the PP E02) was to load the original uBoot image stored on the nand filesystem (created by the installation script), which then boots the original Pogoplug OS (and uses the original blparam uboot variables). Very elegant solution.

I'm just looking to reproduce the same solution on the Pogoplug Mobile.
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
July 16, 2014 06:15PM
Hi gray,

I thought the reason you want to boot Pogo OS is to use the service, then do what moonman did is better. But if you're only looking for way to boot back to Pogo OS as a rescue system then, yes, moonman's method is not applicable here.

Yes, Jeff's approach is very elegant. However, it might no longer work in your situation, as I explained above:

Quote

The problem with trying to load and run stock u-boot from a much newer u-boot (ie. davygravy's image) in NAND is most likely it won't work or works inconsistently. The binaries are too different in structure.

What you would probably need to do is to change u-boot envs to boot the Pogo OS from your currently installed u-boot. You could do this in netconsole without commiting the changes to NAND. Once it works, then set the envs for real in Debian/Arch.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
July 16, 2014 08:10PM
Thanks for the clarification and sorry for the confusion.

Booting the default Pogoplug OS is a nice to have (and for educational purposes), but ultimately I would prefer to boot a debian or openwrt based rescue system straight from NAND.
Following up the discussion I need to ask for a solution where I got stuck.
Got a used pogo E02 (due to RAM) and updated to uboot 2016.05
It boots debian without any problems from USB but don't get stock OS chainload to work.
I put "uboot.mtd0.dockstar.original.kwb" on / in original OS and started with env:
/tmp/fw_setenv bootcmd_pogo 'if ubi part root 2048 && ubifsmount ubi:rootfs && ubifsload 0x800000 uboot.mtd0.dockstar.original.kwb ; then go 0x800200; fi'
which works for Pofo v4 and mobile but is not found by uboot
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
produces nc output:
U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:23:43 -0700)
Pogo E02
gcc (Debian 4.9.2-10) 4.9.2
GNU ld (GNU Binutils for Debian) 2.25
Hit any key to stop autoboot:  0
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'

no USB devices available
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'
running scan_disk ...
Scan device usb
device usb 0:1
** Bad device usb 0 **
device usb 1:1
** Bad device usb 1 **
device usb 2:1
** Bad device usb 2 **
device usb 3:1
** Bad device usb 3 **
Scan device ide
Unknown command 'ide' - try 'help'
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
device ide 2:1
** Bad device ide 2 **
device ide 3:1
** Bad device ide 3 **
Scan device mmc
Unknown command 'mmc' - try 'help'
device mmc 0:1
** Bad device mmc 0 **
device mmc 1:1
** Bad device mmc 1 **
device mmc 2:1
** Bad device mmc 2 **
device mmc 3:1
** Bad device mmc 3 **
loading uImage ...
** Bad device usb 0 **
loading uInitrd ...
** Bad device usb 0 **
loading DTB ...
** Bad device usb 0 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!
### 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 ...
LED keeps blinking orange and unit doesn't boot. So I'm stuck at this point, don't know what I did wrong. Do I need another kwb?
And is there a way to get rid off invalid commands?
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
October 24, 2016 05:59PM
1. You should have saved this Pogo E02 mtd0 as the original uboot! It is always better to use the uboot on the same box (unless you already flashed new uboot and did not backup mtd0).

2. How did you copy this file uboot.mtd0.dockstar.original.kwb to / ? Log into stock OS?

-bodhi
===========================
Forum Wiki
bodhi's corner
All right, thank you bodhi, that was the problem that I didn't backup mtd0.
I followed this thread: Hacking the Pogoplug v4 (Series 4 and Mobile) with Linux (Debian or Arch)
with modification out of your thread 2016.05 U-Boot Kirkwood to have latest default envs and uboot. Worked for pogo v4 and mobile I have.
So I did all the steps under stock OS and put original kwb to / in pogo stock OS.
As far as I can interpret NC output it loads the file but either image or entry address is wrong.
Do you recommend to look for original E02 mtd0 image (didn't find up to now) or modify envs?

Thanks for your input
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
October 25, 2016 12:54PM
Preacher,

I'll find my original Pogo E02 mtd0 for you.

But first, boot into Debian and check for bad blocks, see if there is any:

dmesg | grep -i bad

-bodhi
===========================
Forum Wiki
bodhi's corner
dmesg gives:
[    1.708518] Scanning device for bad blocks
[    1.777365] Bad eraseblock 849 at 0x000006a20000
[    1.785100] Bad eraseblock 890 at 0x000006f40000
[    1.791521] Bad eraseblock 914 at 0x000007240000
Glad if you could help me out with E02 original kwb
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
October 26, 2016 05:11PM
Preacher,

Here is the original Pogo E02 u-boot. Post if you need helps copying this stock u-boot to your stock rootfs.

After you've booted in to stock OS, remmember to adjust the MAC address, Pogo cevsid and serial number to your own box!

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 1 time(s). Last edit at 10/26/2016 05:13PM by bodhi.
Attachments:
open | download - uboot-original-mtd0.kwb (512 KB)
Thank you so much Bodhi!
Actually I have a problem, as far as I can remember I could mount internal flash on pogoplug mobile via mount command, but in E02 I can't.
I see mtd0 - mtd3 in /dev, when trying to mount the command says it isn't a block device.
So I'd be glad if you could give me a hint how to copy the kwb to stock rootfs.
How to adjust MAC and cevsid then?

Thanks, preacher
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
November 01, 2016 07:43PM
Preacher Wrote:
-------------------------------------------------------
> Thank you so much Bodhi!
> Actually I have a problem, as far as I can
> remember I could mount internal flash on pogoplug
> mobile via mount command, but in E02 I can't.
> I see mtd0 - mtd3 in /dev, when trying to mount
> the command says it isn't a block device.
> So I'd be glad if you could give me a hint how to
> copy the kwb to stock rootfs.
> How to adjust MAC and cevsid then?
>
> Thanks, preacher

Are you using different versions of the kernel for the 2 boxes? on PogoE02:
lsblk

It mtd blocks are activated, you should see those listed.

-bodhi
===========================
Forum Wiki
bodhi's corner
Seems that internal flash does not show up. Kernel is from your post.
root@DebiPlug:~# lsblk
NAME   MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda      8:0    1  3,8G  0 disk
└─sda1   8:1    1  3,8G  0 part /

root@DebiPlug:~# uname -a
Linux DebiPlug 3.18.5-kirkwood-tld-1 #1 PREEMPT Thu Feb 5 17:58:07 PST 2015 armv5tel GNU/Linux

mtd-utils is already the newest version (1:1.5.2-1).

What I just thought was that I baked the "kirkwood-pogoplug_v4.dtb" into Linux image as described. Funny that it boots without any problem on the E02. May this be the reason why blockdevices are not found?
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
November 01, 2016 11:50PM
Preacher,

> What I just thought was that I baked the
> "kirkwood-pogoplug_v4.dtb" into Linux image as
> described. Funny that it boots without any problem
> on the E02. May this be the reason why
> blockdevices are not found?

No really, if you have mtdparts in bootargs then it take precendent over what is in DTB. But you should remove that and use the Pogo E02 DTB.


Verify it by:

cat /proc/cmdline
fw_printenv

If mtdparts is specified already, try

modprobe mtdblock
BTW, kernel 3.18.5 is a little bit old. So mtdblock was a module, unlike the latest kernel it is built into the kernel.

-bodhi
===========================
Forum Wiki
bodhi's corner



Edited 3 time(s). Last edit at 11/02/2016 12:01AM by bodhi.
Thank you so much bodhi, could mount internal flash and found that I'm a stupid person.
There was a mismatch between filename in rootfs and env!!!
The only thing that's funny now is that first i corrected filename and could login through ssh immediately.
Then I changed to the original file I got from you and didn't work, also not when changing bak to initial file.
Now I can login through telnet (23) but not ssh (22). But don't mind

Sorry for bothering you wit my stupidness!
Re: Pogoplug Mobile - Booting default Pogoplug OS in NAND
November 02, 2016 02:35PM
Preacher Wrote:
-------------------------------------------------------
> Thank you so much bodhi, could mount internal
> flash and found that I'm a stupid person.
> There was a mismatch between filename in rootfs
> and env!!!
> The only thing that's funny now is that first i
> corrected filename and could login through ssh
> immediately.
> Then I changed to the original file I got from you
> and didn't work, also not when changing bak to
> initial file.
> Now I can login through telnet (23) but not ssh
> (22). But don't mind
>
> Sorry for bothering you wit my stupidness!

Oh no problem :)

In stock OS, check to see dropbear is running, if it is not then SSH is not available.

-bodhi
===========================
Forum Wiki
bodhi's corner
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: