FreeBSDMarvell

balanga

Son of Beastie

Reaction score: 106
Messages: 2,514

Following this old guide, I managed to start:-
FreeBSD/arm U-Boot loader, Revision 1.2
which is great progress for me. The instructions are little out of date and need updating, but at least I have arrived in FreeBSD land....

Not sure what to do next. Here is what I got:-
Code:
Hit any key to stop autoboot:  0
GoFlexHome> setenv serverip 192.168.1.1
GoFlexHome> tftpboot 900000 gfh/ubldr.bin
Using egiga0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.23
Filename 'gfh/ubldr.bin'.
Load address: 0x900000
Loading: ###########################
     4.8 MiB/s
done
Bytes transferred = 389728 (5f260 hex)
GoFlexHome> go 900000                  
## Starting application at 0x00900000 ...
Consoles: U-Boot console
Compatible U-Boot API signature found @0x7b12860

FreeBSD/arm U-Boot loader, Revision 1.2

DRAM: 128MB
Number of U-Boot devices: 1
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: net
Booting from net0:
Startup error in /boot/lua/loader.lua:
LUA ERROR: cannot open /boot/lua/loader.lua: RPC struct is bad.

can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
loader>
Not sure what loaderdev is used for or what sort of values it needs and have never before come across an LUA ERROR, but we're moving in the right direction....
 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

In regards to the Lua error, as of FreeBSD12 the bootloader is now written in Lua instead of Forth.
A quick fix would be to revert to Forth. There is a setting for it. Your going to have to find that yourself.
Lookup all the recent Lua bootloader stuff. There is a fallback.

 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

OK so what is the next step? Have you built or cobbled together a DTS for it?
Since uboot is the ~BIOS you have to tell it about the hardware it is trying to bootstrap.
This is where the DTS comes in. It describes the hardware because Arm has no Plug and Play.
You actually initialize the hardware with the DTS/DTB.
https://wiki.freebsd.org/FlattenedDeviceTree
Then boot your custom Kirkwood kernel.
 
OP
OP
B

balanga

Son of Beastie

Reaction score: 106
Messages: 2,514

In regards to the Lua error, as of FreeBSD12 the bootloader is now written in Lua instead of Forth.
A quick fix would be to revert to Forth. There is a setting for it. Your going to have to find that yourself.
Lookup all the recent Lua bootloader stuff. There is a fallback.
My quick fix was to rebuild using FreeBSD 11.2 :)....
Code:
Hit any key to stop autoboot:  0
GoFlexHome> setenv serverip 192.168.1.1
GoFlexHome> tftpboot 900000 gfh2/ubldr.bin
Using egiga0 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.23
Filename 'gfh2/ubldr.bin'.
Load address: 0x900000
Loading: #################
     4.7 MiB/s
done
Bytes transferred = 244612 (3bb84 hex)
GoFlexHome> go 900000
## Starting application at 0x00900000 ...
Consoles: U-Boot console 
Compatible U-Boot API signature found @0x7b12860

FreeBSD/arm U-Boot loader, Revision 1.2
(Fri Mar 15 10:33:29 UTC 2019 root@Pristine)

DRAM: 128MB
Number of U-Boot devices: 1
U-Boot env: loaderdev not set, will probe all devices.
Found U-Boot device: net
Booting from net0:
/
can't load 'kernel'

Type '?' for a list of commands, 'help' for more detailed help.
loader>
I still can't figure out how to point the loader to the kernel...

is it via DHCP's 'filename' and 'root-path' options?
 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

No checkout this example from the FDT link.
make -j 8 buildworld TARGET_ARCH=arm -DWITH_FDT

You are building with your command for Arm and a custom kernel.
So you also need to add FDT support for the support of those tools.(-DWITH_FDT option builds the tools)
To me it looks like all you need is an DTS to proceed. The Linux DTS for your device will probably work for you.
There may be small incompatibilities between the FreeBSD needs and Linux. You will have to suss them out.
One possible way would be to start with a totally stripped out version.
Only enough to get it to boot, then add back fluffy things...

You passed milestone one with uboot over NFS. Now what?

So where are you thinking of going with this? 256Megabytes NAND is too small for an ordinary build.
You are going to have to slim your build with a custom /make.conf to get it to <256MB.
That or make the NAS devices internal HD part of OS and put just uboot/loader on NAND.
Regardless you need to make sure you don't use swap on the NAND. Minimize the writes to it.

So how are you compiling/building this??? Are you using a chroot env??

Also you need to be thinking ahead some. How will your devices 256MB's NAND look.
A small boot partition FAT for uboot and loader and the rest UFS for the OS.

Yell if you have any more specific questions.
 
OP
OP
B

balanga

Son of Beastie

Reaction score: 106
Messages: 2,514

No checkout this example from the FDT link.
make -j 8 buildworld TARGET_ARCH=arm -DWITH_FDT
All this looks way over my head...

You passed milestone one with uboot over NFS. Now what?
No, I've only managed to load the bootloader - ubldr.bin via tftp. It will be milestone when I can load the kernel. That's where I'm stuck at the moment.

So where are you thinking of going with this? 256Megabytes NAND is too small for an ordinary build.
You are going to have to slim your build with a custom /make.conf to get it to <256MB.
That or make the NAS devices internal HD part of OS and put just uboot/loader on NAND.
Regardless you need to make sure you don't use swap on the NAND. Minimize the writes to it.

So how are you compiling/building this??? Are you using a chroot env??

Also you need to be thinking ahead some. How will your devices 256MB's NAND look.
A small boot partition FAT for uboot and loader and the rest UFS for the OS.

Yell if you have any more specific questions.
Booting from a USB stick would be nice. If I can achieve that, I'll think about how to proceed.
 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

That custom kernconf may no longer be needed. That might have been a quirk on an older version of FreeBSD.
If it compiles OK then ignore that issue.
 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

It looks like the FreeBSD build in source tree DTS might suffice.
/usr/src/sys/boot/fdt/dts/arm/db88f6281.dts
So just add -DWITH_FDT to your compile line. The kernconf points to the file needed.
 

Phishfry

Son of Beastie

Reaction score: 1,176
Messages: 3,401

No, I've only managed to load the bootloader - ubldr.bin via tftp. It will be milestone when I can load the kernel. That's where I'm stuck at the moment.
If you look at the mailing list post they boot the kernel instead of the loader:

So first off recompile with -DWITH_FDT added to your command.
Will not work without this step.

Then try this:
tftpboot $addr_rd dockstarwoipsecnatt <<<< example provided<<<
Your setup:
tftpboot 900000 gfh2/DB-88F6XXX
go 900000
Kernel has no file extension. The kernconf 'ident' is the kernel name.
 
Top