# Fedora-Developer-38-20230519.n.0 (SiFive HiFive Unmatched [Rev 3A0 and 3B0], QEMU) Fedora Developer 38 (F38) release for SiFive HiFive Unmatched development boards and QEMU. Both revisions 3A0 (very rare) and 3B0 (general availability board; you most likely have this) of SiFive HiFive Unmatched are supported. This image was produced on May 30th, 2023. All the images were compressed with `--block-size=16777216` options passed to `xz` and should work with NBD setup. Tested with QEMU version: ``` QEMU emulator version 8.0.0 (qemu-8.0.0-3.fc37) ``` ## Images The following images are available for download: - `Fedora-Developer-38-20230519.n.0-mmc-firmware.raw.img.xz` - firmware (U-Boot SPL and U-Boot proper with OpenSBI in M-mode) for MMC/microSD card. - `Fedora-Developer-38-20230519.n.0-spi-nor-firmware.raw.img.xz` - firmware (U-Boot SPL, U-Boot proper with OpenSBI in M-mode and U-Boot environment partition) for SPI-NOR Flash. - `Fedora-Developer-38-20230519.n.0-mmc.raw.img.xz` - all-in-one images for MMC/microSD card. This includes the firmware, `/boot` and `/` (root) partition. This is very common way to run, but has a high impact on IO performance. - `Fedora-Developer-38-20230519.n.0-nvme.raw.img.xz` - contains only `/boot` and `/` (root) partition for M.2 NVMe storage. The firmware must be in MMC/microSD or SPI-NOR Flash (based on `BOOTSEL` value). - `Fedora-Developer-38-20230519.n.0-uboot-env.bin.xz` - the default U-Boot environment for SiFive HiFive Unmatched board stored on SPI-NOR flash. - `Fedora-Developer-38-20230519.n.0-sda.raw.xz` - the original disk image product by Koji build system. - `Fedora-Developer-38-20230519.n.0-qemu.raw.img.xz` - disk image for QEMU virt machine. - `Fedora-Developer-38-20230519.n.0-u-boot.itb.xz` - U-Boot ITB file (OpenSBI and U-Boot proper) for QEMU virt machine. - `Fedora-Developer-38-20230519.n.0-u-boot-spl.bin.xz` - U-Boot SPL for QEMU virt machine. ## Suggested Configuration After Booted ### Temperature Sensors Create a file `/etc/sensors.d/unmatched.conf` with: ``` chip "tmp451-*" label temp1 "M/B Temp" label temp2 "CPU Temp" ``` Now command `sensors` will show: ``` [..] tmp451-i2c-0-4c Adapter: i2c-ocores M/B Temp: +30.1°C (low = +0.0°C, high = +85.0°C) (crit = +85.0°C, hyst = +75.0°C) CPU Temp: +36.9°C (low = +0.0°C, high = +85.0°C) (crit = +85.0°C, hyst = +75.0°C) ``` ### Load Additional Kernel Modules Not all kernel modules are loaded as the boot. Create file `/etc/modules-load.d/unmatched.conf` with: ``` # Load SPI-NOR block device driver mtdblock # Load DA9063 WDT driver da9063_wdt # LED triggers ledtrig-default-on ledtrig-heartbeat ``` `mtdblock` allows presenting flash memroy as a block device and thus allows using `dd` to flash a new firmware to SPI-NOR Flash. `da9063_wdt` is Watchdog timer for DA9063 PMIC. Based on DA9063 OTP configuration WDT can only shutdown SiFive HiFive Unmatched, but not reset it. `ledtrig-default-on` and `ledtrig-heartbeat` are LED triggers that you can use for D12 and D2 LEDs. ### Configure D12 (green) LED for heartbeat trigger It's very useful to have a heartbeat LED and advice would be to use D12 (green) LED for that. Create a file `/etc/udev/rules.d/99-pwm-leds.rules` with: ``` # D12 LED: heartbeat SUBSYSTEM=="leds", KERNEL=="d12", ACTION=="add", ATTR{trigger}="heartbeat" ``` You can also do that via sysfs under `/sys/devices/platform/led-controller-1/leds/d12/` directory by executing `echo heartbeat > trigger` . If you `cat trigger` it will show all possible triggers and which one is currently selected. There is RGB LED (D2) under `/sys/devices/platform/led-controller-2`. You can assign the trigger in the same way. The color is controller by `multi_intensity` knob, for example: ``` echo 0 0 50 > ./multi_intensity ``` ### Install Watchdog Package You can use WDT manually (`wdctl` and use `/dev/watchdog0` device), but you can also use `watchdog` package to set it up. Modify the configuration file `/etc/watchdog.conf` and uncomment `watchdog-device = /dev/watchdog` line. Now enable the service files: ``` systemctl enable --now watchdog.service ``` ### Load Firmware to SPI-NOR Flash If `mtdblock` driver is loaded you can simply use `dd` command to write a new firmware blob into SPI-NOR flash: ``` sudo dd of=/dev/mtdblock0 if=./Fedora-Developer-38-20230519.n.0-spi-nor-firmware.raw.img bs=1K iflag=fullblock oflag=direct conv=fsync status=progress ``` Note that by default (i.e. out of the factory) SPI-NOR flash is empty. ### Use Firmware From SPI-NOR Flash (BOOTSEL/MSEL) By default configuration on your board is to boot from MMC/microSD and the configuration looks like this: ``` +----------> CHIPIDSEL | +--------> MSEL3 | | +------> MSEL2 | | | +----> MSEL1 | | | | +--> MSEL0 | | | | | +-+-+-+-+-+ | |X| |X|X| ON(1) | | | | | | |X| |X| | | OFF(0) +-+-+-+-+-+ BOOT MODE SEL ``` To switch it to SPI-NOR set it to: ``` +----------> CHIPIDSEL | +--------> MSEL3 | | +------> MSEL2 | | | +----> MSEL1 | | | | +--> MSEL0 | | | | | +-+-+-+-+-+ | | |X|X| | ON(1) | | | | | | |X|X| | |X| OFF(0) +-+-+-+-+-+ BOOT MODE SEL ``` You can find more information about this in FU740 and SiFive HiFive Unmatched documentation on SiFive website.