Welcome! Log In Create A New Profile

Advanced

Conditionally boot with PogoPlug original U-boot?

Posted by johnklos 
Conditionally boot with PogoPlug original U-boot?
January 07, 2014 04:43AM
Hi,

I've figured out that if I write my NetBSD kernel into the 8 meg to 16 meg section of a PogoPlug Mobile's flash (the area referred to as "failsafe"), the PogoPlug's GNU/Linux can still boot just fine. So I'm wondering if anyone has recommendations for how I might selectively boot based on some external thing - absence or presence of a USB device, perhaps, but using just the original U-boot. I'd only want to select between:
bootcmd 'nand read.e 0x800000 0x800000 0x800000; bootm 0x800000'
and
bootcmd 'run boot_nand'
Since NetBSD doesn't have a working NAND driver yet, this would make it possible to boot into GNU/Linux for the purpose of writing NAND without needing a serial cable.

Suggestions?
Re: Conditionally boot with PogoPlug original U-boot?
January 20, 2014 10:46PM
Just check for a file or directory on a USB drive as the trigger to boot into NetBSD.

Something like this will see if the directory /netbsd exists on first usb device, and boot NetBSD from nand if it does.
boot_nand=if fatls usb 0:1 /netbsd; then nand read.e 0x800000 0x800000 0x800000; bootm 0x800000; fi

I find using fatls to check for a directory cleaner than using fatload to load a file or a single byte of a file but either are your choices.



Edited 1 time(s). Last edit at 01/20/2014 10:46PM by kraqh3d.
Re: Conditionally boot with PogoPlug original U-boot?
January 24, 2014 03:38AM
Thanks. That's a step in the right direction, but how do I do that from within the GNU/Linux that comes with the PogoPlug? I can fetch the tools (http://download.doozan.com/uboot/fw_printenv, http://download.doozan.com/uboot/fw_env.config), but the fw_env.config isn't right. ./fw_printenv shows:
Warning: Bad CRC, using default environment
bootcmd=bootp; setenv bootargs root=/dev/nfs nfsroot=${serverip}:${rootpath} ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}::off; bootm
bootdelay=5
baudrate=115200
Obviously the downloaded fw_env.config is intended for the replacement u-boot, not for the built-in u-boot. Does anyone know what the values are for fw_env.config for the default u-boot of the out of the box PogoPlug? Is it the same for all PogoPlugs, or do they have different fw_env.configs?

Thanks!
Re: Conditionally boot with PogoPlug original U-boot?
January 24, 2014 05:46AM
The original Pogoplug uBoot envs is at 0xa0000. The new uBoot uses 0xc0000. Also, for the Pogo Mobile original uBoot, blparam must be used, not fw_setenv and fw_printenv.

You can find blparam in the Pogo OS rootfs (iirc, it's under /usr/local/cloudengines/bin). The syntax is slightly different, and blparam calculates a different checksum for the envs, so dont use fw_setenv.

Here is an example of using blparam with original or ALARM uBoot:
http://forum.doozan.com/read.php?3,11538

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 01/24/2014 11:07AM by bodhi.
Re: Conditionally boot with PogoPlug original U-boot?
January 24, 2014 03:52PM
Thanks, bodhi! That's perfect. Now it can be done 100% from within GNU/Linux.

I wrote up some notes and would appreciate any feedback. The actual installation of NetBSD will be in a separate set of notes.

NetBSD on PogoPlug notes

Are all PogoPlugs configured from factory to the same 192.168.58.x network? I noticed that the netmask is 255.255.0.0, but I don't think people should create an alias with such a large netmask because some people will already be using another 192.168 network.

Does anyone know how to read the state of the eject button in u-boot? Testing for a live IP is easy, but I'm curious if the button can be read.



Edited 1 time(s). Last edit at 01/24/2014 05:31PM by johnklos.
Re: Conditionally boot with PogoPlug original U-boot?
January 25, 2014 10:24AM
johnklos,

> Are all PogoPlugs configured from factory to the
> same 192.168.58.x network? I noticed that the
> netmask is 255.255.0.0, but I don't think people
> should create an alias with such a large netmask
> because some people will already be using another
> 192.168 network.
>

No. 192.168.58.x is the local network IP subnet determined by your router. It is not visible outside your local network.

> Does anyone know how to read the state of the
> eject button in u-boot? Testing for a live IP is
> easy, but I'm curious if the button can be read.

It can be read and trigger events easily inside Linux. I don't think the Pogo Mobile original uBoot supports the button input event trigger.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Conditionally boot with PogoPlug original U-boot?
January 25, 2014 02:13PM
The IP was actually in the u-boot environment before I changed anything (I kept a copy of the original output):
ceboardver=PPV4A1
ipaddr=192.168.58.233
serverip=192.168.58.188
bootargs=console=ttyS0,115200 root=ubi0:rootfs ubi.mtd=4,2048 rootfstype=ubifs
bootcmd=run boot_nand
I can live with the ping test since the button isn't supported in u-boot. We'll see how much the notes need to be changed when I get the PogoPlug Series 4 and PogoPlug v2 (the pink one).

Thanks!
Re: Conditionally boot with PogoPlug original U-boot?
January 31, 2014 12:57PM
johnklos Wrote:
-------------------------------------------------------
> The IP was actually in the u-boot environment
> before I changed anything (I kept a copy of the
> original output):

> ipaddr=192.168.58.233
> serverip=192.168.58.188

These are not relevant if you're not running tftp, nfs, or netconsole (these values are not default, but most likely were set by the installer). They should be changed to whatever your network subnet is (192.168.x.x, 10.10.x.x) before running tftp, netconsole, or nfs.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 01/31/2014 12:58PM by bodhi.
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: