I’ve been able to compile the 5.12.4 kernel with the full Ubuntu configuration. The .deb files are here.
https://www.w6rz.net/linux-image-5.12.4_5.12.4-2_riscv64.deb
https://www.w6rz.net/linux-headers-5.12.4_5.12.4-2_riscv64.deb
https://www.w6rz.net/linux-libc-dev_5.12.4-2_riscv64.deb
If you want to build your own kernel, the config file is here.
https://www.w6rz.net/config-5.12.4
It was created from an edited version of the Ubuntu config file.
https://www.w6rz.net/config-5.11.0-1012-generic
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"
EOF
cat << EOF | sudo tee /etc/systemd/system/led-bootstate-green.service
[Unit]
Description="Change the color of D2 LED to green"
ConditionPathIsReadWrite=/sys/class/leds/green:d2/trigger
ConditionPathIsReadWrite=/sys/class/leds/red:d2/trigger
ConditionPathIsReadWrite=/sys/class/leds/blue:d2/trigger
[Service]
Type=oneshot
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'
EOF
cat << EOF | sudo tee /etc/systemd/system/led-bootstate-green.timer
[Unit]
Description=timer to turn-on green LED
After=getty.target
[Timer]
OnActiveSec=30sec
Unit=led-bootstate-green.service
[Install]
WantedBy=timers.target
EOF
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.