Raspberry Pi + CM4 Adapter
Raspberry Pi Compute Modules come in various flavors, and some do not have eMMC storage at all, relying on SD cards. Some have up to 32GB eMMC directly on board.
For both types of storage, we are going to use a fantastic tool called: Raspberry Pi Imager. This software works on Windows/macOS/Linux. Download it and install it on your PC.
Raspberry Pi Imager allows you to download, customize and copy most OS versions you might like to your RPI Compute Module.
Note: Do not use either SD card and eMMC during installation, remove the SD card temporarily when installing to eMMC.
With the SD card, you have two options, either use the SD card reader and flash the OS on your PC. Or you can use the same method to access the SD card as we are going to describe for installing it on eMMC.
If you have chosen the second method, you will need a USB cable. You need to connect USB 2.0 on Turing Pi V2 (it's the vertical one, next to HDMI) to your PC.
Ideally, you will need USB A-A (or also called USB M/M) that looks like this on both sides:
However, you can also use USB-A to USB-C, it depends on if your computer have USB-C input.
Note: We have seen some reports from users where USB-A to USB-C was not working correctly. If you face issues, please use preferred method USB-A to USB-A.
Driver
For our PC to recognize the Raspberry Pi storage when switched to "storage" mode, you need to install the rpiboot tool.
- For Windows users, install the rpiboot installer.
- For Mac & Linux users, follow the build instructions.
Then run the tool in OS of your choice, usually its:
sudo ./rpiboot
But for windows you need to run CMD. The easiest way to launch the Command Prompt (CMD) in Windows is by using the start menu. Press the Windows key on your keyboard or click on the Windows icon in the bottom left corner of your screen, then type "cmd" into the search bar. Click on the "Command Prompt" result that appears. Another way to launch CMD is by using the Run dialog box. Press the Windows key + R on your keyboard, type "cmd" into the box, and press Enter.
cd "C:\Program Files (x86)\Raspberry Pi"
rpiboot -d .\msd
I should look like this:
C:\Program Files (x86)\Raspberry Pi>rpiboot -d .\msd
RPIBOOT: build-date Dec 16 2022 version 20221215~105525 1afa26c5
Loading: .\msd/bootcode.bin
Loading: .\msd/bootcode4.bin
Waiting for BCM2835/6/7/2711...
Switching to USB mode
Assuming you have connected the USB CM4 from Turing Pi 2 to your PC, where rpiboot is now waiting for connection, and you turned on power to your Compute Modules. You need to execute the following command inside BMC:
tpi -u device -n 1
-n 1 to 4 represents your Node1-4 slots.
On your PC side, you should see rpiboot detecting the Compute Module storage and presenting it to you as a new disk.
Here is an example with a brand new SD card:
C:\Program Files (x86)\Raspberry Pi>rpiboot -d .\msd
RPIBOOT: build-date Dec 16 2022 version 20221215~105525 1afa26c5
Loading: .\msd/bootcode.bin
Loading: .\msd/bootcode4.bin
Waiting for BCM2835/6/7/2711...
Loading: .\msd/bootcode4.bin
Loading: .\msd/bootcode4.bin
Sending bootcode.bin
Successful read 4 bytes
Waiting for BCM2835/6/7/2711...
Loading: .\msd/bootcode4.bin
Second stage boot server
Cannot open file config.txt
Cannot open file pieeprom.sig
Loading: .\msd/start4.elf
File read: start4.elf
Cannot open file fixup4.dat
Second stage boot server done
And in disk manager I can see the new disk (this one is already partitioned as the new SD card tents to be)
Raspberry Pi Imager
You can now freely use the Raspberry Pi Imager to flash the OS you want to your Compute Module.
We will quickly go over flashing Raspbian 64bit, but you can choose Ubuntu or others.
I have chosen: Raspberry Pi OS (other) > Raspberry Pi OS Lite (64-bit).
Next, you can choose Storage. Raspberry Pi Imager already offers the correct disk, but make sure you are really choosing the correct one.
Before Write, click on cog icon and configure your OS, enable SSH, give it a hostname, set passwords etc..
Write, click write and confirm "yes" in next pop up window.
Please wait until the OS is flashed and verified, do not cancel the verification.
Now that the flashing is done, you can reboot the node by issuing the following command in BMC:
Stop Power to Node1:
curl -X POST "http://127.0.0.1/api/bmc?opt=set&type=power&node1=0"
Start Power to Node1:
curl -X POST "http://127.0.0.1/api/bmc?opt=set&type=power&node1=1"
Note: These commands are temporary, proper and easy way will be available soon with newer version off $tpi
We just did a reboot, but if you want to get IP quickly we can modify our script for BMC a little, and after we turn our node off, we can run the following on your PC (change the range to your network) :
range="10.0.0.*"; echo "Please wait, starting scan..."; \
nmap -PN -p 22 --open -oG - "$range" | grep -E '22/open' | \
awk '{print $2}' | sort -V > initial_scan.txt; \
echo "Start RPi, waiting 60sec..."; sleep 60; \
nmap -PN -p 22 --open -oG - "$range" | \
grep -E '22/open' | awk '{print $2}' | \
sort -V | diff initial_scan.txt -
And turn it back on when asked. You should get something like this:
vladoportos@DESKTOP-7BCS3LE:~$ range="10.0.0.*"; echo "Please wait, starting scan..."; \
nmap -PN -p 22 --open -oG - "$range" | grep -E '22/open' | \
awk '{print $2}' | sort -V > initial_scan.txt; \
echo "Start RPi, waiting 60sec..."; sleep 60; \
nmap -PN -p 22 --open -oG - "$range" | \
grep -E '22/open' | awk '{print $2}' | \
sort -V | diff initial_scan.txt -
Please wait, starting scan...
Start RPi, waiting 60sec...
10a11
> 10.0.0.167
Since we enabled SSH server during the installation modification, we should be able to ssh now to that IP.
Done!
Nvidia Jetson
This is a bit more complicated, since Nvidia did not release its flash utility called sdkmanager for anything other than Linux (Ubuntu 18) and I could not get it to flash 100% on virtualbox Ubuntu which is also not supported by Nvidia as a flashing method. Therefore, we would recommend using a live USB / CD with Ubuntu 18.04.6 LTS, this should work.
You can change the USB 2.0 to the module with Jestson Nano with the following command from BMC:
tpi -u device -n 2
This assumes that your Jetson is in slot Node2 you can then install and run sdkmanager according to Nvidia Documentation.
Once logged in to SDK Manager, it should detect the module:
You should be able to continue with flashing the OS according to the documentation.
Comments (4 comments)