Raspberry Pi CM4 installation system

Preface

This record uses the Raspberry Pi CM4 installation system. Because the project needs to replace the previously used Raspberry Pi 4B with a smaller CM4, the system and installation environment on the Raspberry Pi 4B need to be transferred to the CM4. Therefore, The initial idea was to directly read the previous system into an img image, and then burn it to the CM4 with emmc, but the steps were not this. What was done was the following content, recorded here to avoid pitfalls in the future.

Tool preparation

hardware

Insert image description here
CM4 with eMMC and wifi in the lower left corner

Insert image description here

base plate

Insert image description here

software

Install rpiboot program

Windows directly downloads the Windows installer and installs it. Run rpiboot.exe, and the eMMC on the development board is recognized as a removable disk.
Note: You need to turn the BOOT switch to ON

Insert image description here
For Linux systems, you need to use the source code to compile the rpiboot tool and rely on the libusb development library.

sudo apt install git
git clone --depth=1 https://github.com/raspberrypi/usbboot
cd usbboot
make

Execute sudo ./rpiboot in the ubsboot directory. A new device will appear, such as /dev/sdb. You can check the /dev directory or use lsblk to determine the name. This is identified by /dev/sdx. refer to

Format SD card

Windows uses the SDFormatter.exe software to format the SD card. Download , determine the corresponding drive letter, and then click Format to format the SD card or eMMC disk
Insert image description here
in Linux , refer to

sudo mkfs.msdos /dev/sdX   //X要根据下面的df -h命令查看并修改

Insert image description here

Programming Raspberry Pi system tools

Just use the Win32DiskImager tool directly under Windows . After opening it, select the img file and write it to the removable disk recognized by eMMC. After successful programming, two partitions will appear. One boot can be read, written and edited, while the other cannot be edited (Windows Explorer cannot recognize the Linux file system).
Note: It is necessary to format before writing.
Insert image description here

Using commands under Linux

sudo dd if=raw_os_image_of_your_choice.img of=/dev/sdX bs=4MiB//这里的X需要根据自己更改

Use df -h to view the eMMC disk mounted on the system. This is the last /dev/sdb1, so just change the X above to b. You need to change it according to your own situation. refer to
Insert image description here

Burn ubuntu mate 20.04 to CM4 with eMMc

Ubuntu mate 20.04 new image failed to burn

This time I am using the image of the new system. The download address is here
Insert image description here
. After downloading and decompressing, you will get the .img file.
Insert image description here

After burning, turn the BOOT switch on the CM4 expansion board to OFF, and then use the Raspberry Pi's standard 5V3A charger to perform a boot test. Do not use the computer's USB power supply, as it will be affected or even unable to boot (the Raspberry Pi has extremely high power supply requirements )

Problems that occur after using Win32DiskImager to burn:
This is a problem that occurs during the installation process, the installer crashes, and this is a new mirror system. When I thought something was wrong with my image, I decided to try again, and the installer crashed. . . , no solution was found after searching online, so I had to change the method or image for burning.

Insert image description here
Insert image description here

Burning ubuntu20.04 old image (self-made image)

The old image mentioned here is relative to the new image, because the Raspberry Pi 4B I have been using before has been installed with ubuntu20.04 and some environment and other things are on it, so I directly downloaded it from this SD card. Take out this system and turn it into an image, and then burn it into eMMCl in cm4. Here we focus on the process of making an image, because it determines success or failure.

Because I have made images by myself before, I used the read button of win32diskimager on Windows to create images. The process of making images depends on the size of the SD card. If the image produced has 64G but the eMMC only has 32G, it will obviously not be burned in, so you must find a way to compress the image produced.

For reference , create an SD card backup image and restore an image created using the dd command.

sudo dd if=/dev/sdc | gzip>/home/lixinxing/raspberry.gz

However, the image file I created was in .gz format instead of .img format. I thought I could just decompress it, but I didn’t know that every time I decompressed it to the last bit, it would fail, prompting that the file was damaged. Therefore, the image in .img format cannot be obtained, so win32diskimager cannot be used to burn cm4.
Therefore, I chose the second method in the reference link above:
use the command gzip to burn.

sudo gzip -dc /home/lixinxing/raspberry.gz | sudo dd of=/dev/sdc

I waited for a long, long time. I forgot whether it was half an hour or an hour and a half. The key is that there is no prompt message at all when this command is run. After burning, plug in the charger, connect the monitor, and turn on the computer. . . I can't enter the system
and I haven't found a solution online. There are reports of such errors but they don't match mine. So another approach had to be adopted.

Insert image description here

Until I saw this [Raspberry Pi] small space Raspberry Pi image system backup method img image file compression method. The
specific steps are (ubuntu environment):
1. Download a tool first, the specific github project is here

wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
chmod +x pishrink.sh
sudo mv pishrink.sh /usr/local/bin

2. Check the drive letter, that is, the SD card (a system sd card will show that two are mounted on Ubuntu). The specific command is lsblk. Determine the drive letter, such as sdb (it may also be sda, adc, sdd). )
Insert image description here

Then use the dd command to make an image
and use the DD command to copy the SD card: (Copy the entire command line below and modify the sdb in it to the drive letter of your SD card. rpi.img does not need to be changed to the path after the file name you want to store. Be sure to choose a path with enough space)

sudo dd if=/dev/sdb of=./rpi.img bs=8M

3. Compress the image (you need to use the tool downloaded above)

sudo pishrink.sh -s rpi.img newpi.img

The compressed image is much smaller, and then it is burned into the eMMC of cm4 using win32diskimager on Windows. Before burning, turn the extended version BOOT to ON, format it before burning, and after burning, close BOOT to OFF and then turn on the computer.

The result is that I successfully entered the system, which is exactly the same as the one I had before. I don’t need to configure the environment myself, which is much more convenient.

However, a problem arises and the wifi cannot be used.

Raspberry Pi cm4 ubuntu mate 20.04 wifi cannot be used

Insert image description here
Normally it should be like this
Insert image description here
. So I had to find a way to solve the wifi problem, because the cm4 board I bought comes with wifi and eMMC versions, so wifi can definitely be used. After some research on the Internet, I found a way to
install Ubuntu Mate on Raspberry Pi to solve the problem. Problems with connecting to WiFi and deploying the Ros system , Raspberry Pi cannot open wifi, how to connect to wifi with Raspberry Pi , bug records that cannot be connected to wifi with Raspberry Pi , how to configure the WiFi antenna of Raspberry Pi CM4 as an external antenna , Raspberry Pi After connecting to wifi in Pi ubuntu20.04 , network settings in Raspberry Pi Ubuntu 20.04 , and solving the problem that ubuntu20.04 does not display the wifi icon, I found that there is no wifi driver.
Then I didn’t find out that I needed to install the AX200 driver until I saw the AX200 driver installed on Raspberry Pi cm4 - wifi6.
:
AX200 official driver is here: https://www.intel.com/content/www/us/en/support/articles/000005511/wireless.html
AX200, copy link

Note that the driver requires kernel version greater than or equal to 5.1

mkdir wifi6-ax200
cd wifi6-ax200
wget https://wireless.wiki.kernel.org/_media/en/users/drivers/iwlwifi/iwlwifi-cc-46.3cfab8da.0.tgz

tar xzvf iwlwifi-cc-46.3cfab8da.0.tgz
cd iwlwifi-cc-46.3cfab8da.0/
sudo cp *.ucode /lib/firmware

sudo reboot

Then it's ok.

ubuntu22.04 MATE new image burning

Download the 22.04 new system directly from the official website and use win32diskimager to burn it to enter the system normally (Note: If you use ordinary USB power supply, you may not be able to enter the system. Be sure to use the 5V3A power supply that comes with the Raspberry Pi. If Check if BOOT is OFF before entering the system yet )

After entering the system, the overall feeling is still very good, but it is said that only ROS2 can be installed. I tinkered for an hour and wanted to install ROS-noetic (because all the work I did before was in this environment) but it did not succeed. I changed the mirror source and still had the problem. It didn't work. Maybe there was something wrong with the mirror source and it was never done again. If anyone has figured it out, can you let me know? Thank you.

Raspberry Pi system

The image downloaded from this download address can also be burned directly using win32diskimager. Burn it directly to BOOT to OFF and then use the 5V3A power supply that comes with the Raspberry Pi to power it on normally. Do not use other power sources, including mobile phone chargers . No, the original is the best, otherwise some strange problems will occur.

Okay, the entire installation process is over, record it here!

reference

1. Raspberry Pi Compute-Module-4 usage tutorial
2. Raspberry Pi computing module CM4 eMMC system programming, configuration, camera connection
3. Raspberry Pi CM4 boot up and prepare development environment
4. [Raspberry Pi] Small Space Raspberry Pi image system backup method img image file compression method
5. Create SD card backup image and restore
6. Raspberry Pi CM4 burning system
7. Raspberry Pi computing module CM4 eMMC system burning, configuration, camera connection
8. On Raspberry Pi Install Ubuntu Desktop 21.04 on the Pi computing module CM4 eMMC
9. Install Ubuntu Server 20.04 on the Raspberry Pi computing module CM4
10. Install Ubuntu Mate on the Raspberry Pi to solve the problem of being unable to connect to WiFi and deploy the Ros system

Guess you like

Origin blog.csdn.net/weixin_41756645/article/details/126873748