mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-06-04 14:41:42 +00:00
add raspi2 device tarball creation. separate snappy device tarball builds completely from the rootfs. drop old way of in-tree device tarball creation for snappy
This commit is contained in:
parent
b632fd0492
commit
5bc78bede3
6
debian/changelog
vendored
6
debian/changelog
vendored
@ -2,6 +2,12 @@ livecd-rootfs (2.353) UNRELEASED; urgency=medium
|
|||||||
|
|
||||||
* drop input group from snappy images, adjust md5 sums in
|
* drop input group from snappy images, adjust md5 sums in
|
||||||
live-build/ubuntu-core/hooks/00-uid-gid-fix.chroot_early
|
live-build/ubuntu-core/hooks/00-uid-gid-fix.chroot_early
|
||||||
|
* completely separate the snappy device tarball creation from the snappy
|
||||||
|
rootfs so one doesnt taint the other (which allows dropping a lot more from
|
||||||
|
the rootfs we do not need in a snappy system, like initramfs creation
|
||||||
|
tools and all its dependencies).
|
||||||
|
* drop live-build/ubuntu-core/hooks/500-move-kernel-to-device-tar.binary
|
||||||
|
* enable automated build of raspi2 device tarballs for snappy
|
||||||
|
|
||||||
-- Oliver Grawert <ogra@ubuntu.com> Mon, 09 Nov 2015 12:53:24 +0100
|
-- Oliver Grawert <ogra@ubuntu.com> Mon, 09 Nov 2015 12:53:24 +0100
|
||||||
|
|
||||||
|
@ -343,15 +343,137 @@ fi
|
|||||||
# in a binary hook
|
# in a binary hook
|
||||||
case $PROJECT:$SUBPROJECT in
|
case $PROJECT:$SUBPROJECT in
|
||||||
ubuntu-core:system-image|ubuntu-desktop-next:system-image)
|
ubuntu-core:system-image|ubuntu-desktop-next:system-image)
|
||||||
LB_LINUX_FLAVOURS=none
|
|
||||||
|
|
||||||
# rename to have the right prefix etc
|
# create device tarball (for snappy only atm)
|
||||||
mv device.tar.gz "$PREFIX.device.tar.gz"
|
if [ "$PROJECT:$SUBPROJECT" = "ubuntu-core:system-image" ]; then
|
||||||
|
case $ARCH in
|
||||||
|
armhf)
|
||||||
|
subarches="generic raspi2"
|
||||||
|
;;
|
||||||
|
i386|amd64|arm64|powerpc|ppc64el)
|
||||||
|
subarches="generic"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# azure specific tarball
|
# create a clean chroot
|
||||||
if [ -e device-azure.tar.gz ]; then
|
debootstrap --variant=minbase $LB_DISTRIBUTION chroot-device $LB_PARENT_MIRROR_BOOTSTRAP
|
||||||
mv device-azure.tar.gz "$PREFIX.azure.device.tar.gz"
|
|
||||||
|
# ... but keep the PPA setup
|
||||||
|
cp -a chroot/etc/apt/* chroot-device/etc/apt/
|
||||||
|
|
||||||
|
# ... and move it in place
|
||||||
|
rm -rf chroot
|
||||||
|
mv chroot-device chroot
|
||||||
|
|
||||||
|
for devarch in $subarches; do
|
||||||
|
(echo "I: creating $devarch device tarball for $ARCH"
|
||||||
|
HERE="$(pwd)"
|
||||||
|
set -x
|
||||||
|
|
||||||
|
linux_package="linux-$devarch"
|
||||||
|
case $ARCH in
|
||||||
|
amd64)
|
||||||
|
linux_package="linux-signed-generic"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# make sure all virtual filesystems are available
|
||||||
|
lb chroot_proc install "$@"
|
||||||
|
lb chroot_sysfs install "$@"
|
||||||
|
lb chroot_devpts install "$@"
|
||||||
|
|
||||||
|
# prepare the env
|
||||||
|
Chroot chroot "apt-get -y update"
|
||||||
|
Chroot chroot "apt-get -y purge linux-image-*"
|
||||||
|
Chroot chroot "apt-get -y autoremove"
|
||||||
|
rm -rf chroot/boot/initrd.img* chroot/boot/vmlinu?-* chroot/lib/modules/* \
|
||||||
|
chroot/boot/abi-* chroot/boot/System.map-* chroot/boot/config-*
|
||||||
|
mkdir -p chroot/etc/initramfs-tools/conf.d
|
||||||
|
echo "COMPRESS=lzma" >chroot/etc/initramfs-tools/conf.d/snappy-device-tarball.conf
|
||||||
|
|
||||||
|
# install needed packages and the kernel itself
|
||||||
|
Chroot chroot "apt-get -y install initramfs-tools-ubuntu-core linux-firmware xz-utils"
|
||||||
|
Chroot chroot "apt-get -y install $linux_package"
|
||||||
|
|
||||||
|
# clean up
|
||||||
|
lb chroot_devpts remove "$@"
|
||||||
|
lb chroot_sysfs remove "$@"
|
||||||
|
lb chroot_proc remove "$@"
|
||||||
|
|
||||||
|
# now build the actual device tarball
|
||||||
|
TMPDIR="$(mktemp -d)"
|
||||||
|
mkdir -p $TMPDIR/system/
|
||||||
|
mkdir -p $TMPDIR/assets/
|
||||||
|
|
||||||
|
cd chroot
|
||||||
|
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
|
fi
|
||||||
|
|
||||||
|
initrd=boot/initrd.img-*
|
||||||
|
|
||||||
|
cp -ar $initrd $TMPDIR/assets/
|
||||||
|
cp -ar $kernel $TMPDIR/assets/
|
||||||
|
cp -ar boot/abi-* boot/System.map-* boot/config-* $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 armhf == 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
|
||||||
|
|
||||||
|
# compress everything
|
||||||
|
cd $TMPDIR
|
||||||
|
tarname="device.tar.gz"
|
||||||
|
if [ "$devarch" = "raspi2" ];then
|
||||||
|
tarname="raspi2.$tarname"
|
||||||
|
fi
|
||||||
|
tar -c -z -f $HERE/$PREFIX.$tarname system assets hardware.yaml
|
||||||
|
|
||||||
|
# show size of initrd and kernel in the log
|
||||||
|
ls -lh assets/
|
||||||
|
|
||||||
|
# dump the content list into the log
|
||||||
|
echo "I: device tarball contents for $PREFIX.$tarname:"
|
||||||
|
find . -type f
|
||||||
|
|
||||||
|
# azure wants its own device tarball
|
||||||
|
if [ "$ARCH" = "amd64" ]; then
|
||||||
|
cp $HERE/$PREFIX.$tarname $HERE/$PREFIX.azure.$tarname
|
||||||
|
fi
|
||||||
|
cd $HERE)
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
ls -l *device.tar.gz
|
||||||
|
|
||||||
|
LB_LINUX_FLAVOURS=none
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ case $PROJECT in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# generic kernel etc
|
# generic kernel etc
|
||||||
KERNEL_FLAVOURS=generic
|
KERNEL_FLAVOURS=none
|
||||||
case $ARCH in
|
case $ARCH in
|
||||||
i386)
|
i386)
|
||||||
add_package install grub-pc
|
add_package install grub-pc
|
||||||
@ -418,7 +418,7 @@ case $PROJECT in
|
|||||||
add_package install flash-kernel u-boot-tools
|
add_package install flash-kernel u-boot-tools
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
OPTS="${OPTS:+$OPTS }--linux-packages=linux-image"
|
OPTS="${OPTS:+$OPTS }--linux-packages=none --initramfs=none"
|
||||||
|
|
||||||
# contains the framework definition
|
# contains the framework definition
|
||||||
add_package install ubuntu-core-libs
|
add_package install ubuntu-core-libs
|
||||||
|
@ -1,90 +0,0 @@
|
|||||||
#!/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)"
|
|
||||||
ARCH=$(dpkg --print-architecture)
|
|
||||||
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
|
|
||||||
)
|
|
||||||
|
|
||||||
# now build the azure device tarball
|
|
||||||
# this should go away once we have a custom grub.cfg for azure
|
|
||||||
cp $HERE/device.tar.gz $HERE/device-azure.tar.gz
|
|
||||||
|
|
||||||
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
|
|
||||||
# lp: #1468469
|
|
||||||
rm -rf boot/config-*
|
|
||||||
rm -rf usr/share/doc/linux-image*
|
|
||||||
rm -rf var/lib/initramfs-tools/*
|
|
||||||
rm -rf lib/modprobe.d/blacklist_linux_*.conf
|
|
||||||
)
|
|
Loading…
x
Reference in New Issue
Block a user