# FreeBSDMarvell



## balanga (Mar 14, 2019)

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

```
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 (Mar 14, 2019)

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.






						228924 – LUA loader on by default
					






					bugs.freebsd.org


----------



## Phishfry (Mar 15, 2019)

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.


----------



## balanga (Mar 16, 2019)

Phishfry said:


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

```
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?


----------



## balanga (Mar 16, 2019)

Phishfry said:


> OK so what is the next step? Have you built or cobbled together a DTS for it?



Isn't that built into the kernel when you run `make -j 8 buildkernel TARGET_ARCH=arm KERNCONF=DB-88F6XXX`?


----------



## Phishfry (Mar 16, 2019)

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


			FlattenedDeviceTree - FreeBSD Wiki
		


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.


----------



## Phishfry (Mar 17, 2019)

Your kernconf name does not seem correct. Do you remember this post:
DOCKSTARWOIPSECNATT
https://lists.freebsd.org/pipermail/freebsd-arm/2017-April/015993.html
https://forums.freebsd.org/threads/interfacing-freebsd-with-u-boot.61424/#post-356450


----------



## balanga (Mar 17, 2019)

Phishfry said:


> No checkout this example from the FDT link.
> `make -j 8 buildworld TARGET_ARCH=arm -DWITH_FDT`
> 
> 
> FlattenedDeviceTree - FreeBSD Wiki



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



Booting from a USB stick would be nice. If I can achieve that, I'll think about how to proceed.


----------



## Phishfry (Mar 17, 2019)

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 (Mar 17, 2019)

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 (Mar 17, 2019)

balanga said:


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




__





						[SOLUTION] DB-88F6XXX kernel on 88F6281_A0 (GoFlex Net)
					





					lists.freebsd.org
				




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.


----------



## balanga (Apr 1, 2019)

Finally managed to get it to boot up to the login prompt and actually login...

Here's a boot log:-

```
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
Initializing devices...
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices...
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: ide_preinit failed
Loading envs from usb 0...
reading /boot/uEnv.txt
160 bytes read in 63 ms (2 KiB/s)
... envs loaded
importing envs ...
running scan_disk ...
Scan device usb
device usb 0:1
reading /boot/uImage
** Unable to read file /boot/uImage **
device usb 1:1
** Bad device usb 1 **
Scan device ide

Reset IDE: ide_preinit failed
device ide 0:1
** Bad device ide 0 **
device ide 1:1
** Bad device ide 1 **
reading ubldr
295973 bytes read in 85 ms (3.3 MiB/s)
CACHE: Misaligned operation at range [01000098, 01030c04]
CACHE: Misaligned operation at range [01030c04, 01031707]
CACHE: Misaligned operation at range [01031708, 010330f0]
CACHE: Misaligned operation at range [010330f0, 0103558b]
CACHE: Misaligned operation at range [01035590, 01036c98]
CACHE: Misaligned operation at range [01036c98, 01036cf4]
CACHE: Misaligned operation at range [01036cf4, 01036d5c]
CACHE: Misaligned operation at range [01036d5c, 01036e30]
CACHE: Misaligned operation at range [01036e30, 01036e3c]
## Starting application at 0x01000098 ...
Consoles: U-Boot console


Compatible U-Boot API signature found @0x7b12860





FreeBSD/arm U-Boot loader, Revision 1.2


(Thu Nov 30 14:06:37 GMT 2017 root@Test)





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 disk0s2:


|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-/boot/kernel/kernel data=0x684724+0x378dc \|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|/-\|syms=[0x4+0xaa940/-\|/+0x4+0x88e8b-\|/]





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



Booting [/boot/kernel/kernel] in 1 second...
Booting [/boot/kernel/kernel]...              


Using DTB compiled into kernel.


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


Kernel args: (null)


Copyright (c) 1992-2018 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 11.2-RELEASE #0: Fri Mar 22 10:56:27 UTC 2019
    root@S07:/usr/obj/arm.arm/usr/src/sys/DOCKSTAR arm
FreeBSD clang version 6.0.0 (tags/RELEASE_600/final 326565) (based on LLVM 6.0.0)
CPU: Feroceon 88FR131 rev 1 (**unknown 4** core)
  Little-endian DC enabled IC disabled WA disabled DC streaming enabled
  BTB disabled L2 enabled L2 prefetch enabled
  WB enabled LABT branch prediction disabled
  16KB/32B 4-way instruction cache
  16KB/32B 4-way write-back-locking-C data cache
real memory  = 134213632 (127 MB)
avail memory = 121315328 (115 MB)
SOC: Marvell 88F6281 rev A1, TClock 200MHz
  Instruction cache prefetch disabled, data cache prefetch disabled
  256KB 4-way set-associative write-through unified L2 cache
random: entropy device external interface
ofwbus0: <Open Firmware Device Tree>
simplebus0: <Flattened device tree simple bus> on ofwbus0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
localbus0: <Marvell device bus> on ofwbus0
ic0: <Marvell Integrated Interrupt Controller> mem 0x20200-0x2023b on simplebus0
timer0: <Marvell CPU Timer> mem 0x20300-0x2032f irq 1 on simplebus0
Event timer "CPUTimer0" frequency 200000000 Hz quality 1000
Timecounter "CPUTimer1" frequency 200000000 Hz quality 1000
gpio0: <Marvell Integrated GPIO Controller> mem 0x10100-0x1011f irq 35,36,37,38,39,40,41 on simplebus0
rtc0: <Marvell Integrated RTC> mem 0x10300-0x10307 on simplebus0
rtc0: registered as a time-of-day clock, resolution 1.000000s
twsi0: <Marvell Integrated I2C Bus Controller> mem 0x11000-0x1101f irq 43 on simplebus0
iicbus0: <Philips I2C bus> on twsi0
iic0: <I2C generic I/O> on iicbus0
mge0: <Marvell Gigabit Ethernet controller> mem 0x72000-0x73fff irq 12,13,14,11,46 on simplebus0
mge0: PHY0 attached, phy_sc points to mge0
mge0: Ethernet address: 52:3b:20:9c:11:51
miibus0: <MII bus> on mge0
e1000phy0: <Marvell 88E1116R Gigabit PHY> PHY 0 on miibus0
e1000phy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseT, 1000baseT-master, 1000baseT-FDX, 1000baseT-FDX-master, auto
uart0: <16550 or compatible> mem 0x12000-0x1201f irq 33 on simplebus0
uart0: console (1056,n,8,1)
uart1: <16550 or compatible> mem 0x12100-0x1211f irq 34 on simplebus0
cesa0: <Marvell Cryptographic Engine and Security Accelerator> mem 0x30000-0x30fff,0x3d000-0x3dfff irq 22 on simplebus0
ehci0: <Marvell Integrated USB 2.0 controller> mem 0x50000-0x50fff irq 48,19 on simplebus0
usbus0: EHCI version 1.0
usbus0 on ehci0
cryptosoft0: <software crypto>
Timecounters tick every 10.000 msec
ipfw2 (+ipv6) initialized, divert enabled, nat enabled, default to accept, logging disabled
DUMMYNET 0 with IPv6 initialized (100409)
load_dn_sched dn_sched PRIO loaded
load_dn_sched dn_sched QFQ loaded
load_dn_sched dn_sched RR loaded
load_dn_sched dn_sched WF2Q+ loaded
load_dn_sched dn_sched FIFO loaded
load_dn_sched dn_sched FQ_CODEL loaded
load_dn_sched dn_sched FQ_PIE loaded
load_dn_aqm dn_aqm CODEL loaded
load_dn_aqm dn_aqm PIE loaded
usbus0: 480Mbps High Speed USB v2.0
Trying to mount root from ufs:/dev/da0s2 [rw]...
Root mount waiting for: usbus0
ugen0.1: <Marvell EHCI root HUB> at usbus0
uhub0: <Marvell EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
uhub0: 1 port with 1 removable, self powered
Root mount waiting for: usbus0
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.2: <Lexar microSD RDR> at usbus0
umass0 on uhub0
umass0: <Lexar microSD RDR, class 0/0, rev 2.10/8.15, addr 2> on usbus0
mountroot: waiting for device /dev/da0s2...
(probe0:umass-sim0:0:0:0): REPORT LUNS. CDB: a0 00 00 00 00 00 00 00 00 10 00 00
(probe0:umass-sim0:0:0:0): CAM status: SCSI Status Error
(probe0:umass-sim0:0:0:0): SCSI status: Check Condition
(probe0:umass-sim0:0:0:0): SCSI sense: ILLEGAL REQUEST asc:20,0 (Invalid command operation code)
(probe0:umass-sim0:0:0:0): Error 22, Unretryable error
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <Lexar microSD RDR 0815> Removable Direct Access SPC-4 SCSI device
da0: Serial Number 000000000001
da0: 40.000MB/s transfers
da0: 7583MB (15529984 512 byte sectors)
da0: quirks=0x2<NO_6_BYTE>
WARNING: / was not properly dismounted
Setting hostuuid: 54e70ba7-5481-11e9-884f-3b2e22d83865.
Setting hostid: 0xb70082ad.
Starting file system checks:
/dev/da0s2: INCORRECT BLOCK COUNT I=481542 (8 should be 0) (CORRECTED)
/dev/da0s2: INCORRECT BLOCK COUNT I=561876 (8 should be 0) (CORRECTED)
/dev/da0s2: UNREF FILE I=481542  OWNER=root MODE=100600
/dev/da0s2: SIZE=0 MTIME=Apr  1 13:55 2019  (CLEARED)
/dev/da0s2: UNREF FILE I=561876  OWNER=root MODE=100600
/dev/da0s2: SIZE=0 MTIME=Apr  1 13:55 2019  (CLEARED)
/dev/da0s2: FREE BLK COUNT(S) WRONG IN SUPERBLK (SALVAGED)
/dev/da0s2: 28488 files, 629734 used, 1237873 free (361 frags, 154689 blocks, 0.0% fragmentation)
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat
random: unblocking device.
/etc/rc: WARNING: $hostname is not set -- see rc.conf(5).
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,NET_ETHER,NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: .
Starting Network: lo0 mge0 enc0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
    options=600003<RXCSUM,TXCSUM,RXCSUM_IPV6,TXCSUM_IPV6>
    inet6 ::1 prefixlen 128
    inet6 fe80::1%lo0 prefixlen 64 scopeid 0x2
    inet 127.0.0.1 netmask 0xff000000
    groups: lo
    nd6 options=21<PERFORMNUD,AUTO_LINKLOCAL>
mge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> memge0: link state changed to UP
tric 0 mtu 1500
    options=8000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE>
    ether 52:3b:20:9c:11:51
    hwaddr 52:3b:20:9c:11:51
    media: Ethernet autoselect (1000baseT <full-duplex,master>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
enc0: flags=0<> metric 0 mtu 1536
    groups: enc
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.
Starting Network: mge0.
mge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> metric 0 mtu 1500
    options=8000b<RXCSUM,TXCSUM,VLAN_MTU,LINKSTATE>
    ether 52:3b:20:9c:11:51
    hwaddr 52:3b:20:9c:11:51
    media: Ethernet autoselect (1000baseT <full-duplex,master>)
    status: active
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting Network: enc0.
enc0: flags=0<> metric 0 mtu 1536
    groups: enc
    nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
add host 127.0.0.1: gateway lo0 fib 0: route already in table
add host ::1: gateway lo0 fib 0: route already in table
add net fe80::: gateway ::1
add net ff02::: gateway ::1
add net ::ffff:0.0.0.0: gateway ::1
add net ::0.0.0.0: gateway ::1
Creating and/or trimming log files.
Starting syslogd.
Clearing /tmp (X related).
Updating motd:.
Mounting late filesystems:.
Starting sendmail_submit.
Starting sendmail_msp_queue.
can not chdir(/var/spool/clientmqueue/): Permission denied
Apr  1 13:57:41  sm-msp-queue[852]: NOQUEUE: SYSERR(root): can not chdir(/var/spool/clientmqueue/): Permission denied

Program mode requires special privileges, e.g., root or TrustedUser.
/etc/rc: WARNING: failed to start sendmail_msp_queue
Starting cron.
Starting background file system checks in 60 seconds.

Mon Apr  1 13:57:45 UTC 2019


FreeBSD/arm (Amnesiac) (ttyu0)



login: root
Apr  1 13:57:51  login: ROOT LOGIN (root) ON ttyu0

Last login: Mon Apr  1 13:30:58 on ttyu0
FreeBSD 11.2-RELEASE (DOCKSTAR) #0: Fri Mar 22 10:56:27 UTC 2019

Welcome to FreeBSD!

Release Notes, Errata: https://www.FreeBSD.org/releases/
Security Advisories:   https://www.FreeBSD.org/security/
FreeBSD Handbook:      https://www.FreeBSD.org/handbook/
FreeBSD FAQ:           https://www.FreeBSD.org/faq/
Questions List: https://lists.FreeBSD.org/mailman/listinfo/freebsd-questions/
FreeBSD Forums:        https://forums.FreeBSD.org/

Documents installed with the system are in the /usr/local/share/doc/freebsd/
directory, or can be installed later with:  pkg install en-freebsd-doc
For other languages, replace "en" with a language code like de or fr.

Show the version of FreeBSD installed:  freebsd-version ; uname -a
Please include that output and any error messages when posting questions.
Introduction to manual pages:  man man
FreeBSD directory layout:      man hier

Edit /etc/motd to change this login announcement.
You have new mail.
7[r[999;999H[6n8�root@:~ # dhclient mge0

DHCPREQUEST on mge0 to 255.255.255.255 port 67
DHCPACK from 192.168.1.1
bound to 192.168.1.55 -- renewal in 2878 seconds.
root@:~ # ping 8.8.8.8

PING 8.8.8.8 (8.8.8.8): 56 data bytes
64 bytes from 8.8.8.8: icmp_seq=0 ttl=119 time=29.386 ms
64 bytes from 8.8.8.8: icmp_seq=1 ttl=119 time=29.378 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=119 time=29.832 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=119 time=29.054 ms
^C
--- 8.8.8.8 ping statistics ---
4 packets transmitted, 4 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 29.054/29.413/29.832/0.277 ms
root@:~ # ~.

Unknown user: ..
root@:~ # ~
[EOT]

Command exit status: 0
Script done on Mon Apr  1 15:28:28 2019
```

There's a couple of things to iron out but essentially it's working!

And it only took nearly two years to get to this point . Many thanks to Phishfry and bodhi on the Doozan forum among others for their guidance...


----------



## Phishfry (Apr 2, 2019)

Good Job.
I don't see your Marvell SATA controller in there yet.
There is a hackish way to add devices to your DTB.
You decompile your DTB, to a DTS(Device Tree Source) This makes it human readable.
Edit this source to add those lines from the mailing list for the Marvel SATA.(Remember the plus signs in the patch)
Then recompile back into a DTB(Device Tree Binary) reboot and you have SATA.
The compiler used is called dtc (Device Tree Compiler)
This compiler only works on DTS and DTB. It is a shortcut to recompiling everything.
https://www.freebsd.org/cgi/man.cgi?dtc
It only takes a few seconds to compile/decompile the DTS/DTB.


----------



## balanga (Apr 2, 2019)

I've just found that ubldr from 11.2 wants to boot from net0... 
`Found U-Boot device: net
Booting from net0:`

The one from 11.1 boots from disk as a bootable device
`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 disk0s2:
Loading /boot/defaults/loader.conf`

Seeems like there is still quite a bit of work to do... Not sure what this *loaderdev* is or whether there are any FreeBSD utilities for accessing the uBoot environment


----------



## Phishfry (Apr 2, 2019)

I think this is uboot presenting net0 to ubldr.
There have been changes to uboot to allow you to choose what device to boot off of. Just like a bios.
Have you been able to figure that out? There is some keystroke while uboot is loading that will allow you to choose boot device.
I suggest you figure that out.(Maybe ESC key?) I have a feeling the different ubldr 's are not the problem.
It is uboot and its boot priorities.


----------



## balanga (Apr 2, 2019)

Phishfry said:


> I think this is uboot presenting net0 to ubldr.
> There have been changes to uboot to allow you to choose what device to boot off of. Just like a bios.
> Have you been able to figure that out? There is some keystroke while uboot is loading that will allow you to choose boot device.
> I suggest you figure that out.(Maybe ESC key?) I have a feeling the different ubldr 's are not the problem.
> It is uboot and its boot priorities.



It's definitely a different ubldr. I'm using the same uBoot which is installed in Flash.

Can't work out where ubldr gets built...


----------



## Phishfry (Apr 2, 2019)

Take a look at what trev writes here:
https://forums.freebsd.org/threads/...with-usb-pendrive-inserted.68230/#post-407684
I think you should poke around your uboot just to figure it out.
There is also `printenv` which should show you some information from uboot command line.


----------



## balanga (Apr 2, 2019)

Phishfry said:


> Take a look at what trev writes here:
> https://forums.freebsd.org/threads/...with-usb-pendrive-inserted.68230/#post-407684
> I think you should poke around your uboot just to figure it out.
> There is also `printenv` which should show you some information from uboot command line.



Just wondered if there is a FreeBSD equivalent of fw_printenv which is available on Linux...

I'm very familiar with `printenv`... 

This is what it shows:-

```
arcNumber=2097
bootcmd_exec=run load_uimage; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi
bootcmd=run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec
bootcmd_uenv=run uenv_load; if test $uenv_loaded -eq 1; then run uenv_import; fi
bootdelay=10
bootdev=usb
device=0:1
devices=usb ide mmc
disks=0 1 2 3
ethact=egiga0
ethaddr=52:3b:20:9c:11:51
if_netconsole=ping $serverip
ipaddr=192.168.0.231
led_error=orange blinking
led_exit=green off
led_init=green blinking
dtb_file=/boot/dts/kirkwood-pogo_e02.dtb
load_dtb_addr=0x1c00000
load_initrd_addr=0x1100000
load_uimage_addr=0x800000
load_dtb=echo loading DTB $dtb_file ...; load $bootdev $device $load_dtb_addr $dtb_file
load_initrd=echo loading uInitrd ...; load $bootdev $device $load_initrd_addr /boot/uInitrd
load_uimage=echo loading uImage ...; load $bootdev $device $load_uimage_addr /boot/uImage
machid=0x831
mainlineLinux=yes
mtdids=nand0=orion_nand
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)
partition=nand0,2
preboot_nc=run if_netconsole start_netconsole
scan_disk=echo running scan_disk ...; scan_done=0; setenv scan_usb "usb start";  setenv scan_ide "ide reset";  setenv scan_mmc "mmc rescan"; for dev in $devices; do if test $scan_done -eq 0; then echo Scan device $dev; run scan_$dev; for disknum in $disks; do if test $scan_done -eq 0; then echo device $dev $disknum:1; if load $dev $disknum:1 $load_uimage_addr /boot/uImage 1; then scan_done=1; echo Found bootable drive on $dev $disknum; setenv device $disknum:1; setenv bootdev $dev; fi; fi; done; fi; done
serverip=192.168.0.220
set_bootargs=setenv bootargs console=ttyS0,115200 root=LABEL=rootfs rootdelay=10 $mtdparts $custom_params
start_netconsole=setenv ncip $serverip; setenv bootdelay 10; setenv stdin nc; setenv stdout nc; setenv stderr nc; version;
stderr=serial
stdin=serial
stdout=serial
uenv_addr=0x810000
uenv_import=echo importing envs ...; env import -t $uenv_addr $filesize
uenv_init_devices=setenv init_usb "usb start";  setenv init_ide "ide reset";  setenv init_mmc "mmc rescan"; for devtype in $devices; do run init_$devtype; done;
uenv_load=run uenv_init_devices; setenv uenv_loaded 0; for devtype in $devices;  do for disknum in 0; do run uenv_read_disk; done; done;
uenv_read_disk=if test $devtype -eq mmc; then if $devtype part; then run uenv_read;  fi; else if $devtype part $disknum; then run uenv_read; fi;  fi
uenv_read=echo loading envs from $devtype $disknum ...; if load $devtype $disknum:1 $uenv_addr /boot/uEnv.txt; then setenv uenv_loaded 1; fi
usb_ready_retry=15
```


----------

