Welcome! Log In Create A New Profile

Advanced

Un-retire my DockStar

Posted by klou 
Un-retire my DockStar
January 03, 2016 09:09PM
Hey all,

I played with the Dockstar several years ago, and shelved it after it either had a failed kernel upgrade (kirkwood from debian-backports) or the USB drive took a dump. However, I have a need for it and have a few questions regarding updates, especially since Jeff's original scripts were for Lenny/Squeeze, and not Jessie/Stretch. I booted it up today, and found that it has the 2.8.2 rescue image replacing the original Seagate firmware.

1. Is it possible to update U-Boot from the rescue image, and will it affect the image in anyway?

<edit>
rescue:/etc# dmesg | grep -i 'bad'
[   13.197290] Scanning device for bad blocks
[   13.301179] Bad eraseblock 1341 at 0x00000a7a0000
[   13.511632] UBI: number of bad PEBs:         0
[   13.548205] UBI: number of PEBs reserved for bad PEB handling: 2
According to the above, the bad block is NOT in the first 8, so should be OK to flash new U-Boot?

</edit>

2. I think my old USB flash drive failed. Have other people had issues with this? I'd like to install/boot Debian from an old FreeAgent Go (sata) drive, sitting directly on the dock (and not in USB 1). Can I just write bodhi's rootfs to that drive and partition the rest?

3. Will the most recent rootfs (Nov '15, I believe) be affected by kernel updates from say, backports? Or is that just the kernel used to build the rootfs?

Guidance and suggestions appreciated.

Thanks!



Edited 1 time(s). Last edit at 01/03/2016 09:18PM by klou.
Re: Un-retire my DockStar
January 03, 2016 11:39PM
klou Wrote:
-------------------------------------------------------
> Hey all,
>
> I played with the Dockstar several years ago, and
> shelved it after it either had a failed kernel
> upgrade (kirkwood from debian-backports) or the
> USB drive took a dump. However, I have a need for
> it and have a few questions regarding updates,
> especially since Jeff's original scripts were for
> Lenny/Squeeze, and not Jessie/Stretch. I booted
> it up today, and found that it has the 2.8.2
> rescue image replacing the original Seagate
> firmware.
>

This is good news, meaning you have a lot of options.

> 1. Is it possible to update U-Boot from the
> rescue image, and will it affect the image in
> anyway?

You are running an older u-boot, so you should make sure that the current (old) u-boot envs is saved into a text file. And later retrofit a few u-boot envs that are related to rescue system booting. Rescue image will remain intact.

> According to the above, the bad block is NOT in
> the first 8, so should be OK to flash new U-Boot?

Yes.

> 2. I think my old USB flash drive failed. Have
> other people had issues with this? I'd like to
> install/boot Debian from an old FreeAgent Go
> (sata) drive, sitting directly on the dock (and
> not in USB 1). Can I just write bodhi's rootfs to
> that drive and partition the rest?

Best to use the entire drive for rootfs to make booting easy to setup. So if you reformat that HDD to Ext3, and tar the rootfs to it. Or use a USB thumb (use Sandisk brand), then it should be easy. Using a USB thumb, later you can copy the rootfs to the HDD after partitioning it (this needs futher setup to ensure booting, see here for explanation: http://forum.doozan.com/read.php?3,19093).

> 3. Will the most recent rootfs (Nov '15, I
> believe) be affected by kernel updates from say,
> backports? Or is that just the kernel used to
> build the rootfs?

See here for latest rootfs (Updated 24 Feb 2015). Once you use this kernel/rootfs, stay with it and don't do apt-get dist-upgrade (apt-get upgrade to get latest packages is ok to do).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Un-retire my DockStar
January 05, 2016 12:33AM
Hi bodhi,

Thanks for the answers! But I still have a few Q's...

>You are running an older u-boot, so you should make sure that the current (old) u-boot envs is saved into a text file. And later retrofit a few u-boot >envs that are related to rescue system booting. Rescue image will remain intact.

So I can update u-boot from rescue, correct? And what do you mean by retrofit u-boot envs for the rescue?

I saw that the newer u-boot supports ext4 -- is there any reason that I can't use ext4 on the USB/HDD?

Thanks!
Re: Un-retire my DockStar
January 05, 2016 01:05AM
OK, so I'm still confused about the order of operations here.

1) Flash new uBoot from the rescue image.

Do I need to flash the u-boot default envs image (B)? If I do so, and make sure that the 4Requirements are met, then I assume that (D) creating a custom /boot/uEnv.txt is unnecessary?

2) Prepare the media/flash rootfs image. Hopefully the Dockstar will boot directly into a Debian installation that I can work with.

Trying to understand this before I start ...

rescue:~# fw_printenv
ethact=egiga0
bootdelay=3
baudrate=115200
mainlineLinux=yes
console=ttyS0,115200
led_init=green blinking
led_exit=green off
led_error=orange blinking
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
mtdids=nand0=orion_nand
partition=nand0,2
stdin=serial
stdout=serial
stderr=serial
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
usb_scan_list=1 2 3 4
usb_scan_1=usb=0:1 dev=sda1
usb_scan_2=usb=1:1 dev=sdb1
usb_scan_3=usb=2:1 dev=sdc1
usb_scan_4=usb=3:1 dev=sdd1
usb_init=run usb_scan
usb_device=0:1
usb_root=/dev/sda1
usb_rootfstype=ext2
usb_rootdelay=10
usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
ethaddr=00:10:75:1A:47:E8
arcNumber=2097
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_pogo=run bootcmd_rescue
rescue_installed=1

I guess according to this, I'd have to change usb_rootfstype if I want to use ext4.

Last edit: Current u-boot = dockstar davygravy-2012-02-12-current



Edited 1 time(s). Last edit at 01/05/2016 01:22AM by klou.
Re: Un-retire my DockStar
January 05, 2016 10:31AM
klou,

> 1) Flash new uBoot from the rescue image.

Yes.

> Do I need to flash the u-boot default envs image
> (B)?

Yes, that's why you need to save the current envs so that you can retrofit/restore a few rescue-related envs on top of the new ones.

> creating a custom /boot/uEnv.txt is unnecessary?

Yes, unnecessary.

> I guess according to this, I'd have to change
> usb_rootfstype if I want to use ext4.

Yes.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Un-retire my DockStar
January 06, 2016 01:52AM
Thanks for your help with all of this.

I've flashed the newer uBoot and the default env, but haven't rebooted yet. I'd still like to preserve the rescue environment, so do I need to migrate all of the old envs?

Looking at the below list, I'm guessing that I can omit everything that starts with "usb" (-->marked, as this is duplicated somehow in the new envs?), but import everything else? Not entirely sure about the different "bootcmd" entries.

rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
force_rescue=0
force_rescue_bootcmd=if test $force_rescue -eq 1 || ext2load usb 0:1 0x1700000 /rescueme 1 || fatload usb 0:1 0x1700000 /rescueme.txt 1; then run rescue_bootcmd; fi
ubifs_mtd=3
ubifs_set_bootargs=setenv bootargs console=$console ubi.mtd=$ubifs_mtd root=ubi0:rootfs rootfstype=ubifs $mtdparts $ubifs_custom_params
ubifs_bootcmd=run ubifs_set_bootargs; if ubi part data && ubifsmount rootfs && ubifsload 0x800000 /boot/uImage && ubifsload 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; fi
-->usb_scan=usb_scan_done=0;for scan in $usb_scan_list; do run usb_scan_$scan; if test $usb_scan_done -eq 0 && ext2load usb $usb 0x800000 /boot/uImage 1; then usb_scan_done=1; echo "Found bootable drive on usb $usb"; setenv usb_device $usb; setenv usb_root /dev/$dev; fi; done
-->usb_scan_list=1 2 3 4
-->usb_scan_1=usb=0:1 dev=sda1
-->usb_scan_2=usb=1:1 dev=sdb1
-->usb_scan_3=usb=2:1 dev=sdc1
-->usb_scan_4=usb=3:1 dev=sdd1
-->usb_init=run usb_scan
-->usb_device=0:1
-->usb_root=/dev/sda1
-->usb_rootfstype=ext2
-->usb_rootdelay=10
-->usb_set_bootargs=setenv bootargs console=$console root=$usb_root rootdelay=$usb_rootdelay rootfstype=$usb_rootfstype $mtdparts $usb_custom_params
-->usb_bootcmd=run usb_init; run usb_set_bootargs; run usb_boot
-->usb_boot=mw 0x800000 0 1; ext2load usb $usb_device 0x800000 /boot/uImage; if ext2load usb $usb_device 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run rescue_bootcmd; run pogo_bootcmd; reset
ethaddr=00:10:75:1A:47:E8

-->arcNumber=2097
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
bootcmd_pogo=run bootcmd_rescue
rescue_installed=1
Re: Un-retire my DockStar
January 06, 2016 02:42AM
If I'm reading this right, I can append "run rescue_bootcmd" to your default envs bootcmd (after "run bootcmd_exec") to force boot into rescue if no USB rootfs are found?

Or does the default envs have a "fallback to default pogo/rescue environment if no USB installed"?
Re: Un-retire my DockStar
January 06, 2016 03:12AM
This is how you would restore rescue envs:

fw_setenv rescue_set_bootargs 'setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params'
fw_setenv rescue_bootcmd 'if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi'
fw_setenv rescue_installed 1

Add this to the end of bootcmd (if you are booting with USB, the bold part would be the orginal bootcmd)

fw_setenv bootcmd 'usb start; run usb_bootcmd; usb stop; run rescue_bootcmd;  reset'

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Un-retire my DockStar
January 07, 2016 12:24AM
I'm learning.

If I were to modify your set of default envs, would the bootcmd be as below? (already adding rescue_set_bootargs, etc.) This would be using your uenv variables for usb scanning, instead of the "original" Jeff/davygravy ones from 2012.

bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run rescue_bootcmd

Or could I just completely restore the old envs and not use your defaults? Are there any functional differences?
Re: Un-retire my DockStar
January 07, 2016 01:58AM
klou Wrote:
-------------------------------------------------------
> I'm learning.
>
> If I were to modify your set of default envs,
> would the bootcmd be as below? (already adding
> rescue_set_bootargs, etc.) This would be using
> your uenv variables for usb scanning, instead of
> the "original" Jeff/davygravy ones from 2012.
>
>
> bootcmd=run bootcmd_uenv; run scan_disk; run
> set_bootargs; run bootcmd_exec; run
> rescue_bootcmd
>

Yes.

> Or could I just completely restore the old envs
> and not use your defaults? Are there any
> functional differences?

It would work fine for the Dockstar (which has only USB drives). But problem booting will occur without the rootfs label.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Un-retire my DockStar
January 08, 2016 02:01AM
Hi bodhi,

Again, thanks for all of your help with this. I'm so close, I can almost taste it.

While/before I was wrestling with the uboot envs, I ran Jeff's old Wheezy install script on a PNY flash drive and then updated it to Jessie. Then I was able to figure out uboot successfully, and after labeling the PNY as 'rootfs' was able to boot it.

However, I'd like a little more resilience on the filesystem and was trying ext3/ext4, as well as to install on an external HDD (ext3/ext4) as well as a Patriot flash drive (ext3). For the Uboot envs, I replaced ext2load with ext4load in all occurrences (4 places) for ext4, but reverted to ext2load for ext3. And in each case, I used your 3.18.5 rootfs.

The good news is that uboot seemed to be doing what it was supposed to, in all cases. The bad news is that after "Starting kernel ..." I get no response in all cases. So it's obviously not booting correctly. Do you have any ideas about this? I'll try ext2 on the flash drive tomorrow night.

U-Boot 2015.10-tld-1 (Nov 06 2015 - 15:56:21 -0800)
Seagate FreeAgent DockStar
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... 3 USB Device(s) found
       scanning usb for storage devices...
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'

Partition Map for USB device 0  --   Partition Type: DOS

Part    Start Sector    Num Sectors     UUID            Type
  1     63              1953520000      a4b57300-01     83 Boot
loading envs from usb 0 ...
** File not found /boot/uEnv.txt **
Unknown command 'ide' - try 'help'
Unknown command 'mmc' - try 'help'
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 290 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...
2875844 bytes read in 432 ms (6.3 MiB/s)
loading uInitrd ...
6535284 bytes read in 548 ms (11.4 MiB/s)
loading DTB /boot/dts/kirkwood-dockstar.dtb ...
10180 bytes read in 290 ms (34.2 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-3.18.5-kirkwood-tld-1
   Created:      2016-01-08   7:26:24 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2875780 Bytes = 2.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-3.18.5-kirkwood-tld-1
   Created:      2015-02-19   1:49:36 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    6535220 Bytes = 6.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000


Starting kernel ...

bootcmd_exec=mw 0x800000 0 1; run load_uimage; if run load_initrd; then if run load_dtb; then bootm 0x800000 0x1100000 0x1c00000; else bootm 0x800000 0x1100000; fi; else if run load_dtb; then bootm 0x800000 - 0x1c00000; else bootm 0x800000; fi; fi
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
ethact=egiga0
if_netconsole=ping $serverip
led_error=orange blinking
led_exit=green off
led_init=green blinking
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_import=echo importing envs ...; env import -t 0x810000
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 0x810000 /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
arcNumber=2998
ethaddr=00:10:75:1A:47:E8
dtb_file=/boot/dts/kirkwood-dockstar.dtb
rescue_installed=1
bootcmd_rescue=run set_bootargs_rescue; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000
set_bootargs_rescue=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts
pogo_bootcmd=if fsload uboot-original-mtd0.kwb; then go 0x800200; fi
rescue_bootcmd=if test $rescue_installed -eq 1; then run rescue_set_bootargs; nand read.e 0x800000 0x100000 0x400000; bootm 0x800000; else run pogo_bootcmd; fi
rescue_set_bootargs=setenv bootargs console=$console ubi.mtd=2 root=ubi0:rootfs ro rootfstype=ubifs $mtdparts $rescue_custom_params
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run rescue_bootcmd; reset
serverip=192.168.100.120
ipaddr=192.168.100.198
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
preboot=run preboot_nc
load_dtb=echo loading DTB $dtb_file ...; ext4load $bootdev $device 0x1c00000 $dtb_file
load_initrd=echo loading uInitrd ...; ext4load $bootdev $device 0x1100000 /boot/uInitrd
load_uimage=echo loading uImage ...; ext4load $bootdev $device 0x800000 /boot/uImage
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if ext4load $dev $disknum:1 0x800000 /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
Re: Un-retire my DockStar
January 08, 2016 02:29AM
klou,

> The good news is that uboot seemed to be doing
> what it was supposed to, in all cases. The bad
> news is that after "Starting kernel ..." I get no
> response in all cases. So it's obviously not
> booting correctly. Do you have any ideas about
> this? I'll try ext2 on the flash drive tomorrow
> night.

WIth netconsole, that's all you will see before kernel starting. In oder to see Debian kernel booting messages:
http://forum.doozan.com/read.php?2,9522

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Un-retire my DockStar
January 09, 2016 01:48PM
Well, I've tried a lot of things.

I think that the problems where the kernel is not booting stem from when the DTB is loaded ... and I've never been able to get your rootfs to work for me (or the kernel netconsole, for that matter).

So I ended up going back to my upgraded-from-Jeff's-Wheezy-script installation (labeling it rootfs). Looking at that, if I actually point $dtb_file to the kirkwood-dockstar.dtb, uboot shows that it's loading the FDT blob, but then it doesn't want to boot either. Removing $dtb_file then allows it to boot.

I installed the 4.3 kernel (and updated "flash-kernel") from jessie-backports. When it did that, it looks like the dtb was baked into the generated uImage/uInitrd, so when $load_dtb fails, bootcmd_exec reverts to your Kernel 4B booting method (embedded).

And after all of that ...

On a reboot, I think I had a typo in setting ethaddr via fw_setenv, so that it's now an invalid value ( fw_setenv ethaddr '00:J10:75:1a:47:e8' from my logs ...). As a result, netconsole doesn't work, the LEDs seem ok, but no network response on the router side or anything, even in rescue or Debian.

I'm guessing that the only way to fix this is via serial cable?

<edit>
Set a static MAC in /etc/networks/interfaces, and was able to access my box. OK, fixed it, and I think I'm done mucking around for a while.

Thanks for all of your help!

</edit>



Edited 1 time(s). Last edit at 01/09/2016 02:25PM by klou.
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: