Boot FreeBSD 14 Pine64 Rock64 image from eMMC

I would like to run FreeBSD 14 on my Rock64. I first tried both the RELEASE and STABLE (15 Feb 2024) images on a 64gb eMMC. This didn't go well.

I tried on a 64gb SD (with eMMC removed) and that went well.

Is there any way to boot from an eMMC on the Rock64?

Here is the log using the eMMC:

mmcsd0: 63GB <MMCHC DA4064 0.1 SN 7092DB23 MFG 04/2022 by 69 0x0000> at mmc0 150.0MHz/8bit/1016-block
mmcsd0boot0: 4MB partition 1 at mmcsd0
mmcsd0boot1: 4MB partition 2 at mmcsd0
mmcsd0rpmb: 17MB partition 3 at mmcsd0
pcm2: no driver attached to cpu node
CPU 0: ARM Cortex-A53 r0p4 affinity: 0
Cache Type = <64 byte D-cacheline,64 byte I-cacheline,VIPT ICache,64 byte ERG,64 byte CWG>
Instruction Set Attributes 0 = <CRC32,SHA2,SHA1,AES+PMULL>
Instruction Set Attributes 1 = <>
Instruction Set Attributes 2 = <>
Processor Features 0 = <AdvSIMD,FP,EL3 32,EL2 32,EL1 32,EL0 32>
Processor Features 1 = <>
Memory Model Features 0 = <TGran4,TGran64,SNSMem,BigEnd,16bit ASID,1TB PA>
Memory Model Features 1 = <8bit VMID>
Memory Model Features 2 = <32bit CCIDX,48bit VA>
Debug Features 0 = <DoubleLock,2 CTX BKPTs,4 Watchpoints,6 Breakpoints,PMUv3,Debugv8>
Debug Features 1 = <>
Auxiliary Features 0 = <>
Auxiliary Features 1 = <>
AArch32 Instruction Set Attributes 5 = <CRC32,SHA2,SHA1,AES+VMULL,SEVL>
AArch32 Media and VFP Features 0 = <FPRound,FPSqrt,FPDivide,DP VFPv3+v4,SP VFPv3+v4,AdvSIMD>
AArch32 Media and VFP Features 1 = <SIMDFMAC,FPHP DP Conv,SIMDHP SP Conv,SIMDSP,SIMDInt,SIMDLS,FPDNaN,FPFtZ>
CPU 1: ARM Cortex-A53 r0p4 affinity: 1
CPU 2: ARM Cortex-A53 r0p4 affinity: 2
CPU 3: ARM Cortex-A53 r0p4 affinity: 3
Release APs...done
Trying to mount root from ufs:/dev/ufs/rootfs [rw]...
TCP_ratelimit: Is now initialized
Unresolved linked clock found: hdmi_phy
Unresolved linked clock found: usb480m_phy
GEOM: mmcsd0: the secondary GPT header is not in the last LBA.
mmcsd0: Error indicated: 4 Failed
uhub2: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
uhub0: 1 port with 1 removable, self powered
random: unblocking device.
 
In the Porting FreeBSD to ARM processors mailing list, I also found this post with the same error:
Rock64 snapshot on e.MMC media fails to mount root (no microsd card involved)
From that post:
"Tuning has controller specific definitions involved for
stepping the phase and such: such is not specified by the
standard. (There is a command for sending tuning data
but not for how to have the controller explore the
alternative phases and such and then to set good value(s).)

As reported earlier, USB booting also does not complete a
root mount, despite U-Boot 2024.01 supporting USB for its
activities. So the Rock64 may be microsd card only for
FreeBSD for now."


EDIT: and continuing to dig online, I found another link where this issue has been reported and being investigated already, from General:

Chasing Rock64 MMC bug
The last post from in that thread is May'23, so it looks like we're out of luck for now to boot off of an eMMC.

I'm currently running fine off an SD, but I switched to a Rock64 to avoid this and use an eMMC. Also, I had been booting NetBSD10_RC fine from an eMMC, so it seems specific to FreeBSD.

Otherwise, FreeBSD 14 so far runs great on the Rock64.

Thanks.
 
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3328-rock64.dtsWhich file do you use for the .dts file? How does it compare with this linux version of the same file?
https://kernel.googlesource.com/pub...rch/arm64/boot/dts/rockchip/rk3328-rock64.dts
Look at line 291, that seems to power the emmc voltage supply of 1.8 volts vcc

vccio2-supply = <&vcc18_emmc>;

Lines 251-261
Code:
vcc18_emmc: LDO_REG2 {
                regulator-name = "vcc18_emmc";
                regulator-min-microvolt = <1800000>;
                regulator-max-microvolt = <1800000>;
                regulator-always-on;
                regulator-boot-on;
                regulator-state-mem {
                    regulator-on-in-suspend;
                    regulator-suspend-microvolt = <1800000>;
                };
            };
Lines 290 - 298
Code:
&io_domains {
    status = "okay";

    vccio1-supply = <&vcc_io>;
    vccio2-supply = <&vcc18_emmc>;
    vccio3-supply = <&vcc_io>;
    vccio4-supply = <&vcc_18>;
    vccio5-supply = <&vcc_io>;
    vccio6-supply = <&vcc_io>;
    pmuio-supply = <&vcc_io>;
};
 
I am booting my Rock64 from eMMC just fine. I am using FreeBSD 15-CURRENT now and I have been using FreeBSD 14-CURRENT before.
However, I use a custom kernel with MMCCAM option.
 
https://github.com/torvalds/linux/blob/master/arch/arm64/boot/dts/rockchip/rk3328-rock64.dtsWhich file do you use for the .dts file? How does it compare with this linux version of the same file?
https://kernel.googlesource.com/pub...rch/arm64/boot/dts/rockchip/rk3328-rock64.dts
Look at line 291, that seems to power the emmc voltage supply of 1.8 volts vcc

vccio2-supply = <&vcc18_emmc>;
I did a diff with the Linux version:

Code:
diff rk3328-rock64.dts /usr/src/sys/contrib/device-tree/src/arm64/rockchip/rk3328-rock64.dts
14d13
<               ethernet0 = &gmac2io;

I didn't see any difference regarding emmc.
I do see the device in dmesg:

Code:
spibus0: <unknown card> at cs 0 mode 0
rockchip_dwmmc0: <Synopsys DesignWare Mobile Storage Host Controller (RockChip)> mem 0xff500000-0xff503fff irq 44 on ofwbus0
rockchip_dwmmc0: Hardware version ID is 270a
mmc0: <MMC/SD bus> on rockchip_dwmmc0
rockchip_dwmmc1: <Synopsys DesignWare Mobile Storage Host Controller (RockChip)> mem 0xff520000-0xff523fff irq 46 on ofwbus0
rockchip_dwmmc1: Hardware version ID is 270a
mmc1: <MMC/SD bus> on rockchip_dwmmc1
dwc0: <Rockchip Gigabit Ethernet Controller> mem 0xff540000-0xff54ffff irq 47 on ofwbus0

It appears the device is recognized correctly, just not able to be the boot device.
 
I am booting my Rock64 from eMMC just fine. I am using FreeBSD 15-CURRENT now and I have been using FreeBSD 14-CURRENT before.
However, I use a custom kernel with MMCCAM option.
Thank you! This worked using a customer kernel with the MMCCAM options, as you mentioned. I can now boot that custom kernel using an eMMC card on my Rock64.

Here's what I did:
- Downloaded FreeBSD-14.0-RELEASE-arm64-aarch64-ROCK64.img.xz and dd'd image to the eMMC card on my build machine (AMD64 running FreeBSD 13.3).
- Mounted the eMMC to /mnt (mount /dev/da1p2 /mnt).
- Used git to pull stable/14 (git checkout stable/14).
- Created a custom ROCK64 kernel conf on my build machine:
Code:
include ROCKCHIP
ident   ROCK64

device                pass
options               MMCCAM
nodevice      mmc
nodevice      mmcsd

- Built the custom kernel:

Code:
make buildkernel installkernel KERNCONF=ROCK64 TARGET=arm64 DESTDIR=/mnt

After I successfully booted from the eMMC, I was able to then insert the SD card I had used and mount to quickly copy key conf files, etc.
 
Back
Top