# Image usage for HiFive Unmatched ## M.2 Key E W-Fi Module Compatibility > The full `linux-firmware` package is preinstalled in the image, so common m.2 WiFi cards supported by openEuler should work with out any issues. The following list shows the tested WLAN Cards for the image. - Intel Corporation Wireless 7265 (rev 59) - TODO: Add more cards > Note: the WiFi signal is very weak if no antenna is attached. You may not find ANY available WiFi network if the board is inside a metal case. ## Usage > Booting the Unmatched from a NVMe SSD instead of a microSD card makes a **big** difference in terms of performance and usability, so it is **strongly recommended** if possible. ### Booting from a NVMe SSD #### Step 1: Find the device path of your to-be system partition - Install an **empty** NVMe SSD into the machine. - At least make sure there isn't a bootable partition on it which may leading to a booting faliure. - Flash and boot from the **microSD card**. - Make sure the NVMe drive is present by running ```bash > ls -l /dev/nvme* ``` - The SSD may appear as `/dev/nvmeXnY`. In this case we use `/dev/nvme0n1`, and the 3rd partition in openEuler image is for the system. So `/dev/nvme0n1p3` should be the device path we want. #### Step 2: Flash the openEuler image to your SSD ##### Method 1: Flashing and modifying in-place from the running machine booted from microSD card > Note: **This method is generally slower** due to the poor I/O performance of common UHS-I microSD cards. > > **If you have a USB-to-NVMe adapter and can flash and modify the contents on SSDs easily, consider the next method**. - Get the openEuler RISC-V image for the Unmatched onto the microSD card. - Decompress and rename the image for ease of working. In this case, the image is now called `openEuler.img`. - Now flash the image to the NVMe SSD by running ```bash > sudo dd if=/openEuler.img of=/dev/nvme0n1 bs=512K iflag=fullblock oflag=direct conv=fsync status=progress ``` - mkdir and mount the to-be root and boot partition on SSD respectively to `/mnt` and `/mnt/boot`. ```bash > sudo mount /dev/nvme0n1p3 /mnt > sudo mkdir -p /mnt/boot > sudo mount /dev/nvme0n1p2 /mnt/boot ``` - Edit `/mnt/boot/extlinux/extlinux.conf`, modify the device path pointing to the system partition in the extlinux configuration, from the one on microSD card ```bash root=/dev/mmcblk0p3 ``` to the NVMe drive one ```bash root=/dev/nvme0n1p3 ``` - edit `/boot/extlinux/extlinux.conf` as same as the last step. - The work is done. Save the changes, and reboot the system. - Voila! The Unmatched will now boot openEuler RISC-V from your NVMe SSD. Have a good time! #### Method 2: Flashing and modifying on PC directly > This method requires a USB-to-NVMe adapter and other utilities for editing booting parameter of booting after flashing. - Make sure your SSD can be recognized through the USB-to-NVMe adapter. - Get the openEuler RISC-V image for the Unmatched. - Decompress and rename the image for ease of working. In this case, the image is now called `openEuler.img`. - Now flash the image to the NVMe with your favorite utility, such as the Belena Etcher. - Edit `/boot/extlinux/extlinux.conf`, modify the device path pointing to the system partition in the extlinux configuration with your favorite utility, from the one on microSD card ```bash root=/dev/mmcblk0p3 ``` to the NVMe drive one ```bash root=/dev/nvme0n1p3 ``` - The work on NVMe SSD is now done. Save the changes, safely remove the SSD and install it back back to the Unmatched. - Now edit the config **on microSD card** as well - edit `/boot/extlinux/extlinux.conf` as same as the last step. - Voila! The Unmatched will now boot openEuler RISC-V from your NVMe SSD. Have a good time! ## Extend your root partition on NVMe Drives > When we flash images with `dd`, there's always an empty space left on the end of storage device due to the size difference of image and device. For openEuler RISC-V image, the root partition is set to be automaticlly resized on the first boot from **the microSD card** to make use of the empty space. This job is done by a script at `/usr/lib/oE-script/resize-rootfs`, however the script is hardcoded for the microSD card. You can edit this script with following command to make it also useful for the NVMe SSD. - First, find the device path of your system partition with the following command. The device path of the SSD may appear as `/dev/nvmeXnY`. In this case we use `/dev/nvme0n1`. ```bash > mount | grep "on / " /dev/nvme0n1p3 on / type ext4 (rw,noatime) ``` - Then, edit /usr/lib/oE-script/resize-rootfs with: ```bash > sed -i 's#/dev/mmcblk0p3#/dev/nvme0n1p3#g' /usr/lib/oE-script/resize-rootfs ``` - Then touch an indicator for the script at the root partition on NVMe drive: ```bash > touch /.resize-rootfs ``` - Reboot the system. - Voila! Your root partition is now extended. ## Reference - [How to install Ubuntu on RISC-V HiFive boards](https://ubuntu.com/tutorials/how-to-install-ubuntu-on-risc-v-hifive-boards) - [Installing Debian On SiFive HiFive Unmatched](https://wiki.debian.org/InstallingDebianOn/SiFive/HiFiveUnmatched)