[Merge] ~alexghiti/livecd-rootfs:int/alex/riscv_no_beaglev into livecd-rootfs:ubuntu/master

Ɓukasz Zemczak mp+424678 at code.launchpad.net
Fri Jul 1 14:41:00 UTC 2022


Thanks for some context (more inline).

Diff comments:

> 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 e802848..0062266 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
> @@ -183,39 +220,114 @@ 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
> +                        chroot mountpoint mkdir -p /etc/flash-kernel/
> +                        chroot mountpoint bash -c "echo 'Allwinner D1 Nezha' > /etc/flash-kernel/machine"

Okay, this is what I thought, thanks for confirming.

> +                        chroot mountpoint 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
> +                        chroot mountpoint mkdir -p /etc/flash-kernel/
> +                        chroot mountpoint bash -c "echo 'StarFive VisionFive V1' > /etc/flash-kernel/machine"
> +                        chroot mountpoint 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

Ok, so in other words, the uEnv.txt file is basically a floating asset which, in case of some need to be updated for whatever reason in the future, nothing has ownership of it? Since we already had cases where we thought a boot configuration file shouldn't need changes after initial release but then suddenly we had to. But I suppose we can make it flash-kernel's (or some other tool's) responsibility when that happens. But since that time, I don't like the idea of creating random files without a well define path to upgrade them if needed. This is what I meant by my question.

> +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
>  


-- 
https://code.launchpad.net/~alexghiti/livecd-rootfs/+git/livecd-rootfs/+merge/424678
Your team Ubuntu Core Development Team is subscribed to branch livecd-rootfs:ubuntu/master.




More information about the Ubuntu-reviews mailing list