livecd-rootfs/live-build/ubuntu-desktop-next/hooks/500-move-kernel-to-device-tar.binary
Steve Langasek 0ae1111c55 Import patches-unapplied version 2.376 to ubuntu/xenial-proposed
Imported using git-ubuntu import.

Changelog parent: 80fddc56a2b4d6ed82dcce3ef56028b37e40705a

New changelog entries:
  [ Michael Terry ]
  * Change real name for phablet user to "Ubuntu" in ubuntu-touch.
  [ Steve Langasek ]
  * Drop BuildLiveCD from the examples; we now use launchpad-buildd to drive
    livefs builds, so BuildLiveCD is obsolete and misleading.
  * Add hooks to ubuntu-cpc to divert /bin/sync in the chroot and undivert it
    at the end.  This is a general-purpose change that should be applied to
    all flavors and archs, but at the moment it's only needed on armhf+raspi2
    to work around the raspberrypi2-firmware postinst calling sync, which is
    actually warranted in the normal case.
  * If a subarch is specified for a cloud image build, don't build rootfs
    artifacts; these should come from the 'generic' build.
  * Fix architecture handling in hooks.  We know we're always being invoked
    from a launchpad-buildd-like setup, which passes ARCH and SUBARCH in the
    environment, because auto/config and auto/build both rely on this.  So
    don't scatter dpkg --print-architecture calls throughout, especially
    when many of these are not cross-build-aware.
  * Refactor ubuntu-cpc hooks to allow us to handle images where the root
    partition should not be partition 1.
  [ Ben Howard ]
  * ubuntu-cpc: fix hooks/032-disk-image.binary call to
    create_empty_partition, which requires five args due to "-u"
  * ubuntu-cpc: in hooks/030-root-tarball.binary create /lib/modules to fix
    (LP: 1543204).
  [ Dimitri John Ledkov ]
  * Do not remove linux-base, when purging all the linux-*, in the tarball
    build. Otherwise ubuntu-minimal is removed, and things get crazy.
  * Correct initrd.img symlink, kernel/hooks should actually produce the
    right thing here, but meh.
  * Chroot to execute zipl, because it's nice.
  * Use the right loop device to install zipl onto.
  [ Steve Langasek ]
  * Refactor ubuntu-cpc hooks to always produce a 'plain' rootfs via
    live-build and reuse this for the tarball, instead of lb_binary_rootfs
    creating some artifact that we ignore / throw away.
  * Initial support for raspi2 subarch.
  * Import live-build/ubuntu-cpc/hooks/raspi2/mkknlimg from
    https://github.com/raspberrypi/linux/blob/rpi-4.1.y/scripts/mkknlimg
    and use it to install a bootable uboot.bin.
2016-02-12 21:43:58 +00:00

81 lines
1.6 KiB
Bash

#!/bin/sh
#
# move the kernel out into a new device tarfile with system/boot
set -ex
echo "I: Moving kernel into device tarball"
HERE="$(pwd)"
TMPDIR="$(mktemp -d)"
mkdir -p $TMPDIR/system/
mkdir -p $TMPDIR/assets/
# cp files, we can't simply use tar --transform as it changes the symlink target
(
cd binary/boot/filesystem.dir
cp -ar --parent lib/modules/ $TMPDIR/system/
cp -ar --parent lib/firmware/ $TMPDIR/system/
# new assets handling
if [ -f boot/vmlinu?-*.signed ]; then
kernel=boot/vmlinu?-*.signed
else
kernel=boot/vmlinu?-*
fi
initrd=boot/initrd.img-*
cp -ar $initrd $TMPDIR/assets/
cp -ar $kernel $TMPDIR/assets/
cp -ar boot/abi-* boot/System.map-* $TMPDIR/assets/
dtbs=$(find lib/firmware -type d -name 'device-tree' -print0)
if [ -n "$dtbs" ]; then
mv "$dtbs" $TMPDIR/assets/dtbs
fi
# create hardware.yaml
# this assumes armh == u-boot
# and all others grub
# common bits
cat > $TMPDIR/hardware.yaml << EOF
kernel: assets/$(basename $kernel)
initrd: assets/$(basename $initrd)
partition-layout: system-AB
EOF
# arch specific ones
if [ "$ARCH" = "armhf" ]; then
cat >> $TMPDIR/hardware.yaml << EOF
dtbs: assets/dtbs
bootloader: u-boot
EOF
else
cat >> $TMPDIR/hardware.yaml << EOF
bootloader: grub
EOF
fi
)
# and tar it up
(
cd $TMPDIR
tar -c -z -f $HERE/device.tar.gz system assets hardware.yaml
)
rm -rf $TMPDIR
# remove files from the root filesystem
(cd binary/boot/filesystem.dir
rm -f boot/vmlinu?-*
rm -f boot/initrd.img-*
rm -f boot/abi-*
rm -f boot/System.map-*
rm -f initrd.img
rm -f vmlinu?
rm -rf lib/modules
rm -rf lib/firmware
)