Installing OpenWrt on NAND can be done by simply booting the initramfs image, and then doing a sysupgrade. It will write the firmware on NAND.
Then the uboot must be configured to also boot OpenWrt. The easy way would be to install the OpenWrt uboot, which is already configured.
OMG, bodhi went off the rails with his uboot scripting there... it's much more complex than the last time I installed on my devices, but that's not an issue here.
Assuming you want to keep also the ability to boot Debian, which is probably why you aren't just installing OpenWrt uboot, you will need to change the uboot configuration with the following commands.
From the serial console of uboot you use setenv, from debian you use fw_setenv command, if you write these from uboot console with setenv then you must save the config to flash with saveenv, if you use fw_setenv from Debian the config is written to flash automatically
WARNING: I cannot guarantee 100% that this will work as I cannot test it, but according to my experience it should work, and even if it does not the uboot will still try to boot Debian first, so if booting OpenWrt fails you can post here again without having to solder serial console or opening the case.
So these are the commands:
fw_setenv mtdparts 'mtdparts=orion_nand:0x1c0000(uboot),0x40000(uboot_env),0x7e00000(ubi)'
fw_setenv owrt_bootargs 'setenv bootargs'
fw_setenv owrt_bootcmd 'run owrt_bootargs ; usb reset ; fatload usb 0:1 0x2000000 initramfs.bin ; bootm 0x2000000 ; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000'
fw_setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec ; run owrt_bootcmd'
First line tells uboot the flash partitions used by OpenWrt, which is required if you want to boot OpenWrt at all.
Second line prepares a uboot command to clear Debian bootargs before loading OpenWrt. This is called by the third line.
Third line does these things:
-
it calls the second line to clear bootargs as OpenWrt does not need any, and the Debian ones would break it.
-
it sets the uboot for looking on a FAT32-formatted usb drive for a file called "initramfs.bin" and if it finds it then will load and execute it (this is basically a recovery feature, so in case you brick the firmware you just place a initramfs firmare on a USB flash drive and rename it "initramfs.bin" to get it loaded, and from there you can reflash or do whatever. This is what the OpenWrt uboot also does and I think is convenient.
-
If it does not find such file on USB it will actually try to boot OpenWrt from NAND flash.
The last line modifies the current bootcommand of your uboot so that FIRST it will do what it is doing already (i.e. search for Debian and try to load it), THEN if it fails to load Debian it will execute the OpenWrt boot sequence I set on line 3.
Now, the boot will take 3-4 seconds if the uboot only needs to execute my configuration, I don't know how fast is bodhi's configuration.
What I know is that his boot delay is very long. that uboot will wait 10 seconds for no reason, on boot.
Unless you have a reason to have it sit there doing nothing for 10 seconds on boot (in addition to the time it will actually use to boot Debian or OpenWrt), lower this wait to 2 seconds (which is plenty time to stop it and get into uboot console if you have serial access) with
fw_setenv bootdelay 2
After you did these uboot configuration changes power off the device, pull the power plug and wait 5 seconds to be sure that the RAM is wiped. For some reason just rebooting after an uboot settings change could not work well and quite a few times it would just fail to boot OpenWrt because it is passing garbage bootargs and OpenWrt kernel would fail to find the firmware on flash.
This happened on any Kirkwood device I have, isn't specific of this Pogoplug.
But whatever, just pull the plug and wait 5 seconds before powering up again, and it will be fine.