Tuesday, April 06, 2021

Installing Debian Buster to Pogoplug/Dockstar/Seagate GoFlexNet

Installing Debian Buster to Pogoplug/Dockstar/Seagate GoFlexNet

I found that my old dockstars/Pogoplugs (and other similar devices) were running outdated Linux versions (Wheezy) and wanted to update them... A visit to the usual sites like doozan.com had lots of varying instructions, and I made this blog post to consolidate all the instructions and the steps I made to upgrade mine to Debian Buster. Your dockstar/pogoplug compatible device should be accessible as root, and this post doesn't include the instructions to hack your device to allow booting with root. 

Some of my devices have missing USB drives but were able to boot with the drives from different devices (I was able to use the drive from my dockstar with GoFlexNet) and some had rescue boot installed so I was able to work it when I wasn't able to use the boot drive... The instructions here does not include how to install rescue boot but I will figure it out later.

Some the links I posted here are direct links that may change in time, so if the links do expire, visit https://forum.doozan.com/read.php?2,12096 for the current links.

Part 1 would be instructions to install UBoot (which is basically the "firmware"), while Part 2 would be instructions on preparing your usb drive (or SD Card or SATA drive for Pogoplug V4) with Debian Buster(OS)....

Part 1 - Preparing Uboot

Flashing uBoot

Dockstar
wget https://www.dropbox.com/s/8n5c2fzgpoxgk39/uboot.2017.07-tld-1.dockstar.bodhi.tar --no-check-certificate

GoflexNet
wget https://www.dropbox.com/s/b7ac42royuow72q/uboot.2017.07-tld-1.goflexnet.bodhi.tar --no-check-certificate

GoFlexHome
wget https://www.dropbox.com/s/klksl0vawkhie9r/uboot.2017.07-tld-1.goflexhome.bodhi.tar --no-check-certificate

Pogoplug E02
wget https://www.dropbox.com/s/vgbshmiq3o14btp/uboot.2017.07-tld-1.pogo_e02.bodhi.tar --no-check-certificate

Pogoplug V4
wget https://www.dropbox.com/s/6k3a80jqdplpkeg/uboot.2017.07-tld-1.pogo_v4.bodhi.tar --no-check-certificate


Flashing Instructions

1. get your ethernet addr:
fw_printenv ethaddr

2. Save it in a text file for later use (00:10:75:1A:3C:B5)

3. Save the contents of your environment:
fw_printenv > current_envs.txt

4. Dump Nand mtd0:
nanddump --noecc --omitoob -l 0x80000 -f mtd0 /dev/mtd0

If you don't have nanddump, install it using apt-get install mtd-utils
else

cd /tmp
wget http://download.doozan.com/uboot/nanddump
wget http://download.doozan.com/uboot/nandwrite
wget http://download.doozan.com/uboot/flash_erase
chmod +x nanddump nandwrite flash_erase

5. Make sure you don't have bad block from 0 to 7

Be sure there is no bad block in the first 1M of your NAND (check dmesg). This is very important, if there is bad block in the first 1M (8 blocks), don't flash u-boot, because you will almost certainly brick your box. Please post your question here (there is a work around for it).

Example of bad block in mtd0:

dmesg | grep -i 'bad'

[    2.413231] Scanning device for bad blocks
[    2.417731] Bad eraseblock 3 at 0x000000060000

This bad block is the 4th block which resides within mtd0 (block 0 to block 7). So u-boot should not be flashed.

6. Extract archive to /tmp (use the tar file you downloaded for your version of device)
cd /tmp
tar -xf uboot.2017.07-tld-1.dockstar.bodhi.tar
tar -xf uboot.2017.07-tld-1.goflexhome.bodhi.tar
tar -xf uboot.2017.07-tld-1.goflexnet.bodhi.tar
tar -xf uboot.2017.07-tld-1.iconnect.bodhi.tar
tar -xf uboot.2017.07-tld-1.netgear_ms2110.bodhi.tar
tar -xf uboot.2017.07-tld-1.pogo_e02.bodhi.tar
tar -xf uboot.2017.07-tld-1.pogo_v4.bodhi.tar
tar -xf uboot.2017.07-tld-2.sheevaplug.bodhi.tar
tar -xf uboot.2017.07-tld-1.nsa320.bodhi.tar
tar -xf uboot.2017.07-tld-1.nsa325.bodhi.tar
tar -xf uboot.2017.07-tld-1.nsa310s.bodhi.tar
tar -xf uboot.2017.07-tld-1.nsa310.bodhi.tar

7. Erase mtd0

./flash_erase /dev/mtd0 0 4

8. Write image to NAND

./nandwrite /dev/mtd0 uboot.2017.07-tld-1.dockstar.mtd0.kwb
./nandwrite /dev/mtd0 uboot.2017.07-tld-1.goflexhome.mtd0.kwb
./nandwrite /dev/mtd0 uboot.2017.07-tld-1.goflexnet.mtd0.kwb
./nandwrite /dev/mtd0 uboot.2017.07-tld-1.pogo_e02.mtd0.kwb
./nandwrite /dev/mtd0 uboot.2017.07-tld-1.pogo_v4.mtd0.kwb

9. Flash default u-boot envs image

wget https://www.dropbox.com/s/4smmw2wr4ugayz9/uboot.2016.05-tld-1.environment.bodhi.tar --no-check-certificate

10. Extract Archive

cd /tmp
tar -xf uboot.2016.05-tld-1.environment.bodhi.tar

11. Save current envs (no need if you have done 3.)

fw_printenv > current_envs.txt (make a copy in notepad as you will refer it later)

12.Flash u-boot envs to NAND location 0xC0000.

Be extra careful with the next 2 commands, you should see output that look like below. If there is error, then do not reboot, post your problem here so we can help.

./flash_erase /dev/mtd0 0xc0000 1

Expected output:

Erase Total 1 Units
Performing Flash Erase of length 131072 at offset 0xc0000 done

./nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img

Expected output:

Writing data to block 6 at offset 0xc0000

Modify the following u-boot variables using fw_setenv:

ArcNumber:

for Pogo V4/Mobile:

fw_setenv arcNumber 3960
fw_setenv machid f78

for Dockstar:

fw_setenv arcNumber 2998
fw_setenv machid

for Pogo E02:

fw_setenv arcNumber 3542
fw_setenv machid dd6

for GoFlex Home:

fw_setenv arcNumber 3338
fw_setenv machid

for GoFlex Net:

fw_setenv arcNumber 3089
fw_setenv machid

Then for all boxes, restore these 2 envs using the saved envs text

fw_setenv mtdparts 'xxxxxxxxx'
fw_setenv ethaddr 'xx:xx:xx:xx:xx:xx'

Example :
fw_setenv mtdparts 'mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)'
fw_setenv ethaddr '00:10:75:1A:3B:C5'

Note: If fw_setenv ethaddr fails and complains that it is readonly, you will need to change it in netconsole.
      Interrupt the boot process in netconsole, type in "setenv ethaddr '00:10:75:1A:3B:C5'" and then "saveenv" to save the changes

13. Set IDE env

fw_setenv bootcmd_uenv 'run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi; sleep 3'

14. Adjust DTB Name to boot correct rootfs
Find your box DTB file in the rootfs /boot/dts directory and adjust the env to it. For example, if the box is the Dockstar

fw_setenv dtb_file '/boot/dts/kirkwood-dockstar.dtb'
fw_setenv dtb_file '/boot/dts/kirkwood-pogoplug_v4.dtb'
fw_setenv dtb_file '/boot/dts/kirkwood-pogo_e02.dtb'
fw_setenv dtb_file '/boot/dts/kirkwood-goflexhome.dtb'
fw_setenv dtb_file '/boot/dts/kirkwood-goflexnet.dtb'

15. Check your environment

fw_printenv

16. Setup netconsole (the server should be running netconsole)

Set up your server (the PC where netconsole will be sending the screen to... Run "ncat -l -u -p 6666" in a dos prompt

fw_setenv preboot_nc 'setenv nc_ready 0; for pingstat in 1 2 3 4 5; do; sleep 1; if run if_netconsole; then setenv nc_ready 1; fi; done; if test $nc_ready -eq 1; then run start_netconsole; fi'
fw_setenv preboot 'run preboot_nc'
fw_setenv ipaddr    '192.168.1.xxx'
fw_setenv serverip '192.168.1.67'

in this case, 192.168.1.67 is the PC where you ran ncat.

18. Install debian to the drive



Part 2 - Preparing External Media

Preparing the USB/SD Card that Pogoplug uses to load Debian:

1. Partition and format your boot partition/drive from a linux PC (or Rescue mode in Pogoplug)

Assuming your drive is showing as /dev/sdb (do an lsusb command to see usb drives)

fdisk /dev/sdb

Create a partition with linux file system and set it as a boot partition (under fdisk, use "a" to flag partition as bootable)

Format the partition to an ext3 filesystem 

mkfs.ext3 -L rootfs /dev/sdb1

Quit fdisk

Mount the new partition (make sure you create the /media/usb directory first)

mount /dev/sdb1 /media/usb

2. Download Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2 (anywhere, I suggest root dir)

cd /media/usb
wget https://www.dropbox.com/s/pa2cbg93qgcnp8w/Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2 --no-check-certificate

3. Unzip the package to root directory of the new partition

cd /media/usb

tar -xjf Debian-5.2.9-kirkwood-tld-1-rootfs-bodhi.tar.bz2 
Once it finishes, you should have the directories and files for a debian buster on the partition

 

4. Install Boot loader over Debian (/boot directory)

cd /media/usb/boot

wget https://www.dropbox.com/s/79ply8m4r6jj734/linux-5.11.4-kirkwood-tld-1-bodhi.tar.bz2 --no-check-certificate

Once it is downloaded, unzip it to boot directory... it should have all the dtb files you need for all kirkwood types of devices (Pogoplug, GoflexNet, Dockstar)

tar -xjf linux-5.11.4-kirkwood-tld-1-bodhi.tar.bz2
tar -xf  linux-dtb-5.11.4-kirkwood-tld-1.tar


 5. Remove the disk and install in Pogoplug device (use umount to flush the data to the drive)

umount /media/usb