# Installation

# Flashing the Compute Module eMMC

The Compute Module has an on-board eMMC device connected to the primary SD card interface. This guide explains how to write data to the eMMC storage.

To flash the eMMC, you either need a Linux system (a Raspberry Pi is recommended, or Ubuntu on a PC) or a Windows system (Windows 10 is recommended).The programming steps for windows example are as follows:

  • Open the rpiboot tool on the computer and power on CM4NANO, the tool will automatically execute the drive characterization of EMMC, as shown in the following figure:
  • You will see a drive letter in "My Computer", as shown in the figure below:
  • Open the SD Card Formatter software to format, as shown in the figure below:
  • Use the win32diskimager tool to burn the mirroring system, as shown in the figure below
  • After waiting for the writing to succeed, exit the EMMC drive letter, turn off the power of CM4NANO, unplug the Dupont cable and USB cable, and power on again, the system will start from EMMC.

# Installing BSP

If you have already installed a standard Raspberry Pi OS, you could install our bsp package by command-line package manager for Debian - APT.

# Download the key and create repo file edatec.list

curl -sS https://apt.edatec.cn/pubkey.gpg | sudo apt-key add -
echo "deb https://apt.edatec.cn/raspbian stable main" | sudo tee /etc/apt/sources.list.d/edatec.list

# Install BSP

sudo apt update
sudo apt install ed-cm4nano-bsp ed-rtc

# BSP Upgrade

If there is an update of our BSP package, you could update it manual or update it with system upgrading.

Manually update:

sudo apt update
sudo apt install ed-cm4nano-bsp ed-rtc

# System Upgrade

sudo apt full-upgrade

# Backup Your eMMC to an Image File

# Boot from USB

CM4 Nano should boot from USB Mode to backup the eMMC. In USB Boot Mode, CM4 Nano will act as a U-Disk. You can just backup the U-Disk.

You can refer to above sections - Flashing the Compute Module eMMC to see how to boot from USB.

# dd

Suppose the U-Disk is /dev/sdb, You could use dd command to read to an image file.

sudo dd if=/dev/sdb of=pi.img bs=10M conv=fsync

It will read all the eMMC data to the pi.img.

# Shrink the Image File

The pi.img read from eMMC is the same size of eMMC. It is always about 32GB / 16GB. It's to big and write it to a new CM4 eMMC / SD card is very slow. Here is a script could shrink the image smaller. The shrinked image will then resize to the max size of the eMMC on boot. This will make putting the image back onto the eMMC faster.

Install it first

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

Then Shrink an image file

sudo pishrink.sh pi.img