diff --git a/debian/changelog b/debian/changelog index 5628c076..05c9ea4f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,25 @@ +livecd-rootfs (2.374) xenial; urgency=medium + + [ Michael Vogt ] + * ubuntu-core: + - include the dpkg.list in the device tarball + - store /usr/share/snappy/dpkg.list manifest on the OS tarball + + [ Dimitri John Ledkov ] + * ubuntu-cpc: + - exclude s390x from should_install_grub + + [ Steve Langasek ] + * Refactor/reorder ubuntu-cpc support for consistency with other flavors, + so that subarch overrides can be applied correctly. + + [ Ben Howard ] + * ubuntu-cpc: + - fixed loop setup due to change of kpartx output + - only use grub-install logic for Intel architectures + + -- Ben Howard Tue, 02 Feb 2016 10:18:14 -0700 + livecd-rootfs (2.373) xenial; urgency=medium * Set timeout options so ppc64el cloud images don't display a grub boot diff --git a/live-build/auto/build b/live-build/auto/build index 96f9d766..56bc790f 100755 --- a/live-build/auto/build +++ b/live-build/auto/build @@ -395,6 +395,8 @@ case $PROJECT:$SUBPROJECT in Chroot chroot "apt-get -y install initramfs-tools-ubuntu-core linux-firmware xz-utils" Chroot chroot "apt-get -y install $linux_package" + Chroot chroot "dpkg -l" > chroot/dpkg.list + # clean up lb chroot_devpts remove "$@" lb chroot_sysfs remove "$@" @@ -436,6 +438,9 @@ case $PROJECT:$SUBPROJECT in esac fi + # copy dpkg manifest + cp -ar dpkg.list $TMPDIR/assets + # create hardware.yaml # this assumes armhf == u-boot # and all others grub diff --git a/live-build/auto/config b/live-build/auto/config index 920519fe..05692012 100755 --- a/live-build/auto/config +++ b/live-build/auto/config @@ -470,6 +470,31 @@ case $PROJECT in ;; ubuntu-cpc) + add_task install minimal standard cloud-image + add_package install ubuntu-minimal + + BINARY_REMOVE_LINUX=false + OPTS="${OPTS:+$OPTS }--initramfs=none" + KERNEL_FLAVOURS=virtual + case $ARCH in + armhf) + KERNEL_FLAVOURS=generic-lpae + add_package install flash-kernel + add_task install server + ;; + arm64) + KERNEL_FLAVOURS=generic + add_package install flash-kernel + add_task install server + ;; + ppc64el) + add_task install server + ;; + esac + OPTS="${OPTS:+$OPTS }--system=normal" + OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs" + OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096" + OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15" ;; *) @@ -555,33 +580,6 @@ case $PROJECT in esac esac -if [ "$PROJECT" = "ubuntu-cpc" ]; then - BINARY_REMOVE_LINUX=false - OPTS="${OPTS:+$OPTS }--initramfs=none" - KERNEL_FLAVOURS=virtual - case $ARCH in - armhf) - KERNEL_FLAVOURS=generic-lpae - add_package install flash-kernel - add_task install server - ;; - arm64) - KERNEL_FLAVOURS=generic - add_package install flash-kernel - add_task install server - ;; - ppc64el) - add_task install server - ;; - esac - OPTS="${OPTS:+$OPTS }--system=normal" - OPTS="${OPTS:+$OPTS }--hdd-label=cloudimg-rootfs" - OPTS="${OPTS:+$OPTS }--ext-resize-blocks=536870912 --ext-block-size=4096" - OPTS="${OPTS:+$OPTS }--ext-fudge-factor=15" - add_task install minimal standard cloud-image - add_package install ubuntu-minimal -fi - add_chroot_hook update-apt-file-cache add_chroot_hook update-apt-xapian-index add_chroot_hook update-mlocate-database diff --git a/live-build/ubuntu-core/hooks/600-no-debian.binary b/live-build/ubuntu-core/hooks/600-no-debian.binary index 5b02e5d9..5e16071e 100755 --- a/live-build/ubuntu-core/hooks/600-no-debian.binary +++ b/live-build/ubuntu-core/hooks/600-no-debian.binary @@ -8,6 +8,12 @@ echo "I: Removing the debian legacy" PREFIX=binary/boot/filesystem.dir +# store manifest of all installed packages +(cd $PREFIX + install -m755 -d usr/share/snappy + chroot . dpkg -l > usr/share/snappy/dpkg.list +) + # dpkg-deb and dpkg purposefully left behind (cd $PREFIX chroot . dpkg --purge apt diff --git a/live-build/ubuntu-cpc/functions b/live-build/ubuntu-cpc/functions index 79b02c4c..f4557c9e 100644 --- a/live-build/ubuntu-cpc/functions +++ b/live-build/ubuntu-cpc/functions @@ -11,15 +11,16 @@ backing_img= apt-get -qqy install dosfstools gdisk clean_loops() { - if [ -z "${rootfs_dev_mapper}" ]; then - return 0 - fi if [ -n "${backing_img}" ]; then kpartx -v -d "${backing_img}" + unset backing_img + fi + + if [ -z "${rootfs_dev_mapper}" ]; then + return 0 fi - unset backing_img unset loop_device unset loop_raw unset rootfs_dev_mapper @@ -40,11 +41,27 @@ mount_image() { apt-get install -qqy kpartx trap clean_loops EXIT backing_img="$1" - loop_raw="$(kpartx -s -v -a "$1" )" - loop_device="$(echo -e "${loop_raw}" | head -n1 | awk '{print($(NF-1))}')" - rootfs_dev_mapper="/dev/mapper${loop_device///dev/}p1" - [ ! -b "${rootfs_dev_mapper}" ] && - echo "${rootfs_dev_mapper} is not a block device" && exit 1 + kpartx_mapping="$(kpartx -s -v -a ${backing_img})" + + # Find the loop device + loop_p1="$(echo -e ${kpartx_mapping} | head -n1 | awk '{print$3}')" + loop_device="/dev/loop$(echo ${loop_p1} | cut -b5)" + 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}" + if [ ! -b "${rootfs_dev_mapper}" ]; then + echo "${rootfs_dev_mapper} is not a block device"; + exit 1 + fi + + # Add some information to the debug logs + echo "Mounted disk image ${backing_img} to ${rootfs_dev_mapper}" + blkid ${rootfs_dev_mapper} + return 0 } diff --git a/live-build/ubuntu-cpc/hooks/032-disk-image.binary b/live-build/ubuntu-cpc/hooks/032-disk-image.binary index eebd85f8..fe6f1c71 100755 --- a/live-build/ubuntu-cpc/hooks/032-disk-image.binary +++ b/live-build/ubuntu-cpc/hooks/032-disk-image.binary @@ -32,24 +32,23 @@ cp -a chroot/* mountpoint/ umount mountpoint rmdir mountpoint -should_install_grub() { - case $architecture in - armhf|arm64|s390x) - return 1 - ;; - *) - return 0 - ;; - esac -} +case $architecture in + amd64|i386) should_install_grub=1;; + *) should_install_grub=0;; +esac -if should_install_grub; then +if [ "${should_install_grub}" -eq 1 ]; then mkdir mountpoint mount_partition "${rootfs_dev_mapper}" mountpoint echo "(hd0) ${loop_device}" > mountpoint/tmp/device.map chroot mountpoint grub-install ${loop_device} - chroot mountpoint grub-bios-setup --boot-image=i386-pc/boot.img --core-image=i386-pc/core.img --skip-fs-probe --device-map=/tmp/device.map ${loop_device} + chroot mountpoint grub-bios-setup \ + --boot-image=i386-pc/boot.img \ + --core-image=i386-pc/core.img \ + --skip-fs-probe \ + --device-map=/tmp/device.map \ + ${loop_device} rm mountpoint/tmp/device.map umount_partition mountpoint @@ -75,7 +74,15 @@ parameters = root=LABEL=cloudimg-rootfs EOF # Create bootmap file - mountpoint/sbin/zipl -V --image=mountpoint/boot/vmlinuz --ramdisk=mountpoint/boot/initrd.img --parameters='root=LABEL=cloudimg-rootfs' --target=mountpoint/boot/ --targetbase=/dev/loop0 --targettype=SCSI --targetblocksize=512 --targetoffset=2048 + mountpoint/sbin/zipl -V \ + --image=mountpoint/boot/vmlinuz \ + --ramdisk=mountpoint/boot/initrd.img \ + --parameters='root=LABEL=cloudimg-rootfs' \ + --target=mountpoint/boot/ \ + --targetbase=/dev/loop0 \ + --targettype=SCSI \ + --targetblocksize=512 \ + --targetoffset=2048 umount_partition mountpoint rmdir mountpoint