Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting a CM4 to boot from USB?

861 views
Skip to first unread message

Bryan

unread,
Jan 4, 2024, 9:06:05 PM1/4/24
to
I recently picked up a Compute Module 4 Lite, not realizing that the
device is unable to boot from SD card. This is on me and my stupidity,
but I assumed that it would be able to boot from USB and what I can see
appears to confirm this.

I'm using a CM4 8GB Wireless board on a MCUZone CM4-4G carrier board
w/LTE modem. I have an official RPi power supply connected, and I have
network and HDMI cables connected. I've grabbed the latest release from
the Pi OS page and flashed it to a USB stick that I know will boot other
machines, using Win32DiskImager.

So, what I get here is the machine goes through some text on screen and
then it appears to restart, and I get the rainbow splash screen right
after a bit of activity on the USB stick.

It simply sits there and does nothing past this. I've tried using both
the 32 and 64 bit images, different USB sticks, different power supplies
including powering it from a big powered commercial USB hub that has
amps to spare. I'm missing something here, or I got a bad board. I'm
hoping someone has some insight into what I'm doing wrong.

Theo

unread,
Jan 5, 2024, 4:32:28 AM1/5/24
to
Not familiar with that board, but it seems like the USB A port(s) are
disabled if you have the LTE module plugged in?
https://www.aliexpress.com/item/1005001972265702.html

But I think the CM4 Lite should be able to boot from SD card, since they
don't have an eMMC flash chip that takes the place of the SD card?

For USB boot you may need to update the EEPROM on the CM4, which is easiest
done via an SD card boot. Did you try SD boot, and what happened?

Theo

The Natural Philosopher

unread,
Jan 5, 2024, 5:13:17 AM1/5/24
to
That's what my Pi 4 did on one version of Bookworm.
Try a different version



--
A lie can travel halfway around the world while the truth is putting on
its shoes.

Bryan

unread,
Jan 5, 2024, 8:49:50 AM1/5/24
to
On 1/5/2024 05:13, The Natural Philosopher wrote:
> That's what my Pi 4 did on one version of Bookworm.
> Try a different version


From what I understand, the Compute Module 4 cannot boot from SD card
because it's literally missing the connections to the card - the card
slot is only there so you can load the Pi OS onto the built-in eMMC.
It's designed to boot from eMMC. If I'd paid attention, I would have
picked up the 8GB eMMC version instead, but after waiting for a year I
took what I could get.

If you put a card in, it doesn't do anything. As far as the eeprom, that
shouldn't be an issue past 2021 or so - I can see it trying to boot from
the flash stick, and I did try it without the modem as well.



The version of (official) OS is the only thing I did not try, if I have
time I'll download the second-to-last version and try it this weekend. I
did try the Armbian version, but I don't know that it specifically
states CM4 compatibility.

--
Vintage electronics, hamfest pictures, and general junk I like.
https://wereboar.com/projects

Theo

unread,
Jan 5, 2024, 9:41:52 AM1/5/24
to
Bryan <pbya...@4wrd.cc> wrote:
> On 1/5/2024 05:13, The Natural Philosopher wrote:
> > That's what my Pi 4 did on one version of Bookworm.
> > Try a different version
>
>
> From what I understand, the Compute Module 4 cannot boot from SD card
> because it's literally missing the connections to the card - the card
> slot is only there so you can load the Pi OS onto the built-in eMMC.
> It's designed to boot from eMMC. If I'd paid attention, I would have
> picked up the 8GB eMMC version instead, but after waiting for a year I
> took what I could get.

You have it backwards: the Lite version has no eMMC which is why the
official I/O board has an SD card socket to boot the Pi:
"MicroSD card socket for Compute Module 4 Lite (without eMMC) variants"
https://www.raspberrypi.com/products/compute-module-4-io-board/

If you have a non-Lite board there's a way to flash the eMMC externally (via
USB I think). If there is onboard eMMC the SD slot is not connected to the
Pi (or maybe to the second MMC channel, not sure).

> If you put a card in, it doesn't do anything. As far as the eeprom, that
> shouldn't be an issue past 2021 or so - I can see it trying to boot from
> the flash stick, and I did try it without the modem as well.

I wonder if there is something odd about the way they've wired the SD slot
on your board? Maybe it needs a jumper or something? What does the
documentation for your board say?

> The version of (official) OS is the only thing I did not try, if I have
> time I'll download the second-to-last version and try it this weekend. I
> did try the Armbian version, but I don't know that it specifically
> states CM4 compatibility.

There can sometimes be firmware issues that means third party OSes won't
boot on new variants of the same board like CM4 because of minor hardware
differences, but these are usually ironed out fairly soon after release.

Theo

Bryan

unread,
Jan 5, 2024, 10:44:00 AM1/5/24
to
Ok, I do see the lite version SHOULD boot from uSD, so perhaps this is a
problem with the actual OS version as well. There's also this little bit
of info with some changes to config.txt:

https://www.waveshare.com/wiki/Wrote_Image_for_Compute_Module_Boards_Lite_version

which I'll try.


I don't have a lot of information on the carrier itself, that seems to
be somewhat lacking. Maybe the carrier is bad, being a Super High
Quality Much Goodly Chinese device, who knows? There are reviews of it
out there, but no real hard information. I'll dig into that as well.

The local Micro Center has a cheap carrier in stock of a different
style, so I'm going to pick up one of those this weekend and give that a
try as well, but I'll grab an older OS first to see how that goes.

Theo

unread,
Jan 5, 2024, 11:11:21 AM1/5/24
to
Bryan <pbya...@4wrd.cc> wrote:
>
> Ok, I do see the lite version SHOULD boot from uSD, so perhaps this is a
> problem with the actual OS version as well. There's also this little bit
> of info with some changes to config.txt:
>
> https://www.waveshare.com/wiki/Wrote_Image_for_Compute_Module_Boards_Lite_version
>
> which I'll try.

This in config.txt:
dtoverlay=dwc2,dr_mode=host

(there should not be a dot on the end)

overrides the USB 2 port into host mode, ie to accept USB sticks etc. I
suppose that could be a reason why your CM4 won't USB boot. Ordinarily the
port can detect whether to be in host or device more via the 5th pin on the
micro USB connector, which is tied low in an OTG adapter to force host mode.
Maybe your board doesn't do this correctly? Of course, if you can't boot
you can't read config.txt to force the port to the right direction, so
you'd have to rely on the pin being tied low.

Even without this, and even with no SD, I'd expect to see some sign of life
on the HDMI: the Pi4 should display a 'BIOS' style boot screen that says
what it's trying to boot from.

> I don't have a lot of information on the carrier itself, that seems to
> be somewhat lacking. Maybe the carrier is bad, being a Super High
> Quality Much Goodly Chinese device, who knows? There are reviews of it
> out there, but no real hard information. I'll dig into that as well.
>
> The local Micro Center has a cheap carrier in stock of a different
> style, so I'm going to pick up one of those this weekend and give that a
> try as well, but I'll grab an older OS first to see how that goes.

Good plan. Once you can get anything working, you can then take deltas
against the setup you have to narrow down the problem. If absolutely
nothing works then there are few clues.

Theo

Scott Alfter

unread,
Jan 5, 2024, 12:10:48 PM1/5/24
to
In article <lUt*kv...@news.chiark.greenend.org.uk>,
Theo <theom...@chiark.greenend.org.uk> wrote:
>If you have a non-Lite board there's a way to flash the eMMC externally (via
>USB I think). If there is onboard eMMC the SD slot is not connected to the
>Pi (or maybe to the second MMC channel, not sure).

There's a tool called rpiboot that you use to flash a CM4. Most carrier
boards have a switch or jumper to enable or disable eMMC boot. Set it to
disabled, then connect it in to your computer. Running rpiboot sends over a
small program that causes the CM4's eMMC storage to show up as a USB storage
device. At this point, you can use the RPi Imager, dd, or whatever to blast
software onto it the same way you'd load up a MicroSD (or SD) card for other
Raspberry Pis. When done, unplug it, set the switch or jumper back to
enabled, and power it back up.

--
_/_
/ v \ Scott Alfter (remove the obvious to send mail)
(IIGS( https://alfter.us/ Top-posting!
\_^_/ >What's the most annoying thing on Usenet?

Bryan

unread,
Jan 5, 2024, 7:59:44 PM1/5/24
to
Some success here. I'm using the Bullseye version presented on the RPi
OS page, instead of whatever the latest is.

I set the other carrier board up, it's marked as being made by
"bigtreetech" and looks like a regular Pi once assembled. Trying the SD
card in it's slot, I see the same things as with the other board,
according to my router it's been offered an address - this happens over
and over. No boot happens.

I took the SD card and put it in a USB reader, put it in a USB port on
this carrier, and it booted. That would seem to indicate that the
MCUZone carrier that I hoped to use is incapable of booting from USB - I
assume the rainbow splash screen is a kernel panic at this point.

(I can't see anything visual on the bigtreetech carrier, it has
micro-HDMI and I can't find my adapters.)


Going back to the MCUZone carrier, I put the known good card in the SD
slot. Here's what I see:

https://pic8.co/a/d697dd4c-18c1-42c7-90e9-2fcf8d7d931c/

The device eventually gets an address like it's waiting for something
else, and does this over and over, never booting. I should mention this
carrier has a run/boot jumper, this is in the boot position. Putting it
in the run position (I assume, it's not clear) gives me a black screen
and nothing else. Putting the card in the known good reader gives me the
same rainbow screen.

One thing I notice is the boot order, which has a "1" for SD card at the
end of the list. However, I also see "SD card not detected" - is it
possible that the boot order needs to be changed so it's looking for the
SD card first? Doing this is something I'd have to research before
attempting.

In any event, the MCUZone device won't boot from USB, and none of them
boot from SD at this point.

Bryan

unread,
Jan 5, 2024, 8:02:00 PM1/5/24
to
But looking a little closer, it looks like it's trying all the boot
devices from right to left - it doesn't see the SD card so it goes to
the next one. So it probably won't matter if I change the boot order,
it would just never get to the SD card.

Theo

unread,
Jan 6, 2024, 5:08:51 AM1/6/24
to
Scott Alfter <sc...@alfter.diespammersdie.us> wrote:
> In article <lUt*kv...@news.chiark.greenend.org.uk>,
> Theo <theom...@chiark.greenend.org.uk> wrote:
> >If you have a non-Lite board there's a way to flash the eMMC externally (via
> >USB I think). If there is onboard eMMC the SD slot is not connected to the
> >Pi (or maybe to the second MMC channel, not sure).
>
> There's a tool called rpiboot that you use to flash a CM4. Most carrier
> boards have a switch or jumper to enable or disable eMMC boot. Set it to
> disabled, then connect it in to your computer. Running rpiboot sends over a
> small program that causes the CM4's eMMC storage to show up as a USB storage
> device. At this point, you can use the RPi Imager, dd, or whatever to blast
> software onto it the same way you'd load up a MicroSD (or SD) card for other
> Raspberry Pis. When done, unplug it, set the switch or jumper back to
> enabled, and power it back up.

If you can boot the CM4 by any means, that also allows you to run an EEPROM
update to upgrade the firmware on the CM4. It's possible the board has old
firmware which won't boot new images or carrier boards, and doing an update
might imorove matters.

Theo

Theo

unread,
Jan 6, 2024, 6:31:46 AM1/6/24
to
Bryan <pbya...@4wrd.cc> wrote:
> But looking a little closer, it looks like it's trying all the boot
> devices from right to left - it doesn't see the SD card so it goes to
> the next one. So it probably won't matter if I change the boot order,
> it would just never get to the SD card.

As I mentioned in my other post, I'd boot from USB and try upgrading the
bootloader in EEPROM on the board:

https://www.raspberrypi.com/documentation/computers/raspberry-pi.html#raspberry-pi-boot-eeprom

I also note there are some CM4 specific settings:
https://www.raspberrypi.com/documentation/computers/compute-module.html#cm4bootloader

Bryan

unread,
Jan 7, 2024, 11:08:08 AM1/7/24
to
I found out why my device won't see the SD card. But first:

I can't update the onboard eeprom without using the imaging tool, that's
apparently by design. The CM4 won't let you touch that stuff because
it's "impossible to remove the eMMC if something goes wrong." Makes
sense, but still a PITA for those of us not using the thing in production.

However, the real reason I'm having all these issues is because, after
inspection, my vendor sent me the 8GB eMMC version instead of the no
eMMC version I asked for. That sucks because I don't really want storage
I can't ever change because it likes to go bad, but there it is.

I believe the reason the device won't USB boot on the MCUZone carrier is
because it is indeed going into panic at boot - I've seen some
information about the USB device on this being problematic.

My next step is to try and flash the eMMC on this one the see what
happens. I'll let you know.

Bryan

unread,
Jan 7, 2024, 12:13:45 PM1/7/24
to
Last update -

I tried connecting the CM4 device to my laptop to flash via the imaging
tool. The only machine I have that's not a Pi or associated device (or
something even older) is my old Win7 gaming laptop. You can install the
imaging tool on Win7, and it "supports" it, but there's apparently no
driver for the BCM2711 boot device, so you can't access it. That was a
waste of my time.

I found some instructions on flashing an image direct to eMMC from the
OS itself, meaning on the Pi:

https://www.reddit.com/r/turingpi/comments/10mk3t4/how_to_flash_emmc_cm4/

wget raspbian imgage
extract image file
sudo dd if=image of=/dev/mmcblk0 bs=10MB
clean shutdown CM4, remove USB drive and power on CM4 again
you should end up with a booting CM4

I downloaded the image, unzipped it, and SCP'd it over to the Pi. I then
used these instructions to flash the Pi, and it booted with no external
devices. Yay!

For now, I'm going to use this as-is, as I need the 4G modem to replace
some old 2G stuff that's offline in a few months here in the USA.
Otherwise, I will probably look to purchase a real Lite version at some
point in the future and pass this board on to someone who would like,
but can't afford one.

Thank you for the help - sometimes it takes someone going "well, look at
this instead" to break out of the tunnel vision and find the information
you need.

Theo

unread,
Jan 7, 2024, 12:23:06 PM1/7/24
to
Bryan <pbya...@4wrd.cc> wrote:
> I downloaded the image, unzipped it, and SCP'd it over to the Pi. I then
> used these instructions to flash the Pi, and it booted with no external
> devices. Yay!
>
> For now, I'm going to use this as-is, as I need the 4G modem to replace
> some old 2G stuff that's offline in a few months here in the USA.
> Otherwise, I will probably look to purchase a real Lite version at some
> point in the future and pass this board on to someone who would like,
> but can't afford one.

Glad you got it sorted. One thing you can do, at the expense of a slightly
non-standard setup, is to keep your /boot partition on the eMMC, and set
config.txt to use a root partition on your USB. So most of your OS
lives on the USB and only the kernel, firmware and device trees live on the
eMMC. That means you aren't limited by the eMMC size for your OS install.

To do this you flash the OS to your USB as well as the eMMC, then boot the
Pi from eMMC and alter:

root=/dev/mmcblk0p2

to

root=/dev/sda2

in config.txt. You'll also need to amend /etc/fstab on the USB to match.

Theo

Bryan

unread,
Jan 7, 2024, 1:20:51 PM1/7/24
to
I used to do that with NFS booting on an older Pi 2 - probably will at
some point. Thank you for the reminder.
0 new messages