Welcome! Log In Create A New Profile

Advanced

New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )

Posted by jazzoo 
New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 16, 2017 10:53PM
I followed your "installation" instructions for both the new U-boot and Kernel on a "stock" Goflex Home. All went great and the box booted fine.

Pressing my luck, I tried repeating the same installation using the same installation files and repeating the same instructions on a GFH I'd installed Arch on some years ago. U-Boot works, however the U-Boot environment variables seemed to load the kernal and ramfs but the box would hang at ".....Starting Kernel."

Over the next several days my thinking was that either one the load addresses or the kernel commandline MUST be off. It dawned on me to reset/erase all of the env variables on the broken GFH and replace with the env variables from the working box.

In case someone runs into this, my working env variables are

NOTE: Though collision is unlikely you shoud change the MAC/ethaddr to the one printed on the label of your box.

root@debian:~# fw_printenv
baudrate=115200
bootcmd=ide reset; usb start; setenv letter 9;for type in ide usb; do for disk in 0; do if ${type} part ${disk};then setexpr letter $letter + 1;run load;fi;done;done;
bootdelay=3
bootm=echo Booting from ${disk} ...; run setargs; bootm ${loadaddr};
bootz=echo Booting from ${disk} ...; run setargs; bootz ${loadaddr} - ${fdt_addr};
console=ttyS0
ethact=egiga0
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
load=echo Attempting to boot from ${type} ${disk}:1...;if run loadbootenv; then run importbootenv;fi;echo Checking if uenvcmd is set ...;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;echo Running default loadzimage ...;if run loadzimage; then run loadfdt;run bootz;fi;echo Running default loaduimage ...;if run loaduimage; then run bootm;fi;
loadaddr=0x810000
loadbootenv=load ${type} ${disk}:1 ${loadaddr} /boot/uEnv.txt
loadfdt=load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}
loaduimage=load ${type} ${disk}:1 ${loadaddr} ${uimage}
loadzimage=load ${type} ${disk}:1 ${loadaddr} ${zimage}
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}
uimage=/boot/uImage
zimage=/boot/zImage
ethaddr=00:10:75:28:99:13



BINGO, two working GFH boxes.


Again, thank you for sharing your work.


Jazzoo



Edited 1 time(s). Last edit at 09/17/2017 12:57AM by bodhi.
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 17, 2017 01:00AM
Jazzoo,

The reason you've run into problem was because you did not flash the new u-boot default envs.

Quote

8. Flashing default u-boot envs image:

As described in step 1, u-boot envs must be defined in etc/fw_env.config as

# MTD device name Device offset Env. size Flash sector size Number of sectors
/dev/mtd0 0xc0000 0x20000 0x20000

A special section (B. Flashing default u-boot envs image) about flashing default u-boot envs is included at the end of this installation procedure. Please follow the instruction in this section B to perform this step before continuing with step 9.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 17, 2017 11:40AM
Bodi,

Not the case at all.

I did, in fact, follow the instructions after reading and rereading them several times including step 8.) Flashing default u-boot envs image: (sub section B.) using the uboot.2016.05-tld-1.environment you kindly provided.

Including making changes to match the GoFlex Home and enabling NC console support.

The box is working and I am grateful for your knowledge and help.

My assumption that the load address may be incorrect, for the GFH, is based on comparison from the "stock envs" vs. the uboot.2016.05-tld-1.environment and the boot console output.

There is no doubt you know far more than I. My desire is to understand exactly the requirements to load and boot the device. I hope this is not a distraction.

My, limited, understanding of the execution path that U-Boot follows is to load the environment variables and attempt to execute bootcmd if set. If this assumption is correct then looking at the Serial output (see below), to my mind the u-boot execution path follows along and eventually runs loaduimage=load ${type} ${disk}:1 ${loadaddr} ${uimage} which expands to loaduimage=load ide 0:1 0x810000 /boot/uImage.

So the absolute memory load address of the kernel should/will be 0x810000.

Performing the static analysis of the execution flow for uboot.2016.05-tld-1.environment, the path would follow to load_uimage=load $bootdev $device $load_uimage_addr /boot/uImage which should expand to load ide 0:1 0x800000 /boot/uImage.

So the absolute memory load address of the kernel should/will be 0x800000 not 0x810000.

Using uboot.2016.05-tld-1.environment with recommended "GoFlex Home" modifications, at least in my attempts, resulted in the Kernel loading but hanging at "Starting kernel ...".

I will run through your instruction again but modify the load address and see where that leads.

Thank you for your time and attention,


Jazzoo

uboot.2016.05-tld-1.environment
arcNumber=2097
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
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
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
machid=0x831
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
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 load $dev $disknum:1 $load_uimage_addr /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
serverip=192.168.0.220
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_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
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 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15

Stock envs
baudrate=115200
bootcmd=ide reset; usb start; setenv letter 9;for type in ide usb; do for disk in 0; do if ${type} part ${disk};then setexpr letter $letter + 1;run load;fi;done;done;
bootdelay=3
bootm=echo Booting from ${disk} ...; run setargs; bootm ${loadaddr};
bootz=echo Booting from ${disk} ...; run setargs; bootz ${loadaddr} - ${fdt_addr};
console=ttyS0
ethact=egiga0
ethaddr=00:10:75:28:D2:14
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
load=echo Attempting to boot from ${type} ${disk}:1...;if run loadbootenv; then run importbootenv;fi;echo Checking if uenvcmd is set ...;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;echo Running default loadzimage ...;if run loadzimage; then run loadfdt;run bootz;fi;echo Running default loaduimage ...;if run loaduimage; then run bootm;fi;
loadaddr=0x810000
loadbootenv=load ${type} ${disk}:1 ${loadaddr} /boot/uEnv.txt
loadfdt=load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}
loaduimage=load ${type} ${disk}:1 ${loadaddr} ${uimage}
loadzimage=load ${type} ${disk}:1 ${loadaddr} ${zimage}
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}
stderr=serial
stdin=serial
stdout=serial
uimage=/boot/uImage
zimage=/boot/zImage


Serial output booting with "stock env"
U-Boot 2016.05-tld-1 (Jun 12 2016 - 13:30:55 -0700)
Seagate GoFlex Home

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 

Reset IDE: Bus 0: ...OK Bus 1: not available  
  Device 0: Model: ST9500325AS  Firm: 0003BSM1 Ser#: S2WL1THE
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 476940.0 MB = 465.7 GB (976773168 x 512)
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 1 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

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

Part	Start Sector	Num Sectors	UUID		Type
  1	2048      	968382464 	000b2b0c-01	83
  2	968384512 	8388608   	000b2b0c-02	82
Attempting to boot from ide 0:1...
** File not found /boot/uEnv.txt **
Checking if uenvcmd is set ...
Running default loadzimage ...
** File not found /boot/zImage **
Running default loaduimage ...
3832195 bytes read in 1541 ms (2.4 MiB/s)
Booting from 0 ...
## Booting kernel from Legacy Image at 00810000 ...
   Image Name:   Linux-4.12.1-kirkwood-tld-1
   Created:      2017-08-11  14:19:28 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    3832131 Bytes = 3.7 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...

Uncompressing Linux... done, booting the kernel.

Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 17, 2017 04:24PM
jazzoo,

Let me read your post a little more closely and comment on it later.

The reason I thought you did not flash the default evns image was:

root@debian:~# fw_printenv
baudrate=115200
bootcmd=ide reset; usb start; setenv letter 9;for type in ide usb; do for disk in 0; do if ${type} part ${disk};then setexpr letter $letter + 1;run load;fi;done;done;
bootdelay=3
bootm=echo Booting from ${disk} ...; run setargs; bootm ${loadaddr};
bootz=echo Booting from ${disk} ...; run setargs; bootz ${loadaddr} - ${fdt_addr};
console=ttyS0
ethact=egiga0
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
load=echo Attempting to boot from ${type} ${disk}:1...;if run loadbootenv; then run importbootenv;fi;echo Checking if uenvcmd is set ...;if test -n $uenvcmd; then echo Running uenvcmd ...;run uenvcmd;fi;echo Running default loadzimage ...;if run loadzimage; then run loadfdt;run bootz;fi;echo Running default loaduimage ...;if run loaduimage; then run bootm;fi;
loadaddr=0x810000
loadbootenv=load ${type} ${disk}:1 ${loadaddr} /boot/uEnv.txt
loadfdt=load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}
loaduimage=load ${type} ${disk}:1 ${loadaddr} ${uimage}
loadzimage=load ${type} ${disk}:1 ${loadaddr} ${zimage}
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)
setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}
uimage=/boot/uImage
zimage=/boot/zImage
ethaddr=00:10:75:28:99:13

The above is Arch version of default envs (not stock envs or uboot.2016.05-tld-1 envs).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 17, 2017 04:43PM
jazzoo,

> So the absolute memory load address of the kernel
> should/will be 0x810000.

No, it should not be 0x810000. It should be 0x800000. That's where the confusion was.

0x810000 is used in the envs as a temporary address to load the envs in (if there is uEnv.txt file in the rootfs to load). And then this location is used to import the envs to u-boot memory. After the import, this location is no longer relevant.

When u-boot load the uImage or zImage, we'll use 0x800000 as the load address. And the loading populates that memory region with uImage/zImage, i.e. overwritten what was there during the envs loading.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 2 time(s). Last edit at 09/17/2017 04:49PM by bodhi.
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 17, 2017 04:46PM
These are correct addresses from uboot.2016.05-tld-1.

load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
uenv_addr=0x810000

Those and other default envs were populated by the flashing command:
/usr/sbin/nandwrite -s 786432 /dev/mtd0 uboot.2016.05-tld-1.environment.img

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 18, 2017 09:27AM
Bodhi,

Digging a little deeper into this; using the "Arch envs," I changed the loadaddr (load address used in U-Boot command load) variable to 0x800000 and attempted to run the kernel ... success.

I'm not sure where I have gone wrong using/setting up uboot.2016.05-tld-1.environment; however, I am more than a little embarrassed for jumping the gun assuming the issue was the load address. I know better than to change more than one variable at a time. Deepest apologies for the waist of your time.

Apparently, the kernel may be loaded in either 0x810000 or 0x800000 without issue.

Thanks again for your time, attention, and work.



Jazzoo
Re: New U-Boot - GoFlex Home (GFH) Envs Issues (from previous installed Arch u-boot )
September 18, 2017 12:57PM
jazzoo,

> Apparently, the kernel may be loaded in either
> 0x810000 or 0x800000 without issue.

That's true. And glad it works well for you!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
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: