DebianOn is an effort to document how to install, configure and use Debian on some specific hardware. Therefore potential buyers would know if that hardware is supported and owners would know how get the best out of that hardware.

The purpose is not to duplicate the Debian Official Documentation, but to document how to install Debian on some specific hardware.

If you need help to get Debian running on your hardware, please have a look at our user support channels where you may find specific channels (mailing list, IRC channel) dedicated to certain types of hardware.

Translation(s): none

Models covered
?SiFive ?HiFive Unmatched

Overall Status

Core Components

[ATTACH]

Boot Standard Kernel:

{OK}

LAN network card ():

{OK}

Detect hard drives (mini SD mmc):

{OK}

Xorg

[?]

Extra Features

CPU Frequency Scaling

[?]

Hibernation

[?]

Sleep / Suspend

[?]

Power Off / Reboot

/!\

Legend :
{OK} = OK ; {X} Unsupported(No Driver) ; /!\ = Error (Couldn't get it working); [?] Unknown, Not Test ; [-] Not-applicable
{i} = Configuration Required; X-( = Only works with a non-free driver and or firmware

Important Note

Debian on the ?HiFive Unmatched is very new. There are no public images available yet.

Installing Debian on HiFive

The easiest way at present to run Debian binaries on a ?HiFive is to generate an sdcard image with all the Debian stock parts.

Preparing disk image

# create image file
dd if=/dev/zero of=debian-sid-risc-v-sifive-unmatched.img bs=1M count=4096

# Partition image with correct disk IDs
sudo sgdisk -g --clear --set-alignment=1 \
       --new=1:34:+1M:    --change-name=1:'u-boot-spl'    --typecode=1:5b193300-fc78-40cd-8002-e86c45580b47 \
       --new=2:2082:+4M:  --change-name=2:'opensbi-uboot' --typecode=2:2e54b353-1271-4842-806f-e436d6af6985 \
       --new=3:16384:+130M:   --change-name=3:'boot'      --typecode=3:0x0700  --attributes=3:set:2  \
       --new=4:286720:-0   --change-name=4:'rootfs'       --typecode=4:0x8300 \
       debian-sid-risc-v-sifive-unmatched.img
       
# Mount image in loop device
sudo losetup --partscan --find --show debian-sid-risc-v-sifive-unmatched.img

# format partitions
sudo mkfs.vfat /dev/loop0p3
sudo mkfs.ext4 /dev/loop0p4
sudo e2label /dev/loop0p3 boot
sudo e2label /dev/loop0p4 rootfs

Installing debian sid+riscv-port on image

# mount root partition
sudo mount /dev/loop0p4 /mnt

# install base files
sudo apt install mmdebstrap qemu-user-static binfmt-support debian-ports-archive-keyring
sudo mmdebstrap --architectures=riscv64 --include="debian-ports-archive-keyring" sid /mnt "deb http://deb.debian.org/debian-ports/ sid main" "deb http://deb.debian.org/debian-ports/ unreleased main"

# mount boot partition
sudo mount /dev/loop0p3 /mnt/boot

# chroot into base filesystem and made basic configuration
sudo chroot /mnt

Inside created chroot:

# Update package information
apt-get update

# Set up basic networking
cat >>/etc/network/interfaces <<EOF
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
EOF

# Set root password 'sifive'
passwd

# Change hostname
echo unmatched > /etc/hostname

# Set up fstab
cat > /etc/fstab <<EOF
# <file system> <mount point>   <type>  <options>       <dump>  <pass>

/dev/mmcblk0p4 /               ext4    errors=remount-ro 0       1
/dev/mmcblk0p3 /boot           ext4    nodev,noexec,ro   0       2
EOF

# Install kernel and bootloader infrastructure
apt-get install linux-image-riscv64 u-boot-menu u-boot-sifive
apt-get clean

# add needed modules in initrd
echo mmc_spi >> /etc/initramfs-tools/modules
update-initramfs -u

# Set up u-boot (TODO: better integration for kernel updates)
cp /usr/lib/linux-image-5.14.0-2-riscv64/sifive/hifive-unmatched-a00.dtb /boot/
echo U_BOOT_FDT="hifive-unmatched-a00.dtb" >> /etc/default/u-boot
echo U_BOOT_PARAMETERS="rw quiet" >> /etc/default/u-boot
u-boot-update

# exit chroot
exit

Setup bootloaders

sudo dd if=/mnt/usr/lib/u-boot/sifive_unmatched/u-boot-spl.bin of=/dev/loop0p1 bs=4k iflag=fullblock oflag=direct conv=fsync status=progress
sudo dd if=/mnt/usr/lib/u-boot/sifive_unmatched/u-boot.itb of=/dev/loop0p2 bs=4k iflag=fullblock oflag=direct conv=fsync status=progress

Finish and write image to sdcard

sudo umount /mnt/boot
sudo umount /mnt

sudo losetup -d /dev/loop0

# take care of writing to the correct sdcard-device
sudo dd if=debian-sid-risc-v-sifive-unmatched.img of=/dev/sdcard-device bs=64k iflag=fullblock oflag=direct conv=fsync status=progress