Welcome! Log In Create A New Profile

Advanced

Is uBoot OS specific?

Posted by balanga 
Re: Is uBoot OS specific?
July 31, 2017 01:17PM
bodhi Wrote:
-------------------------------------------------------
> Here is the uEnv.txt script.
>
>
>
> run bootcmd_uenv
>

## Error: "bootcmd_uenv" not defined
Re: Is uBoot OS specific?
July 31, 2017 03:34PM
balanga Wrote:
-------------------------------------------------------
> bodhi Wrote:
> --------------------------------------------------
> -----
> > Here is the uEnv.txt script.
> >
> >
> >
> > run bootcmd_uenv
> >
>
> ## Error: "bootcmd_uenv" not defined

Ah! I forgot that you still have Arch u-boot envs, not my u-boot default envs. Will revise the instruction above.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Is uBoot OS specific?
July 31, 2017 04:13PM
Re: Is uBoot OS specific?
August 01, 2017 04:21AM
Script started on Tue 01 Aug 2017 09:04:24 BST
#]0;me@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mme@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m$ exit####sudo sh bodhi
[sudo] password for me: 
Sending boot message. Please reboot the target...#-#\#|#/#-#\#|#/#-#\#|#/#-#\
Sending boot image...
  0 % [......................................................................]
  1 % [......................................................................]
  3 % [......................................................................]
  5 % [......................................................................]
  6 % [......................................................................]
  8 % [......................................................................]
 10 % [......................................................................]
 11 % [......................................................................]
 13 % [......................................................................]
 15 % [......................................................................]
 17 % [......................................................................]
 18 % [......................................................................]
 20 % [......................................................................]
 22 % [......................................................................]
 23 % [......................................................................]
 25 % [......................................................................]
 27 % [......................................................................]
 29 % [......................................................................]
 30 % [......................................................................]
 32 % [......................................................................]
 34 % [......................................................................]
 35 % [......................................................................]
 37 % [......................................................................]
 39 % [......................................................................]
 41 % [......................................................................]
 42 % [......................................................................]
 44 % [......................................................................]
 46 % [......................................................................]
 47 % [......................................................................]
 49 % [......................................................................]
 51 % [......................................................................]
 53 % [......................................................................]
 54 % [......................................................................]
 56 % [......................................................................]
 58 % [......................................................................]
 59 % [......................................................................]
 61 % [......................................................................]
 63 % [......................................................................]
 64 % [......................................................................]
 66 % [......................................................................]
 68 % [......................................................................]
 70 % [......................................................................]
 71 % [......................................................................]
 73 % [......................................................................]
 75 % [......................................................................]
 76 % [......................................................................]
 78 % [......................................................................]
 80 % [......................................................................]
 82 % [......................................................................]
 83 % [......................................................................]
 85 % [......................................................................]
 87 % [......................................................................]
 88 % [......................................................................]
 90 % [......................................................................]
 92 % [......................................................................]
 94 % [......................................................................]
 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=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: 1455/131068 bytes
GoFlexHome> setenv load_bsdenv 'usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize'
GoFlexHome> setenv boot_bsd 'run load_bsdenv; boot'
GoFlexHome> printenv
api_address=7b12860
baudrate=115200
boot_bsd=run load_bsdenv; boot
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;
load_bsdenv=usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize
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: 1584/131068 bytes
GoFlexHome> run boot_bsd
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 /boot/uEnv.txt
287 bytes read in 63 ms (3.9 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
reading ubldr
280361 bytes read in 91 ms (2.9 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> ls -l


|#open '/' failed: no such file or directory


loader> #[A#[Bls -l boot


#[A#[Bls not found


loader> #[A#[Blsdev -v


#[A#[Blsdev not found


loader> lsmod -v


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> help


/#Verbose help not available, use '?' to list commands


loader> ? fdt


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> fdt


usage is 'fdt <command> [<args>]


loader> fdt help


unknown command


loader> fdt ?


unknown command


loader> ubenv


usage: 'ubenv <import|show> [var ...]


loader> ubenv show


uboot.loaderdev=usb 0:1


uboot.boot_bsd=run load_bsdenv; boot


uboot.loadbootenv=load ${type} ${disk}:1 ${loadaddr} /boot/uEnv.txt


uboot.fatdev=usb 0:1


uboot.pxefile_addr_r=0x00100000


uboot.bootm=echo Booting from ${disk} ...; run setargs; bootm ${loadaddr};


uboot.api_address=7b12860


uboot.importbootenv=echo Importing environment (uEnv.txt)...; env import -t $loadaddr $filesize


uboot.scriptaddr=0x00000000


uboot.ethaddr=00:10:75:2E:AE:0F


uboot.fdt_addr=0x800000


uboot.baudrate=115200


uboot.uimage=/boot/uImage


uboot.zimage=/boot/zImage


uboot.ethact=egiga0


uboot.bootcmd=usb start;fdt addr 0x100;fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}


uboot.load_bsdenv=usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize


uboot.kernel_addr_r=0x01000000


uboot.bootz=echo Booting from ${disk} ...; run setargs; bootz ${loadaddr} - ${fdt_addr};


uboot.filesize=44729


uboot.bootfile=ubldr


uboot.mtdids=nand0=orion_nand


uboot.fdt_file=/boot/dtbs/kirkwood-goflexnet.dtb


uboot.fdtfile=db88f6281.dtb


uboot.setargs=setenv bootargs console=${console},${baudrate} ${optargs} root=/dev/sd${letter}1 rw rootwait ${mtdparts}


uboot.loadaddr=0x02000000


uboot.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;


uboot.bootdelay=3


uboot.fileaddr=2000000


uboot.mtdparts=mtdparts=orion_nand:1M(u-boot),-(rootfs)


uboot.loadfdt=load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}


uboot.ramdisk_addr_r=0x02100000


uboot.loadzimage=load ${type} ${disk}:1 ${loadaddr} ${zimage}


uboot.loaduimage=load ${type} ${disk}:1 ${loadaddr} ${uimage}


uboot.console=ttyS0


loader> ls -al /


loader> #[A#[Bls -al


#[A#[Bls not found


loader> ls -?


loader> printenv


printenv not found


loader> boot kernel.bin


-#\#|#/#-#\#|#/#-#can't find 'kernel.bin'


loader> fdt


usage is 'fdt <command> [<args>]


loader> load -t dtb db88f56# ## #6281.dtb


can't load file before kernel


loader> lsmod


loader> fdt ls


No device tree blob found!





loader> #]0;me@ThinkPad-X61: ~/projects/kwboot-tool##[01;32mme@ThinkPad-X61#[00m:#[01;34m~/projects/kwboot-tool#[00m$ exit
exit

Script done on Tue 01 Aug 2017 09:33:52 BST

Apologies for the truncated lines, I haven't mastered Ubuntu's clipboard yet...

It seems that the system can't load the kernel and I can't work out how to do a directory listing.

I see this line but can't work out where it come from
FreeBSD/arm U-Boot loader, Revision 1.2
Doesn't seem to be in ubldr.

I tried entering some commands at the Loader> prompt but couldn't get any to work. How do I work out the cwd for the Loader> prompt?
Re: Is uBoot OS specific?
August 01, 2017 03:20PM
> FreeBSD/arm U-Boot loader, Revision 1.2

This means you are running inside ubldr

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

Again, this error indicates that ubldr cannot find the "kernel" to load. An env for that might be missing.

> loader> #[A#[Bls -l boot
> loader> #[A#[Blsdev -v

You can not run a typical Unix/Linus shell command here. uboot loader is a boot loader which has limited capability.

> loader> fdt ls
> No device tree blob found!

This means the DTB file has not been loaded successfully yet.

> It seems that the system can't load the kernel and
> I can't work out how to do a directory listing.

Shut down and insert the FreeBSD rootfs stick to ThinkPad-X61. Mount it if it is not automounted.

Assuming it is mounted at /media/sdb1 (in your FreeBSD system it could be at a different mount point).

cd /media/sdb1
ls -l .
ls -l boot
ls -l kernel

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 08/01/2017 05:01PM by bodhi.
Re: Is uBoot OS specific?
August 01, 2017 05:09PM
total 8928
drwxr-xr-x   1 root  wheel    16384 Dec 31  1979 .
drwxr-xr-x  12 root  wheel      512 Jul 20 07:01 ..
drwxr-xr-x   1 root  wheel     4096 Jul 31 19:52 boot
-rwxr-xr-x   1 root  wheel     5482 Jul 20 09:45 db88f6281.dtb
-rwxr-xr-x   1 root  wheel  4408164 Jul 30 06:25 kernel
-rwxr-xr-x   1 root  wheel  4408164 Jul 20 09:50 kernel.bin
-rwxr-xr-x   1 root  wheel      287 Jul 31 13:47 uEnv.txt
-rwxr-xr-x   1 root  wheel   280361 Jul 20 09:36 ubldr

./boot:
total 8924
drwxr-xr-x  1 root  wheel     4096 Jul 31 19:52 .
drwxr-xr-x  1 root  wheel    16384 Dec 31  1979 ..
-rwxr-xr-x  1 root  wheel     5482 Jul 20 09:45 db88f6281.dtb
-rwxr-xr-x  1 root  wheel  4408164 Jul 30 06:25 kernel
-rwxr-xr-x  1 root  wheel  4408164 Jul 20 09:50 kernel.bin
-rwxr-xr-x  1 root  wheel      287 Jul 31 13:47 uEnv.txt
-rwxr-xr-x  1 root  wheel   280361 Jul 20 09:36 ubldr


I have the same five files in both locations... just in case...
Re: Is uBoot OS specific?
August 01, 2017 05:17PM
bodhi Wrote:
-------------------------------------------------------
>
> > loader> #[A#[Bls -l boot
> > loader> #[A#[Blsdev -v
>
> You can not run a typical Unix/Linus shell command
> here. uboot loader is a boot loader which has limi
> ted capability.

https://www.freebsd.org/cgi/man.cgi?loader(8)

BUILTIN	COMMANDS
     In	loader,	builtin	commands take parameters from the command line.
     Presently,	the only way to	call them from a script	is by using evaluate
     on	a string.  If an error condition occurs, an exception will be gener-
     ated, which can be	intercepted using ANS Forth exception handling words.
     If	not intercepted, an error message will be displayed and	the inter-
     preter's state will be reset, emptying the	stack and restoring interpret-
     ing mode.

     The builtin commands available are:

     ls	[-l] [path]
	     Displays a	listing	of files in the	directory path,	or the root
	     directory if path is not specified.  If -l	is specified, file
	     sizes will	be shown too.
Re: Is uBoot OS specific?
August 01, 2017 06:30PM
balanga,

> I have the same five files in both locations... ju
> st in case...

Not a good thing to do! just keep them in the original location only.

Which directory is the original?

And output of these?

ls -l .
ls -l boot
ls -l kernel

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 08/01/2017 06:32PM by bodhi.
Re: Is uBoot OS specific?
August 01, 2017 11:33PM
I've moved everything into /boot

ls -l .
drwxr-xr-x  1 root  wheel  4096 Jul 31 19:52 boot

ls -l boot
-rwxr-xr-x  1 root  wheel     5482 Jul 20 09:45 db88f6281.dtb
-rwxr-xr-x  1 root  wheel  4408164 Jul 30 06:25 kernel
-rwxr-xr-x  1 root  wheel  4408164 Jul 20 09:50 kernel.bin
-rwxr-xr-x  1 root  wheel      287 Jul 31 13:47 uEnv.txt
-rwxr-xr-x  1 root  wheel   280361 Jul 20 09:36 ubldr

ls -l kernel
ls: kernel: No such file or directory

Re: Is uBoot OS specific?
August 02, 2017 01:55AM
balanga Wrote:
-------------------------------------------------------
> I've moved everything into /boot
>

Again, that's not a good idea. Because ubldr might have the kernel file and DTB file paths hardcoded in it. If it does not use envs to find the files, then the path is likely hardcoded.

Try moving them back to the original location and see if the boot process got further.

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Is uBoot OS specific?
August 02, 2017 02:44AM
Actually I just stumbled upon a missing link

https://cooltrainer.org/freebsd-kirkwood/installation/
Unlike the Sheevaplug and other Kirkwood hardware, the DockStar has a crippled bootloader. 
Luckily, Jeff Doozan maintains a replacement. Install it.

The default setup will attempt to load a Linux kernel image from USB. Change it to search for FreeBSD’s kernel.bin.
 fw_setenv usb_boot 'fatload usb $usb_device 0x900000 kernel.bin; go 0x900000;'
fw_setenv usb_init 'usb start; if fatload usb 0 0x900000 kernel.bin; then setenv usb_device 0; elif fatload usb 1 0x900000 kernel.bin; then setenv usb_device 1; elif fatload usb 2 0x900000 kernel.bin; then setenv usb_device 2; elif fatload usb 3 0x900000 kernel.bin; then setenv usb_device 3; elif fatload usb 4 0x900000 kernel.bin; then setenv usb_device 4; else run pogo_bootcmd; fi;'

kernel.bin is the name of the kernel produced by the build referred to in this guide https://cooltrainer.org/freebsd-kirkwood/building/


The 'crippled bootloader' mentioned above is this http://projects.doozan.com/uboot/

I'm not sure how old this information is or whether an update is available. Presumably it supports bootelf...
Re: Is uBoot OS specific?
August 02, 2017 03:24PM
Re: Is uBoot OS specific?
August 02, 2017 05:03PM
balanga,

Please repeat this task. Run the ls commands below exactly as they were written.

Shut down and insert the FreeBSD rootfs stick to ThinkPad-X61. Mount it if it is not automounted. Assuming it is mounted at /media/sdb1 (in your FreeBSD system it could be at a different mount point).

cd /media/sdb1
ls -l 
ls -lR  ./boot/

1. Post the output of the above commands here at the top of your post.
2. Any follow up discussion/questions should be at the bottom of your post (as the 2nd part of the post).

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 1 time(s). Last edit at 08/02/2017 09:00PM by bodhi.
Re: Is uBoot OS specific?
August 03, 2017 08:30AM
bodhi Wrote:
-------------------------------------------------------
> I will post another alternative booting script: uE
> nv.2.txt.

Did you post an alternative uEnv2.txt?
Re: Is uBoot OS specific?
August 03, 2017 04:17PM
balanga Wrote:
-------------------------------------------------------
> bodhi Wrote:
> --------------------------------------------------
> -----
> > I will post another alternative booting script:
> uE
> > nv.2.txt.
>
> Did you post an alternative uEnv2.txt?

No, not before I see the output from the above

Quote

balanga,

Please repeat this task. Run the ls commands below exactly as they were written.

Shut down and insert the FreeBSD rootfs stick to ThinkPad-X61. Mount it if it is not automounted. Assuming it is mounted at /media/sdb1 (in your FreeBSD system it could be at a different mount point).

cd /media/sdb1
ls -l
ls -lR ./boot/

1. Post the output of the above commands here at the top of your post.
2. Any follow up discussion/questions should be at the bottom of your post (as the 2nd part of the post).

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner
Re: Is uBoot OS specific?
August 04, 2017 02:12AM
I'm getting a little confused by the procedure you want me to go through, so I will reiterate what I think it is, just for my own reference and correct me if I have misunderstood something.

1. copy supplied uEnv.txt to /media/sdb1/root/uEnv.txt

2. directory listing of USB FAT partition

3. run './kwboot -t -B 115200 /dev/cuaU0 -b uboot.2017.05-tld-2.goflexhome.mtd0.kwb -p'

4. interupt boot process and enter the following:-
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'

printenv
run boot_bsd

ls -l

drwxr-xr-x  1 root  wheel    16384 Jul 31 19:52 boot
-rwxr-xr-x  1 root  wheel     5482 Jul 20 09:45 db88f6281.dtb
-rwxr-xr-x  1 root  wheel  4408164 Jul 30 06:25 kernel
-rwxr-xr-x  1 root  wheel   280361 Jul 20 09:36 ubldr

ls -lR ./boot/

-rwxr-xr-x  1 root  wheel  287 Jul 31 13:47 uEnv.txt

Re: Is uBoot OS specific?
August 04, 2017 05:20AM
balanga,

Yes, that's exactly the procedure.

But in your test, ubldr could not find the kernel file to load, and the DTB was not loaded to the expected address, either.

So that's why I need to see where in your FreeBSD rootfs for GFHome (not the rPi) these 2 files are. Afer that, they should be either scripted in uEnv.txt, or copied to the correct location. It seems ubldr look for these files at a fixed location, not using env.

The following folders needed to be listed:

ls -la .
ls -laR boot
ls -la kernel/
ls -la kernel/kernel

Note that I wrote these commands this way because there might be too many files under kernel directory. Or they might not exist.

If you want, upload your GFHome FreeBSD rootfs somewhere and I'll download and examine it. Important: if you upload, you should upload the rootfs just as you have created it now using FreeBSD build script (no modification to it before uploading).

Or you could just pastebin this, expected to be a long list output:

ls -laR .

-bodhi
===========================
Wiki
latest Kirkwood kernel builds and rootfs
latest u-boot-kirkwood builds
latest Oxnas kernel builds and rootfs
latest u-boot-oxnas builds
latest MVEBU Armada kernel builds and rootfs
U-Boot & Kernel Booting process
bodhi's u-boot GitHub
bodhi's corner



Edited 2 time(s). Last edit at 08/04/2017 05:24AM by bodhi.
Re: Is uBoot OS specific?
August 04, 2017 06:10AM
A log of the latest kwboot session:-

 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> 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
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: 1455/131068 bytes
GoFlexHome> setenv load_bsdenv 'usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize'
GoFlexHome> setenv boot_bsd 'run load_bsdenv; boot'
GoFlexHome> printenv
api_address=7b12860
baudrate=115200
boot_bsd=run load_bsdenv; boot
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;
load_bsdenv=usb start; load usb 0:1 0x810000 /boot/uEnv.txt; env import -t 0x810000 $filesize
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: 1584/131068 bytes
GoFlexHome> run boot_bsd
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 /boot/uEnv.txt
287 bytes read in 63 ms (3.9 KiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
reading ubldr
280361 bytes read in 91 ms (2.9 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> 

Re: Is uBoot OS specific?
August 04, 2017 06:29AM
bodhi Wrote:
-------------------------------------------------------
>
> If you want, upload your GFHome FreeBSD rootfs som
> ewhere and I'll download and examine it. Important
> : if you upload, you should upload the rootfs just
> as you have created it now using FreeBSD build scr
> ipt (no modification to it before uploading).

The FreeBSD rootfs is on a seperate UFS partition which I presume one of ubldr, kernel or dtb know where to find.

Here's something I found from someone who has produced a guide..

Update the Bootloader

fw_setenv usb_boot 'fatload usb $usb_device 0x900000 kernel.bin; go 0x900000;'
fw_setenv usb_init 'usb start; if fatload usb 0 0x900000 kernel.bin; then setenv usb_device 0; elif fatload usb 1 0x900000 kernel.bin; then setenv usb_device 1; elif fatload usb 2 0x900000 kernel.bin; then setenv usb_device 2; elif fatload usb 3 0x900000 kernel.bin; then setenv usb_device 3; elif fatload usb 4 0x900000 kernel.bin; then setenv usb_device 4; else run pogo_bootcmd; fi;'

This looks for various boot devices, but I'm only interested in 1 USB device, and it loads kernel.bin from that device. In my build kernel.bin has been replaced by kernel, but I assume the bootloader must be told the name of the program and where to load it... I'm just guessing here..
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: