Welcome! Log In Create A New Profile

Advanced

Is uBoot OS specific?

Posted by balanga 
Re: Is uBoot OS specific?
July 22, 2017 04:14AM
I'm not sure what this would give me since I use FreeBSD and building is not the issue.

The instructions at https://cooltrainer.org/freebsd-kirkwood/building/ contain errors and ommissions due to being out of date.

The issue for me is being able to invoke a program via uBoot. So far I can load a program from the network via tftp, but I'm not sure how to execute it.
Re: Is uBoot OS specific?
July 22, 2017 06:34AM
OK. I am sorry about that.

Just a bit off topic. Why do you wanna run a FreeBSD on your Seagate GoFLEX Home? Is Linux not good enough or perhaps you are more familiar with a FreeBSD than a Linux?
Re: Is uBoot OS specific?
July 22, 2017 08:02AM
I'm more familiar with FreeBSD. I run a FreeBSD based router/firewall ( pfSense), a FreeBSD based NAS (FreeNAS) and a FreeBSD VPS. I have a number of laptops with FreeBSD installed and even run FreeBSD on my Raspberry Pi :)...

It's my preferred OS, and since it is apparently possible to run it on a GoFlexHome unit, that's what I'm aiming to do, hence the title of this thread.
Re: Is uBoot OS specific?
July 22, 2017 03:58PM
balanga Wrote:
-------------------------------------------------------
> I have a number of
> laptops with FreeBSD installed and even run FreeBS
> D on my Raspberry Pi
:)...
>

Looking at how your PI boots then wouldn't it provide you with how to adapt that to your needs.

http://elinux.org/RPi_U-Boot talks about this and

Oleksandr Tymoshenko's branch for u-boot may give you what you are looking for.
Re: Is uBoot OS specific?
July 22, 2017 05:09PM
> Looking at how your PI boots then wouldn't it prov
> ide you with how to adapt that to your needs.
>
> http://elinux.or
> g/RPi_U-Boot
talks about this and

Exactly, that's what I've been recommending :) I guess this will be the last time.

-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 24, 2017 12:56PM
This is an interesting link that shows the FreeBSD boot procedure quite clearly.

https://kernelnomicon.org/?tag=nvidia

The ubldr is basically the u-boot wrapper that loads the BSD kernel. This binary has hooks that callback to u-boot API.

/src/FreeBSD/obj/arm.armv6/src/FreeBSD/wip/sys/boot/arm/uboot/ubldr

This file should be loaded into memroy and then go command can be executed. The page described how to boot it with network, but it would be simpler if we load it from USB.

It looks quite easy. However, to run this I would need to build another version of the GoFlex Home u-boot that has CONFIG_API turned on (it was turned off to save space),

-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 07/24/2017 12:59PM by bodhi.
Re: Is uBoot OS specific?
July 24, 2017 03:22PM
feas Wrote:
-------------------------------------------------------
> balanga Wrote:
> --------------------------------------------------
> -----
> > I have a number of
> > laptops with FreeBSD installed and even run F
> reeBS
> > D on my Raspberry Pi
:)...
> >
>
> Looking at how your PI boots then wouldn't it prov
> ide you with how to adapt that to your needs.
>
> http://elinux.or
> g/RPi_U-Boot
talks about this and
>
> Oleksandr Tymoshenko's branch for u-boot may give
> you what you are looking for.

At this point, I think trying to build a FreeBSD U-Boot would be a distraction since I'm told my ArchLinux U-Boot should be capable of loading FreeBSD. As I understand it, I need to figure out what to put in my uEnv.txt. I currently have this for booting Debian:-

console=ttyS0,115200
uimage=/boot/uImage
initrd=/boot/uInitrd
fdt_file=/boot/dts/kirkwood-pogo_e02.dtb 
fdt_addr=0x1c00000
uimage_addr=0x800000
initrd_addr=0x1100000
loadfdt=ext2load ${type} ${disk}:1 ${fdt_addr} ${fdt_file}
loaduimage=ext2load ${type} ${disk}:1 ${uimage_addr} ${uimage}
loaduinitrd=ext2load ${type} ${disk}:1 ${initrd_addr} ${initrd} 
set_bootargs=setenv bootargs console=$console root=LABEL=rootfs rootdelay=10 $mtdparts
load_debian=setenv type usb; setenv disk 0; run set_bootargs; echo Running loadfdt ...;run loadfdt; echo Running loaduinitrd ...;run loaduinitrd; echo Running loaduimage ...; run loaduimage 
bootm=run load_debian; echo Booting from ${type} ${disk}:1 ...; bootm ${uimage_addr} ${initrd_addr} ${fdt_addr}

but can't figure out what uimage or initrd are or what their FreeBSD equivalents would be.
Re: Is uBoot OS specific?
July 24, 2017 10:30PM
>
> At this point, I think trying to build a FreeBSD U
> -Boot would be a distraction since I'm told my Arc
> hLinux U-Boot should be capable of loading FreeBSD
> . As I understand it, I need to figure out what to
> put in my uEnv.txt.

Then it is really easy.

> but can't figure out what uimage or initrd are or
> what their FreeBSD equivalents would be.

uImage: kernel image + u-boot header
uInitrd: init ram disk + u-boot header

The equivalence of uImage in BSD: none. The BSD kernel file (elf format) should be the equivalence of Linux kernel image inside uImage. Ram disk? don't know if BSD use ramdisk, probably not. Arch Linux does not (unless you explicitly build and use it).

u-boot boot commands bootm and bootz are for Linux kernel. bootelf is for any other system that has elf format image. That's what the link I posted above is about. But since to boot a kernel, there are a whole bunch of hardware characteristics that need to pass to that kernel (implicitly done in bootm and bootz), they have something called ubldr, which is basically a wrapper that call u-boot API to extract those parameters and then pass them to BSD 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
Re: Is uBoot OS specific?
July 25, 2017 12:35AM
bodhi Wrote:
-------------------------------------------------------
> This is an interesting link that shows the FreeBSD
> boot procedure quite clearly.
>
> https://kernelnomicon.org/?tag=nvidia
>
> The ubldr is basically the u-boot wrapper that loa
> ds the BSD kernel. This binary has hooks that call
> back to u-boot API.
>
>
> /src/FreeBSD/obj/arm.armv6/src/FreeBSD/wip/sys/boo
> t/arm/uboot/ubldr
>
>
> This file should be loaded into memroy and then go
> command can be executed. The page described how to
> boot it with network, but it would be simpler if w
> e load it from USB.

Since I already have a PXE environment set up, I thought I'd try a network boot, and ran
dhcp; bootelf

as mentioned, but got a msg "Unknown command 'bootelf'"
Re: Is uBoot OS specific?
July 25, 2017 01:31AM
balanga,

> as mentioned, but got a msg "Unknown command 'boot
> elf'"

Then Arch u-boot did not have bootelf.

I think it is best to look at what's in your rPi and do a similar boot procedure. If you have serial console connected to rPi then you could reboot and post the serial log here.

-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 25, 2017 06:06AM
bodhi Wrote:
>
> I think it is best to look at what's in your rPi a
> nd do a similar boot procedure. If you have seria
> l console connected to rPi then you could reboot a
> nd post the serial log here.

Here's the first part of it:-

Connected

U-Boot 2015.04 (Oct 14 2016 - 16:33:57)

DRAM:  944 MiB
WARNING: Caches not enabled
RPI 2 Model B
MMC:   bcm2835_sdhci: 0
reading uboot.env

** Unable to read "uboot.env" from mmc0:1 **
Using default environment

In:    serial
Out:   lcd
Err:   lcd
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  2  1  0 
Booting from: mmc 0 ubldr
reading ubldr
283886 bytes read in 217 ms (1.2 MiB/s)
## Starting application at 0x02000098 ...
Consoles: U-Boot console  


Compatible U-Boot API signature found @0x3ab4a4c8





FreeBSD/armv6 U-Boot loader, Revision 1.2


(Fri Dec 23 08:20:58 MST 2016 brd@hive.raspbsd.org)





DRAM: 944MB


Number of U-Boot devices: 1


U-Boot env: loaderdev='mmc 0'


Found U-Boot device: disk


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


Booting from disk0s2a:


|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\/boot/kernel/kernel text=0x5e7558 |/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\data=0x5a3e4+0x1d969c |/-\syms=[0x4+0x893b0|/-\+0x4+0x9d69b|/-\|]





Hit [Enter] to boot immediately, or any other key for command prompt.



Booting [/boot/kernel/kernel] in 9 seconds... 
Booting [/boot/kernel/kernel] in 8 seconds... 
Booting [/boot/kernel/kernel] in 7 seconds... 
Booting [/boot/kernel/kernel] in 6 seconds... 
Booting [/boot/kernel/kernel] in 5 seconds... 
Booting [/boot/kernel/kernel] in 4 seconds... 
Booting [/boot/kernel/kernel] in 3 seconds... 
Booting [/boot/kernel/kernel] in 2 seconds... 
Booting [/boot/kernel/kernel] in 1 second... 
Booting [/boot/kernel/kernel]...               


Using DTB provided by U-Boot at address 0x100.


/-\|Kernel entry at 0x2200180...


Kernel args: (null)


KDB: debugger backends: ddb
KDB: current backend: ddb
Copyright (c) 1992-2016 The FreeBSD Project.
Copyright (c) 1979, 1980, 1983, 1986, 1988, 1989, 1991, 1992, 1993, 1994
	The Regents of the University of California. All rights reserved.
FreeBSD is a registered trademark of The FreeBSD Foundation.
FreeBSD 12.0-CURRENT #0 r310476: Fri Dec 23 08:20:46 MST 2016
    brd@hive.raspbsd.org:/usr/local/raspbsd/obj/RPI2/obj/arm.armv6/usr/local/raspbsd/src/common/sys/RPI2 arm
FreeBSD clang version 3.9.1 (tags/RELEASE_391/final 289601) (based on LLVM 3.9.1)
WARNING: WITNESS option enabled, expect reduced performance.
VT: init without driver.
CPU: ARM Cortex-A7 r0p5 (ECO: 0x00000000)
CPU Features: 
  Multiprocessing, Thumb2, Security, Virtualization, Generic Timer, VMSAv7,
  PXN, LPAE, Coherent Walk

Re: Is uBoot OS specific?
July 25, 2017 06:13AM
The microSDHC cards contains the following files on a FAT partition:-

total 7592
drwxr-xr-x   1 root  wheel    16384 Dec 31  1979 .
drwxr-xr-x  12 root  wheel      512 Jul 20 07:01 ..
-rwxr-xr-x   1 root  wheel     1447 Dec 23  2016 LICENCE.broadcom
-rwxr-xr-x   1 root  wheel      607 Dec 23  2016 README
-rwxr-xr-x   1 root  wheel    17900 Dec 23  2016 bootcode.bin
-rwxr-xr-x   1 root  wheel      103 Dec 23  2016 config.txt
-rwxr-xr-x   1 root  wheel     6161 Dec 23  2016 fixup.dat
-rwxr-xr-x   1 root  wheel     2366 Dec 23  2016 fixup_cd.dat
-rwxr-xr-x   1 root  wheel     9214 Dec 23  2016 fixup_x.dat
-rwxr-xr-x   1 root  wheel        0 Jul 25 12:56 rpi.lst
-rwxr-xr-x   1 root  wheel     9590 Dec 23  2016 rpi2.dtb
-rwxr-xr-x   1 root  wheel  2664088 Dec 23  2016 start.elf
-rwxr-xr-x   1 root  wheel   567672 Dec 23  2016 start_cd.elf
-rwxr-xr-x   1 root  wheel  3621768 Dec 23  2016 start_x.elf
-rwxr-xr-x   1 root  wheel   301088 Dec 23  2016 u-boot.bin
-rwxr-xr-x   1 root  wheel   283886 Dec 23  2016 ubldr
-rwxr-xr-x   1 root  wheel   231800 Dec 23  2016 ubldr.bin

config.txt contains:-

disable_commandline_tags=0
device_tree_address=0x100
device_tree=rpi2.dtb
kernel=u-boot.bin
gpu_mem=64
Re: Is uBoot OS specific?
July 25, 2017 03:01PM
Booting from: mmc 0 ubldr
reading ubldr
283886 bytes read in 217 ms (1.2 MiB/s)
## Starting application at 0x02000098 ...

The ubldr is loaded form the SD card, into address 0x02000098, and executed with a "go" command.

kernel=u-boot.bin

This probably specific to this rPi rootfs. But no matter, you just compare your own BSD rootfs with this.

1. Find, or build an ARMV5 rootfs for FreeBSD. I thought you did this.
2. See if the files match the rPir rootfs. IOW, does it have ubldr?
3. Interrupt rPi serial console, get the current u-boot envs, so we can see how the envs were executed

printenv

-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 25, 2017 04:12PM
bodhi Wrote:
-------------------------------------------------------
> 3. Interrupt rPi serial console, get the current u
> -boot envs, so we can see how the envs were execut
> ed

How do I interrupt the serial console?

I'm using 'cu' on FreeBSD to view the terminal session.

https://www.freebsd.org/cgi/man.cgi?cu(1)

No idea what is used on Linux, so I'd expect an interrupt signal would be different.
Re: Is uBoot OS specific?
July 25, 2017 04:40PM
balanga Wrote:
-------------------------------------------------------
>How do I interrupt the serial console?
>
>
> Here's the first part of it:-
>
>
> Connected
> 
> U-Boot 2015.04 (Oct 14 2016 - 16:33:57)
> 
> DRAM:  944 MiB
> WARNING: Caches not enabled
> RPI 2 Model B
> MMC:   bcm2835_sdhci: 0
> reading uboot.env
> 
> ** Unable to read "uboot.env" from mmc0:1 **
> Using default environment
> 
> In:    serial
> Out:   lcd
> Err:   lcd
> Net:   Net Initialization Skipped
> No ethernet found.
> Hit any key to stop autoboot:  2  1  0
> 
Re: Is uBoot OS specific?
July 25, 2017 04:58PM
feas Wrote:
-------------------------------------------------------
> balanga Wrote:
> --------------------------------------------------
> -----
> >How do I interrupt the serial console?
> >
> >
> > Here's the first part of it:-
> >
> >
> > Hit any key to stop autoboot:  2  1  0[
> /b]
> > 
Thanks for that...


Connected



U-Boot 2015.04 (Oct 14 2016 - 16:33:57)

DRAM:  944 MiB
WARNING: Caches not enabled
RPI 2 Model B
MMC:   bcm2835_sdhci: 0
reading uboot.env
*** Warning - bad CRC, using default environment

In:    serial
Out:   lcd
Err:   lcd
Net:   Net Initialization Skipped
No ethernet found.
Hit any key to stop autoboot:  2  1  0 
U-Boot> printenv
Fatboot=env exists loaderdev || env set loaderdev ${fatdev}; env exists UserFatboot && run UserFatboot; echo Booting from: ${fatdev} ${bootfile}; fatload ${fatdev} ${loadaddr} ${bootfile} && bootelf ${loadaddr}; 
Netboot=env exists ethact || usb start; env exists loaderdev || env set loaderdev net; env exists UserNetboot && run UserNetboot; dhcp ${loadaddr} ${bootfile} && bootelf ${loadaddr}; 
SetupFatdev=env exists fatdev || env set fatdev 'mmc 0'; 
arch=arm
baudrate=115200
board=rpi_2
board_name=rpi_2
bootcmd=run Fatboot
bootdelay=2
bootfile=ubldr
cpu=armv7
fatdev=mmc 0
fdtaddr=0x100
fdtfile=bcm2836-rpi-2-b.dtb
kernel_addr_r=0x01000000
loadaddr=0x02000000
preboot=fdt addr 0x100; env exists bootfile || env set bootfile ubldr; env exists SetupFatdev && run SetupFatdev; env exists UserPreboot && run UserPreboot; 
pxefile_addr_r=0x00100000
ramdisk_addr_r=0x02100000
scriptaddr=0x00000000
soc=bcm283x
stderr=serial,lcd
stdin=serial,lcd
stdout=serial,lcd
usbethaddr=b8:27:eb:2c:a6:39
vendor=raspberrypi

Environment size: 1064/16380 bytes
U-Boot> ~
[EOT]

Re: Is uBoot OS specific?
July 25, 2017 08:20PM
balanga,

Everything looks quite simple.

Btw, this rPi uboot looks a bit primitive (barebone).

- Now you will need to find out why your GFHome's Arch uboot does not support bootelf. Perhaps just it is not in the version that you are running. I could rebuild my GF Home uboot image for you to try (booting temorarily with kwboot, no flashing).

- After that, I 'll post the uEnv.txt for this. This will be dependent on which uboot you will run.

- what file system is your FreeBSD rootfs? not important but good to know.

-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 26, 2017 12:19AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> Everything looks quite simple.
>
> Btw, this rPi uboot looks a bit primitive (barebon
> e).

Well if you can suggest how to improve it, I will pass on the info..

> - Now you will need to find out why your GFHome's
> Arch uboot does not support bootelf. Perhaps just
> it is not in the version that you are running

I installed it running the instructions here:-

https://archlinuxarm.org/platforms/armv5/seagate-goflex-home
>. I c
> ould rebuild my GF Home uboot image for you to try
> (booting temorarily with kwboot, no flashing).

That would be great.

> - After that, I 'll post the uEnv.txt for this. Th
> is will be dependent on which uboot you will run.
>
> - what file system is your FreeBSD rootfs? not imp
> ortant but good to know.

Here is an example of how someone got this working a number of years ago:-

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, the kernel is on a FAT partition and the rest is on UFS...

Bodhi, I really appreciate the time you've taken to help me out.
Re: Is uBoot OS specific?
July 26, 2017 03:06AM
> I installed it running the instructions here:-
>
> https://archlinuxarm.org/platforms/armv5/seagate-g
> oflex-home

That's the latest when you install that u-boot, but Arch tend to update it to track mainline from time to time.

> So, the kernel is on a FAT partition and the rest
> is on UFS...

OK, we'll use the rPi example.

-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 26, 2017 03:30AM
bodhi Wrote:
-------------------------------------------------------
>
> OK, we'll use the rPi example.

This might help

https://wiki.freebsd.org/FreeBSD/arm/Raspberry%20Pi
Re: Is uBoot OS specific?
July 26, 2017 04:02AM
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 if your armV5 BSD rootfs for the GoFlexHome has the same file structure then we know how to boot it.

Attached in this post is the new GFHome u-boot: uboot.2017.05-tld-2.goflexhome.mtd0.kwb

How you would load this u-boot at serial console:
=====================================


If the box you are using is an ARM box (hopefully it is the rPi?), then use ARM version:

http://forum.doozan.com/read.php?3,12381

Quote

To download ARM kwboot binary for UART booting at Dropbox

kwboot-2016.05.tar
md5:
76977c5a61544a5707dfa17ae832a3ad
sha256:
25ee4fa8a94372d2d398cac4704e9ee3ca87585c29e72e18323209b7f163209d

kwboot (this is an older version)
md5:
0efd011bdb244436e432a8de33e639a1

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.

-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 07/26/2017 04:36AM by bodhi.
Attachments:
open | download - uboot.2017.05-tld-2.goflexhome.mtd0.kwb (512 KB)
Re: Is uBoot OS specific?
July 26, 2017 11:56PM
bodhi Wrote:
-------------------------------------------------------
>
> So if your armV5 BSD rootfs for the GoFlexHome has
> the same file structure then we know how to boot i
> t.
>
> Attached in this post is the new GFHome u-boot: u
> boot.2017.05-tld-2.goflexhome.mtd0.kwb

I have this file but not sure what to do with it... Do I copy it with this name to the FAT partition of my FreeBSD USB stick or do I use my Debian stick?


> How you would load this u-boot at serial console:
> =====================================
>
>
> If the box you are using is an ARM box (hopefully
> it is the rPi?), then use ARM version:
>
> http://forum.doozan.com/read.php?3,12381
>
>
Quote

To download ARM kwboot binary for UART boot
> ing at Dropbox
>
> kwboot-2016.05.tar
> md5:
> 76977c5a61544a5707dfa17ae832a3ad
> sha256:
> 25ee4fa8a94372d2d398cac4704e9ee3ca87585c29e72e1832
> 3209b7f163209d
>
> kwboot (this is an older version)
> md5:
> 0efd011bdb244436e432a8de33e639a1
>
> And then at serial console, instead of running pic
> ocom/putty/screen, run kwboot:
>
>
> ./kwboot -t -B 115200 /dev/ttyUSB0 -b uboot.2017.0
> 5-tld-2.goflexhome.mtd0.kwb -p
>

Should I also copy this to the FAT partition of my FreeBSD USB stick?


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

Sorry for so many questions, but the u-Boot environment is pretty daunting for me.
Re: Is uBoot OS specific?
July 27, 2017 12:24AM
balanga,

> I have this file but not sure what to do with it..
> . Do I copy it with this name to the FAT partition
> of my FreeBSD USB stick or do I use my Debian stic
> k?

When you connect with serial console, like here:

Connected

U-Boot 2015.04 (Oct 14 2016 - 16:33:57)

DRAM:  944 MiB
WARNING: Caches not enabled
RPI 2 Model B
MMC:   bcm2835_sdhci: 0
reading uboot.env

** Unable to read "uboot.env" from mmc0:1 **
Using default environment

Do you use picocom/minicom, putty or screen?

Instead of that binary, you will run kwboot. So download kwboot and this attached u-boot to the box where you start serial console.

kwboot serial comm functionality is the same as putty/picocom/screen, but it also capapble of loading a u-boot binary and send it to the box that will accept it and run it. GF Home bootROM is coded in a way that it will handshake with kwboot, receive the u-boot image, and run it.


> Sorry for so many questions, but the u-Boot enviro
> nment is pretty daunting for me.

Don't worry about it! most Linux desktop expert users don't know this subject. We'll just take it slow and ask anything you're not sure about.

-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 27, 2017 12:55AM
bodhi Wrote:
-------------------------------------------------------
> balanga,
>
> > I have this file but not sure what to do with it
> ..
> > . Do I copy it with this name to the FAT partiti
> on
> > of my FreeBSD USB stick or do I use my Debian st
> ic
> > k?
>
> When you connect with serial console, like here:
>
>
> Connected
> 
> U-Boot 2015.04 (Oct 14 2016 - 16:33:57)
> 
> DRAM:  944 MiB
> WARNING: Caches not enabled
> RPI 2 Model B
> MMC:   bcm2835_sdhci: 0
> reading uboot.env
> 
> ** Unable to read "uboot.env" from mmc0:1 **
> Using default environment
>
>
> Do you use picocom/minicom, putty or screen?
>
> Instead of that binary, you will run kwboot. So do
> wnload kwboot and this attached u-boot to the box
> where you start serial console.
>
> kwboot serial comm functionality is the same as pu
> tty/picocom/screen, but it also capapble of loadin
> g a u-boot binary and send it to the box that will
> accept it and run it. GF Home bootROM is coded in
> a way that it will handshake with kwboot, receive
> the u-boot image, and run it.

I'm still not sure I understand... Do you mean that I should run kwboot on my laptop rather than on my GoFlexHome unit?

On my laptop I'm running FreeBSD and using the cu command to connect over the serial link. If I'm supposed to use kwboot under FreeBSD, I doubt whether it would work. When I try running it, I get Exec format erro. Binary file not executable. I have never used picocom or screen.

Maybe I should try and compile it on FreeBSD.... I see the source code here:

https://searchcode.com/codesearch/view/26117643/.
Re: Is uBoot OS specific?
July 27, 2017 01:58AM
balanga,

> I'm still not sure I understand... Do you mean tha
> t I should run kwboot on my laptop rather than on
> my GoFlexHome unit?

Exactly. If you use your laptop to run serial console, then it is where kwboot will run. But you can also run it from the rPi. The rPi is ARM box so you would run the ARM kwboot.

>
> On my laptop I'm running FreeBSD and using the cu
> command to connect over the serial link. If I'm su
> pposed to use kwboot under FreeBSD, I doubt whethe
> r it would work.

> When I try running it, I get Exec
> format erro. Binary file not executable. I have ne
> ver used picocom or screen

I see.

On your laptop, I assume it is a x86 based system, you would need to run x86 kwboot. There is one I've uploaded here. Let's see if I can find it.

Update:

No. I can't find it. But I forgot it's BSD version that you need anyway.

-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 07/27/2017 02:07AM by bodhi.
Re: Is uBoot OS specific?
July 27, 2017 03:45AM
Maybe I can use kermit...
Re: Is uBoot OS specific?
July 27, 2017 02:52PM
balanga,

Find a FreeBSD kwboot binary to run it on one of your FreeBSD boxes.

Whichever version, ARM or x86, run it on the appropriate FreeBSD box and load it as I described above. Don't waste time try too many things that will not work, when you already have a proven method.

-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 28, 2017 02:53AM
bodhi Wrote:
-------------------------------------------------------
> And then at serial console, instead of running pic
> ocom/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.
GoFlexHome> help bootelf
Unknown command 'bootelf'  - try 'help' ...

I ran the above command and it connected OK, but went through the normal boot process. What should I have seen?

Also do I need to have anything in the FAT partition of my FreeBSD USB stick? Maybe I should delete everything as it may be interfering with your script...
Re: Is uBoot OS specific?
July 28, 2017 03:21AM
balanga,

Please post the entire serial log of what I asked you to do in this post:

http://forum.doozan.com/read.php?3,34799,35728#msg-35728

----

And then, ask questions if you are not sure you understand what we are doing in those steps.

That way, everybody who is intesrested in this subject can see the progress and hopefully will benefit from it.

That's how we normally do the hacking. I know you are not familiar with this process, but that's the most efficient way to go. We are probably in a different time zone, so question/answer exchange like in IRC is not going to work well. I probably post some followups when you are sleeping :)) and vice versa.

-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 07/28/2017 03:24AM by bodhi.
Re: Is uBoot OS specific?
July 28, 2017 07:15AM
I had deleted everything from the FAT partition on the USB stick before running this command.

./kwboot -t -B 115200 /dev/cuaU0 -b uboot.2017.05-tld-2.goflexhome.mtd0.kwb -p | tee /var/log/kwboot.log


I'm not sure what I should have seen but this what I saw:-






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  0 
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> help elfboot
Unknown command 'elfboot' - try 'help' without arguments for list of all known commands

GoFlexHome> help bootelf
Unknown command 'bootelf' - try 'help' without arguments for list of all known commands

GoFlexHome> he; lp
?       - 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    help bootelf            help elfboot            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> ~.
Unknown command '~.' - try 'help'
GoFlexHome> |.
syntax error
GoFlexHome> <INTERRUPT>
GoFlexHome> exit
exit not allowed from main input shell.
GoFlexHome>  
exit not allowed from main input shell.
GoFlexHome> 
exit not allowed from main input shell.
GoFlexHome> 
exit not allowed from main input shell.
GoFlexHome>


BTW how do I break out of kwboot?
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: