5.12.4 kernel for Ubuntu

I’ve been able to compile the 5.12.4 kernel with the full Ubuntu configuration. The .deb files are here.


If you want to build your own kernel, the config file is here.


It was created from an edited version of the Ubuntu config file.


It takes around 5 hours to build on the Unmatched at 1.5 GHz.

This kernel includes the SiFive patches and I was hoping that the shutdown -h command would work, but it doesn’t. Maybe @davidlt can comment.

The LEDs do work. You can have a heartbeat LED with the following recipe (taken from riscv-bringup/unmatched at master · carlosedp/riscv-bringup · GitHub).

cat << EOF | sudo tee /etc/udev/rules.d/99-pwm-leds.rules
# D12 LED: heartbeat
SUBSYSTEM=="leds", KERNEL=="green:d12", ACTION=="add", ATTR{trigger}="heartbeat"

# D12 RGB LED: boot status
SUBSYSTEM=="leds", KERNEL=="green:d2", ACTION=="add", ATTR{trigger}="default-on", ATTR{brightness}="25"
SUBSYSTEM=="leds", KERNEL=="red:d2", ACTION=="add", ATTR{trigger}="default-on", ATTR{brightness}="25"
SUBSYSTEM=="leds", KERNEL=="blue:d2", ACTION=="add", ATTR{trigger}="default-on", ATTR{brightness}="25"

cat << EOF | sudo tee /etc/systemd/system/led-bootstate-green.service
Description="Change the color of D2 LED to green"

ExecStart=/bin/bash -c '/bin/echo "default-on" > /sys/class/leds/green:d2/trigger'
ExecStart=/bin/bash -c '/bin/echo "25" > /sys/class/leds/green:d2/brightness'
ExecStart=/bin/bash -c '/bin/echo "none" > /sys/class/leds/red:d2/trigger'
ExecStart=/bin/bash -c '/bin/echo "none" > /sys/class/leds/blue:d2/trigger'

cat << EOF | sudo tee /etc/systemd/system/led-bootstate-green.timer
Description=timer to turn-on green LED



sudo systemctl daemon-reload
sudo systemctl enable led-bootstate-green.timer
sudo systemctl start led-bootstate-green.timer

And then reboot to load the udev rules.

1 Like

for ssd ,failed.

okay ,fixed.
modify /boot/extlinux/extlinux.conf manually, add : fdtdir

I’ve upgraded my image to 5.12.14 and halt as well as shutdown -h seem to work (system shuts down and turns off)

not sure how to track the differences though.

1 Like

I forget about the custom location of the FDT files. The linux-image-5.12.4_5.12.4-2_riscv64.deb file puts them in /usr/lib/linux-image-5.12.4/sifive/, but the Ubuntu extlinux.conf wants them in /lib/firmware/5.12.4/device-tree/sifive/.

You have to copy the files after you install linux-image-5.12.4_5.12.4-2_riscv64.deb.

sudo cp /usr/lib/linux-image-5.12.4/sifive/*.dtb /lib/firmware/5.12.4/device-tree/sifive/

When I had the files already in /lib/firmware/5.12.4/device-tree/sifive, extlinux.conf was updated correctly. I think sudo u-boot-update will also work after you copy the files.

I found this reason. Just like you , i can’t shutdown computer using command: halt or shutdown.

Ubuntu 21.04 was frozen before shutdown patches were available, so the provided u-boot and OpenSBI images don’t support the shutdown call. I’ve built new ones that have the updated BSP patches, before they make it into the distro itself. Can you test them with your kernel?

Assuming you’re using the preinstalled Ubuntu 21.04 Unmatched image, upgrade to u-boot-sifive 2021.01+dfsg-3ubuntu9.1+ppa3 from riscv64 build of u-boot 2021.01+dfsg-3ubuntu9.1+ppa3 : Non-virtual test builds : William Grant, then update the firmware partitions on the microSD card:

sudo dd if=/usr/lib/u-boot/sifive_hifive_unmatched_fu740/u-boot-spl.bin of=/dev/mmcblk0p13
sudo dd if=/usr/lib/u-boot/sifive_hifive_unmatched_fu740/u-boot.itb of=/dev/mmcblk0p14
1 Like

Not work, for me.

sd card+ssd ubuntu21.04

didnt work for me either:
ubuntu 21.04 (5.12.4 kernel) + nvme (wrote to both mmc and nvme drives)

Just wanted to chime in and say it worked fine for me.