From 7167e3718bf3f8b4cf7b42c6dde4a44a67fd2229 Mon Sep 17 00:00:00 2001 From: Michael Hudson-Doyle Date: Thu, 13 Dec 2018 11:22:34 +1300 Subject: [PATCH] add initramfs hook to record kernel metapackage & mount modules --- .../hooks/033-kernel-bits.binary | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/live-build/ubuntu-server/hooks/033-kernel-bits.binary b/live-build/ubuntu-server/hooks/033-kernel-bits.binary index 9a193b52..af67924d 100644 --- a/live-build/ubuntu-server/hooks/033-kernel-bits.binary +++ b/live-build/ubuntu-server/hooks/033-kernel-bits.binary @@ -47,6 +47,27 @@ for variant in $variants; do mount_overlay "$INSTALLER_ROOT/" "$KERNEL_BITS_OVERLAY/" "$KERNEL_BITS_ROOT/" setup_mountpoint $KERNEL_BITS_ROOT + # Configure initramfs creation + mkdir -p "$KERNEL_BITS_ROOT"/etc/initramfs-tools/conf.d/ + if [ -n "$LB_INITRAMFS_COMPRESSION" ]; then + echo "COMPRESS=$LB_INITRAMFS_COMPRESSION" > "$KERNEL_BITS_ROOT"/etc/initramfs-tools/conf.d/livecd-rootfs.conf + fi + echo "CASPER_GENERATE_UUID=1" > "$KERNEL_BITS_ROOT"/etc/initramfs-tools/conf.d/casper.conf + + # Add a hook to record which kernel was booted and mount the + # modules.squashfs created below. + cat < "$KERNEL_BITS_ROOT"/etc/initramfs-tools/scripts/init-bottom/live-server +#!/bin/sh +case \$1 in +prereqs) exit 0;; +esac + +echo ${kernel_metapkg} > /run/kernel-meta-package +mkdir -p \$rootmnt/lib/modules +mount \$rootmnt/cdrom/casper/extras/modules.squashfs-$flavor \$rootmnt/lib/modules +EOF + chmod +x "$KERNEL_BITS_ROOT"/etc/initramfs-tools/scripts/init-bottom/live-server + # Install the kernel! env DEBIAN_FRONTEND=noninteractive chroot $KERNEL_BITS_ROOT apt-get -y install ${kernel_metapkg}