mirror of
https://git.launchpad.net/livecd-rootfs
synced 2025-02-11 13:17:21 +00:00
Imported using git-ubuntu import. Changelog parent: bc2b9aed67e9a153c42c0aea158f3bc3d8fe2021 New changelog entries: * merge lp:~sergiusens/livecd-rootfs/no-walinuxagent to remove all the hackery that was initially needed for azure snappy images, this got properly implemented now.
87 lines
1.9 KiB
Bash
87 lines
1.9 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)"
|
|
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
|
|
|
|
# for compatibility with current grub/u-d-f
|
|
cp -ar --parent boot/vmlinu?-* boot/initrd.img-* boot/abi-* boot/System.map-* $TMPDIR/system/
|
|
if [ -e vmlinu? ] && [ -e initrd.img ]; then
|
|
cp -ar --parent vmlinu? initrd.img $TMPDIR/system
|
|
fi
|
|
cp -ar --parent lib/modules/ $TMPDIR/system/
|
|
cp -ar --parent lib/firmware/ $TMPDIR/system/
|
|
|
|
# new assets handling
|
|
# FIXME:
|
|
# - how to keep version information (and do we care)
|
|
if [ -f boot/vmlinu?-*.signed ]; then
|
|
cp -ar boot/vmlinu?-*.signed $TMPDIR/assets/vmlinuz
|
|
else
|
|
cp -ar boot/vmlinu?-* $TMPDIR/assets/vmlinuz
|
|
fi
|
|
cp -ar boot/initrd.img-* $TMPDIR/assets/initrd.img
|
|
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 for u-boot
|
|
# this assumes armh == u-boot
|
|
# and all others grub
|
|
(
|
|
# common bits
|
|
cat > $TMPDIR/hardware.yaml << EOF
|
|
kernel: assets/vmlinuz
|
|
initrd: assets/initrd.img
|
|
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
|
|
)
|