Add image for StarFive VisionFive 2

SUBARCH=visionfive2 is used to build images for the StarFive VisionFive 2
boards. For the device-tree we assume board revision 1.3B.

Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
canary-build
Heinrich Schuchardt 2 years ago
parent e1090424bb
commit d42c7c5989

@ -352,7 +352,14 @@ fi
# one also must request disk1-img-xz image format # one also must request disk1-img-xz image format
if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then
case $ARCH:$SUBARCH in case $ARCH:$SUBARCH in
armhf:raspi2|riscv64:sifive_*|riscv64:nezha|riscv64:visionfive|riscv64:licheerv|riscv64:icicle|*:generic) armhf:raspi2 | \
riscv64:icicle | \
riscv64:nezha | \
riscv64:licheerv | \
riscv64:sifive_* | \
riscv64:visionfive | \
riscv64:visionfive2 | \
*:generic)
IMAGE_HAS_HARDCODED_PASSWORD=1 IMAGE_HAS_HARDCODED_PASSWORD=1
if [ -z "${IMAGE_TARGETS:-}" ]; then if [ -z "${IMAGE_TARGETS:-}" ]; then
export IMAGE_TARGETS="disk1-img-xz" export IMAGE_TARGETS="disk1-img-xz"

@ -128,6 +128,23 @@ create_partitions() {
--change-name=3:uEnv \ --change-name=3:uEnv \
--new=1:: \ --new=1:: \
--attributes=1:set:2 --attributes=1:set:2
elif [ "${SUBARCH:-}" = "visionfive2" ]; then
# VisionFive 2
sgdisk "${disk_image}" \
--set-alignment=4096 \
--new=13:4096:8191 \
--typecode=13:2E54B353-1271-4842-806F-E436D6AF6985 \
--change-name=13:loader1 \
--new=2:8192:16383 \
--typecode=2:7a097280-70d2-44bc-886c-ff5ffbb7b098 \
--change-name=2:loader2 \
--new=12:16384:24575 \
--change-name=12:CIDATA \
--new=15:24576:229375 \
--typecode=15:ef00 \
--change-name=15:ESP \
--new=1:229376: \
--attributes=1:set:2
else else
# preinstalled server, currently FU540 # preinstalled server, currently FU540
# FU740 too in the future # FU740 too in the future
@ -373,8 +390,32 @@ EOF
# without a cloud datasource. # without a cloud datasource.
setup_cinocloud mountpoint setup_cinocloud mountpoint
;; ;;
"visionfive2")
echo "Installing GRUB for ${SUBARCH} board"
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 mkdir -p /etc/flash-kernel/
chroot mountpoint bash -c "echo 'StarFive VisionFive 2 v1.3B' > /etc/flash-kernel/machine"
chroot mountpoint bash -c 'FK_FORCE=yes apt-get install -qqy grub-efi-riscv64 flash-kernel'
efi_target=riscv64-efi
# Provide end-user modifyable CIDATA
cidata_dev="/dev/mapper${loop_device///dev/}p12"
setup_cidata "${cidata_dev}"
# Provide stock nocloud datasource
# Allow interactive login on baremetal board,
# without a cloud datasource.
setup_cinocloud mountpoint
# Flash-kernel creates boot.scr if it believes we did
# not boot in UEFi mode. Remove it so that we can boot
# via GRUB.
chroot mountpoint rm -f /boot/boot.scr
;;
*) *)
cp ${my_d}/riscv64/grub/90_watchdog-thresh.cfg mountpoint/etc/default/grub.d/ cp ${my_d}/riscv64/grub/90_watchdog-thresh.cfg mountpoint/etc/default/grub.d/
echo "Installing u-boot-menu for ${SUBARCH} board"
chroot mountpoint apt-get install -qqy u-boot-menu #grub-efi-riscv64 chroot mountpoint apt-get install -qqy u-boot-menu #grub-efi-riscv64
mkdir -p mountpoint/etc/u-boot-menu/conf.d/ mkdir -p mountpoint/etc/u-boot-menu/conf.d/
cp ${my_d}/riscv64/u-boot-menu/*.conf mountpoint/etc/u-boot-menu/conf.d/ cp ${my_d}/riscv64/u-boot-menu/*.conf mountpoint/etc/u-boot-menu/conf.d/
@ -408,7 +449,11 @@ EOF
chroot mountpoint u-boot-update chroot mountpoint u-boot-update
fi fi
if [ "${SUBARCH:-}" != "visionfive" ] && [ "${SUBARCH:-}" != "nezha" ] && [ "${SUBARCH:-}" != "licheerv" ] && [ "${SUBARCH:-}" != "icicle" ]; then if [ "${SUBARCH:-}" != "nezha" ] && \
[ "${SUBARCH:-}" != "licheerv" ] && \
[ "${SUBARCH:-}" != "icicle" ] \
[ "${SUBARCH:-}" != "visionfive" ] && \
[ "${SUBARCH:-}" != "visionfive2" ]; then
## TODO remove below once we have grub-efi-riscv64 for the platforms ## TODO remove below once we have grub-efi-riscv64 for the platforms
rm mountpoint/tmp/device.map rm mountpoint/tmp/device.map
umount mountpoint/boot/efi umount mountpoint/boot/efi

Loading…
Cancel
Save