Skip to main content

Image Flashing Guide

Preparation

Hardware Requirements

  • Milk-V Megrez
  • USB A to C / USB C to C Cable
  • DC 12V / ATX PSU
  • eMMC module / M.2 SATA SSD / PCI-E SSD (adapter card required for M.2 NVMe SSD) / microSD card
    • You can choose any of the storage devices as boot media, but you can only use one at a time.
  • (Optional) Keyboard, mouse, monitor, ethernet cable
  • (Optional) M.2 SDIO Wi-Fi Module
  • (Optional) A USB drive formatted in FAT32 or EXT4 to upgrade firmware
    • Or you may use dhcp or tftpboot instead, which requires ethernet connection and a TFTP server setup on your computer
  • (Optional) A M.2 SATA or M.2 NVMe / PCI-E SSD to USB enclosure
    • For flashing the image to SSD
  • (Optional) microSD card reader
    • For flashing the image to microSD card

Image Downloads

For bootloader, boot and root images, download from here.

  • BootFS: boot-rockos-*.ext4.zst
  • RootFS: root-rockos-*.ext4.zst
  • For SD Card and SSD: sdcard-rockos-*.img.zst
  • Bootloader: bootloader_secboot_ddr5_milkv-megrez.bin

After downloading, please extract the boot and rootfs files.

If you want to upgrade bootloader via a USB drive, copy the bootloader_secboot_ddr5_milkv-megrez.bin file into the drive's first FAT32/EXT4 partition.

On Linux, install zstd and decompress the iamge.

On Windows, you can use tools like 7-zip or Nanazip.

Flashing Image

First of all we should upgrade the firmware, a.k.a. bootchain for EIC7700X boards.

In short, you need to load the firmware into RAM, then run es_burn to write the firmware to onboard SPI Flash.

To load the bootloader file, you have a few options:

  • From an internal or external storage device
    • ext4load
    • fatload
  • From network / LAN
    • tftpboot
    • dhcp
  1. Connect the onboard USB Type-C "Debug" port to your computer.

You will see a CH340 USB to UART serial device showing up.

  1. Open the UART serial terminal.

On Linux you can use tools like tio, minicom and more.

On Windows there are PuTTY, SimplySerial and more.

The default baud rate is 115200.

  1. Now plug in the power. Megrez should automatically power on.

Make sure your boot device is properly installed before powering on.

If you want to upgrade via a USB drive, plug it in before powering on. Make sure you plugged into the two ports near the 3.5mm ports, otherwise it might not be picked up in U-Boot.

  1. While the console prompts Autoboot in 5 seconds, press s to stop the autoboot.
Upgrade via USB drive
  1. Check if the USB Drive is detected: usb info

If you plugged the USB drive after boot, you need usb reset to rescan USB devices.

2.1. If your drive is FAT32: fatload usb 0 0x90000000 bootloader_secboot_ddr5_milkv-megrez.bin

2.2. If your drive is EXT4: ext4load usb 0 0x9000000 0bootloader_secboot_ddr5_milkv-megrez.bin

  1. Flash the firmware and reboot: es_burn write 0x90000000 flash; reset

  2. After rebooting, it is recommended to reset U-Boot env vars to default and save:

env default -a -f; env save; reset

Other wise you might see your MAC address is regenerated on every boot.

Upgrade via TFTP

Set up a TFTP Server.

For Windows you may use TFTPd64, for Linux you may use tftp-hpa, atftp, or even dnsmasq has a TFTP server built in.

Please check your distros' documations for usage.

Or you may want to check out Arch Wiki here.

Make sure the TFTP server is serving the bootloader_secboot_ddr5_milkv-megrez.bin file at the root directory.

Then check your computer's LAN IP.

Make sure the board is plugged in to ethernet.

After interrupting the autoboot, type:

dhcp 0x90000000 $hostIPaddr:bootloader_secboot_ddr5_milkv-megrez.bin
es_burn write 0x90000000 flash; reset

As said above, it is recommended to reset U-Boot env vars to default and save after upgrading:

env default -a -f; env save; reset

Other wise you might see your MAC address is regenerated on every boot.

Flash to eMMC via fastboot

After upgrading the bootloader, power on the board, type s to interrupt autoboot, then following these steps:

  1. In U-Boot console: fastboot usb 0

  2. Find the RECOVERY switch beside the DC barrel jack. Flip it to RECOVERY mode. Your computer should pick up a USB download gadget / Android Bootloader Interface.

  3. Use fastboot to flash the firmware.

(On Linux, you'll need sudo, or add VID:PID 3452:7700 to your udev rules.)

fastboot flash boot boot-rockos-20250818-234921.ext4
fastboot flash root root-rockos-20250818-234921.ext4
  1. Wait for the flashing process to complete. After that, press Ctrl+C in U-Boot console, then type reset to reboot.

  2. You're good to go.

note

Although U-Boot also supports fastboot udp to flash via network, but this would be much slower.

Flashing via network is generally not recommended, unless you're doing it remotely and cannot flip the switch.

Flash to SSD or microSD

Just use etcher or dd to write the sdcard image into SSD or microSD.

For Windows users, Rufus is also okay.

sudo dd if=sdcard-rockos-20250818-234921.img of=/dev/sdX bs=1M status=progress; sync
tip

Since the bootloader is inside the onboard SPI Flash, if you have any troubles booting from microSD or SSD, update the bootloader first and then retry.

Other Notes

It is recommended to do a system upgrade after booting into the system.

sudo apt update; sudo apt upgrade -y; sudo reboot

Default username and password are both: debian