mirror of
				https://git.launchpad.net/livecd-rootfs
				synced 2025-11-04 10:54:07 +00:00 
			
		
		
		
	Revert "Revert the recent kpartx->losetup changes, as we need to put some other changes on top. Let's try to re-introduce this for MM."
This reverts commit 7b07db91110a3dda2723bc853a43f81c4e2a2f75.
This commit is contained in:
		
							parent
							
								
									a418f52bd4
								
							
						
					
					
						commit
						ada1f09b39
					
				
							
								
								
									
										3
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								debian/changelog
									
									
									
									
										vendored
									
									
								
							@ -1,8 +1,5 @@
 | 
			
		||||
livecd-rootfs (2.833) UNRELEASED; urgency=medium
 | 
			
		||||
 | 
			
		||||
  * Revert all the losetup related changes introduced in versions between
 | 
			
		||||
    2.829 and 2.832. Those are not quite good for lunar due to CPC
 | 
			
		||||
    incompatibilities.
 | 
			
		||||
  * Add ubuntucinnamon, ubuntu-unity and edubuntu to the workaround for the
 | 
			
		||||
    invalid apt cache issue we encountered during all of our previous
 | 
			
		||||
    releases.
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								debian/control
									
									
									
									
										vendored
									
									
								
							@ -27,6 +27,7 @@ Depends: ${misc:Depends},
 | 
			
		||||
         lsb-release,
 | 
			
		||||
         lzma,
 | 
			
		||||
         make,
 | 
			
		||||
         mount,
 | 
			
		||||
         parted,
 | 
			
		||||
         procps,
 | 
			
		||||
         python3,
 | 
			
		||||
 | 
			
		||||
@ -41,7 +41,7 @@ create_partitions() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
create_and_mount_uefi_partition() {
 | 
			
		||||
    uefi_dev="/dev/mapper${loop_device///dev/}p15"
 | 
			
		||||
    uefi_dev="${loop_device}p15"
 | 
			
		||||
    mountpoint="$1"
 | 
			
		||||
    mkfs.vfat -F 32 -n UEFI "${uefi_dev}"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -12,16 +12,13 @@ loop_raw=
 | 
			
		||||
backing_img=
 | 
			
		||||
 | 
			
		||||
clean_loops() {
 | 
			
		||||
    local kpartx_ret
 | 
			
		||||
    local kpartx_stdout
 | 
			
		||||
 | 
			
		||||
    if [ -n "${backing_img}" ]; then
 | 
			
		||||
    if [ -n "${loop_device}" ]; then
 | 
			
		||||
        # If something just finished writing to the device or a
 | 
			
		||||
        # partition (e.g. the zerofree in umount_partition) udev might
 | 
			
		||||
        # still be processing the device.
 | 
			
		||||
        udevadm settle
 | 
			
		||||
        sync
 | 
			
		||||
        kpartx -v -d "${backing_img}"
 | 
			
		||||
        losetup -v -d "${loop_device}"
 | 
			
		||||
        unset backing_img
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
@ -65,18 +62,15 @@ mount_image() {
 | 
			
		||||
    trap clean_loops EXIT
 | 
			
		||||
    backing_img="$1"
 | 
			
		||||
    local rootpart="$2"
 | 
			
		||||
    kpartx_mapping="$(kpartx -s -v -a ${backing_img})"
 | 
			
		||||
    loop_device=$(losetup --show -f -P -v ${backing_img})
 | 
			
		||||
 | 
			
		||||
    # Find the loop device
 | 
			
		||||
    loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')"
 | 
			
		||||
    loop_device="/dev/${loop_p1%p[0-9]*}"
 | 
			
		||||
    if [ ! -b ${loop_device} ]; then
 | 
			
		||||
        echo "unable to find loop device for ${backing_img}"
 | 
			
		||||
        exit 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    # Find the rootfs location
 | 
			
		||||
    rootfs_dev_mapper="/dev/mapper/${loop_p1%%[0-9]}${rootpart}"
 | 
			
		||||
    rootfs_dev_mapper="${loop_device}p${rootpart}"
 | 
			
		||||
    if [ ! -b "${rootfs_dev_mapper}" ]; then
 | 
			
		||||
        echo "${rootfs_dev_mapper} is not a block device";
 | 
			
		||||
        exit 1
 | 
			
		||||
@ -213,7 +207,7 @@ mount_disk_image() {
 | 
			
		||||
    mount_image ${disk_image} 1
 | 
			
		||||
    mount_partition "${rootfs_dev_mapper}" $mountpoint
 | 
			
		||||
 | 
			
		||||
    local uefi_dev="/dev/mapper${loop_device///dev/}p15"
 | 
			
		||||
    local uefi_dev="${loop_device}p15"
 | 
			
		||||
    if [ -b ${uefi_dev} -a -e $mountpoint/boot/efi ]; then
 | 
			
		||||
        mount "${uefi_dev}" $mountpoint/boot/efi
 | 
			
		||||
    fi
 | 
			
		||||
@ -254,7 +248,7 @@ umount_partition() {
 | 
			
		||||
umount_disk_image() {
 | 
			
		||||
    mountpoint="$1"
 | 
			
		||||
 | 
			
		||||
    local uefi_dev="/dev/mapper${loop_device///dev/}p15"
 | 
			
		||||
    local uefi_dev="${loop_device}p15"
 | 
			
		||||
    if [ -e "$mountpoint/boot/efi" -a -b "$uefi_dev" ]; then
 | 
			
		||||
	# zero fill free space in UEFI partition
 | 
			
		||||
	cat < /dev/zero > "$mountpoint/boot/efi/bloat_file" 2> /dev/null || true
 | 
			
		||||
 | 
			
		||||
@ -49,7 +49,7 @@ GRUB_TIMEOUT=0
 | 
			
		||||
# Set the default commandline
 | 
			
		||||
GRUB_CMDLINE_LINUX_DEFAULT="console=hvc0 earlyprintk"
 | 
			
		||||
EOF
 | 
			
		||||
    prep_partition="/dev/mapper${loop_device///dev/}p2"
 | 
			
		||||
    prep_partition="${loop_device}p2"
 | 
			
		||||
    chroot mountpoint grub-install "${prep_partition}" \
 | 
			
		||||
        --no-nvram \
 | 
			
		||||
        --boot-directory=/boot \
 | 
			
		||||
 | 
			
		||||
@ -197,7 +197,7 @@ create_partitions() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
create_and_mount_uefi_partition() {
 | 
			
		||||
    uefi_dev="/dev/mapper${loop_device///dev/}p15"
 | 
			
		||||
    uefi_dev="${loop_device}p15"
 | 
			
		||||
    mountpoint="$1"
 | 
			
		||||
    mkfs.vfat -F 32 -n UEFI "${uefi_dev}"
 | 
			
		||||
 | 
			
		||||
@ -234,7 +234,7 @@ install_grub() {
 | 
			
		||||
                # Server preinstalled image
 | 
			
		||||
                # Setup cidata sample data & nocloud fallback
 | 
			
		||||
                # Allows login on first boot with or without metadata
 | 
			
		||||
                cidata_dev="/dev/mapper${loop_device///dev/}p14"
 | 
			
		||||
                cidata_dev="${loop_device}p14"
 | 
			
		||||
                setup_cidata "${cidata_dev}"
 | 
			
		||||
                setup_cinocloud mountpoint
 | 
			
		||||
            fi
 | 
			
		||||
@ -246,7 +246,7 @@ install_grub() {
 | 
			
		||||
                # Server preinstalled image
 | 
			
		||||
                # Setup cidata sample data & nocloud fallback
 | 
			
		||||
                # Allows login on first boot with or without metadata
 | 
			
		||||
                cidata_dev="/dev/mapper${loop_device///dev/}p14"
 | 
			
		||||
                cidata_dev="${loop_device}p14"
 | 
			
		||||
                setup_cidata "${cidata_dev}"
 | 
			
		||||
                setup_cinocloud mountpoint
 | 
			
		||||
            fi
 | 
			
		||||
@ -258,7 +258,7 @@ install_grub() {
 | 
			
		||||
                # Server preinstalled image
 | 
			
		||||
                # Setup cidata sample data & nocloud fallback
 | 
			
		||||
                # Allows login on first boot with or without metadata
 | 
			
		||||
                cidata_dev="/dev/mapper${loop_device///dev/}p13"
 | 
			
		||||
                cidata_dev="${loop_device}p13"
 | 
			
		||||
                setup_cidata "${cidata_dev}"
 | 
			
		||||
                setup_cinocloud mountpoint
 | 
			
		||||
            fi
 | 
			
		||||
@ -285,10 +285,10 @@ install_grub() {
 | 
			
		||||
                        efi_target=riscv64-efi
 | 
			
		||||
                        # The real U-Boot
 | 
			
		||||
                        chroot mountpoint apt-get install -qqy u-boot-microchip
 | 
			
		||||
                        loader="/dev/mapper${loop_device///dev/}p13"
 | 
			
		||||
                        loader="${loop_device}p13"
 | 
			
		||||
                        dd if=mountpoint/usr/lib/u-boot/microchip_icicle/u-boot.payload of=$loader
 | 
			
		||||
                        # Provide end-user modifyable CIDATA
 | 
			
		||||
                        cidata_dev="/dev/mapper${loop_device///dev/}p12"
 | 
			
		||||
                        cidata_dev="${loop_device}p12"
 | 
			
		||||
                        setup_cidata "${cidata_dev}"
 | 
			
		||||
                        # Provide stock nocloud datasource
 | 
			
		||||
                        # Allow interactive login on baremetal board,
 | 
			
		||||
@ -330,10 +330,10 @@ install_grub() {
 | 
			
		||||
                        chroot mountpoint apt-get install -qqy u-boot-nezha
 | 
			
		||||
                        # Since version 2022.10 U-Boot SPL and U-Boot are installed onto the same partition.
 | 
			
		||||
                        # Package nezha-boot0 is not needed anymore.
 | 
			
		||||
                        loader1="/dev/mapper${loop_device///dev/}p13"
 | 
			
		||||
                        loader1="${loop_device}p13"
 | 
			
		||||
                        dd if=mountpoint/usr/lib/u-boot/${SUBARCH}/u-boot-sunxi-with-spl.bin of=$loader1
 | 
			
		||||
                        # Provide end-user modifyable CIDATA
 | 
			
		||||
                        cidata_dev="/dev/mapper${loop_device///dev/}p12"
 | 
			
		||||
                        cidata_dev="${loop_device}p12"
 | 
			
		||||
                        setup_cidata "${cidata_dev}"
 | 
			
		||||
                        # Provide stock nocloud datasource
 | 
			
		||||
                        # Allow interactive login on baremetal SiFive board,
 | 
			
		||||
@ -359,7 +359,7 @@ install_grub() {
 | 
			
		||||
                        efi_target=riscv64-efi
 | 
			
		||||
 | 
			
		||||
                        # factory u-boot requires a p3 partition with /boot/uEnv.txt file
 | 
			
		||||
                        uenv_dev="/dev/mapper${loop_device///dev/}p3"
 | 
			
		||||
                        uenv_dev="${loop_device}p3"
 | 
			
		||||
                        mkfs.ext4 "${uenv_dev}"
 | 
			
		||||
                        uenv_mnt_dir=`mktemp -d uenvXXX`
 | 
			
		||||
                        mount "${uenv_dev}" "${uenv_mnt_dir}"
 | 
			
		||||
@ -387,7 +387,7 @@ EOF
 | 
			
		||||
                        umount "${uenv_mnt_dir}"
 | 
			
		||||
                        rmdir "${uenv_mnt_dir}"
 | 
			
		||||
                        # Provide end-user modifyable CIDATA
 | 
			
		||||
                        cidata_dev="/dev/mapper${loop_device///dev/}p12"
 | 
			
		||||
                        cidata_dev="${loop_device}p12"
 | 
			
		||||
                        setup_cidata "${cidata_dev}"
 | 
			
		||||
                        # Provide stock nocloud datasource
 | 
			
		||||
                        # Allow interactive login on baremetal SiFive board,
 | 
			
		||||
@ -406,7 +406,7 @@ EOF
 | 
			
		||||
                        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"
 | 
			
		||||
                        cidata_dev="${loop_device}p12"
 | 
			
		||||
                        setup_cidata "${cidata_dev}"
 | 
			
		||||
                        # Provide stock nocloud datasource
 | 
			
		||||
                        # Allow interactive login on baremetal board,
 | 
			
		||||
@ -431,13 +431,13 @@ EOF
 | 
			
		||||
                        fi
 | 
			
		||||
                        chroot mountpoint apt-get install -qqy u-boot-sifive
 | 
			
		||||
                        # FSBL, which gets U-Boot SPL
 | 
			
		||||
                        loader1="/dev/mapper${loop_device///dev/}p13"
 | 
			
		||||
                        loader1="${loop_device}p13"
 | 
			
		||||
                        # The real U-Boot
 | 
			
		||||
                        loader2="/dev/mapper${loop_device///dev/}p14"
 | 
			
		||||
                        loader2="${loop_device}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"
 | 
			
		||||
                        cidata_dev="${loop_device}p12"
 | 
			
		||||
                        setup_cidata "${cidata_dev}"
 | 
			
		||||
                        # Provide stock nocloud datasource
 | 
			
		||||
                        # Allow interactive login on baremetal SiFive board,
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user