Welcome! Log In Create A New Profile

Advanced

GoflexHome USB Boot

Posted by juan 
GoflexHome USB Boot
October 02, 2012 06:50PM
I have arch running on my goflex and need to boot from usb to fix the partition. What I would like to do is boot usb whenever it is plugged in and do normal boot when it is not. I have been reading the forum for the correct way to do this but sadly, my fw_printenv hardly resembles the other configs I found.

It appears I need to add the following to my current config to do this but I really need a sanity check. Is this correct? Thank you

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 ; setenv usb_root LABEL=rootfs
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

nand_bootcmd=nand read.e 0x800000 0x100000 0x300000; setenv bootargs $(console) $(bootargs_root); bootm 0x800000

bootcmd=usb start; run usb_bootcmd; usb stop; run nand_bootcmd



Edited 1 time(s). Last edit at 10/02/2012 10:49PM by juan.
Re: GoflexHome USB Boot
October 22, 2012 11:20PM
Does anyone have an answer to Juan's question? I'm also running ArchLinux on the GFH hard drive. I'd like to be able plug a USB in and boot from it without having to remove the hard drive. I don't understand how to set up the environment variables so I'm reluctant to experiment with them too much in fear of getting locked out and being unable to boot anything.

At mimimum would someone please point me in the right direction.
Thanks

my environment looks like this
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
if_netconsole=ping $serverip
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
preboot=run if_netconsole start_netconsole
ethaddr=XX:XX:XX:XX:XX:XX
serverip=192.168.1.101
ipaddr=192.168.1.103
sata_boot=ide reset; mw 0x800000 0 1; ext2load ide 0:1 0x800000 /boot/uImage; if ext2load ide 0:1 0x1100000 /boot/uInitrd; then bootm 0x800000 0x1100000; else bootm 0x800000; fi
sata_bootcmd=run usb_set_bootargs; run sata_boot
bootcmd=usb start; run force_rescue_bootcmd; run ubifs_bootcmd; run usb_bootcmd; usb stop; run sata_bootcmd; run rescue_bootcmd; run pogo_bootcmd; reset
arcNumber=3338
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
rescue:~#



Edited 1 time(s). Last edit at 10/23/2012 09:40AM by maihoaomv.
Re: GoflexHome USB Boot
October 23, 2012 08:15AM
hello maihoaomv,

I found this is baked into arch. during boot, the bootloader is already configured to give precedence to usb so all you need to do is prepare a usb with arch, plug it in and boot.

set another system to receive connection @ 10.10.10.5

I recommend using ncat for this (ncat -lu 6666)

hope this helps.
~juan
Re: GoflexHome USB Boot
October 23, 2012 11:36AM
I am going to link to an old post with my environment. It is designed to do what you want. Boot HDD unless USB is plugged in. The only thing is you need the USB to be named rootfs for it to boot.

Click Here
Re: GoflexHome USB Boot
October 23, 2012 05:54PM
Optim
Thanks. I think that is what I'm looking for. I forgot to mention that I'm running the current uboot "U-Boot 2011.12 (Apr 18 2012 - 23:08:20)" with v2.8.1 rescue installed in mtd1 and mtd2 rather than Jeff's older .6 uboot, which as Juan says, would boot from the rescue usb first if present. Unfortunately the alarm rescue usb will not boot with the newer version of uboot.

I'm looking over the post you pointed me to and comparing it to my existing environment. There looks to be considerable difference between them. If I should happen to screw it up and am unable to boot from either the usb or the hard drive how do I get it back to the point that it is working? I have a serial console so I can see what is going on.

The reason I'm trying to get it to boot from the USB with the HHD installed is of course to be able to rescue the HHD if it should fail to boot.I also want to setup Debian and get it working (with HHD installed) on a usb stick the way I want, then replace ArchLinux currently on the HHD with Debian.

Juan thank you also for your input.


maihoaomv



Edited 1 time(s). Last edit at 10/23/2012 05:56PM by maihoaomv.
Re: GoflexHome USB Boot
October 23, 2012 10:54PM
@maihoamv,

Using optim's list of envs will make booting the USB consistent if it's plugged in. Don't worry about messing up the envs, since you have serial console. You can stop the boot process right from the beginning and fix the envs, if needed. I would recommend testing your serial console before changing the UBoot envs.

Another important note. USB rootfs is labeled "rootfs" to tell UBoot to pick it as the booting drive. Your SATA drive rootfs is also named "rootfs" to get it booting if the USB drive is unplugged. IIRC, with both drives plugged in, the net result is that it will boot with the uImage from the USB flash, but likely that the rootfs is the one on the SATA drive !!! that's what I remember seeing booting Debian. To make it absolutely foolproof, the 2 rootfs labels should be different, but that will need more changes in UBoot envs. For now, just use these envs settings and see if you can boot USB drive consistently, and make a note whether the roofs running is actually the USB's or the SATA's.
Re: GoflexHome USB Boot
October 24, 2012 10:36AM
I know this is a dumb question but how do I stop the boot process? It goes from the version strings straight into decompressing the kernel
I don't understand how to stop it. Pressing "anykey" doesn't seem to work.

this is all I get on boot.

U-Boot 2011.12 (Apr 18 2012 - 23:08:20)
Seagate GoFlexNet

SoC: Kirkwood 88F6281_A1
DRAM: 128 MiB
WARNING: Caches not enabled
NAND: 256 MiB
In: serial
Out: serial
Err: serial
Net: egiga0
88E1116 Initialized on egiga0
Using egiga0 device
host 192.168.1.101 is alive
Uncompressing Linux... done, booting the kernel.
Re: GoflexHome USB Boot
October 24, 2012 03:43PM
You meant you did not get the "Hit any key to stop autoboot" countdown? If you did, try pressing control-j real quick a few times and it should go into the prompt. I would make sure to get the countdown because without it, you can only observe the booting process but can't do anything. The output should look like this:

U-Boot 2011.12 (Apr 18 2012 - 23:08:20)
Seagate GoFlexNet
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1
GNU ld (Sourcery G++ Lite 2009q3-67) 2.19.51.20090709
Hit any key to stop autoboot:  8

You could try reinstall UBoot using Jeff's script to make sure your environment is correct.
Re: GoflexHome USB Boot
October 24, 2012 06:06PM
I tried the CTRL-J multiple times but nothing happens. I tried using C-KERMIT, MINICOM and GKTTERM with no results. there is a long delay, which I assume, is the countdown before it starts loading the kernel. It appears that during boot it is not accepting keyboard input. Once the kernel starts to load the keyboard works. I have stderr, stdout and stdin redirected to serial in the variables.

Is there a variable that needs to set to allow keyboard input?
Is it possible to reflash the NAND from the rescue prompt?


The serial console appears to be working ok. I just don't get the marvell prompt. I don't understand what I'm doing wrong.

Update: I tried netconsole and I get what I'm suppose to be seeing on the output. but I still can't stop it. It just hangs and gives me nothing but line feeds and no marvell prompt. There were a couple UBI errors that I highlighted in the output. The following is the nc output booting from the nand rescue system:

maihoa@LinuxMint13 ~ $ nc -l -u -p 6666 &
[1] 4359
maihoa@LinuxMint13 ~ $ nc -u 192.168.1.100 6666

U-Boot 2011.12 (Apr 18 2012 - 23:08:20)
Seagate GoFlexNet
arm-none-linux-gnueabi-gcc (Sourcery G++ Lite 2009q3-67) 4.4.1
GNU ld (Sourcery G++ Lite 2009q3-67) 2.19.51.20090709
Hit any key to stop autoboot:  0 
(Re)start USB...
USB:   Register 10011 NbrPorts 1
USB EHCI 1.00
scanning bus for devices... 1 USB Device(s) found
       scanning bus for storage devices... 0 Storage Device(s) found
** Block device usb 0 not supported

** Invalid boot device **
Creating 1 MTD partitions on "nand0":
0x000002500000-0x000010000000 : "mtd=3"
UBI: attaching mtd1 to ubi0
UBI: physical eraseblock size:   131072 bytes (128 KiB)
UBI: logical eraseblock size:    129024 bytes
UBI: smallest flash I/O unit:    2048
UBI: sub-page size:              512
UBI: VID header offset:          512 (aligned 512)
UBI: data offset:                2048
UBI error: validate_ec_hdr: bad VID header offset 2048, expected 512
UBI error: validate_ec_hdr: bad EC header
UBI error: ubi_io_read_ec_hdr: validation failed for PEB 0
UBI error: ubi_init: cannot attach mtd1
UBI error: ubi_init: UBI error: cannot initialize UBI, error -22
UBI init error 22
** Block device usb 0 not supported
** Block device usb 1 not supported
** Block device usb 2 not supported
** Block device usb 3 not supported
** Block device usb 0 not supported
** Block device usb 0 not supported
Wrong Image Format for bootm command
ERROR: can't get kernel image!
stopping USB..

Reset IDE: ide_preinit failed
** Bad partition 1 **
** Bad partition 1 **
Wrong Image Format for bootm command
ERROR: can't get kernel image!

NAND read: device 0 offset 0x100000, size 0x400000
 4194304 bytes read: OK
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-3.3.2-kirkwide
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3627768 Bytes = 3.5 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK
OK

Starting kernel ...



Edited 2 time(s). Last edit at 10/24/2012 06:34PM by maihoaomv.
Re: GoflexHome USB Boot
October 24, 2012 11:43PM
maihoaomv Wrote:
-------------------------------------------------------
>
> Is there a variable that needs to set to allow
> keyboard input?

I use Putty, and these are the communication parameters:
115200 baud, 8 bits data, 1 stop bit, parity None, No flow control


> Is it possible to reflash the NAND from the rescue
> prompt?
>

Yes. As long as you can boot into the rescue system, you can reinstall the whole thing. Just rerun Jeff's script to either reinstall UBoot only: http://projects.doozan.com/uboot/ , or install Debian (every thing) http://projects.doozan.com/debian/

> The serial console appears to be working ok. I
> just don't get the marvell prompt. I don't
> understand what I'm doing wrong.

The odd thing is you din't see the count down in serial console... OTOH, in the count down in the netconsole output below, what was the starting number of seconds?


> maihoa@LinuxMint13 ~ $ nc -l -u -p 6666 &
> [1] 4359
> maihoa@LinuxMint13 ~ $ nc -u 192.168.1.100 6666
> 
> U-Boot 2011.12 (Apr 18 2012 - 23:08:20)
> Seagate GoFlexNet
> arm-none-linux-gnueabi-gcc (Sourcery G++ Lite
> 2009q3-67) 4.4.1
> GNU ld (Sourcery G++ Lite 2009q3-67)
> 2.19.51.20090709
> Hit any key to stop autoboot:  0



In the second command, try this (thanks restamp!):

nc -up 6666 192.168.1.100 6666

and press control-j repeatedly when you see the count down.



Edited 1 time(s). Last edit at 10/25/2012 12:12AM by bodhi.
Re: GoflexHome USB Boot
October 24, 2012 11:57PM
Try ncat. You dont have to do that double nc crap and its a much more stable connection.

ncat is the updated replacement for nc
Re: GoflexHome USB Boot
October 25, 2012 01:27AM
Bodhi
nc -up 6666 192.168.1.103 6666 worked like a charm. I reflashed the NAND from the rescue command line. I also chose to reset the variables to default. I must not have done that the first time I flashed it. So now I get the autoboot countdown on the serial console and it stops with CTRL-J.
Is it normal for the boot up on the console to differ from the boot up on netconsole?

Thanks for your help
maihoaomv

console output.
U-Boot 2011.12 (Apr 18 2012 - 23:08:20)
Seagate GoFlexNet

SoC:   Kirkwood 88F6281_A1
DRAM:  128 MiB
WARNING: Caches not enabled
NAND:  256 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0
88E1116 Initialized on egiga0
Hit any key to stop autoboot:  0 
(Re)start USB...

Re: GoflexHome USB Boot
October 25, 2012 02:51PM
Cool! it is normal, usually you get more info in serial console than netconsole.
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: