Installing Fedora on SpacemiT hardware
This page explains how to install and update Fedora on SpacemiT hardware such as the Milk-V K1 and M1 Jupiter and the Banana Pi F3. Only very minimal support for this hardware is upstream at the time of writing, but patches have started to land, so the situation should improve.
Prepare Fedora
- Download the image:
wget https://openkoji.iscas.ac.cn/pub/dist-repos/dl/Milk-V/Jupiter/images/latest/k1-fedora-minimal.img.gz
- Extract it:
gzip -d k1-fedora-minimal.img.gz
- Write it to an SD Card
dd if=k1-fedora-minimal.img of=/dev/sdX bs=64M status=progress
Recommended Steps
- Move
/
(partition 6) to an NVME disk and resize it. If you do this mount/boot
and updateroot=/dev/mmcblk0p6
toroot=/dev/nvme0n1p1
inextlinux/extlinux.conf
- Resize
/boot
. (partition 5) The image only has a 256MB /boot partition, which is too small for installing multiple kernels. ~1GB should be fine. - Add a
/boot/efi
partition (partition 6 on mmc if you moved / to nvme). It does not need to be large. 1GB would be beyond adequate. This should be a fat16/fat32/vfat partition with the boot and esp flags set / EFI System partition type.
Boot and Complete
- Install your storage device(s) and boot
- Replace
/etc/yum.repos.d/fedora-riscv-koji.repo
with
[fedora-riscv-koji] name=Fedora RISC-V Koji baseurl=http://fedora.riscv.rocks/repos/f41-build/latest/riscv64/ enabled=1 gpgcheck=0 [fedora-riscv-openkoji] name=Fedora RISC-V Koji baseurl=http://openkoji.iscas.ac.cn/kojifiles/repos/f41-build/latest/riscv64/ enabled=0 gpgcheck=0
dnf remove python3-unbound-1.20.0-2.fc41.riscv64 && dnf -y update
# It should not be necessary to uninstall python3-unbound, but dnf has a problem resolving a conflict. It can be reinstalled afterward if needed or wanted.
Optional: Install updated SpacemiT kernel repo and switch to EFI boot
Rust projects have been observed failing to build with 6.1.15 kernel that comes on the image. It also does not have selinux enabled, modules necessary for firewalld to run, etc.
I am attempting to maintain and keep up to date an mainline/stable and LTS 6.6 kernels that more closely resemble a Fedora config with patches from https://github.com/spacemit-com/linux-k1x / https://gitee.com/bianbu-linux/linux-6.6/ until we have proper mainline kernel support. Starting with 6.13.0-rc6 and 6.6.70 it should be possible to efi boot either.
Note: The bpi-f3 will probably get a load access fault error if u-boot is not updated. You can update it by downloading the latest Bianbu 2.0 OS image and dd'ing partitions 1-4 over the existing 1-4 partitions on the sd card.
- Add /boot/efi to /etc/fstab
/dev/mmcblk0p6 /boot/efi vfat umask=0077,shortname=winnt 0 2
- Mount it with
sudo mount /boot/efi
- Edit
/etc/kernel/cmdline
and add suitable commandline arguments:
console=ttyS0,115200 root=/dev/nvme0n1p1 rootfstype=ext4 rootwait rw earlycon clk_ignore_unused quiet loglevel=2
- Ensure grub2-efi, shim-riscv64-unsigned are installed:
sudo dnf -y install http://fedora.riscv.rocks/kojifiles/packages/shim-unsigned-riscv64/15.8/3.1.riscv64/riscv64/shim-unsigned-riscv64-15.8-3.1.riscv64.riscv64.rpm grub2-common- grub2-tools-minimal grub2-tools grub2-efi-riscv64
- Edit
/boot/env_k1-x.txt
and change the bootcmd line to efi boot:
load mmc 0:5 ${fdt_addr_r} dtb/spacemit/${product_name}.dtb; load mmc 0:6 ${kernel_addr_r} EFI/fedora/shimriscv64.efi; bootefi ${kernel_addr_r} ${fdt_addr_r}
=== mainline/stable
- Add
/etc/yum.repos.d/spacemit-mainline.repo
[spacemit-mainline] name=spacemit-mainline enabled=1 gpgcheck=0 baseurl=https://people.redhat.com/jmontleo/fedora/linux/releases/41/spacemit-mainline/riscv64/ priority=98 [spacemit-mainline-source] name=spacemit-mainline-source enabled=0 gpgcheck=0 baseurl=https://people.redhat.com/jmontleo/fedora/linux/releases/41/spacemit-mainline/source/tree
sudo dnf -y update
- Change
SELINUX=enforcing
toSELINUX=permissive
in/etc/selinux/config
touch /.autorelabel
reboot
, let relabel complete- Change
SELINUX=permissive
back toSELINUX=enforcing
in/etc/selinux/config
reboot
(or justsetenforce 1
)
=== 6.6 LTS
- Add
/etc/yum.repos.d/spacemit.repo
[spacemit] name=spacemit enabled=1 gpgcheck=0 baseurl=https://people.redhat.com/jmontleo/fedora/linux/releases/41/spacemit/riscv64/ priority=98 [spacemit-source] name=spacemit-source enabled=0 gpgcheck=0 baseurl=https://people.redhat.com/jmontleo/fedora/linux/releases/41/spacemit/source/tree
dnf -y downgrade kernel*
dnf -y update
dnf -y remove kernel-6.1[01]* kernel-core-6.1[01]* kernel-modules-6.1[01]* kernel-modules-core-6.1[01]*
- Change
SELINUX=enforcing
toSELINUX=permissive
in/etc/selinux/config
touch /.autorelabel
reboot
, let relabel complete- Change
SELINUX=permissive
back toSELINUX=enforcing
in/etc/selinux/config
reboot
(or justsetenforce 1
)
=== Old extlinux boot
- This is not preferred, but you can boot 6.6 kernels using extlinux if for some reason you want to.
- This script is not required, but will automatically update
/boot/extlinux/extlinux.conf
when a new kernel is installed. To use it save it as/etc/kernel/install.d/99-update-extlinux.install
, ensuring the cmdlineroot=
settings matches your root device.
cat << EOF > /boot/extlinux/extlinux.conf menu title Fedora boot menu prompt 0 timeout 50 default F41S1 EOF index=0 for i in $(ls -1vr /boot/vmlinuz*); do index=$((index+1)) version=$(echo $i | sed 's,/boot/vmlinuz-,,g' | sed 's,\.unzboot,,g') if [ ${index} == 1 ]; then unlink /boot/dtb ln -sf dtb-${version} /boot/dtb fi if [ "${version}" == "6.1.15+" ]; then export spacemit=spacemit else export spacemit=dtb/spacemit fi cat << EOF >> /boot/extlinux/extlinux.conf label F41S${index} menu label Fedora 41 ${version} linux /vmlinuz-${version} initrd /initramfs-${version}.img fdtdir /${spacemit} append console=ttyS0,115200 root=/dev/nvme0n1p1 rootfstype=ext4 rootwait rw earlycon clk_ignore_unused quiet EOF done
chmod +x /etc/kernel/install.d/99-update-extlinux.install
- Run it now manually;
/etc/kernel/install.d/99-update-extlinux.install
- Change
SELINUX=enforcing
toSELINUX=permissive
in/etc/selinux/config
touch /.autorelabel
reboot
, let relabel complete- Change
SELINUX=permissive
back toSELINUX=enforcing
in/etc/selinux/config
reboot
(or justsetenforce 1
)