Milk-V Mars
U-Boot
The Milk-V Mars board can boot firmware from either of SPI flash, SD-card, eMMC, or UART. The boot source is selected via DIP switches on hardware version 1.2 and later. Older hardware revisions boot from SPI flash by default and can boot from eMMC or SD card after that. More information is available on the manufacturer site.
GPIO01 |
GPIO00 |
|
0 |
0 |
SPI flash |
0 |
1 |
SD-card |
1 |
0 |
eMMC |
1 |
1 |
UART |
The vendor U-Boot is not compatible with the EBBR specification and cannot boot Ubuntu without manual changes.
The preinstalled server image comes with U-Boot built from upstream sources. U-Boot SPL and U-Boot are installed in the partitions designated loader1 and loader2. Select the SD-card as boot source via the DIP switches as shown in the photo:
The next steps are only relevant when using the live installer.
The Ubuntu live installer image which can be used to install to an NVMe, eMMC, or USB drive does not provide U-Boot for the Milk-V Mars board. You will have to update U-Boot on the SPI flash to use it. Package u-boot-starfive contains the U-Boot SPL and main U-Boot binaries. The easiest way to update U-Boot in the SPI flash is by booting the preinstalled image and entering the U-Boot console by pressing enter when seeing the "Hit any key to stop autoboot:" message:
sf probe load mmc 1:1 $kernel_addr_r /usr/lib/u-boot/starfive_visionfive2/u-boot-spl.bin.normal.out sf update $kernel_addr_r 0 $filesize load mmc 1:1 $kernel_addr_r /usr/lib/u-boot/starfive_visionfive2/u-boot.itb sf update $kernel_addr_r 0x100000 $filesize
Switch the board off and set the boot source to SPI flash via the DIP switches:
After rebooting reset the environment
env default -f -a env save
Using the preinstalled server image
Copying Ubuntu onto the SD-card
Download the Ubuntu preinstalled server image from https://cdimage.ubuntu.com/releases/24.04/release/ and flash it on your sdcard using:
xzcat ubuntu-24.04-preinstalled-server-riscv64+milk-v-mars.img.xz | sudo dd bs=1M conv=fsync of=/dev/sdX
You will have to replace /dev/sdX by the actual device name of your SD card. Please, be especially cautious not to overwrite the wrong drive as this cannot be undone.
First boot
Connect to the UART using a UART-TTL USB adapter. For accessing the serial console you can use picocom:
picocom -b 115200 /dev/ttyUSB0
Insert the SD card and power on the board.
Enter the U-Boot console by pressing enter when seeing the "Hit any key to stop autoboot:" message to reset the environment:
env default -f -a env save
Power cycle the board.
When booting the first time wait until you see an output line confirming that cloud-init has finished. Cloud init is responsible for generating the SSH keys and setting the default password. It must have finished before you can log in. Wait for a line like the following appearing:
[ 35.682018] cloud-init[909]: Cloud-init v. 24.1.3-0ubuntu3 finished at Tue, 23 Apr 2024 07:44:59 +0000. Datasource DataSourceNoCloud [seed=/var/lib/cloud/seed/nocloud-net][dsmode=net]. Up 35.65 seconds
Now you can login with user ubuntu and the default password ubuntu. You will be asked to choose a new password.
Using the server install image
The live installer image is used to install Ubuntu to an eMMC, USB, or NVMe drive. Please, ensure that a current U-Boot is installed on the SPI flash and the boot source DIP switches select SPI flash.
Copying Ubuntu onto the SD-card
Download the Ubuntu live install server image and flash it onto your sdcard using:
zcat ubuntu-24.04-live-server-riscv64.img.gz | sudo dd of=/dev/sdX bs=1M conv=fsync
You will have to replace /dev/sdX by the actual device name of your SD card. Please, be especially cautious not to overwrite the wrong drive as this cannot be undone.
Installation
Establish a serial console connection to the Milk-V Mars board.
sudo picocom -b 115200 /dev/ttyUSB1
Insert the SD card and power up the system.
If no prior operating system installation exists, U-Boot will start up GRUB on the SD card.
Otherwise press the enter key when seeing the Hit any key to stop autoboot: message and execute:
load mmc 1:1 $fdt_addr_r dtb/starfive/jh7110-milkv-mars.dtb load mmc 1:1 $kernel_addr_r EFI/boot/bootriscv64.efi bootefi $kernel_addr_r $fdt_addr_r
(Depending on the U-Boot version the SD-card might show up as mmc device 0. In this case you would have to use mmc 0:1.)
In the GRUB menu select Try or Install Ubuntu Server.
Loading the installer takes some time. Once it is loaded follow the installation steps in https://ubuntu.com/tutorials/install-ubuntu-server.
When the installation is finished reboot the board without removing the SD card.
U-Boot does not allow the operating system to write UEFI variables. You can do this manually using U-Boot's eficonfig command.
Limitations
- The onboard GPU is not supported.
PCIe support is incomplete: An NVMe drive can be used. WiFi cards and external GPUs don't work.
- While the 3 USB 3.0 ports are working the USB 2.0 port is not supported by the 6.8 kernel.
RISC-V/Milk-V Mars (last edited 2025-01-03 01:27:29 by lengau)