Package: flash-kernel Version: 3.104 Severity: wishlist Tags: patch
As boards using the riscv64 architecture can be booted from U-Boot via the booti command like arm64 boards we should start adding these to the package.
The three appended patches * add a bootscr.uboot-generic script for riscv64 * provide the database entry for the SiFive Unmatched board * enable building on riscv64The main benefit of the package I see is that when booting via GRUB it can be used to supply the newest device-tree before launching GRUB via the preboot hook.
Best regards Heinrich
From 94d1eba3ffdfdca6917a7975b35197f1aae70e26 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt <heinrich.schucha...@canonical.com> Date: Tue, 8 Mar 2022 11:03:16 +0100 Subject: [PATCH 3/3] debian/control: enable building for riscv64 riscv64 boards use device-trees. So we should provide the flash-kernel package for them. Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com> --- debian/control | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/debian/control b/debian/control index d37b6d5..89e6751 100644 --- a/debian/control +++ b/debian/control @@ -11,7 +11,7 @@ Vcs-Git: https://salsa.debian.org/installer-team/flash-kernel.git Rules-Requires-Root: no Package: flash-kernel -Architecture: arm64 armel armhf +Architecture: arm64 armel armhf riscv64 Depends: ${misc:Depends}, devio, initramfs-tools (>= 0.92f), @@ -31,7 +31,7 @@ Section: debian-installer Priority: standard Package-Type: udeb Build-Profiles: <!noudeb> -Architecture: arm64 armel armhf +Architecture: arm64 armel armhf riscv64 XB-Subarchitecture: kirkwood orion5x s3c24xx mx5 generic Provides: bootable-system Depends: cdebconf-udeb, installed-base -- 2.34.1
From d43ffd2af4fd5387fa20909ccf0b51fbbba76626 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt <heinrich.schucha...@canonical.com> Date: Tue, 8 Mar 2022 10:18:49 +0100 Subject: [PATCH 2/3] db/all.db: add SiFive HiFive Unmatched A00 Add the SiFive HiFive Unmatched board to the database. Ubuntu uses the 'generic' flavor while Debian uses 'riscv64'. Add both to the database. Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com> --- db/all.db | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/db/all.db b/db/all.db index 951effe..585e45c 100644 --- a/db/all.db +++ b/db/all.db @@ -1719,6 +1719,13 @@ Boot-DTB-Path: /boot/dtb Required-Packages: u-boot-tools Bootloader-Sets-Incorrect-Root: no +Machine: SiFive HiFive Unmatched A00 +Kernel-Flavors: generic riscv64 +DTB-Id: sifive/hifive-unmatched-a00.dtb +Boot-Script-Path: /boot/boot.scr +U-Boot-Script-Name: bootscr.uboot-generic +Required-Packages: u-boot-tools + Machine: Sinlinx SinA31s Development Board Kernel-Flavors: armmp armmp-lpae Boot-Script-Path: /boot/boot.scr -- 2.34.1
From 44be15212b83a2c72de6a0c8a79c49cef7442494 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt <heinrich.schucha...@canonical.com> Date: Tue, 8 Mar 2022 11:24:30 +0100 Subject: [PATCH 1/3] riscv64: add bootscr.uboot-generic riscv64 uses booti not bootz. So we have to add a separate bootscr.uboot-generic. Signed-off-by: Heinrich Schuchardt <heinrich.schucha...@canonical.com> --- bootscript/riscv64/bootscr.uboot-generic | 56 ++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 bootscript/riscv64/bootscr.uboot-generic diff --git a/bootscript/riscv64/bootscr.uboot-generic b/bootscript/riscv64/bootscr.uboot-generic new file mode 100644 index 0000000..33f90d2 --- /dev/null +++ b/bootscript/riscv64/bootscr.uboot-generic @@ -0,0 +1,56 @@ +# Bootscript using the new unified bootcmd handling +# +# Expects to be called with the following environment variables set: +# +# devtype e.g. mmc/scsi etc +# devnum The device number of the given type +# bootpart The partition containing the boot files +# distro_bootpart The partition containing the boot files +# (introduced in u-boot mainline 2016.01) +# prefix Prefix within the boot partiion to the boot files +# kernel_addr_r Address to load the kernel to +# fdt_addr_r Address to load the FDT to +# ramdisk_addr_r Address to load the initrd to. +# +# The uboot must support the booti and generic filesystem load commands. + +if test -n "${console}"; then + setenv bootargs "${bootargs} console=${console}" +fi + +setenv bootargs @@LINUX_KERNEL_CMDLINE_DEFAULTS@@ ${bootargs} @@LINUX_KERNEL_CMDLINE@@ +@@UBOOT_ENV_EXTRA@@ + +if test -z "${fk_kvers}"; then + setenv fk_kvers '@@KERNEL_VERSION@@' +fi + +# These two blocks should be the same apart from the use of +# ${fk_kvers} in the first, the syntax supported by u-boot does not +# lend itself to removing this duplication. + +if test -n "${fdtfile}"; then + setenv fdtpath dtbs/${fk_kvers}/${fdtfile} +else + setenv fdtpath dtb-${fk_kvers} +fi + +if test -z "${distro_bootpart}"; then + setenv partition ${bootpart} +else + setenv partition ${distro_bootpart} +fi + +@@UBOOT_PREBOOT_EXTRA@@ + +load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz-${fk_kvers} \ +&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}${fdtpath} \ +&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img-${fk_kvers} \ +&& echo "Booting Debian ${fk_kvers} from ${devtype} ${devnum}:${partition}..." \ +&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} + +load ${devtype} ${devnum}:${partition} ${kernel_addr_r} ${prefix}vmlinuz \ +&& load ${devtype} ${devnum}:${partition} ${fdt_addr_r} ${prefix}dtb \ +&& load ${devtype} ${devnum}:${partition} ${ramdisk_addr_r} ${prefix}initrd.img \ +&& echo "Booting Debian from ${devtype} ${devnum}:${partition}..." \ +&& booti ${kernel_addr_r} ${ramdisk_addr_r}:${filesize} ${fdt_addr_r} -- 2.34.1