# Hummingboard 2 Edge



## Phishfry (Dec 31, 2021)

I have FreeBSD running on Hummingboard 2 Edge.
It is not supported but has enough similarities with Hummingboard-Pro to work.
This board uses an interchangable iMX6 CPU and Memory module.
Called a uSOM it also can hold embedded emmc storage.

```
CPU: ARM Cortex-A9 r2p10 (ECO: 0x00000000)
CPU Features: 
  Multiprocessing, Thumb2, Security, VMSAv7, Coherent Walk
Optional instructions: 
  UMULL, SMULL, SIMD(ext)
LoUU:2 LoC:2 LoUIS:2 
Cache level 1:
 32KB/32B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 4-way instruction cache Read-Alloc
real memory  = 2147483648 (2048 MB)
avail memory = 2089701376 (1992 MB)
```


----------



## Phishfry (Dec 31, 2021)

Here is the real killer feature. It has an M.2 slot that works with mSATA.

```
FreeBSD generic 13.0-RELEASE FreeBSD 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 06:33:09 UTC 2021     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC  arm
root@generic:~ # diskinfo -wS /dev/ada0
/dev/ada0
        512             # sectorsize
        124034899968    # mediasize in bytes (116G)
        242255664       # mediasize in sectors
        0               # stripesize
        0               # stripeoffset
        240333          # Cylinders according to firmware.
        16              # Heads according to firmware.
        63              # Sectors according to firmware.
        M.2 (S80) 3MG2-P        # Disk descr.
        20170606AA0008570055    # Disk ident.
        ahcich0         # Attachment
        Yes             # TRIM/UNMAP support
        0               # Rotation rate in RPM
        Not_Zoned       # Zone Mode

Synchronous random writes:
         0.5 kbytes:   1651.0 usec/IO =      0.3 Mbytes/s
           1 kbytes:   1674.5 usec/IO =      0.6 Mbytes/s
           2 kbytes:   1711.7 usec/IO =      1.1 Mbytes/s
           4 kbytes:   1679.5 usec/IO =      2.3 Mbytes/s
           8 kbytes:   1720.6 usec/IO =      4.5 Mbytes/s
          16 kbytes:   1801.2 usec/IO =      8.7 Mbytes/s
          32 kbytes:   1889.8 usec/IO =     16.5 Mbytes/s
          64 kbytes:   2226.4 usec/IO =     28.1 Mbytes/s
         128 kbytes:   2775.3 usec/IO =     45.0 Mbytes/s
         256 kbytes:   4021.1 usec/IO =     62.2 Mbytes/s
         512 kbytes:   5830.2 usec/IO =     85.8 Mbytes/s
        1024 kbytes:   8801.6 usec/IO =    113.6 Mbytes/s
        2048 kbytes:  14639.8 usec/IO =    136.6 Mbytes/s
        4096 kbytes:  26122.4 usec/IO =    153.1 Mbytes/s
        8192 kbytes:  49125.9 usec/IO =    162.8 Mbytes/s
```


----------



## Phishfry (Dec 31, 2021)

I hate fighting RTC on ARM. What a relief that SolidRun realized that and includes a RTC and battery plug.

```
nxprtc0: <NXP PCF8523 RTC> at addr 0xd0 on iicbus1
```

Cellular Modem mounted in the MiniPCIe slot on the underside of the board along with a SIM slot.

```
u3g0 on uhub2
u3g0: <Sierra Wireless, Incorporated MC7354, class 0/0, rev 2.00/0.06, addr 3> on usbus1
u3g0: Found 6 ports.
Autoloading module: u3g.ko
```


----------



## mark_j (Dec 31, 2021)

I have an old cubox i4 pro (with the imx 6) and it sort-of worked with FreeBSD. It looks like the support, albeit not directly, has improved. Perhaps I should dig it up and re-try with FreeBSD.
(If I recall eSata didn't work nor did HDMI and toslink/spdif.)
I think most of their products come with an RTC which is great for embedded stuff.  Certainly the cuboxs did.


----------



## Phishfry (Dec 31, 2021)

This is my first Quad Core uSOM

The bonus is they are still on sale. Not cheap but reasonable.

The cubox/hummingboard wiki has a link to a github script that puts Uboot from FreeBSD-11 on whatever you want.
That is the only way it will boot.

I plan on investigating the uboot in ports failing to work.
From a layman it appears that all uboot ports were conglomerated into uboot master tree around 2018.
Cubox and HB were using a custom SolidRun repository as the work there was not upstreamed to uboot.
This repository is from 2013 and still in use. I dunno how or why.

But when uboot slave ports were conglomerated into the same source tree we lost our support.
The uboot patches we have are for SolidRuns tree.

So I don't know what to do. Continue using old uboot in stupid hack or attempt to build and fix uboot.
That it works on Hummingboard2 is groovy.
GPIO assignments are the only fault I can find.

I need to see what it takes to use the /gnu/dtb files for HB2 instead of HB1.


----------



## Phishfry (Dec 31, 2021)

Can anyone help me understand this port message:



> U-Boot loader for SolidRun Cubox-i and Hummingboard.
> 
> Install the u-boot.imx file onto the boot disk using:
> 
> ...



What I am wondering is where is it writing u.boot.imx to? This is an unformated area of the disk right?

So when I go to make my uboot fat partition I must start it at a special spot to not overwrite u.boot.imx right?
`dd if=u-boot.imx of=/dev/da0 bs=1k oseek=1 conv=sync`

What would that look like? Do I have to start this command specially? Will MBR stomp on uboot without direction?
`gpart create -s mbr da0`

Where do I create an offset for uboot? Here?
`gpart add -t \!12 -s 10m da0`

This would be too late I assume:
`newfs_msdos -F12 -L 'MSDOSBOOT' /dev/da0s1`
`gpart set -a active -i 1 da0`


AllWinner wiki has more details but no example for creating partitions.


			arm/Allwinner/booting - FreeBSD Wiki
		


Anybody care to comment?


----------



## mark_j (Dec 31, 2021)

I see that Manu has done some commits for this u-boot version, so perhaps ask him on email?
He's a bit of a guru on all things SoC in NetBSD and also FreeBSD. I have a bookmark of his blog here, you might wish to read.

If you look at wandboard (which is imx.6) for crochet, here, you'll note it creates an MBR (line 16), something like:
`gpart create -s MBR geom`
Then it writes the u-boot image to it:
`dd if=${WANDBOARD_UBOOT_SRC}/u-boot.imx of=/dev/${DISK_MD} bs=512 seek=2`
So, that's seeking to 2*512 to write the image.


----------



## Phishfry (Dec 31, 2021)

Thanks for the crochet hints.
Funny thing is I have seen mailing list post about crochet being broken because it downloads uboot instead of using ports tree uboot.
But in this case that might be good. I need to see what happened around 2017.
That was last update to SolidRuns git repository for their IMX6 uboot fork.

All of this coinsides with FreeBSD uboot moving to a master port scheme.

I understand the 1024K set aside for u-boot.imx but I am unsure why its needed.
For example my Beaglebone only required copying files from uboot port to msdos partition.
No flashing a file to first 1K of disk.

Is this just an architectural thing? iMX6 needs first 1K of boot medium for bootstrap?
Whereas Beaglebone Ti am335 just has different routine for booting where it can read a file from msdos?


----------



## Phishfry (Dec 31, 2021)

I tried to get the Hummingboard1 to boot from mSATA. I was not successful but learned alot.
Now I have Hummingboard2 and
The work allowed me to set SATA as root without SDcard even mounting ufs.

```
# Custom /etc/fstab for FreeBSD embedded images
/dev/ada0s2a            /                       ufs             rw                      1       1
/dev/mmcsd0s1           /boot/msdos             msdosfs         rw,noatime              0       0
tmpfs                   /tmp                    tmpfs           rw,mode=1777,size=50m   0       0
```

Loaded on the SDcard is the full FreeBSD image modified with FreeBSD11 uboot partition hack

Earlier I had tried stripping it down to just the /boot directory on SDcard along with uboot fat partition.
Mounted /boot via fstab at /dev/mmcsd0s2a
That did not work. Tried to add path to kernel with /dev/mmcsd0s2a/boot . No luck
So by chance I skipped using mmcsd0s2a on sdcard in fstab and it worked.
I had the full image on ada0 so it just worked.
Amazing, I dunno what it is doing but I like the desired effect. No more depending on SDcard reads.

```
root@generic:~ # mount
/dev/ada0s2a on / (ufs, local, journaled soft-updates, nfsv4acls)
devfs on /dev (devfs)
/dev/mmcsd0s1 on /boot/msdos (msdosfs, local, noatime)
tmpfs on /tmp (tmpfs, local)
```
Downloading a ports tree heated her up some.

```
root@generic:~ # sysctl -a | grep temperature
hw.imx.throttle_temperature: 95.0C
hw.imx.temperature: 51.6C
```


----------



## mark_j (Dec 31, 2021)

Phishfry said:


> Thanks for the crochet hints.
> Funny thing is I have seen mailing list post about crochet being broken because it downloads uboot instead of using ports tree uboot.
> But in this case that might be good. I need to see what happened around 2017.
> That was last update to SolidRuns git repository for their IMX6 uboot fork.
> ...


It's another stage that sets up the device tree and perhaps enables other stuff like the RTC? I don't know, I'm guessing, but I expect if you email Emmanuel Vadot he will know and be able to explain it or fire up a message on freebsd-arm and likely someone knows the intricacies and you can post back with the information. 



Phishfry said:


> For example my Beaglebone only required copying files from uboot port to msdos partition.
> 
> No flashing a file to first 1K of disk.
> 
> Is this just an architectural thing? iMX6 needs first 1K of boot medium for bootstrap?



Speaking from a high degree of ignorance, yes, this seems to be architectural in that, regardless of the underlying CPU, if the SoC requires u-boot on a FAT partition or an EFI one, largely seems to depend on the design of the device.

That's why I looked at crochet for another imx.6 SoC board because I presumed it would be the same. 



Phishfry said:


> Whereas Beaglebone Ti336 just has different routine for booting where it can read a file from msdos?



Precisely. Look at the Wandaboard stuff. It's different again.


----------



## Phishfry (Dec 31, 2021)

Hummingboard2 uses jumpers for boot device.
Wow that sounds nice. Tried it and it don't work???





						HummingBoard Edge/Gate Boot Jumpers - Developer Center -  SolidRun
					






					developer.solid-run.com
				




Unfortunately uboot needs to have SATA compiled in the build.
FreeBSD's uboot for iMX6 does not include it.
More reasons to get uboot straightened out for this platform.


----------



## mark_j (Dec 31, 2021)

What about a later build of BSD? 12.3 seems to be the latest with a specific build for Cubox/Hummingboard. (Although it's not HummingBoard2 if that is significantly different?)


			Index of /ftp/releases/arm/armv7/ISO-IMAGES/12.3/


----------



## Phishfry (Dec 31, 2021)

I just bought a Transcend drive from the evil borg Amazon for this box.
Cheapest preferred name brand M.2--2242 drive was 512GB@$82

I had a 2280 M.2 Innodisk stuck in her and had to duct tape her in. She was a tad too long hanging off the side..


----------



## Phishfry (Dec 31, 2021)

mark_j said:


> What about a later build of BSD?


Please confirm with your similar box. I tested everything up the ladder. Failed.

I don't know how that's possible without someone speaking up. I do know its documented.


			arm/imx6 - FreeBSD Wiki
		

Ian is the iMX6 guru. The wiki is spot on and he made the latest changes.

I did not implement the changes at the very bottom of the wiki. Just what the script does.
(I did change script version to 13-RELEASE)
That might be why eMMC on SOM is not recognized.
I am not sure my rig even has any eMMC though. Never even tried the Linux distro.


----------



## Phishfry (Dec 31, 2021)

mark_j said:


> (Although it's not HummingBoard2 if that is significantly different?)


I am using the stock images except bad uboot trick.
So thankfully Cubox/Hummingboard work transfers. The Generic 13-RELEASE arm7 image is what I am using.
I think the SOM being similar/same really helps. The rest is peripherals.
Networking worked fine for a ports tree. My temps are hot because the board is out of the case.
The fact that M.2 worked when the mSATA on original board was MiniPCIe slot is great.

I would like to see MiniPCIe bus work on iMX6. My cellular modem works because it uses USB signalling.
mSATA must use its own wiring scheme.
I tested the slot with a MiniPCIe slot Serial Port card. It was not recognized. PCIe signalling needed.

On my Hummingboard1 there is mSATA on underside and Mini-PCIe Half-Slot on top.
I have not tested USB signalling MiniPCIe half cards in Hummingboard1. No SIM so I never tried.
I do have RT3072 wireless Mini-PCIe card half length (usb signalling) I could test it with.
A GPS module would also be a good USB slot test.


----------



## Phishfry (Dec 31, 2021)

mark_j
If you do have the cubox i4 model you may be in luck.
I was thinking in my head, cubox is too small for a mSATA slot.
So I went looking and sure enough, no mSATA slot. But....
The quad core version did have an eSATA connector.
So external SATA may be possible.





						CuBox-i Quick Start Guide - Developer Center -  SolidRun
					






					developer.solid-run.com
				




Yup here is a nice pic of the eSATA jack.





						SolidRun - Docs products:imx6:cubox-i:hardware [Wiki | SolidRun ]
					






					www.solid-run.com
				




Solid Run has some good documentation. That is for sure. Plus old disk images still up. Bravo
Now if they would push upstream uboot patches we might have something.


----------



## mark_j (Jan 1, 2022)

Yes, it has an eSata, that was one of the problems when I tried it a LONG time ago (FreeBSD 10?) and it didn't work.
It has since been archived in a box somewhere. I will have a look around to see if I can dig it out (hopefully the battery hasn't leaked all over the contents )

My Cubox is an i4 Pro if I recall correctly. It has, from memory, 2 usb2 slots, spdif, eSata, GB network and HDMI (full size). The SPDIF is to the side of the box. It has built-in CEC support for a remote. There's absolutely no room for an mSata. LOL.  It's basically 2inches squared.


Anyway, back to your hummingboard issue, I was thinking you could grab the version of FreeBSD 12.3 for the cubox/hummingboard and look at the structure of the image file to see if it matches what you're trying to build using the "custom" u-boot.


----------



## Phishfry (Jan 1, 2022)

I might try and re-invigorate the old uboot-hummingboard port that pointed to Solid Runs github.
Modernize from there.

I am also looking to build dts from gnu source for Hummingboard2
/usr/src/sys/gnu/dts/arm/imx6q-hummingboard2.dts
Then copy the dtb over to my boards /boot/dtb directory and see how it acts.

I don't understand what chooses the dtb to use on these generic arm images.
In the /boot/dtb/ directory is several different boards dtbs. So what is the chooser?

The reason I ask is uboot uses cubox dtb on my Hummingboard2

```
U-Boot 2013.10-rc4 (Sep 29 2016 - 10:50:56)

CPU:   Freescale i.MX6Q rev1.5 at 792 MHz
Reset cause: POR
Board: MX6-CuBox-i
DRAM:  2 GiB
MMC:   FSL_SDHC: 0
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
Warning: failed to set MAC address

** Unable to read file uEnv.txt **
Hit any key to stop autoboot:  0 
Booting from: mmc 0 ubldr
272013 bytes read in 30 ms (8.6 MiB/s)
## Starting application at 0x12000098 ...
Consoles: U-Boot console  
Compatible U-Boot API signature found @0x8f7708a8

FreeBSD/armv6 U-Boot loader, Revision 1.2
(root@releng2.nyi.freebsd.org, Thu Sep 29 11:08:21 UTC 2016)

DRAM: 2048MB
Number of U-Boot devices: 2
U-Boot env: loaderdev='mmc 0'
Found U-Boot device: disk
  Checking unit=0 slice=<auto> partition=<auto>... good.
Booting from disk0s2a:
Loading /boot/defaults/loader.conf
```

Instead it should be using /boot/dtb/imx6q-hummingboard.dtb


----------



## covacat (Jan 1, 2022)

on pi's latest freebsd boot procedures have the the dts compiled in the u-boot binary
freebsd loader can load dtb-s but their names should come from u-boot (you cannot set them in loader.conf)
you can specify overlays though
try to stop u-boot boot and printenv
look for fdt_* in it
for me just building the u-boot.bin from ports did not work until i added the conf option to embed the dtb
probably something wrong with my config.txt
in u-boot README

```
- Device tree:
                CONFIG_OF_CONTROL
                If this variable is defined, U-Boot will use a device tree
                to configure its devices, instead of relying on statically
                compiled #defines in the board file. This option is
                experimental and only available on a few boards. The device
                tree is available in the global data as gd->fdt_blob.

                U-Boot needs to get its device tree from somewhere. This can
                be done using one of the three options below:

                CONFIG_OF_EMBED
                If this variable is defined, U-Boot will embed a device tree
                binary in its image. This device tree file should be in the
                board directory and called <soc>-<board>.dts. The binary file
                is then picked up in board_init_f() and made available through
                the global data structure as gd->fdt_blob.

                CONFIG_OF_SEPARATE
                If this variable is defined, U-Boot will build a device tree
                binary. It will be called u-boot.dtb. Architecture-specific
                code will locate it at run-time. Generally this works by:

                        cat u-boot.bin u-boot.dtb >image.bin

                and in fact, U-Boot does this for you, creating a file called
                u-boot-dtb.bin which is useful in the common case. You can
                still use the individual files if you need something more
                exotic.

                CONFIG_OF_BOARD
                If this variable is defined, U-Boot will use the device tree
                provided by the board at runtime instead of embedding one with
                the image. Only boards defining board_fdt_blob_setup() support
                this option (see include/fdtdec.h file).
```


----------



## Phishfry (Jan 1, 2022)

I hit a roadblock just building a DTB from source. Strange thing is I get this error with Hummingboard 1 too.


```
root@HB2:/usr/src/sys/gnu/dts/arm # dtc -@ -O dtb -I dts -o imx6q-hummingboard2.dtb imx6q-hummingboard2.dts
Unable to merge node: sata
```

I guess I could force compile. That never works out good.
My other option is to de-compile my official FreeBSD working DTB and see what is changed from this gnu dts.


----------



## covacat (Jan 1, 2022)

you need to run the dts thru cpp first
cpp -x assembler-with-cpp -nostdinc -I include arch/arm/dts/imx6q-hummingboard2.dts |dtc -I dts  -O dts -o /tmp/xx.dts -


----------



## Phishfry (Jan 1, 2022)

I would have never figured that out.
I copied to Hummingboard2 the /usr/src/sys/gnu/dts directory to compile with dtc native.

My de-compiling failed too:

```
root@HB2:/boot/dtb # dtc -O dts -I dtb -o imx6q-cubox-i.dts imx6q-cubox-i.dtb
Failed to mmap file: Invalid argument
```

I had assumed the method to compile DTS to DTBO and back was similar on DTB/DTS


----------



## covacat (Jan 1, 2022)

if you used my line above be aware i put -O dts instead of -O dtb by mistake


----------



## Phishfry (Jan 2, 2022)

Well Thanks, your help certainly helped me find the culprit.
I need to copy more files or just download the whole source tree.


```
oot@HB2:/usr/src/sys/gnu/dts/arm # cpp -x assembler-with-cpp -nostdinc -I include /usr/src/sys/gnu/dts/arm/imx6q-hummingboard2.dts | dtc -O dtb -I dts -o imx6q-hummingboard2.dtb imx6q-hummingboard2.dts
Unable to merge node: sata
In file included from /usr/src/sys/gnu/dts/arm/imx6q-hummingboard2.dts:44:
./imx6q.dtsi:5:10: fatal error: 'dt-bindings/interrupt-controller/irq.h' file not found
#include <dt-bindings/interrupt-controller/irq.h>
         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
```


----------



## Phishfry (Jan 2, 2022)

My bad. I was running this from the wrong directory.
It *must* be ran from the /usr/src/sys/gnu/dts/ directory.
Then all paths are correct and it compiles.

Because I was having troubles I decided to output pre-process to a file to work out the problem.
`cpp -x assembler-with-cpp -nostdinc -I include /usr/src/sys/gnu/dts/arm/imx6q-hummingboard2.dts -o test.dts`


----------



## covacat (Jan 2, 2022)

i ran it from the top of extracted u-boot archive (/usr/ports/sysutils/u-boot-rpi)


----------



## grahamperrin@ (Jan 4, 2022)

Phishfry said:


> … the evil borg Amazon …



I do share the sentiment. Still, some of what's done by Amazon interests me …


----------



## Phishfry (Jan 7, 2022)

I compiled u-boot for cubox-hummingboard from ports and added support for SATA in config.
Finally just flashed the firmware to sd card and it gets along well. It is trying to pxeboot.
This is encouraging. I need to throw the jumpers for mSATA to see if it will boot that.


```
U-Boot SPL 2021.07 (Dec 29 2021 - 03:40:30 -0500)
WDT:   Not found!
Trying to boot from MMC1


U-Boot 2021.07 (Dec 29 2021 - 03:40:30 -0500)

CPU:   Freescale i.MX6Q rev1.3 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 28C
Reset cause: POR
Board: MX6 HummingBoard2
DRAM:  2 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   
Warning: ethernet@2188000 (eth0) using random MAC address - fa:dc:39:e1:59:d0
eth0: ethernet@2188000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
Scanning mmc 1:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk usdhc@2194000.blk...
** Unrecognized filesystem type **
Scanning disk usdhc@2198000.blk...
** Unrecognized filesystem type **
Found 4 disks
No EFI system partition
No panel detected: default to HDMI
Display: HDMI (1024x768)
ERROR: invalid device tree
switch to partitions #0, OK
mmc2(part 0) is current device
** No partition table - mmc 2 **
Couldn't find partition mmc 2:1
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part
SATA Device Info:
S/N: G884850166
Product model number: TS512GMTS430S
Firmware version: R0427GN1
Capacity: 1000215216 sectors

Device 0: Model: TS512GMTS430S Firm: R0427GN1 Ser#: G884850166
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
... is now current device
** No partition table - sata 0 **
Couldn't find partition sata 0:1
starting USB...
Bus usb@2184000: usb dr_mode not found
USB EHCI 1.00
Bus usb@2184200: USB EHCI 1.00
scanning bus usb@2184000 for devices... 1 USB Device(s) found
scanning bus usb@2184200 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 0 Storage Device(s) found

Device 0: unknown device
BOOTP broadcast 1
BOOTP broadcast 2
BOOTP broadcast 3
BOOTP broadcast 4
BOOTP broadcast 5
BOOTP broadcast 6
DHCP client bound to address 192.168.1.121 (6966 ms)
*** Warning: no boot file name; using 'C0A80179.img'
Using ethernet@2188000 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.121
Filename 'C0A80179.img'.
Load address: 0x12000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
missing environment variable: pxeuuid
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A80179
Using ethernet@2188000 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.121
Filename 'pxelinux.cfg/C0A80179'.
Load address: 0x12000000
Loading: T T T T T T T T T T
Retry count exceeded; starting again
missing environment variable: bootfile
Retrieving file: pxelinux.cfg/C0A8017
Using ethernet@2188000 device
TFTP from server 192.168.1.1; our IP address is 192.168.1.121
Filename 'pxelinux.cfg/C0A8017'.
Load address: 0x12000000
Loading: T T
```


----------



## Phishfry (Jan 10, 2022)

Phishfry said:


> I must start it at a special spot to not overwrite u.boot.imx right?


OK I have mastered this process.

So all the Generic images I tried and fail did so because I did not flash the uboot.imx  uboot to disk.
That is what is needed. iMX6 requires u-boot raw mode. Wrote to first 1K of disk.
`dd if=u-boot.imx of=/dev/da0 bs=1k oseek=1 conv=sync`
Write the FreeBSD Generic Arm image to a SD disk then flash the uboot-imx to SDCard.
Even though it overwrites the first 1K this does not affect the MBR scheme it seems.

Could I use a freebsd-boot partition type instead and flash to that?


----------



## covacat (Jan 10, 2022)

Phishfry said:


> OK I have mastered this process.
> 
> So all the Generic images I tried and fail did so because I did not flash the uboot.imx  uboot to disk.
> That is what is needed. iMX6 requires u-boot raw mode. Wrote to first 1K of disk.
> ...


it skips the first kilo of the disk so it does not overwrite the boot record  (oseek=1)


----------



## Phishfry (Jan 10, 2022)

I have it booting off sd card with only ubldr.bin, /EFI/ and /dtb directories.
Kernel and rest on mSATA.

With the proper Hummingboard2 DTB from U-Boot I now have emmc working and I need to investigate.
Some special partitions already exist.
mmcsd1
mmcsd1boot0
mmcsd1boot1


```
mmcsd0: 4GB <SDHC SD04G 3.0 SN 6D542913 MFG 12/2013 by 39 PH> at mmc0 50.0MHz/4bit/65535-block
mmcsd1: 8GB <MMCHC 8GTF4R 0.6 SN 2950F48F MFG 01/2018 by 21 0x0000> at mmc1 50.0MHz/8bit/65535-block
mmcsd1boot0: 4MB partition 1 at mmcsd1
mmcsd1boot1: 4MB partition 2 at mmcsd1
mmcsd1rpmb: 524kB partition 3 at mmcsd1
```

The rpmb partition looks interesting:








						How to access Replay Protected Memory Block (RPMB) in eMMC?
					

RPMB is a special partition in eMMC 4.5. Internet research suggests that it is used for saving keys and is the only special partition that responds to commands like READ, WRITE. etc. Can anyone exp...




					security.stackexchange.com


----------



## Phishfry (Jan 10, 2022)

With the DTB's now working well the boot messages have increased.

```
U-Boot SPL 2021.07 (Dec 29 2021 - 03:40:30 -0500)
WDT:   Not found!
Trying to boot from MMC1


U-Boot 2021.07 (Dec 29 2021 - 03:40:30 -0500)

CPU:   Freescale i.MX6Q rev1.3 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 47C
Reset cause: WDOG
Board: MX6 HummingBoard2
DRAM:  2 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   
Warning: ethernet@2188000 (eth0) using random MAC address - d2:a7:fd:f7:ea:d0
eth0: ethernet@2188000
Hit any key to stop autoboot:  0
switch to partitions #0, OK
mmc1 is current device
** Unrecognized filesystem type **
switch to partitions #0, OK
mmc2(part 0) is current device
** Invalid partition 1 **
Couldn't find partition mmc 2:1
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part
SATA Device Info:
S/N: 153303400094
Product model number: SanDisk SSD U110 16GB
Firmware version: U21B001
Capacity: 31277232 sectors

Device 0: Model: SanDisk SSD U110 16GB Firm: U21B001 Ser#: 153303400094
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 15272.0 MB = 14.9 GB (31277232 x 512)
... is now current device
Scanning sata 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Scanning disk usdhc@2194000.blk...
** Unrecognized filesystem type **
Scanning disk usdhc@2198000.blk...
Scanning disk sata@2200000.blk...
** Unrecognized filesystem type **
Found 6 disks
No EFI system partition
No panel detected: default to HDMI
Display: HDMI (1024x768)
ERROR: invalid device tree
Found EFI removable media binary efi/boot/bootarm.efi
1403700 bytes read in 19 ms (70.5 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Booting /efi\boot\bootarm.efi
```
FreeBSD Booting:

```
Consoles: EFI console 
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk2p1:
FreeBSD/arm EFI loader, Revision 1.1

   Command line arguments: l
   Image base: 0x8d417000
   EFI version: 2.80
   EFI Firmware: Das U-Boot (rev 8225.1792)
   Console: comconsole (0)
   Load Path: /efi\boot\bootarm.efi
   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(1,0x01,0,0x81f,0x18fa8)
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(1,0x01,0,0x81f,0x18fa8)
Setting currdev to disk2p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(2,0x01,0,0x197c7,0x1dba8e9)
Setting currdev to disk2p2:
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
Loading /boot/loader.conf.local
Loading kernel...
/boot/kernel/kernel text=0x1b4 text=0x6f2fe4 text=0x1831dc data=0xb00b0 data=0x0+0x1e8000 syms=[0x4+0x9e880+0x4+0x1100f4]
Loading configured modules...
/etc/hostid size=0x25
/boot/kernel/umodem.ko text=0x1540 text=0xf20 data=0x234+0x4 syms=[0x4+0xe70+0x4+0xa74]
loading required module 'ucom'
/boot/kernel/ucom.ko text=0x1714 text=0x2c7c data=0x484+0x838 syms=[0x4+0x13e0+0x4+0xbac]
/boot/entropy size=0x1000

Hit [Enter] to boot immediately, or any other key for command prompt.
Booting [/boot/kernel/kernel]...               
Using DTB provided by EFI at 0x17f00000.
Kernel entry at 0x87600200...
Kernel args: (null)
WARNING: Cannot find freebsd,dts-version property, cannot check DTB compliance
---<<BOOT>>---
Copyright (c) 1992-2021 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 13.0-RELEASE #0 releng/13.0-n244733-ea31abc261f: Fri Apr  9 06:33:09 UTC 2021
    root@releng1.nyi.freebsd.org:/usr/obj/usr/src/arm.armv7/sys/GENERIC arm
FreeBSD clang version 11.0.1 (git@github.com:llvm/llvm-project.git llvmorg-11.0.1-0-g43ff75f2c3fe)
VT: init without driver.
No PSCI/SMCCC call function found
CPU: ARM Cortex-A9 r2p10 (ECO: 0x00000000)
CPU Features:
  Multiprocessing, Thumb2, Security, VMSAv7, Coherent Walk
Optional instructions:
  UMULL, SMULL, SIMD(ext)
LoUU:2 LoC:2 LoUIS:2
Cache level 1:
 32KB/32B 4-way data cache WB Read-Alloc Write-Alloc
 32KB/32B 4-way instruction cache Read-Alloc
real memory  = 2130145280 (2031 MB)
avail memory = 2071646208 (1975 MB)
FreeBSD/SMP: Multiprocessor System Detected: 4 CPUs
random: unblocking device.
random: entropy device external interface
WARNING: Device "kbd" is Giant locked and may be deleted before FreeBSD 14.0.
kbd0 at kbdmux0
WARNING: Device "openfirm" is Giant locked and may be deleted before FreeBSD 14.0.
ofwbus0: <Open Firmware Device Tree>
ofw_clkbus0: <OFW clocks bus> on ofwbus0
clk_fixed0: <Fixed clock> on ofw_clkbus0
clk_fixed1: <Fixed clock> on ofw_clkbus0
clk_fixed2: <Fixed clock> on ofw_clkbus0
simplebus0: <Flattened device tree simple bus> on ofwbus0
simplebus1: <Flattened device tree simple bus> mem 0x2000000-0x20fffff on simplebus0
simplebus2: <Flattened device tree simple bus> mem 0x2000000-0x203ffff on simplebus1
imx6_anatop0: <Freescale i.MX6 Analog PLLs and Power> mem 0x20c8000-0x20c8fff irq 47,48,49 on simplebus1
simplebus3: <Flattened device tree simple bus> mem 0x2100000-0x21fffff on simplebus0
regfix0: <Fixed Regulator> on ofwbus0
regfix1: <Fixed Regulator> on ofwbus0
regfix2: <Fixed Regulator> on ofwbus0
regfix3: <Fixed Regulator> on ofwbus0
regfix4: <Fixed Regulator> on ofwbus0
regfix5: <Fixed Regulator> on ofwbus0
regfix6: <Fixed Regulator> on ofwbus0
regfix7: <Fixed Regulator> on ofwbus0
regfix8: <Fixed Regulator> on ofwbus0
regfix9: <Fixed Regulator> on ofwbus0
simple_mfd0: <Simple MFD (Multi-Functions Device)> mem 0x20cc000-0x20cffff on simplebus1
ocotp0: <Freescale On-Chip One-Time-Programmable Memory> mem 0x21bc000-0x21bffff on simplebus3
ccm0: <Freescale i.MX6 Clock Control Module> mem 0x20c4000-0x20c7fff irq 45,46 on simplebus1
l2cache0: <PL310 L2 cache controller> mem 0xa02000-0xa02fff irq 11 on simplebus0
l2cache0: cannot allocate IRQ, not using interrupt
l2cache0: Part number: 0x3, release: 0x7
l2cache0: L2 Cache enabled: 1024KB/32B 16 ways
imx_iomux0: <Freescale i.MX pin configuration> mem 0x20e0000-0x20e3fff on simplebus1
gic0: <ARM Generic Interrupt Controller> mem 0xa01000-0xa01fff,0xa00100-0xa001ff on simplebus0
gic0: pn 0x39, arch 0x1, rev 0x2, implementer 0x43b irqs 160
gpio0: <Freescale i.MX GPIO Controller> mem 0x209c000-0x209ffff irq 28,29 on simplebus1
gpiobus0: <OFW GPIO bus> on gpio0
gpio1: <Freescale i.MX GPIO Controller> mem 0x20a0000-0x20a3fff irq 30,31 on simplebus1
gpiobus1: <OFW GPIO bus> on gpio1
gpio2: <Freescale i.MX GPIO Controller> mem 0x20a4000-0x20a7fff irq 32,33 on simplebus1
gpiobus2: <OFW GPIO bus> on gpio2
gpio3: <Freescale i.MX GPIO Controller> mem 0x20a8000-0x20abfff irq 34,35 on simplebus1
gpiobus3: <OFW GPIO bus> on gpio3
gpio4: <Freescale i.MX GPIO Controller> mem 0x20ac000-0x20affff irq 36,37 on simplebus1
gpiobus4: <OFW GPIO bus> on gpio4
gpio5: <Freescale i.MX GPIO Controller> mem 0x20b0000-0x20b3fff irq 38,39 on simplebus1
gpiobus5: <OFW GPIO bus> on gpio5
gpio6: <Freescale i.MX GPIO Controller> mem 0x20b4000-0x20b7fff irq 40,41 on simplebus1
gpiobus6: <OFW GPIO bus> on gpio6
sdma0: <i.MX6 Smart Direct Memory Access Controller> mem 0x20ec000-0x20effff irq 60 on simplebus1
imx_wdog0: <Freescale i.MX Watchdog> mem 0x20bc000-0x20bffff irq 43 on simplebus1
imx_epit0: <i.MX EPIT timer> mem 0x20d0000-0x20d3fff irq 52 on simplebus1
Timecounter "EPIT" frequency 66000000 Hz quality 1000
mp_tmr0: <ARM MPCore Timers> mem 0xa00600-0xa0061f irq 10 on simplebus0
Event timer "MPCore" frequency 492000000 Hz quality 1000
usbphy0: <Freescale i.MX6 USB PHY> mem 0x20c9000-0x20c9fff irq 50 on simplebus1
usbphy1: <Freescale i.MX6 USB PHY> mem 0x20ca000-0x20cafff irq 51 on simplebus1
imx_usbmisc0: <i.MX USB Misc Control> mem 0x2184800-0x21849ff on simplebus3
pmu0: <Performance Monitoring Unit> irq 1 on ofwbus0
hdmi0: <Freescale i.MX6 HDMI core> mem 0x120000-0x128fff irq 7 on simplebus0
uart0: <Freescale i.MX UART> mem 0x2020000-0x2023fff irq 66 on simplebus2
uart0: console (115200,n,8,1)
pcm0: <i.MX6 Synchronous Serial Interface (SSI)> mem 0x2028000-0x202bfff irq 68 on simplebus2
pcm0: ssimixer_set() 75 75
gpioc0: <GPIO controller> on gpio0
gpioc1: <GPIO controller> on gpio1
gpioc2: <GPIO controller> on gpio2
gpioc3: <GPIO controller> on gpio3
gpioc4: <GPIO controller> on gpio4
gpioc5: <GPIO controller> on gpio5
gpioc6: <GPIO controller> on gpio6
snvs0: <i.MX6 SNVS RTC> mem 0x20cc000-0x20cffff irq 99,100 on simple_mfd0
snvs0: registered as a time-of-day clock, resolution 0.000030s
src0: <Freescale i.MX6 System Reset Controller> mem 0x20d8000-0x20dbfff irq 54,55 on simplebus1
ehci0: <Freescale i.MX integrated USB controller> mem 0x2184000-0x21841ff irq 73 on simplebus3
usbus0: EHCI version 1.0
usbus0: stop timeout
usbus0 on ehci0
ehci1: <Freescale i.MX integrated USB controller> mem 0x2184200-0x21843ff irq 74 on simplebus3
usbus1: EHCI version 1.0
usbus1 on ehci1
ffec0: <Freescale Gigabit Ethernet Controller> mem 0x2188000-0x218bfff irq 77,78 on simplebus3
miibus0: <MII bus> on ffec0
atphy0: <Atheros F1 10/100/1000 PHY> PHY 0 on miibus0
atphy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 1000baseSX-FDX, 1000baseT-FDX, 1000baseT-FDX-master, auto
ffec0: Ethernet address: d2:a7:fd:f7:ea:d0
sdhci_fsl0: <Freescale uSDHC controller> mem 0x2194000-0x2197fff irq 83 on simplebus3
mmc0: <MMC/SD bus> on sdhci_fsl0
sdhci_fsl1: <Freescale uSDHC controller> mem 0x2198000-0x219bfff irq 84 on simplebus3
mmc1: <MMC/SD bus> on sdhci_fsl1
imx_i2c0: <Freescale i.MX I2C> mem 0x21a0000-0x21a3fff irq 86 on simplebus3
imx_i2c1: <Freescale i.MX I2C> mem 0x21a4000-0x21a7fff irq 87 on simplebus3
imx_i2c2: <Freescale i.MX I2C> mem 0x21a8000-0x21abfff irq 88 on simplebus3
audmux0: <i.MX6 Digital Audio Multiplexer> mem 0x21d8000-0x21dbfff on simplebus3
uart1: <Freescale i.MX UART> mem 0x21ec000-0x21effff irq 96 on simplebus3
uart2: <Freescale i.MX UART> mem 0x21f0000-0x21f3fff irq 97 on simplebus3
fb0: <Freescale IPU> mem 0x2400000-0x27fffff irq 13,14 on simplebus0
ahci0: <i.MX6 Integrated AHCI controller> mem 0x2200000-0x2203fff irq 15 on simplebus0
ahci0: AHCI v1.30 with 1 3Gbps ports, Port Multiplier supported
ahcich0: <AHCI channel> at channel 0 on ahci0
cpulist0: <Open Firmware CPU Group> on ofwbus0
cpu0: <Open Firmware CPU> on cpulist0
cpu1: <Open Firmware CPU> on cpulist0
cpu2: <Open Firmware CPU> on cpulist0
cpu3: <Open Firmware CPU> on cpulist0
cryptosoft0: <software crypto>
Timecounters tick every 1.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
ugen0.1: <Freescale EHCI root HUB> at usbus0
uhub0 on usbus0
uhub0: <Freescale EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus0
ugen1.1: <Freescale EHCI root HUB> at usbus1
uhub1 on usbus1
uhub1: <Freescale EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on usbus1
mmcsd0: 4GB <SDHC SD04G 3.0 SN 6D542913 MFG 12/2013 by 39 PH> at mmc0 50.0MHz/4bit/65535-block
mmcsd1: 8GB <MMCHC 8GTF4R 0.6 SN 2950F48F MFG 01/2018 by 21 0x0000> at mmc1 50.0MHz/8bit/65535-block
mmcsd1boot0: 4MB partition 1 at mmcsd1
mmcsd1boot1: 4MB partition 2 at mmcsd1
mmcsd1rpmb: 524kB partition 3 at mmcsd1
iicbus0: <OFW I2C bus> on imx_i2c0
iic0: <I2C generic I/O> on iicbus0
nxprtc0: <NXP PCF8523 RTC> at addr 0xd0 on iicbus0
iicbus0: <unknown card> at addr 0x14
iicbus1: <OFW I2C bus> on imx_i2c1
iic1: <I2C generic I/O> on iicbus1
hdmi0: HDMI controller 13:0a:a0:c1
iicbus2: <OFW I2C bus> on imx_i2c2
iic2: <I2C generic I/O> on iicbus2
nxprtc0: WARNING: RTC battery failed; time is invalid
nxprtc0: registered as a time-of-day clock, resolution 0.015625s
Release APs
ada0 at ahcich0 bus 0 scbus0 target 0 lun 0
ada0: <SanDisk SSD U110 16GB U21B001> ACS-2 ATA SATA 3.x device
ada0: Serial Number 153303400094
ada0: 300.000MB/s transfers (SATA 2.x, UDMA6, PIO 512bytes)
ada0: Command Queueing enabled
ada0: 15272MB (31277232 512 byte sectors)
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
mmcsd0: Error indicated: 1 Timeout
mmcsd0: Error indicated: 3 Fifo
mmcsd0: Error indicated: 3 Fifo
mmcsd0: Error indicated: 3 Fifo
mmcsd0: Error indicated: 3 Fifo
nxprtc0: RTC clock not running
Warning: bad time from time-of-day clock, system time will not be set accurately
Starting file system checks:
/dev/ufs/rootfs: FILE SYSTEM CLEAN; SKIPPING CHECKS
/dev/ufs/rootfs: clean, 3271740 free (196 frags, 408943 blocks, 0.0% fragmentation)
uhub0: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
Setting hostuuid: f9eb306c-9901-11eb-bc5e-db838861316e.
Setting hostid: 0xdd134f92.
Mounting local filesystems:.
ELF ldconfig path: /lib /usr/lib /usr/lib/compat /usr/local/lib /usr/local/lib/compat/pkg /usr/local/lib/compat/pkg
Soft Float compatibility ldconfig path:
Setting hostname: generic.
Setting up harvesting: [UMA],[FS_ATIME],SWI,INTERRUPT,NET_NG,[NET_ETHER],NET_TUN,MOUSE,KEYBOARD,ATTACH,CACHED
Feeding entropy: ugen1.2: <vendor 0x0424 product 0x2514> at usbus1
uhub2 on uhub1
uhub2: <vendor 0x0424 product 0x2514, class 9/0, rev 2.00/b.b3, addr 2> on usbus1
uhub2: MTT enabled
.
pcm0: ssimixer_set() 75 75
Autoloading module: imx_spi.ko
imx_spi0: <i.MX ECSPI Master> mem 0x200c000-0x200ffff irq 63 on simplebus2
spibus0: <OFW SPI bus> on imx_spi0
lo0: link state changed to UP
uhub2: 4 ports with 3 removable, self powered
ffec0: link state changed to DOWN
Starting Network: lo0 ffec0.
lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> metric 0 mtu 16384
        options=680003<RXCSUM,TXCSUM,LINKSTATE,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>
ffec0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500
        options=80008<VLAN_MTU,LINKSTATE>
        ether d2:a7:fd:f7:ea:d0
        media: Ethernet autoselect (none)
        status: no carrier
        nd6 options=29<PERFORMNUD,IFDISABLED,AUTO_LINKLOCAL>
Starting devd.
ffec0: link state changed to UP
Autoloading module: imx_spi.ko
```


----------



## Phishfry (Jan 12, 2022)

Well In the end the best I can manage is u-boot.imx flashed to the onboard 8GB eMMC emmcsd1 .
Once I flash the eMMC I switch jumpers from SD Card boot to eMMC boot.

With that it jumps to EFI partition and root filesystem on mSATA.
So no SD card needed and all solid state drives. Granted eMMC2 speed is only 25Megabytes /sec.
But for a bootloader it should be fine.
What U-Boot is doing with a 1Kb bootloader is pretty amazing.

```
U-Boot SPL 2021.07 (Jan 11 2022 - 18:49:08 -0500)
WDT:   Not found!
Trying to boot from MMC2


U-Boot 2021.07 (Jan 11 2022 - 18:49:08 -0500)

CPU:   Freescale i.MX6Q rev1.3 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 44C
Reset cause: WDOG
Board: MX6 HummingBoard2
DRAM:  2 GiB
MMC:   FSL_SDHC: 1, FSL_SDHC: 2
Loading Environment from MMC... *** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:
Warning: ethernet@2188000 (eth0) using random MAC address - 72:37:bf:8f:f8:0b
eth0: ethernet@2188000
Hit any key to stop autoboot:  0
MMC: no card present
switch to partitions #0, OK
mmc2(part 0) is current device
** No partition table - mmc 2 **
Couldn't find partition mmc 2:1
AHCI 0001.0300 32 slots 1 ports 3 Gbps 0x1 impl SATA mode
flags: ncq stag pm led clo only pmp pio slum part
SATA Device Info:
S/N: G884850166
Product model number: TS512GMTS430S
Firmware version: R0427GN1
Capacity: 1000215216 sectors

Device 0: Model: TS512GMTS430S Firm: R0427GN1 Ser#: G884850166
            Type: Hard Disk
            Supports 48-bit addressing
            Capacity: 488386.3 MB = 476.9 GB (1000215216 x 512)
... is now current device
Scanning sata 0:1...
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
MMC: no card present
Scanning disk usdhc@2194000.blk...
Disk usdhc@2194000.blk not ready
Scanning disk usdhc@2198000.blk...
** Unrecognized filesystem type **
Scanning disk sata@2200000.blk...
** Unrecognized filesystem type **
Found 4 disks
No EFI system partition
No panel detected: default to HDMI
Display: HDMI (1024x768)
ERROR: invalid device tree
Found EFI removable media binary efi/boot/bootarm.efi
1403700 bytes read in 19 ms (70.5 MiB/s)
libfdt fdt_check_header(): FDT_ERR_BADMAGIC
Booting /efi\boot\bootarm.efi


Consoles: EFI console  
    Reading loader env vars from /efi/freebsd/loader.env
Setting currdev to disk1p1:
FreeBSD/arm EFI loader, Revision 1.1

   Command line arguments: l
   Image base: 0x8d41b000
   EFI version: 2.80
   EFI Firmware: Das U-Boot (rev 8225.1792)
   Console: comconsole (0)
   Load Path: /efi\boot\bootarm.efi
   Load Device: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(1,0x01,0,0x81f,0x18fa8)
Trying ESP: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(1,0x01,0,0x81f,0x18fa8)
Setting currdev to disk1p1:
Trying: /VenHw(e61d73b9-a384-4acc-aeab-82e828f3628b)/Sata(0x0,0xffff,0x0)/HD(2,0x01,0,0x197c7,0x5e6821)
Setting currdev to disk1p2:
Loading /boot/defaults/loader.conf
Loading /boot/defaults/loader.conf
Loading /boot/device.hints
Loading /boot/loader.conf
Loading /boot/loader.conf.local
```


----------



## Phishfry (Jan 13, 2022)

Phishfry said:


> What U-Boot is doing with a 1Kb bootloader is pretty amazing.


I was greatly off here. U-Boot boot image size is 53Kb

```
Image Type:   Freescale IMX Boot Image
Image Ver:    2 (i.MX53/6/7 compatible)
Mode:         DCD
Data Size:    53248 Bytes = 52.00 KiB = 0.05 MiB
Load Address: 00907420
Entry Point:  00908000
```

The raw image size of u-boot.imx is 623k


----------



## Phishfry (Jan 21, 2022)

I just got a used Hummingboard2 CBI.








						HummingBoard CBi - SolidRun
					

Product Overview Main features SoC: NXP i.MX6 based Solo to Quad Core SOM Cortex A9 Memory: Up to 2GB Storage: 8GB eMMC Temperature:  Industrial (-40C to 85C) OS: Linux Specifications SOM Model NXP i.MX6 based Solo to Quad Core SOM Processor i.MX6 Solo – Quad core ARM Cortex A9 up...




					developer.solid-run.com
				



This board drops HDMI and audio jacks and adds CAN Bus and RS485.

The CPU module is the older uSOM rev 1.3. This has no eMMC.
It is also IMX6 Dual-Lite. That means no SATA!!
I also have another Hummingboard with IMX6 Solo on the way. No SATA on the IMX6 Solo either.

I have swapped the uSOM around. The Quad Core with 8GB eMMC works fine on the Hummingboard2 CBI model.
That eSOM is rev 1.5 and most of those have 8GB eMMC on eSOM.
Some earlier carrier boards had the eMMC mounted on it. The Solo board I have coming has eMMC on the carrier.


----------



## Phishfry (Jan 21, 2022)

I looked around at another board to invest in and I really can't find any compatibles.
Hummingboard2 has swappable CPU/Mem/eMMC and slotted standard storage with M.2 mSATA and a mPCIe slot.

Beat that.

Quartz and RockPro have PCIe x4 slot. But custom eMMC module needed with several sizes out of stock.
That comes close. But PCIe slot for embedded? Why not several M.2 slots.


----------



## Phishfry (Jan 27, 2022)

I was looking at the inner working of the u-boot mx6cuboxi board files and I am amazed that they are using GPIO Pin states to identify the various Hummingboards and uSOM modules.

```
static enum board_type board_type(void)
{
    int val1, val2, val3;

    SETUP_IOMUX_PADS(board_detect);

    /*
     * Machine selection -
     * Machine      val1, val2, val3
     * ----------------------------
     * HB2            x     x    0
     * HB rev 3.x     x     0    x
     * CBi            0     1    x
     * HB             1     1    x
     */

    gpio_direction_input(IMX_GPIO_NR(2, 8));
    val3 = gpio_get_value(IMX_GPIO_NR(2, 8));

    if (val3 == 0)
        return HUMMINGBOARD2;

    gpio_direction_input(IMX_GPIO_NR(3, 4));
    val2 = gpio_get_value(IMX_GPIO_NR(3, 4));

    if (val2 == 0)
        return HUMMINGBOARD;

    gpio_direction_input(IMX_GPIO_NR(4, 9));
    val1 = gpio_get_value(IMX_GPIO_NR(4, 9));

    if (val1 == 0) {
        return CUBOXI;
    } else {
        return HUMMINGBOARD;
    }
}

static bool is_rev_15_som(void)
{
    int val1, val2;
    SETUP_IOMUX_PADS(som_rev_detect);

    val1 = gpio_get_value(IMX_GPIO_NR(6, 0));
    val2 = gpio_get_value(IMX_GPIO_NR(6, 4));

    if (val1 == 1 && val2 == 0)
        return true;

    return false;
}

static bool has_emmc(void)
{
    struct mmc *mmc;
    mmc = find_mmc_device(2);
    if (!mmc)
        return 0;
    return (mmc_get_op_cond(mmc) < 0) ? 0 : 1;
}
```


----------



## Phishfry (Feb 1, 2022)

I have decoded the Hummingboard2 GPIO Pin Assignments from imx6qdl-hummingboard2.dtsi
This uses a 36 Pin GPIO Header(Slight Gap/Shift In Middle) 4 Pins wide x 9 rows.
The top part of this is right from the dtsi file. I did add ROW-s to make it easier to decode.


```
* 36 pin headers GPIO description. The pins
                 * numbering as following -
                 *
    ROW-A         *    3.2v  5v    74    75
    ROW-B         *    73    72    71    70
    ROW-C         *    69    68    67    66
                 *
    ROW-D         *    77    78    79    76
    ROW-E         *    65    64    61    60
    ROW-F         *    53    52    51    50
    ROW-G         *    49    48   166    132
    ROW-H         *    95    94    90    91
    ROW-I         *    GND   54    24    204
                 *
                 * The GPIO numbers can be extracted using
                 * signal name from below.
                 * i.e. The mapping of GPIO(X,Y) to Linux gpio
                 * number is : gpio number = (X-1) * 32 + Y
--------------------------------------------------------------------------------------------------------

  Here is what to use for FreeBSD gpioctl: (ie. gpioctl -f /dev/gpioc4 -c 4 OUT)

ROW-A=        3.2v             5v               GPIOC2-10            GPIOC2-11
ROW-B=        GPIOC2-09        GPIOC2-08        GPIOC2-07            GPIOC2-06
ROW-C=        GPIOC2-05        GPIOC2-04        GPIOC2-03            GPIOC2-02


ROW-D=        GPIOC2-13        GPIOC2-14        GPIOC2-15            GPIO12-12
ROW-E=        GPIOC2-01        GPIOC2-00        GPIOC1-29            GPIOC1-28
ROW-F=        GPOIC1-21        GPIOC1-20        GPIOC1-19            GPIOC1-18
ROW-G=        GPOIC1-17        GPIOC1-16        GPIOC5-06            GPIOC5-04
ROW-H=        GPOIC2-31        GPIOC2-30        GPIOC2-26            GPIOC2-27
ROW-I=        NEGATIVE         GPOIC1-22        GPIOC0-24            GPIOC6-12
-----------------------------------------------------------------------------------------------------------
```


----------

