From 2149b617890c6833b06c219c0a218f1e8c66eb4f Mon Sep 17 00:00:00 2001 From: CloudBuilder Date: Wed, 2 Aug 2023 11:51:09 +0000 Subject: [PATCH] Imported 23.10.8 No reason for CPC update specified. --- debian/changelog | 13 ++++ live-build/lb_chroot_layered | 72 ++++--------------- .../base/disk-image-uefi-non-cloud.binary | 8 +-- 3 files changed, 32 insertions(+), 61 deletions(-) diff --git a/debian/changelog b/debian/changelog index e23e241c..7d01eb77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,16 @@ +livecd-rootfs (23.10.8) mantic; urgency=medium + + [ Heinrich Schuchardt ] + * risc-v: increase loader2 partition for VisionFive 2. EDK II is available + for the StarFive VisionFive 2 board. As it is larger than U-Boot we need + to increase the size of the loader 2 partition to accommodate it. + + [ Michael Hudson-Doyle ] + * lb_chroot_layered: use rsync to make more minimal overlay layers. + (LP: #2028213) + + -- Michael Hudson-Doyle Wed, 02 Aug 2023 13:19:29 +1200 + livecd-rootfs (23.10.7) mantic; urgency=medium * Actually fix live-build/ubuntu-cpc/hooks.d/base/disk-image.binary to not diff --git a/live-build/lb_chroot_layered b/live-build/lb_chroot_layered index 6529ef2e..d3173755 100755 --- a/live-build/lb_chroot_layered +++ b/live-build/lb_chroot_layered @@ -107,57 +107,6 @@ lb_chroot_includes () { cd "${OLDPWD}" } -reduce_pass_size () { - # Remove duplicated files between parent and current pass - # Note the empty directories created in a child pass are not removed - local pass=$1 - local parent="$(get_parent_pass $pass)" - - $(is_root_layer $pass) && return - - pass_dir="overlay.${pass}" - parent_pass_dir="overlay.${parent}" - - local list_pass=$(mktemp) - local list_parent=$(mktemp) - - (cd $pass_dir && find . ! -type d -printf "%h/%f|%s|%y|%U|%G|%m\n"|sort > $list_pass) - (cd $parent_pass_dir && find . ! -type d -printf "%h/%f|%s|%y|%U|%G|%m\n"|sort > $list_parent) - - # Only iterate on common files with same type, owner, permission and size - comm -12 $list_pass $list_parent|cut -d'|' -f1|while read f; do - # If file contents are different, keep it - if ! diff --brief --no-dereference "$pass_dir/$f" "$parent_pass_dir/$f" >/dev/null; then - continue - fi - p="$(dirname "$f")" - while [ "$p" != . ]; do - # As explained in the overlayfs documentation - # https://www.kernel.org/doc/html/latest/filesystems/overlayfs.html#whiteouts-and-opaque-directories - # an xattr of trusted.overlay.opaque indicates an 'opaque' directory - # that was deleted from the overlay. Removing files from within the - # directory, even if identical with one in the lower layer, will result - # in it going missing from the combined filesystem. - # - # It would be possible to be more clever, e.g. if the two directories - # are still similar, we could the delete the attribute and convert any - # still-needed deletions to whiteouts but it doesn't seem worth it in - # the cases seen so far. - if [ -n "$(getfattr -n trusted.overlay.opaque -h --only-values -- "$pass_dir/$p" 2>/dev/null)" ]; then - Echo_message "reduce_pass_size: '%s' would be removed from overlay but for trusted.overlay.opaque on '%s'" "$f" "$p" - continue 2 - fi - p="$(dirname "$p")" - done - # Files are strictly identical between the 2 passes (only mod or access times differs). No need for unused delta. - Echo_message "reduce_pass_size: '%s' is strictly identical between %s and %s. Removing." "$f" "$pass" "$parent" - rm "$pass_dir/$f" - done - - rm $list_pass - rm $list_parent -} - create_chroot_pass () { local pass=$1 shift 1 # restore ${*} @@ -182,8 +131,8 @@ create_chroot_pass () { mkdir -p "$overlay_dir/" lowerdirs=$(get_lowerdirs_for_pass $pass) if [ -n "$lowerdirs" ]; then - mkdir -p chroot/ - mount_overlay "$lowerdirs" "$overlay_dir" chroot/ + mkdir -p chroot "${overlay_dir}-initial" + mount_overlay "$lowerdirs" "${overlay_dir}-initial" chroot/ else ln -s "$overlay_dir/" chroot fi @@ -319,13 +268,22 @@ create_chroot_pass () { lb chroot_devpts remove ${*} if [ -n "$lowerdirs" ]; then - umount chroot - rmdir chroot + # Although the current chroot was created as an overlay over + # the previous layer, many operations can result in redundant + # files in the upperdir. Rather than trying to minimize the + # overlay by hand, we rsync the chroot into a fresh overlay, + # rely on rsyncs ability to avoid redundant file operations, + # and take _that_ overlay's upperdir as the content of the + # layer. + mkdir chroot-2 + mount_overlay "$lowerdirs" "$overlay_dir" chroot-2/ + rsync -aXHAS --del chroot/ chroot-2/ + umount chroot chroot-2 + rmdir chroot chroot-2 + rm -rf ${overlay_dir}-initial else rm chroot fi - - reduce_pass_size $pass } if [ ! -d chroot.bootstrap/ ]; then diff --git a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary index bcc04e28..781419cf 100755 --- a/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary +++ b/live-build/ubuntu-cpc/hooks.d/base/disk-image-uefi-non-cloud.binary @@ -139,15 +139,15 @@ create_partitions() { --new=13:4096:8191 \ --typecode=13:2E54B353-1271-4842-806F-E436D6AF6985 \ --change-name=13:loader1 \ - --new=2:8192:16383 \ + --new=2:8192:40959 \ --typecode=2:7a097280-70d2-44bc-886c-ff5ffbb7b098 \ --change-name=2:loader2 \ - --new=12:16384:24575 \ + --new=12:40960:49151 \ --change-name=12:CIDATA \ - --new=15:24576:229375 \ + --new=15:49152:253951 \ --typecode=15:ef00 \ --change-name=15:ESP \ - --new=1:229376: \ + --new=1:253952: \ --attributes=1:set:2 else # preinstalled server, currently FU540