From a3a51beeaf3c3f4fa9b28d986341789ea7499d33 Mon Sep 17 00:00:00 2001 From: Heinrich Schuchardt Date: Fri, 8 Mar 2024 07:02:35 +0100 Subject: [PATCH] riscv: add pre-installed image for Milk-V Mars Signed-off-by: Heinrich Schuchardt --- live-build/auto/config | 6 ++++-- .../base/disk-image-uefi-non-cloud.binary | 19 +++++++++++++++++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/live-build/auto/config b/live-build/auto/config index 8e984151..a229f393 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -9,7 +9,8 @@ case $ARCH:$SUBARCH in i386:|\ ppc64el:|\ riscv64:|riscv64:generic|riscv64:icicle|riscv64:licheerv|\ - riscv64:nezha|riscv64:unmatched|riscv64:visionfive|riscv64:visionfive2|\ + riscv64:milk-v-mars|riscv64:nezha|riscv64:unmatched|riscv64:visionfive|\ + riscv64:visionfive2|\ s390x:|\ *appliance*) ;; @@ -392,8 +393,9 @@ fi if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then case $ARCH:$SUBARCH in riscv64:icicle | \ - riscv64:nezha | \ riscv64:licheerv | \ + riscv64:milk-v-mars | \ + riscv64:nezha | \ riscv64:unmatched | \ riscv64:visionfive | \ riscv64:visionfive2 | \ diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary index 5060c284..d86fd830 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary @@ -132,8 +132,8 @@ create_partitions() { --change-name=3:uEnv \ --new=1:: \ --attributes=1:set:2 - elif [ "${SUBARCH:-}" = "visionfive2" ]; then - # VisionFive 2 + elif [ "${SUBARCH:-}" = "visionfive2" ] || [ "${SUBARCH:-}" = "milk-v-mars" ]; then + # VisionFive 2, Milk-V Mars sgdisk "${disk_image}" \ --set-alignment=4096 \ --new=13:4096:8191 \ @@ -285,6 +285,21 @@ install_grub() { loader="${loop_device}p13" dd if=mountpoint/usr/lib/u-boot/microchip_icicle/u-boot.payload of=$loader ;; + "milk-v-mars") + cp ${my_d}/riscv64/grub/90_watchdog-thresh.cfg mountpoint/etc/default/grub.d/ + # flash-kernel is needed to install the dtb for update-grub: it uses the + # /proc/device-tree/model value to pick the correct dtb and as we are in a chroot, + # the model value is wrong and we need to use /etc/flash-kernel/machine instead. + # This explains why we install flash-kernel here. + chroot mountpoint bash -c "echo 'Milk-V Mars' > /etc/flash-kernel/machine" + chroot mountpoint apt-get install -qqy u-boot-starfive + # U-Boot SPL + loader1="${loop_device}p13" + # Main U-Boot + loader2="${loop_device}p2" + dd if=mountpoint/usr/lib/u-boot/starfive_visionfive2/u-boot-spl.bin.normal.out of=$loader1 + dd if=mountpoint/usr/lib/u-boot/starfive_visionfive2/u-boot.itb of=$loader2 + ;; "nezha"|"licheerv") echo "Reducing initramfs size for ${SUBARCH} board" mkdir -p mountpoint/etc/initramfs-tools/conf.d/