[neon/neon/livecd-rootfs/Neon/release] live-build: Merge remote-tracking branch 'lp/ubuntu/jammy' into Neon/unstable

Jonathan Esk-Riddell null at kde.org
Tue Jul 26 12:23:09 BST 2022


Git commit 5b958668dea79cd84ca7cdb92521de089e82867e by Jonathan Esk-Riddell.
Committed on 26/07/2022 at 11:22.
Pushed by jriddell into branch 'Neon/release'.

Merge remote-tracking branch 'lp/ubuntu/jammy' into Neon/unstable

M  +3    -0    live-build/auto/build
M  +16   -6    live-build/auto/config
M  +155  -32   live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary

https://invent.kde.org/neon/neon/livecd-rootfs/commit/5b958668dea79cd84ca7cdb92521de089e82867e

diff --cc live-build/auto/config
index 933d2c4b,b594b79c..458babc4
--- a/live-build/auto/config
+++ b/live-build/auto/config
@@@ -988,21 -938,19 +988,31 @@@ case $PROJECT i
  				;;
  			riscv64*)
  				if [ -n "$SUBARCH" ]; then
- 					KERNEL_FLAVOURS=generic
+ 					case "${SUBARCH:-}" in
+ 						nezha)
+ 							KERNEL_FLAVOURS=allwinner
+ 							;;
+ 						visionfive)
+ 							KERNEL_FLAVOURS=starfive
+ 							;;
+ 						*)
+ 							KERNEL_FLAVOURS=generic
+ 							;;
+ 					esac
  				fi
  				;;
 +			amd64*)
 +				if [ "${SUBARCH:-}" = "intel-iot" ]; then
 +					KERNEL_FLAVOURS=image-intel
 +					COMPONENTS='main restricted'
 +					OPTS="${OPTS:+$OPTS }--initramfs=none"
 +				fi
 +				;;
 +			riscv64)
 +				if [ -n "$SUBARCH" ]; then
 +					KERNEL_FLAVOURS=generic
 +				fi
 +				;;
  		esac
  		OPTS="${OPTS:+$OPTS }--system=normal"
  		OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs"
diff --cc live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
index 250bd7ff,5009ffe3..e6f382b2
--- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
+++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi.binary
@@@ -215,103 -220,126 +252,189 @@@ 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
+             if [ -n "${SUBARCH:-}" ]; then
+                 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 u-boot-update
+                         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
  
-             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
+                         # 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
+                         ;;
+                     *)
+                         chroot mountpoint apt-get install -qqy u-boot-menu #grub-efi-riscv64
+                         efi_target=riscv64-efi
+                         chroot mountpoint u-boot-update
+                         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
-             ##
              ;;
 +        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.
 +                mkdir -p mountpoint/var/lib/cloud/seed/nocloud-net
 +                cat <<EOF >mountpoint/var/lib/cloud/seed/nocloud-net/meta-data
 +instance-id: iid-$(openssl rand -hex 8)
 +EOF
 +                cat <<EOF >mountpoint/var/lib/cloud/seed/nocloud-net/user-data
 +#cloud-config
 +chpasswd:
 +    expire: True
 +    list:
 +        - ubuntu:ubuntu
 +ssh_pwauth: True
 +EOF
 +                cat <<EOF >mountpoint/var/lib/cloud/seed/nocloud-net/network-config
 +# This is the initial network config.
 +# It can be overwritten by cloud-init.
 +version: 2
 +ethernets:
 +  zz-all-en:
 +    match:
 +      name: "en*"
 +    dhcp4: true
 +    optional: true
 +  zz-all-eth:
 +    match:
 +      name: "eth*"
 +    dhcp4: true
 +    optional: true
 +EOF
 +            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
  
      chroot mountpoint apt-get autoremove --purge --assume-yes


More information about the Neon-commits mailing list