Welcome! Log In Create A New Profile

Advanced

install u-boot on Pogoplug Pro from OpenWrt

Posted by Koen 
install u-boot on Pogoplug Pro from OpenWrt
March 28, 2020 07:02PM
Hi,

I bought a pogoplug pro on ebay recently and decided to install OpenWrt on it. I played around with it for a bit but quickly realised that the current release of OpenWrt does not expose the internal sata port and I also had problems using different wifi cards in the pcie slot. So I decided to look into updating uboot to bohdi's version as released on the forum here to be able to run Debian on it. This was a bit more difficult than expected so I'll outline the process below which may be useful to others. This has worked for me but everything you do is at your own risk so please read the whole post and only continue if you understand the process. Messing up your uboot install will probably result in a brick so you have been warned.

The starting point is a pogoplug pro with OpenWrt 19.07.2 installed, a working serial connection and a 64 bit linux machine / VM.

OpenWrt on the Pogoplug Pro uses the following layout of the mtd:

0x000000000000-0x000000040000 : "stage1"
0x000000040000-0x0000003c0000 : "u-boot"
0x0000003c0000-0x000000440000 : "u-boot-env"
0x000000440000-0x000000e00000 : "kernel"
0x000000e00000-0x000008000000 : "ubi"


        hex           bytes           eraseblocks
mtd0    40000       262144         2          
mtd1    380000     3670016       28
mtd2    80000       524288         4
mtd3    9c0000     10223616     78
mtd4    7200000   119537664   912


To be able to flash bohdi's uboot and environment to nand you will need write access to mtd0 and mtd1. Unfortunately OpenWrt has mtd0 and mtd1 set to 'read only' by default which means it is not possible to flash uboot from the default OpenWrt install. So the first thing you need to do is to build a custom OpenWrt image which does not set mtd0 and mtd1 to 'read only'.

The following guides give a good description how to build your own custom OpenWrt image:

https://openwrt.org/docs/guide-developer/quickstart-build-images

https://openwrt.org/docs/guide-user/additional-software/beginners-build-guide

Follow these guides to setup your 64 bit linux build system / VM, download the sources and checkout branch 19.07.2

One thing to remember is that a manual / custom build of OpenWrt does not allow you to download the different prebuilt packages due to difference in 'vermagic'. The following page gives a good description how to compile a custom version of OpenWrt which still allows you to use the official openwrt package repository:

https://hamy.io/post/0015/how-to-compile-openwrt-and-still-use-the-official-repository/

It is important to do this since some additional packages are needed to be able to write uboot to nand.

Once you have setup the OpenWrt build environment and created the correct configuration a change in the OpenWrt dts file is needed to make sure mtd0 and mtd1 are writable. Open the dts file in the following folder and remove the 'read only' settings of mtd0 and mtd1 in the dts file. openwrt/target/linux/oxnas/files/arch/arm/boot/dts/ox820-cloudengines-pogoplugpro.dts Once that has been done save the dts file and continue with building your custom OpenWrt image. This may take a while depending on the speed of your build PC.

The build should complete OK and you will have a custom sysupgrade image for the pogoplug pro with the same 'vermagic' as the official builds. Now log into the luci webinterface or use ssh to connect to the device and run sysupgrade using your custom image. Once this finishes the device will reboot and you can connect via ssh / serial port again. (You may have to pull the power plug to force a reboot)

Use ssh or serial to connect to your custom OpenWrt on the pogoplug. Run the following commands to to update the openwrt package list and install the nand-utils package.

opkg update
opkg install nand-utils

Check the output of the following commands which should say that mtd0 and mtd1 are now writable.

mtdinfo /dev/mtd0
mtdinfo /dev/mtd1

Copy bodhi's pogoplug pro uboot archive to the /tmp directory (RAM) on the pogoplug. Change to the /tmp directory and extract the archive:

cd /tmp
tar xvf uboot.2015.10-tld-2.ox820.bodhi.tar

Now it is time to erase part of the nand flash and write the new uboot files there. It is important that you do not switch off the device until you have done all the steps below or you will probably end up with a brick.

Erase 2 blocks on mtd0 and write spl file to it:

flash_erase /dev/mtd0 0x0 2
nandwrite /dev/mtd0 uboot.spl.2013.10.ox820.850mhz.mtd0.img

Erase 8 blocks on mtd1 and write uboot and the environment to it:

flash_erase /dev/mtd1 0x0 8
nandwrite /dev/mtd1 uboot.2015.10-tld-2.ox820.mtd0.img
nandwrite -s 786432 /dev/mtd1 uboot.2015.10-tld-2.ox820.environment.img

Assuming you dont get any erors the new uboot and environment have been written to nand. When you reboot the device the serial console output should show it is now running bohdi's uboot:

U-Boot SPL 2013.10-tld-4 (Sep 07 2014 - 14:10:12)
  Boot device: NAND
Attempting to set PLLA to 850 MHz ...
  plla_ctrl0 : 0000020a
  plla_ctrl1 : 00330000
  plla_ctrl2 : 0065008b
  plla_ctrl3 : 000000f1

PLLA Set

U-Boot 2015.10-tld-2 (Oct 21 2017 - 22:00:02 -0700)
OXNAS OX820

Now you can connect your USB or sata drive with the Debian rootfs and it should boot into debian. You can also boot back into your custom OpenWrt in nand (as a sort of rescue system) by using the following command:

nboot 60500000 0 440000; bootm

Koen



Edited 3 time(s). Last edit at 03/28/2020 07:10PM by Koen.
Re: install u-boot on Pogoplug Pro from OpenWrt
March 28, 2020 09:21PM
Nicely done Koen!

I'll add this to the Wiki thread.

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: install u-boot on Pogoplug Pro from OpenWrt
March 28, 2020 09:26PM
Wiki thread:

Quote
https://forum.doozan.com/read.php?2,23630,23630#msg-23630

Booting Debian on Pogoplug

How to set up U-Boot for booting in multiple drives configuration
Backup and Restore NAND mtds
UART Booting HowTo for Selected Kirkwood Devices
Migrating from Arch to Debian?
How to boot new Debian rootfs using stock u-boot tftp - Pogo E02
How to boot new Debian rootfs on USB using stock u-boot - NSA325
How to boot Debian rootfs on a GPT HDD with stock u-boot (kernel files stored in HDD raw sector), 2nd HowTo post
How to boot Pogo V3 from SATA (to unbrick), 2nd How to Post
How to install U-Boot for Pogoplug V3 (OXNAS OX820) from OpenWRT

-bodhi
===========================
Forum Wiki
bodhi's corner
Re: install u-boot on Pogoplug Pro from OpenWrt
March 29, 2020 07:25AM
bodhi Wrote:
-------------------------------------------------------
> Nicely done Koen!
>
Indeed. Thank you, Koen.
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: