Flashing a Nerves Rpi image from SD Card to eMMC

Hi everyone,

At my company we’ve been working on a Nerves-based prototype that runs on a Raspberry Pi 4B. The entire experience has been really great and we’ve been absolutely loving the entire dev cycle. Thanks everyone making this project happen!

We are now considering going with a CM4 device which uses eMMC memory instead of the SD Card. This part is not 100% clear to us. While we did read the Advanced Configuration docs as well as the source code of the fwup.conf file (of both Raspberry and BBB which seems to use eMMC), to us it’s not really clear what exactly we should do and if we should even change anything.

We’ve been checking this guide as well: Raspberry Pi Documentation - Compute Module Hardware
Our current idea would be to:

  • Run a CM4 on a Compute Module IO board and start it in eMMC disabled mode
  • Use mix firmware.image to generate an img file of our firmware
  • Use their rpiboot tool that allows to write the generated img file to /dev/sdX
  • Reboot enabling eMMC back

Does this process seems valid or would we be having issues with the fwup.conf part (wrong partition size etc.)?
Please note that we are not looking for mass manufacturing, this would be small batches of devices that we could see ourselves flashing manually.

Since there are not much topics around going from a Pi to a CM device, hopefully this topic could serve as some documentation for others as well.

Thanks in advance for anyone’s insights.
Best regards
Quentin

1 Like

Hi Quentin,

I don’t use a CM4, but I have started hearing about many people using CM4s. Thank you for getting this conversation started so that we can figure out the best way.

What you wrote would exactly be how I’d start:

  1. Run a CM4 on a Compute Module IO board and start it in eMMC disabled mode
  2. Use mix firmware.image to generate an img file of our firmware
  3. Use their rpiboot tool that allows to write the generated img file to /dev/sdX
  4. Reboot enabling eMMC back

What I don’t know is how the eMMC and MicroSD are exposed to Linux when you run this way. My guess is that mmcblk0 and mmcblk1 may be hardcoded in nerves_system_rpi4 the wrong way. If it doesn’t boot, then if you could post a log of the console messages that scroll on the UART, that would help.

The hardcoded locations are in the config.txt file and fwup.conf.

The good news is that I’m an ElixirConf and was just got an CM4 and an IO board. I should be able to replicate any issue that you see when time allows.

-Frank

2 Likes

Thank you very much for your prompt feedback Frank!

We should receive a CM4 + CM4 IO Board in the next few days to test things.
I’ll report back our result (positive or negative) to let anyone know.

Quentin.

1 Like

Hi everyone,

So after all it was much easier than I expected.
The detailed steps apply, the only thing missing thing is to use fwup to convert the fw image to an img one as follow after having built the firmware:

fwup -a -d hello_nerves.img -i hello_nerves.fw -t complete

Then it’s just a matter of using something like Raspberry Pi Image, Balena Etcher or dd directly.

We still get those warning on the first boot (like with the SD Card)

[ 5.069221] F2FS-fs (mmcblk0p3): Can’t find valid F2FS filesystem in 1th superblock
[ 5.077634] F2FS-fs (mmcblk0p3): Can’t find valid F2FS filesystem in 2th superblock
But they go away after the first reboot.

Quentin.

2 Likes