# ROCK64 microSD and eMMC



## outpaddling (Jun 24, 2021)

I'm wondering if it's possible to boot from a microSD and have access to the eMMC module at the same time.  I found the eMMC jumper, which enables booting from the SD while the eMMC is present, but the eMMC is not accessible.  I believe the jumper might be disabling it entirely.  I haven't found any info about this online.

If this is not possible, has anyone had any luck booting FreeBSD from the eMMC?

Thanks...


----------



## outpaddling (Jul 7, 2021)

I ordered a USB 3.0 eMMC module writer from Ameridroid and copied the ROCK64 image onto my eMMC module from a FreeBSD laptop.  After doing this, I was able to boot from the microSD *and* access the eMMC.  So the jumper does not disable the eMMC completely.  Apparently it only disables booting from it so the ROCK64 falls back on the microSD.

Booting from the eMMC also works fine.

Interestingly, I saw sustained write speed around 55 MB/s using dd with the USB eMMC writer, but only see about 31 MB/s (and 39 read) when the same module is installed in the ROCK64.


----------



## Isoux (Nov 29, 2022)

Hi!
13.1-RELEASE-p4 on ROCKPRO64

I copied the ROCKPRO64 image onto my microSD and eMMC module. 

The system boots up and works with microSD. When I boot it from eMMC it boots up well and then stops when it needs to mount the root file system... I looked in /etc/fstab but there is no information about the mentioned devices. 

I don't know where and how I can change the reference to the root file system from eMMC?


----------



## Phishfry (Nov 30, 2022)

Ok I am fresh off this routine and can offer valid advice.
There are several ways to approach this.

A) Flash only uboot to microSD card and flash FreeBSD ROCK64 image to eMMC. (USB eMMC Flash Stick Adapter)

Ok no USB eMMC adapter? You can burn FreeBSD ROCK64 image to microSD card of >8GB size.
Let it boot up one time with only microSD inserted, no eMMC. This will allow growfs to run and expand your microSD to full size. Now you should have all disk space. So now copy the FreeBSD ROCK64 image onto the microSD card from another computer..
Now you can bootup from MicroSD card with your eMMC installed and dd your FreeBSD ROCK64 image onto the eMMC.
Upon sucess eject MicroSD card and from another PC wipe the microSD card out with gpart destroy da0.
This will keep the uboot on the first sectors. This acts as a 'jump starter' for EFI and ROOT on the eMMC.
Uboot will detect the FreeBSD partitions and boot.

B) Same approach but put uboot and EFI on MicroSD. Then you can put loader.env to set currdev=disk1p1
With eMMC only containing the ROOT.

C) Use no MicroSD card and bootup right off the eMMC card. It works.


----------



## Phishfry (Nov 30, 2022)

Isoux said:


> I don't know where and how I can change the reference to the root file system from eMMC?


Ok so from the fstab you might notice they use labels on the Arm images in /etc/fstab.
These labels can really get in the way here because both disks have the same label name.
I disable them and use real devices in fstab.
/dev/mmcsd0s2a             /
dev/mmcsd0s1               /boot/msdos

boot/loader.conf
kern.geom.label.ufs.enable=0
kern.geom.label.ufsid.enable=0
kern.geom.label.gptid.enable=0
kern.geom.label.gpt.enable=0


----------



## Isoux (Nov 30, 2022)

I'll give it a try, hope it's the same for the ROCKPRO64 I'm using...


----------



## Isoux (Nov 30, 2022)

Phishfry said:


> C) Use no MicroSD card and bootup right off the eMMC card. It works.


Somehow this method helped me with my ROCKPRO64 after a few trial combinations when I inserted a blank microSD card into the slot and booted from eMMC... Thanks!

The question:
Does your USB keyboard work? While I am in u_boot mode it works but when the system boots even `dmesg` does not show any keyboard on the system or plug-in changes according to any other USB keyboard connected or disconnected to the device... Then, the only solution to entering the system is over SSH.


----------



## Phishfry (Dec 6, 2022)

I can confirm there are problems with ROCK64 and the eMMC module on FreeBSD 13.1-RELEASE.

My results are different in that I cannot get the eMMC to be seen at all.

Over the weekend I ran `freebsd-update` on ROCK64 13.0-RELEASE to bring it up to 13.1-RELEASE.
It was an utter failure. Bombed my eMMC setup and luckily I had backed up.
My failure seems to be eMMC related. It boots kernel but before mountroot it bombs.
Cannot find mmcsd0.
Using a empty microSD did not help. Flashing u-boot to an microSD same result.
Only with 13.1-RELEASE image flashed to microSD will it boot. It can't see eMMC module. The drive appears empty.
It is not. gpart shows it but with no partitions only MBR scheme.
It acts like the eMMC drive timed out.

I thought it was a u-boot issue but I crossbuilt FreeBSD 13.1-RELEASE root and EFI and u-boot from 13.0-RELEASE.
Still failed. So its not the dtb or u-boot. FreeBSD 13.0-RELEASE is working well.
I have a feeling it is kernel related.


----------

