Welcome! Log In Create A New Profile

Advanced

Is uBoot OS specific?

Posted by balanga 
Re: Is uBoot OS specific?
July 28, 2017 03:52PM
balanga,

You did not run it the way I posted above

Quote

And then at serial console, instead of running picocom/putty/screen, run kwboot:

./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.05-tld-2.goflexhome.mtd0.kwb -p


After u-boot has been loaded, interrupt serial console at the countdown and,

help
help bootelf
printenv


Hopefully we will see the bootlef command in the help listing.

So you were never in kwboot.

Changing to /dev/cuaU0 is fine, since that's your USB device as detected by the system. But "| tee" is not OK.

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



Edited 1 time(s). Last edit at 07/28/2017 03:57PM by bodhi.
Re: Is uBoot OS specific?
July 29, 2017 04:59AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> You did not run it the way I posted above
>
>
Quote

And then at serial console, instead of runn
> ing picocom/putty/screen, run kwboot:
>
>
> ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.0
> 5-tld-2.goflexhome.mtd0.kwb -p
>
>
>
> After u-boot has been loaded, interrupt serial con
> sole at the countdown and,
>
>
> help
> help bootelf
> printenv
>
>
>
> Hopefully we will see the bootlef command in the h
> elp listing.
>
> So you were never in kwboot.
>
> Changing to /dev/cuaU0 is fine, since that's your
> USB device as detected by the system. But "| tee"
> is not OK.

"| tee" was only put in to get a log... This time I used 'script' to create a log, but ran this command

./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.05-tld-2.goflexhome.mtd0.kwb -p

U-Boot 2014.04.R2-1 (May 15 2014 - 14:36:05) Arch Linux ARM
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:  3  2  1  0 
GoFlexHome> help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootz   - boot Linux zImage image from memory
chpart  - change active partition
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
date    - get/set/reset date & time
dhcp    - boot image via network using DHCP/TFTP protocol
diskboot- boot from IDE device
dns     - lookup the IP of a hostname
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls  - list files in a directory (default /)
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fdt     - flattened device tree utility commands
go      - start application at address 'addr'
help    - print command description/usage
ide     - IDE sub-system
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
load    - load binary file from a filesystem
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
md      - memory display
mii     - MII utility commands
mm      - memory modify (auto-incrementing address)
mtdparts- define flash/nand partitions
mw      - memory write (fill)
nand    - NAND sub-system
nboot   - boot from NAND device
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
saveenv - save environment variables to persistent storage
setenv  - set environment variables
setexpr - set environment variable as the result of eval expression
showvar - print local hushshell variables
sleep   - delay execution for some time
sntp    - synchronize RTC via network
source  - run script from memory
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
true    - do nothing, successfully
ubi     - ubi commands
ubifsload- load file from an UBIFS filesystem
ubifsls - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
GoFlexHome> help bootelf
Unknown command 'bootelf' - try 'help' without arguments for list of all known commands

GoFlexHome> 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
ethaddr=00:10:75:2E:AE:0F
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

Environment size: 1433/131068 bytes
GoFlexHome> usb start
(Re)start USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
GoFlexHome> ls usb 0

0 file(s), 0 dir(s)

I don't see any difference, so either something is incorrect or I'm misunderstanding what you are asking me to do....
Re: Is uBoot OS specific?
July 29, 2017 06:28AM
balanga Wrote:
-------------------------------------------------------
> bodhi Wrote:
> --------------------------------------------------
>
> ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.0
> 5-tld-2.goflexhome.mtd0.kwb -p
>
>
> U-Boot 2014.04.R2-1 (May 15 2014 - 14:36:05) Arch
> Linux ARM
> Seagate GoFlex Home
>
>
> I don't see any difference, so either something is
> incorrect or I'm misunderstanding what you are ask
> ing me to do....

The date of the u-boot you are running is not what bodhi has provided. So is there and error displayed before it defaults to the installed u-boot? Perhaps in the previous file you piped the results to to see?
Re: Is uBoot OS specific?
July 29, 2017 07:11AM
Can someone tell me what I should be seeing as I'm confused at this point. Presumably I should have my FreeBSD USB stick inserted when I power on my GFH dock, having previously started kwboot on my laptop. Should I see the new U-boot immediately?

There is also the possibility that my kwboot, which I built myself does not work properly... Is there any debugging facility to see if it is actually working properly?
Re: Is uBoot OS specific?
July 29, 2017 07:18AM
Show all the info on the screen when you run kwboot incliding the command you typed such as:

./kwboot  -t -B 115200 /dev/ttyUSB0 -b uboot.2016.05-tld-4-rc6.dreamplug.mtd0.kwb   -p 
Sending boot message. Please reboot the target.../
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]

 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]


U-Boot 2016.05-tld-4-rc6 (Jun 19 2017 - 22:43:45 -0700)
Marvell-DreamPlug

SoC:   Kirkwood 88F6281_A1
SPI:   ready
DRAM:  512 MiB
WARNING: Caches not enabled
SF: Detected MX25L1605D with page size 256 Bytes, erase size 64 KiB, total 2 MiB
In:    serial
Out:   serial
Err:   serial
Net:   egiga0, egiga1
88E1116 Initialized on egiga0
88E1116 Initialized on egiga1
Hit any key to stop autoboot:  0 
Dreamplug>
Re: Is uBoot OS specific?
July 29, 2017 09:14AM
The problem was probably with my kwboot....

I've now booted up an Ubuntu system and am working from that.

Sending boot image...
  0 % [+++++++++++++++xmodem: Bad message....]

Trying again...

It worked this time....

I need to workout how to log the messages from Ubuntu, and will send that from a different machine shortly.
Re: Is uBoot OS specific?
July 29, 2017 09:23AM
balanga Wrote:
-------------------------------------------------------
> The problem was probably with my kwboot....
>
> I've now booted up an Ubuntu system and am working
> from that.
>
>
> Sending boot image...
> 0 % [+++++++++++++++xmodem: Bad message....]
> 
> Trying again...
> 
> It worked this time....
> 
> I need to workout how to log the messages from Ubu
> ntu, and will send that from a different machine s
> hortly.
That looks like just a bad connection. Trust me I have had plenty of them.


You should be able to just copy and paste from the terminal window.



Edited 2 time(s). Last edit at 07/29/2017 09:41AM by feas.
Re: Is uBoot OS specific?
July 29, 2017 09:42AM
]0;root@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mroot@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m# sh bodhi
Sending boot message. Please reboot the target...#-#\#|#/#-#\#|#/#-#\#|#/#-
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]
#

U-Boot 2017.05-tld-2 (Jul 26 2017 - 02:37:42 -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:  3 ### 2 ### 1 ### 0 

Reset IDE: ide_preinit failed
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
## Unknown partition table type 0

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

Part	Start Sector	Num Sectors	UUID		Type
  1	63        	65536     	00000000-01	a5
  2	65599     	131006401 	00000000-02	a5
Attempting to boot from usb 0:1...
reading /boot/uEnv.txt
** Unable to read file /boot/uEnv.txt **
Checking if uenvcmd is set ...
Running default loadzimage ...
reading /boot/zImage
** Unable to read file /boot/zImage **
Running default loaduimage ...
reading /boot/uImage
** Unable to read file /boot/uImage **
GoFlexHome> help
?       - alias for 'help'
base    - print or set address offset
bdinfo  - print Board Info structure
boot    - boot default, i.e., run 'bootcmd'
bootd   - boot default, i.e., run 'bootcmd'
bootefi - Boots an EFI payload from memory
bootelf - Boot from an ELF image in memory
bootm   - boot application image from memory
bootp   - boot image via network using BOOTP/TFTP protocol
bootvx  - Boot vxWorks from an ELF image
bootz   - boot Linux zImage image from memory
chpart  - change active partition
cmp     - memory compare
coninfo - print console devices and information
cp      - memory copy
crc32   - checksum calculation
date    - get/set/reset date & time
dhcp    - boot image via network using DHCP/TFTP protocol
diskboot- boot from IDE device
dns     - lookup the IP of a hostname
echo    - echo args to console
editenv - edit environment variable
env     - environment handling commands
exit    - exit script
ext2load- load binary file from a Ext2 filesystem
ext2ls  - list files in a directory (default /)
ext4load- load binary file from a Ext4 filesystem
ext4ls  - list files in a directory (default /)
ext4size- determine a file's size
false   - do nothing, unsuccessfully
fatinfo - print information about filesystem
fatload - load binary file from a dos filesystem
fatls   - list files in a directory (default /)
fatsize - determine a file's size
fdt     - flattened device tree utility commands
fsinfo  - print information about jffs filesystems
fsload  - load binary file from a jffs filesystem image
fsls    - list jffs files in a directory (default /)
fstype  - Look up a filesystem type
go      - start application at address 'addr'
gpio    - query and control gpio pins
gpt     - GUID Partition Table
help    - print command description/usage
ide     - IDE sub-system
iminfo  - print header information for application image
imxtract- extract a part of a multi-image
itest   - return true/false on integer compare
load    - load binary file from a filesystem
loadb   - load binary file over serial line (kermit mode)
loads   - load S-Record file over serial line
loadx   - load binary file over serial line (xmodem mode)
loady   - load binary file over serial line (ymodem mode)
loop    - infinite loop on address range
ls      - list files in a directory (default /)
md      - memory display
mii     - MII utility commands
mm      - memory modify (auto-incrementing address)
mtdparts- define flash/nand partitions
mw      - memory write (fill)
nand    - NAND sub-system
nboot   - boot from NAND device
nfs     - boot image via network using NFS protocol
nm      - memory modify (constant address)
ping    - send ICMP ECHO_REQUEST to network host
printenv- print environment variables
reset   - Perform RESET of the CPU
run     - run commands in an environment variable
save    - save file to a filesystem
saveenv - save environment variables to persistent storage
setenv  - set environment variables
setexpr - set environment variable as the result of eval expression
showvar - print local hushshell variables
size    - determine a file's size
sleep   - delay execution for some time
sntp    - synchronize RTC via network
source  - run script from memory
test    - minimal test like /bin/sh
tftpboot- boot image via network using TFTP protocol
true    - do nothing, successfully
ubi     - ubi commands
ubifsload- load file from an UBIFS filesystem
ubifsls - list files in a directory
ubifsmount- mount UBIFS volume
ubifsumount- unmount UBIFS volume
usb     - USB sub-system
usbboot - boot from USB device
version - print monitor, compiler and linker version
GoFlexHome> help bootelf
bootelf - Boot from an ELF image in memory

Usage:
bootelf [-p|-s] [address]
	- load ELF image at [address] via program headers (-p)
	  or via section headers (-s)
GoFlexHome> printenv
api_address=7b12860
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:2E:AE:0F
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
letter=a
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

Environment size: 1466/131068 bytes
GoFlexHome>
Re: Is uBoot OS specific?
July 29, 2017 02:29PM
Can I use this method to update the U-Boot on my GoFlexHome once it has booted?
Re: Is uBoot OS specific?
July 29, 2017 02:50PM
balanga Wrote:
-------------------------------------------------------
> Can I use this method to update the U-Boot on my
> GoFlexHome once it has booted?

No kwboot is to test if a proposed u-boot will work so as not to risk bricking your device.
Re: Is uBoot OS specific?
July 29, 2017 03:56PM
balanga,

As feas said, it is best to copy what's in the terminal to a note you opened in an editor. When you run kwboot, it should be the only thing running in that command.


> U-Boot 2017.05-tld-2 (Jul 26 2017 - 02:37:42 -0700)
> Seagate GoFlex Home

Congrats! you are running new u-boot.


> GoFlexHome> help
> bootelf - Boot from an ELF image in memory

And the bootelf comand is available now.

The next step is to:

- Keep booting this way, and enter u-boot commands to try loading FreeBSD. I will post the commands.
- In the mean time, whatever you do here do not execute saveenv. Doing this will mess up your box.

Once you get it booting into BSD, you can flash u-boot in its shell. The commands should be similar to Linux.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 29, 2017 05:15PM
balanga,


1. kwboot with uboot.2017.05-tld-2.goflexhome.mtd0.kwb like you did before.

2. Interrupt serial console at countdown and execute the following commands (copy and paste each line to the u-boot prompt).

setenv bootfile ubldr
setenv fdtfile kirkwood-goflexhome.dtb

setenv kernel_addr_r 0x01000000
setenv loadaddr 0x02000000
setenv pxefile_addr_r 0x00100000
setenv ramdisk_addr_r 0x02100000
setenv scriptaddr 0x00000000
fdt addr 0x100

setenv bootcmd 'usb start; fatload usb 0:1 ${loadaddr} ${bootfile} && bootelf ${loadaddr}'
printenv
boot

See how far you will get.

Please post the entire serial console log (from kwboot command to the last line you see on your terminal).

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 29, 2017 07:07PM
Script started on Sun 30 Jul 2017 00:30:27 BST
#]0;me@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mme@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m$ exit####sudo sh bodhi#############exit#[K####sudo sh bodhi
[sudo] password for me: 
Sending boot message. Please reboot the target...#-#\#|#/#-#\#|#/#-#\#|#/#-
Sending boot image...
  0 % [....+xmodem: Protocol error
#]0;me@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mme@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m$ sudo sh bodhi
Sending boot message. Please reboot the target...#-#\#|
Sending boot image...
  0 % [+++++++++++++++++xmodem: Bad message
#]0;me@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mme@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m$ sudo sh bodhi
Sending boot message. Please reboot the target...#-#\#|#/#-#\#|#/#-#\#|#/#-#\#|#/#-
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
 95 % [......................................................................]
 97 % [......................................................................]
 99 % [....................................]
[Type Ctrl-\ + c to quit]
#

U-Boot 2017.05-tld-2 (Jul 26 2017 - 02:37:42 -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:  3 ### 0

GoFlexHome> printenv
api_address=7b12860
baudrate=115200
bootcmd=usb start; fatload usb 0:1 ${loadaddr} ${bootfile} && bootelf ${loadaddr}
bootdelay=3
bootfile=ubldr
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:2E:AE:0F
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
fdtfile=krkwood-goflexhome.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
kernel_at=0x02000000
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)
pxefile_aetenv=ramdisk_addr_r 0x02100000
scriptaddddr=0x100
setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}
uimage=/boot/uImage
zimage=/boot/zImage

Environment size: 1507/131068 bytes
GoFlexHome> boot
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
reading ubldr
280361 bytes read in 88 ms (3 MiB/s)
CACHE: Misaligned operation at range [01000098, 0102acc8]
CACHE: Misaligned operation at range [0102acd0, 0102b873]
CACHE: Misaligned operation at range [0102b874, 0102d25c]
CACHE: Misaligned operation at range [0102d25c, 0102d2b8]
CACHE: Misaligned operation at range [0102d2b8, 01031da6]
CACHE: Misaligned operation at range [01031db0, 010334ac]
CACHE: Misaligned operation at range [010334b0, 01036548]
## Starting application at 0x01000098 ...
Consoles: U-Boot console  


Compatible U-Boot API signature found @0x7b12860



FreeBSD/arm U-Boot loader, Revision 1.2

!!!!!!!!!

(root@Multiboot, Thu Jul 20 09:36:42 BST 2017)

DRAM: 128MB
Number of U-Boot devices: 2
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: disk
  Probing all disk devices...
  Checking unit=0 slice=<auto> partition=<auto>... good.
Booting from disk0s1:
|#/#-#
\#|#/#-#\#|#/#-#\#can't load 'kernel'
Type '?' for a list of commands, 'help' for more detailed help.
loader> ?
Available commands:
  boot             boot a file or loaded kernel
  autoboot         boot automatically after a delay
  help             detailed help
  ?                list commands
  show             show variable(s)
  set              set a variable
  unset            unset a variable
  echo             echo arguments
  read             read input from the terminal
  more             show contents of a file
  lsdev            list all devices
  include          read commands from a file
  ls               list files
  load             load a kernel or module
  load_geli        load a geli key
  unload           unload all modules
  lsmod            list loaded modules
  heap             show heap usage
  reboot           reboot the system
  devinfo          show U-Boot devices
  sysinfo          show U-Boot system info
  ubenv            show or import U-Boot env vars
 --more--  <space> page down <enter> line down <q> quit 
                                                   
  fdt              flattened device tree handling
loader> sysinfo
U-Boot system info:
sys info:
  clkbus	= 0 MHz
  clkcpu	= 0 MHz
  bar		= 0x00000000
---
  start	= 0x00000000
  size	= 0x08000000
  type	= DRAM
---
loader> devinfo
U-Boot devices:
device info (0):
  cookie	= 0x0x7b12928
  type		= 0x00000001
  hwaddr	= 00 10 75 2e ae 0f 
device info (1):
  cookie	= 0x0x7fb2a00
  type		= 0x00000042
  type		= USB
  blk size		= 512
  blk count		= 15148032
loader> #
# not found
loader> #
# not found
loader> #
# not found
loader> 
Re: Is uBoot OS specific?
July 29, 2017 10:03PM
Very encouraging! let me post another revised set of envs. There are preset envs that we did not have.

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



Edited 1 time(s). Last edit at 07/29/2017 10:03PM by bodhi.
Re: Is uBoot OS specific?
July 29, 2017 10:10PM
Revised booting envs:

setenv fatdev 'usb 0:1'

setenv loaderdev ${fatdev}
setenv bootfile ubldr
setenv fdtfile kirkwood-goflexhome.dtb

setenv kernel_addr_r 0x01000000
setenv loadaddr 0x02000000
setenv pxefile_addr_r 0x00100000
setenv ramdisk_addr_r 0x02100000
setenv scriptaddr 0x00000000
fdt addr 0x100

setenv bootcmd 'usb start; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}'
printenv
boot

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 30, 2017 01:24AM
U-Boot 2017.05-tld-2 (Jul 26 2017 - 02:37:42 -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:  3 ### 0
GoFlexHome> setenv fatdev 'usb 0:1'
GoFlexHome> setenv loaderdev ${fatdev}
GoFlexHome> 
GoFlexHome> setenv bootfile ubldr
GoFlexHome> setenv fdtfile kirkwood-goflexhome.dtb
GoFlexHome> setenv kernel_addr_r 0x01000000
GoFlexHome> setenv loadaddr 0x02000000
GoFlexHome> setenv pxefile_addr_r 0x00100000
GoFlexHome> setenv ramdisk_addr_r 0x02100000
GoFlexHome> setenv scriptaddr 0x00000000
GoFlexHome> fdt addr 0x100
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
GoFlexHome> setenv bootcmd 'usb start; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}'
GoFlexHome> printenv
api_address=7b12860
baudrate=115200
bootcmd=usb start; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}
bootdelay=3
bootfile=ubldr
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:2E:AE:0F
fatdev=usb 0:1
fdt_addr=0x800000
fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb
fdtfile=kirkwood-goflexhome.dtb
importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize
kernel_addr_r=0x01000000
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=0x02000000
loadbootenv=load ${type} ${disk}:1 ${loadaddr} /boot/uEnv.txt
loaderdev=usb 0:1
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)
pxefile_addr_r=0x00100000
ramdisk_addr_r=0x02100000
scriptaddr=0x00000000
setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}
uimage=/boot/uImage
zimage=/boot/zImage

Environment size: 1569/131068 bytes
GoFlexHome> boot
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 1 Storage Device(s) found
reading ubldr
280361 bytes read in 88 ms (3 MiB/s)
CACHE: Misaligned operation at range [01000098, 0102acc8]
CACHE: Misaligned operation at range [0102acd0, 0102b873]
CACHE: Misaligned operation at range [0102b874, 0102d25c]
CACHE: Misaligned operation at range [0102d25c, 0102d2b8]
CACHE: Misaligned operation at range [0102d2b8, 01031da6]
CACHE: Misaligned operation at range [01031db0, 010334ac]
CACHE: Misaligned operation at range [010334b0, 01036548]
## Starting application at 0x01000098 ...
Consoles: U-Boot console  

Compatible U-Boot API signature found @0x7b12860

FreeBSD/arm U-Boot loader, Revision 1.2

(root@Multiboot, Thu Jul 20 09:36:42 BST 2017)

DRAM: 128MB

Number of U-Boot devices: 2

U-Boot env: loaderdev='usb 0:1'

Found U-Boot device: disk

  Checking unit=0 slice=1 partition=<auto>... good.

Booting from disk0s1:

|#/#-#

\#|#/#-#\#|#/#-#\#can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.

loader> boot

|#/#-#\#|#/#-#\#|#can't load 'kernel'

no bootable kernel

Almost there!

Not sure if something is missing from the environment, or whether there is something missing from the USB stick. There is a 'kernel' file in the root of the FAT partition, so I'm not sure whether there is something wrong with it, or whether U-boot can't load it.
Re: Is uBoot OS specific?
July 30, 2017 04:32AM
balanga,


> Compatible U-Boot API signature found @0x7b12860
>
> FreeBSD/arm U-Boot loader, Revision
> 1.2

>
> (root@Multiboot, Thu Jul 20 09:36:42 BST 2017)
>
> DRAM: 128MB
>
> Number of U-Boot devices: 2
>
> U-Boot env: loaderdev='usb 0:1'
>
> Found U-Boot device: disk
>
> Checking unit=0 slice=1 partition=<auto>... good
> .
>

Good progress! Now we know that there are a few default envs that the ubldr expects, such as loaderdev.


> Booting from disk0s1:
>
> |#/#-#
>
> \#|#/#-#\#|#/#-#\#can't load 'kernel'
>

The kernel file was not found, or an env needed to be defined.


> Almost there!
>
> Not sure if something is missing from the environm
> ent, or whether there is something missing from th
> e USB stick. There is a 'kernel' file in the root
> of the FAT partition, so I'm not sure whether ther
> e is something wrong with it, or whether U-boot ca
> n't load it.

Yes, almost there!

That kernel file was what ubldr looking for, and could not find it!

Could you compare the location of your BSD kernel file and the rPi kernel file, see if they are at the same location?

I also need to look at the rPi envs again.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 30, 2017 04:43AM
balanga,

There are 2 files that needed to be where they are in the rootfs:

/boot/kernel/kernel
/kirkwood-goflexhome.dtb

So check your rootfs to see if they are at those locations.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 30, 2017 04:55AM
But the rPi instruction states:


https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20P

Quote

A FreeBSD bootable image for Raspberry Pi has both FAT and UFS partitions containing the following files:

FAT Partition
bootcode.bin - First stage boot
start.elf - Second stage boot
config.txt - configuration for start.elf
rpi.dtb - FDT file loaded via config.txt
uboot.bin - Third stage: U-Boot loader
uEnv.txt - configuration file for U-Boot
ubldr - Fourth stage: FreeBSD bootloader
UFS Partition
/boot/kernel - dynamic kernel
... rest of FreeBSD ...

So the kernel file might be

/boot/kernel

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 30, 2017 06:33AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> Good progress! Now we know that there are a few de
> fault envs that the ubldr expects, such as loaderd
> ev.
>
>
> > Booting from disk0s1:
> >
> > |#/#-#
> >
> > \#|#/#-#\#|#/#-#\#can't load 'kernel'
> >
>
> The kernel file was not found, or an env needed to
> be defined.
>
>
> > Almost there!
>
> Yes, almost there!
>
> That kernel file was what ubldr looking for, and c
> ould not find it!
>
> Could you compare the location of your BSD kernel
> file and the rPi kernel file, see if they are at t
> he same location?

These are the files on the RPi FAT partition:-

23/12/2016  08:21            17,900 bootcode.bin
23/12/2016  08:21         2,664,088 start.elf
23/12/2016  08:21         3,621,768 start_x.elf
23/12/2016  08:21           567,672 start_cd.elf
23/12/2016  08:21               103 config.txt
23/12/2016  08:21             9,590 rpi2.dtb
23/12/2016  08:21           301,088 u-boot.bin
23/12/2016  08:21           231,800 ubldr.bin
23/12/2016  08:21           283,886 ubldr
23/12/2016  08:21             6,161 fixup.dat
23/12/2016  08:21             9,214 fixup_x.dat
23/12/2016  08:21             2,366 fixup_cd.dat
23/12/2016  08:21               607 README
23/12/2016  08:21             1,447 LICENCE.broadcom

As you can see there is no 'kernel' although config.txt contains:-

disable_commandline_tags=0
device_tree_address=0x100
device_tree=rpi2.dtb
kernel=u-boot.bin
gpu_mem=64


> I also need to look at the rPi envs again.

Also remember that the RPi card uses a FreeBSD U-Boot.
Re: Is uBoot OS specific?
July 30, 2017 07:58AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> There are 2 files that needed to be where they are
> in the rootfs:
>
> /boot/kernel/kernel
> /kirkwood-goflexhome.dtb

I presume this is what I have as db88f6281.dtb....

No more progress to relate at the moment. It seems like a FreeBSD problem now, since it is actually getting loaded.


Just wondered if it's possible to enter the parameters
setenv fatdev 'usb 0:1'

setenv loaderdev ${fatdev}
setenv bootfile ubldr
setenv fdtfile kirkwood-goflexhome.dtb

setenv kernel_addr_r 0x01000000
setenv loadaddr 0x02000000
setenv pxefile_addr_r 0x00100000
setenv ramdisk_addr_r 0x02100000
setenv scriptaddr 0x00000000
fdt addr 0x100

setenv bootcmd 'usb start; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}'
printenv
boot

in an automated way - entering each one individually via clipboard is proving error prone.

> So check your rootfs to see if they are at those l
> ocations.
Re: Is uBoot OS specific?
July 30, 2017 09:42AM
> balanga,
>
> There are 2 files that needed to be where they are
> in the rootfs:
>
> /boot/kernel/kernel
> /kirkwood-goflexhome.dtb

I presume this is what I have as db88f6281.dtb....

No more progress to relate at the moment. It seems like a FreeBSD problem now, since it is actually getting loaded.


On the FreeBSD forum, someone pointed this out which may be useful...

https://wiki.freebsd.org/FlattenedDeviceTree#Using_loader.288.29

I'll investigate this later
Re: Is uBoot OS specific?
July 30, 2017 04:30PM
> Just wondered if it's possible to enter the parame
> ters
> in an automated way - entering each one individual
> ly via clipboard is proving error prone.

Sure. It's now time to scritp them. I'll write a short description how.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 30, 2017 04:54PM
Many thanks!

The FreeBSD build calls the DTB db88f6201,dtb. Does its name matter?
Re: Is uBoot OS specific?
July 30, 2017 06:14PM
balanga Wrote:
-------------------------------------------------------
> Many thanks!
>
> The FreeBSD build calls the DTB db88f6201,dtb. Doe
> s its name matter?

Yes it does.

Please get the lisiting of all files in the top 2 level of directories on your GF Home FreeBSD rootfs and post here. If there are too many files, you can pastebin and post the link here.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Is uBoot OS specific?
July 31, 2017 01:21AM
bodhi Wrote:
-------------------------------------------------------
> balanga Wrote:
> --------------------------------------------------
> -----
> > Many thanks!
> >
> > The FreeBSD build calls the DTB db88f6201,dtb. D
> oe
> > s its name matter?
>
> Yes it does.
>
> Please get the lisiting of all files in the top 2
> level of directories on your GF Home FreeBSD rootf
> s and post here. If there are too many files, you
> can pastebin and post the link here.


That's one of the problems, I don't really know... According to this guide - which which I've been trying to follow and which is several years old

https://cooltrainer.org/freebsd-kirkwood/building/


Install the kernel
 mount -t msdosfs /dev/da0s1 /root/usb
cp /usr/obj/arm/usr/src/sys/DOCKSTAR-COOLTRAINER/kernel.bin /root/usb
umount /root/usb
Install world
 mount /dev/da0s2a /root/usb
export DESTDIR=/root/usb
make installworld distrib-dirs distribution TARGET_ARCH=arm

So it looks like just a single file is copied to the boot partition. My build has a slightly different structure but the patches in the guide above have been folded into the mainline code, and it does create a db88f6201.dtb.. I haven't received any guidance from the author, but I'll try asking around since it appears that several people have this working.
Re: Is uBoot OS specific?
July 31, 2017 02:20AM
> That's one of the problems, I don't really know...

Understood. That's why I' suggested just cd to to top level folder of the rootfs and list the files. For example, it the USB drive is mounted in another Linux/BSD box as /media/sdb1, then,

mount /dev/sdb1 /media/sdb1
cd /media/sdb1
ls -l

And 2 level of directories, because if a folder is relevant such as /boot or /kernel, then I need to see the file names in it.

For example, is the .dtb file in the top level directory? is there a file named "kernel"? is there a uboot.bin file and where is it? Are they at the same location in the rPi rootfs?

Because those are likely the relevant files that you'd need to script.

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



Edited 2 time(s). Last edit at 07/31/2017 02:22AM by bodhi.
Re: Is uBoot OS specific?
July 31, 2017 02:42AM
bodhi, if you can let me have a script, i can experiment by copying various files to my boot partition until I find some combination that gets me to the login prompt

As I see it you've already created a U-Boot which will load FreeBSD's uldr so can this be wriiten to nand? Presumably this can be updated if there are any modifications.
Re: Is uBoot OS specific?
July 31, 2017 02:51AM
balanga Wrote:
-------------------------------------------------------
> bodhi, if you can let me have a script, i can expe
> riment by copying various files to my boot partit
> ion until I find some combination that gets me to
> the login prompt

Sure. Let me upload it in a moment.

>
> As I see it you've already created a U-Boot which
> will load FreeBSD's uldr so can this be wriiten to
> nand? Presumably this can be updated if there are
> any modifications.

Once you booted into FreeBSD then you can flash it there. If this turns out to be a long delay then I'll write instruction to flash it in serial console.

BTW, and keep in mind that if you flash the new u-boot, the default envs will boot Linux. You will need to use the script to boot Arch or BSD. Until you can boot BSD successfully, you should not save envs.

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



Edited 2 time(s). Last edit at 07/31/2017 02:57AM by bodhi.
Re: Is uBoot OS specific?
July 31, 2017 03:06AM
On another box, download and copy the attached boot script uEnv.txt to your /boot directory in your FreeBSD rootfs 1st partition.

1. Insert the FreeBSD rootfs to the GoFlexHome. Run kwboot with U-Boot 2017.05-tld-2 (Jul 26 2017 - 02:37:42 -0700) GoFlex Home. And power up the GoFlex Home.

2. After kwboot has loaded the new u-boot, interrupt serial console and

setenv load_bsdenv 'usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize'
setenv boot_bsd 'run load_bsdenv; boot'

Once the uEnv.txt script has been loaded, list the envs to double check to see it the envs in this script were set correctly. And then boot

printenv
run boot_bsd

Please post entire serial console log here.

If FreeBSD is booted successfully, this u-boot can be flashed to NAND. Instruction will followed.

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



Edited 6 time(s). Last edit at 07/31/2017 05:12PM by bodhi.
Attachments:
open | download - uEnv.txt (287 bytes)
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: