Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions features/_usi/image.cc.tar
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ chroot "$rootfs" dracut \
--kver "${kernel#*-}" \
--modules "bash dash systemd systemd-emergency systemd-initrd systemd-repart systemd-resolved systemd-cryptsetup kernel-modules kernel-modules-extra terminfo udev-rules dracut-systemd base fs-lib shutdown crypt" \
--reproducible \
--install 'find findmnt grep lsblk tail head realpath basename sfdisk mkfs.ext4 mkfs.vfat wget oras efibootmgr objcopy resizefat32 dd cryptsetup' \
--install 'find findmnt grep lsblk tail head realpath basename sfdisk mkfs.ext4 mkfs.vfat wget oras efibootmgr objcopy objdump resizefat32 dd cryptsetup' \
--include '/tmp/initrd.include' / \
--add-drivers erofs \
/initrd
Expand All @@ -81,7 +81,7 @@ chroot "$rootfs" ukify build \
--linux "/boot/$kernel" \
--initrd "/initrd" \
--uname "${kernel#*-}" \
--cmdline "$cmdline xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx" \
--cmdline "$cmdline" \
--os-release "@/etc/os-release" \
--output "/uki"

Expand Down
17 changes: 11 additions & 6 deletions features/_usi/initrd.include/usr/bin/persist
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,17 @@ UKI_SHA=$(oras manifest fetch "$OCI_REPO:${OCI_TAG}" | jq -r '.layers[] | select
oras blob fetch "$OCI_REPO@$UKI_SHA" -o "$esp_dir/EFI/Linux/uki.efi"

if [ "$ENABLE_HUGEPAGE_SETUP" = "true" ]; then
# update the kernel cmdline in the uki
# TODO: when using the USI tool to perform the in place update, should the cmdline of the new image also be changed?
# n.b. secureboot makes all this impossible!
cmdline=$(objcopy --dump-section .cmdline=/dev/stdout /sysroot/efi/EFI/Linux/uki.efi | sed -r 's/x{8,}//')
echo "$cmdline hugepagesz=2MB hugepages=$hugepages" > /tmp/cmdlinef
objcopy --update-section .cmdline=/tmp/cmdlinef /sysroot/efi/EFI/Linux/uki.efi
echo "hugepagesz=2MB hugepages=$hugepages" > /tmp/cmdlinef
addon="/sysroot/usr/lib/systemd/boot/efi/addonx64.efi.stub"
offs=$(objdump -h $addon | awk 'NF==7 {size=$3;offset=$4} END {print "16#"size" + 16#"offset}')
if [[ $offs -eq 0 ]]; then
echo "the offset can't be calculated for the stub addon"
exit 1
fi
align=$(objdump -p $addon | grep Section | awk '{ print "16#"$2}')
offs=$((offs + "$align" - offs % "$align"))
mkdir -p /sysroot/efi/EFI/loader/addons
objcopy --add-section .cmdline=/tmp/cmdlinef --change-section-vma .cmdline=$(printf 0x%x $offs) $addon /sysroot/efi/EFI/loader/addons/hugepages.addon.efi
fi

# Network config generation
Expand Down