Flashing Nerves to CM4's eMMC directly - wrong size partitions?

Hi,

I have:

  • Raspberry CM4 8Gb, 32Gb eMMC
  • CM4 IO expansion board

I would like to correctly flash CM4 and make it operational (without SD Card).
I was following or lets say combining few sources:

  1. Flashing a Nerves Raspberry image from SD Card to eMMC
  2. Flashing a Nerves Rpi image from SD Card to eMMC
  3. Flash Raspberry Pi OS to eMMC of the CM4

I ended up with a working CM4. I can use LAN and connect to it. So it kind of works. But I am confused with the partitioning on CM4. This is the output of cmd("df -h") command on it.

iex(1)> cmd("df -h")
Filesystem                Size      Used Available Use% Mounted on
/dev/root                28.3M     28.3M         0 100% /
devtmpfs                  1.0M         0      1.0M   0% /dev
tmpfs                   770.6M      8.0K    770.5M   0% /tmp
tmpfs                   385.3M      4.0K    385.3M   0% /run
/dev/mmcblk0p1           18.7M     15.5M      3.1M  83% /boot
/dev/mmcblk0p3          510.0M    434.6M     75.4M  85% /root
tmpfs                     1.0M         0      1.0M   0% /sys/fs/cgroup

So this /dev/mmcblk0p3 is to my understanding too small. Am I correct? It should be around 30Gb?

For instance… on my 16Gb SDCard on another Nerves system (plain RPi4 - SDCard, no eMMC) I can see this:

iex(5)> cmd("df -h")
Filesystem                Size      Used Available Use% Mounted on
/dev/root                28.3M     28.3M         0 100% /
devtmpfs                  1.0M         0      1.0M   0% /dev
tmpfs                   368.8M      8.0K    368.8M   0% /tmp
tmpfs                   184.4M      4.0K    184.4M   0% /run
/dev/mmcblk0p1           18.7M     15.5M      3.1M  83% /boot
tmpfs                     1.0M         0      1.0M   0% /sys/fs/cgroup
/dev/mmcblk0p3           14.5G    603.5M     13.9G   4% /root

So, what did I do wrong? I would really appreciate some feedback.
Thanks!

Tomaz

Hi Thomaz,

Your problem might reside in your fwup.conf and fwup-revert.conf
You’ll see something like define(APP_PART_COUNT, 1044480)
You should try to increase it to define(APP_PART_COUNT, 62914560) to make space for 30GB instead of 510MB.

Not 100% sure but worth a look.
Hope it helps.
Quentin

Hi Quentin,

I do have 1044480 set, but isn’t this expansion done automatically to the size of “disk”. At least I compared both installations CM4 and RPi4. On RPi4 with the same number it did expand to occupy the whole SD card. On CM4 eMMC it didn’t.

Hmm… any other idea perhaps?

Tomaz,

Are you using fwup to flash the nerves image directly on the CM4 or converting to an img file first?

I suspect that if you create an img file first, it is going to create a fixed size application partition. I’d recommend mounting the CM4 as an SD card and then run fwup <your_nerves_app>.fw and select the eMMC chip as the destination.

I don’t have direct experience with the CM4 but I believe that would work.

Eric