From 9ea0f1567e16ce8f1ff9ecf6743481698b776647 Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Thu, 21 Jul 2022 17:38:13 +0000 Subject: [PATCH] Imported 2.769 No reason for CPC update specified. --- debian/changelog | 13 ++ live-build/auto/config | 14 +- .../hooks.d/base/disk-image-uefi.binary | 186 ++++++++++++++---- .../chroot/052-ssh_authentication.chroot | 4 +- 4 files changed, 179 insertions(+), 38 deletions(-) diff --git a/debian/changelog b/debian/changelog index 28584c09..c1f2c580 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +livecd-rootfs (2.769) kinetic; urgency=medium + + [ Alexandre Ghiti ] + * Add support for the VisionFive and the Nezha boards (LP: #1980935) + * Set FK_FORCE_CONTAINER for RISC-V images build to force flash-kernel + to run in a container (LP: #1980929). + + [ Thomas Bechtold ] + * Revert "don't modify ssh_config for ubuntu-cpc projects (LP:1968873)" + This change triggered a bug in cloud-init (see LP: #1968873). + + -- Thomas Bechtold Mon, 11 Jul 2022 14:10:52 +0200 + livecd-rootfs (2.768) kinetic; urgency=medium * Use the new iso-url= parameter in the bootloader configs in the netboot diff --git a/live-build/auto/config b/live-build/auto/config index dd9fa173..89650c59 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -352,7 +352,7 @@ fi # one also must request disk1-img-xz image format if [ "$IMAGEFORMAT" = "ext4" ] && [ "$PROJECT" = "ubuntu-cpc" ]; then case $ARCH:$SUBARCH in - armhf:raspi2|riscv64:sifive_*|*:generic) + armhf:raspi2|riscv64:sifive_*|riscv64:nezha|riscv64:visionfive|*:generic) IMAGE_HAS_HARDCODED_PASSWORD=1 if [ -z "${IMAGE_TARGETS:-}" ]; then export IMAGE_TARGETS="disk1-img-xz" @@ -957,7 +957,17 @@ case $PROJECT in ;; riscv64*) if [ -n "$SUBARCH" ]; then - KERNEL_FLAVOURS=generic + case "${SUBARCH:-}" in + nezha) + KERNEL_FLAVOURS=allwinner + ;; + visionfive) + KERNEL_FLAVOURS=starfive + ;; + *) + KERNEL_FLAVOURS=generic + ;; + esac fi ;; esac diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary index e8028489..f34d827d 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary @@ -25,13 +25,17 @@ if [ "$ARCH" = "armhf" ]; then IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2); Since Jammy armhf need more then the default 2.2G fi -# Change image size for preinstalled generic images & all preinstalled riscv64 images +# Change image size for preinstalled generic images if [ -n "${SUBARCH:-}" ]; then - if [ "${SUBARCH:-}" = "generic" ] || [ "$ARCH" = "riscv64" ]; then + if [ "${SUBARCH:-}" = "generic" ]; then IMAGE_SIZE=3758096384 # bump to 3.5G (3584*1024**2), due to linux-generic instead of virtual fi fi +if [ "$ARCH" = "riscv64" ]; then + IMAGE_SIZE=4831838208 # bump to 4.5G (4608*1024**2); initrd creation fails with "No space left" with 3.5G +fi + . config/binary . config/functions @@ -69,6 +73,39 @@ create_partitions() { --typecode=15:ef00 \ --new=1:: \ --attributes=1:set:2 + elif [ "${SUBARCH:-}" = "nezha" ]; then + # Nezha D1 board + sgdisk "${disk_image}" \ + --set-alignment=2 \ + --new=13:256:25575 \ + --change-name=13:loader1 \ + --typecode=13:B161E8AB-7D4B-4DB4-821C-4120A0554A35 \ + --new=16:25576:32799 \ + --change-name=16:loader2b \ + --typecode=16:F79E76D9-AC98-418B-8F31-E17EA24FF07C \ + --new=14:32800:43007 \ + --change-name=14:loader2 \ + --typecode=14:F4FA3898-3478-4941-887D-FCEC4E9E3C05 \ + --new=15::+106M \ + --typecode=15:ef00 \ + --change-name=15:ESP \ + --new=12::+4M \ + --change-name=12:CIDATA \ + --new=1:: \ + --attributes=1:set:2 + elif [ "${SUBARCH:-}" = "visionfive" ]; then + # VisionFive + sgdisk "${disk_image}" \ + --set-alignment=2 \ + --new=15::+106M \ + --typecode=15:ef00 \ + --change-name=15:ESP \ + --new=12::+4M \ + --change-name=12:CIDATA \ + --new=3::+1M \ + --change-name=3:uEnv \ + --new=1:: \ + --attributes=1:set:2 else # preinstalled server, currently FU540 # FU740 too in the future @@ -183,39 +220,122 @@ install_grub() { ;; riscv64) # TODO grub-efi-riscv64 does not exist yet on riscv64 - chroot mountpoint apt-get install -qqy u-boot-menu #grub-efi-riscv64 - efi_target=riscv64-efi - - chroot mountpoint u-boot-update - if [ -n "${SUBARCH:-}" ]; then - u_boot_arch="${SUBARCH}" - if [ "${u_boot_arch}" = "hifive" ]; then - u_boot_arch=sifive_fu540 - fi - chroot mountpoint apt-get install -qqy u-boot-sifive - # FSBL, which gets U-Boot SPL - loader1="/dev/mapper${loop_device///dev/}p13" - # The real U-Boot - loader2="/dev/mapper${loop_device///dev/}p14" - dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot-spl.bin of=$loader1 - dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot.itb of=$loader2 - # 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 SiFive board, - # without a cloud datasource. - setup_cinocloud mountpoint + case "${SUBARCH}" in + "nezha") + echo "Installing U-Boot for Nezha board" &1>2 + # 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 'Allwinner D1 Nezha' > /etc/flash-kernel/machine" + chroot mountpoint bash -c 'FK_FORCE_CONTAINER=yes apt-get install -qqy grub-efi-riscv64 flash-kernel' + efi_target=riscv64-efi + + chroot mountpoint apt-get install -qqy nezha-boot0 + # FSBL, which gets U-Boot SPL + loader1="/dev/mapper${loop_device///dev/}p13" + dd if=mountpoint/usr/lib/u-boot/nezha/boot0_sdcard_sun20iw1p1.bin of=$loader1 + # The real U-Boot + chroot mountpoint apt-get install -qqy u-boot-nezha + loader2="/dev/mapper${loop_device///dev/}p14" + dd if=mountpoint/usr/lib/u-boot/nezha/u-boot.toc1 of=$loader2 + # 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 SiFive board, + # without a cloud datasource. + setup_cinocloud mountpoint + + # u-boot-nezha will boot using UEFI if it does not find + # any extlinux.conf or boot.scr: but flash-kernel will + # install a boot.scr if it believes it did not boot in + # EFI mode, so make sure we don't leave a boot.scr + # behind. + chroot mountpoint rm -f /boot/boot.scr + ;; + "visionfive") + echo "Installing GRUB for VisionFive board" &1>2 + # 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 V1' > /etc/flash-kernel/machine" + chroot mountpoint bash -c 'FK_FORCE_CONTAINER=yes apt-get install -qqy grub-efi-riscv64 flash-kernel' + efi_target=riscv64-efi + + # factory u-boot requires a p3 partition with /boot/uEnv.txt file + uenv_dev="/dev/mapper${loop_device///dev/}p3" + mkfs.ext4 "${uenv_dev}" + uenv_mnt_dir=`mktemp -d uenvXXX` + mount "${uenv_dev}" "${uenv_mnt_dir}" + mkdir -p "${uenv_mnt_dir}"/boot + + cat <<'EOF' >${uenv_mnt_dir}/boot/uEnv.txt +scriptaddr=0x88100000 +script_offset_f=0x1fff000 +script_size_f=0x1000 + +kernel_addr_r=0x84000000 +kernel_comp_addr_r=0x90000000 +kernel_comp_size=0x10000000 + +fdt_addr_r=0x88000000 +ramdisk_addr_r=0x88300000 + +bootcmd=load mmc 0:f ${kernel_addr_r} /EFI/ubuntu/grubriscv64.efi; bootefi ${kernel_addr_r} +bootcmd_mmc0=devnum=0; run mmc_boot + +ipaddr=192.168.120.200 +netmask=255.255.255.0 +EOF + + umount "${uenv_mnt_dir}" + rmdir "${uenv_mnt_dir}" + # 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 SiFive board, + # without a cloud datasource. + setup_cinocloud mountpoint + ;; + *) + u_boot_arch="${SUBARCH}" + if [ "${u_boot_arch}" = "hifive" ]; then + u_boot_arch=sifive_fu540 + fi + chroot mountpoint apt-get install -qqy u-boot-sifive + # FSBL, which gets U-Boot SPL + loader1="/dev/mapper${loop_device///dev/}p13" + # The real U-Boot + loader2="/dev/mapper${loop_device///dev/}p14" + dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot-spl.bin of=$loader1 + dd if=mountpoint/usr/lib/u-boot/${u_boot_arch}/u-boot.itb of=$loader2 + # 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 SiFive board, + # without a cloud datasource. + setup_cinocloud mountpoint + ;; + esac + fi + + if [ "${SUBARCH}" != "visionfive" ] && [ "${SUBARCH}" != "nezha" ]; then + ## TODO remove below once we have grub-efi-riscv64 + rm mountpoint/tmp/device.map + umount mountpoint/boot/efi + mount + umount_partition mountpoint + rmdir mountpoint + return + ## fi - ## TODO remove below once we have grub-efi-riscv64 - rm mountpoint/tmp/device.map - umount mountpoint/boot/efi - mount - umount_partition mountpoint - rmdir mountpoint - return - ## ;; esac diff --git a/live-build/ubuntu-cpc/hooks.d/chroot/052-ssh_authentication.chroot b/live-build/ubuntu-cpc/hooks.d/chroot/052-ssh_authentication.chroot index 0218a85f..6b0a34ea 100755 --- a/live-build/ubuntu-cpc/hooks.d/chroot/052-ssh_authentication.chroot +++ b/live-build/ubuntu-cpc/hooks.d/chroot/052-ssh_authentication.chroot @@ -1,5 +1,3 @@ #!/bin/bash -cat << EOF >> "/etc/ssh/sshd_config.d/10-cloudimg-settings.conf" -PasswordAuthentication no -EOF +sed -i "s|#PasswordAuthentication yes|PasswordAuthentication no|g" /etc/ssh/sshd_config