# U-Boot bootloader for FreeBSD



## balanga (Nov 13, 2017)

In my ongoing quest to get my GoFlexHome to work as a FreeBSD file server, I'm trying to get it to boot via tftp, but am unsure of what files I need to store on the tftp server to get it to boot.

Any suggestions?


----------



## Phishfry (Nov 13, 2017)

Gonzo has a blog entry about this:
https://kernelnomicon.org/?p=306

Covered here too:
https://wiki.freebsd.org/FreeBSDMarvell


----------



## balanga (Nov 16, 2017)

Phishfry said:


> Gonzo has a blog entry about this:
> https://kernelnomicon.org/?p=306



The article looks to be written in short-hand, and seems to be designed for those who have previously set up the whole process. I can see myself struggling to make this work.

I have pfSense and FreeNAS set up to provide DHCP, TFTPD and NFS, although I'm not sure how easy it is to configure them as suggested in the article.



> Covered here too:
> https://wiki.freebsd.org/FreeBSDMarvell



I'd be interested to know where this 'Marvell U-Boot' comes from and how I would get it installed on my GoFlexHome unit...
but I'm principally interested in what file to fetch from the tftp server and how to execute it.
This line seems to be what I need...
`tftpboot 900000 mv5281/kernel.bin`


----------



## Phishfry (Nov 16, 2017)

Why not try on a know working board like your rpi2. Figure out tftp booting with a known booting kernel.


----------



## balanga (Nov 28, 2017)

balanga said:


> The article looks to be written in short-hand, and seems to be designed for those who have previously set up the whole process. I can see myself struggling to make this work.
> 
> I have pfSense and FreeNAS set up to provide DHCP, TFTPD and NFS, although I'm not sure how easy it is to configure them as suggested in the article.
> 
> ...



According to Thread 59609 ubldr.bin should now be used instead of kernel.bin...

But why should the file be loaded at the address 0x900000? Is that related to the version of U-Boot?


----------



## balanga (Nov 28, 2017)

In another attempt to follow instructions here I see a number things I don't understand...

For example:

```
Prepare a drive
I’m using a slow, generic 2GB flash drive, but anything with at least a GiB or so of space should do.

Delete any existing partitions.
[LIST=1]
[*]gpart delete -i 1 da0
[*]gpart destroy da0
[/LIST]
Create a 32MiB FAT partition and fill the rest of the drive with a FreeBSD slice.
[LIST=1]
[*]gpart create -s MBR da0
[*]gpart add -s 32M -t freebsd da0
[*]gpart add -t freebsd da0
[/LIST]
Format the FAT partition.
[LIST=1]
[*]newfs_msdos /dev/da0s1
[/LIST]
Label the UFS slice, create the filesystem, and add a filesystem volume label so the kernel can find it later.
[LIST=1]
[*]bsdlabel -w /dev/da0s2
[*]newfs -n da0s2a
[*]tunefs -L kirkwoodroot /dev/da0s2a
[/LIST]
```
The first partition has '-t freebsd' and then is formatted msdos... seems strange... then the only file installed appears to be kernel.bin

```
Install the kernel
[LIST=1]
[*]mount -t msdosfs /dev/da0s1 /root/usb
[*]cp /usr/obj/arm/usr/src/sys/DOCKSTAR-COOLTRAINER/kernel.bin /root/usb
[*]umount /root/usb
[/LIST]
```
Having run

```
make -j 8 buildworld TARGET_ARCH=arm -DWITH_FDT
make -j 8 buildkernel TARGET_ARCH=arm KERNCONF=DB-88F6XXX
```
I seem to think that this is the file I should be using..
/usr/obj/arm.arm/usr/src/sys/boot/arm/uboot/ubldr.bin
 but can't be sure. Does anyone know?


----------

