Revert "Refactor EFI directory structure creation"

This reverts commit b294a76309.

The template system was put in place to differentiate what is in the live
image and what needs to be in the target system. doing away with it
broke the installation
This commit is contained in:
Harald Sitter
2025-01-26 16:52:14 +01:00
parent aaa81980ff
commit c6b95cf982
4 changed files with 24 additions and 14 deletions

View File

@@ -91,14 +91,15 @@ mkosi \
--output-directory=. \
"$@"
# Create a directory structure for the UKIs.
mkdir --parents "${OUTPUT}/efi/EFI/Linux"
chmod --recursive 0700 "${OUTPUT}/efi"
# Move the UKIs to their appropriate places.
cp "${OUTPUT}/kde-linux.efi" "$MAIN_UKI"
mv "${OUTPUT}/kde-linux.efi" "${OUTPUT}/efi/EFI/Linux/$EFI"
mv "${OUTPUT}/live.efi" "$LIVE_UKI"
# NOTE: /efi must be empty so auto mounting can happen. As such we put our templates in a different directory
rm -rfv "${OUTPUT}/efi"
[ -d "${OUTPUT}/efi" ] || mkdir --mode 0700 "${OUTPUT}/efi"
[ -d "${OUTPUT}/efi-template" ] || mkdir --mode 0700 "${OUTPUT}/efi-template"
[ -d "${OUTPUT}/efi-template/EFI" ] || mkdir --mode 0700 "${OUTPUT}/efi-template/EFI"
[ -d "${OUTPUT}/efi-template/EFI/Linux" ] || mkdir --mode 0700 "${OUTPUT}/efi-template/EFI/Linux"
cp -v "${OUTPUT}"/kde-linux.efi "$MAIN_UKI"
mv -v "${OUTPUT}"/kde-linux.efi "${OUTPUT}/efi-template/EFI/Linux/$EFI"
mv -v "${OUTPUT}"/live.efi "$LIVE_UKI"
make_debug_archive
@@ -106,7 +107,7 @@ make_debug_archive
# We use kde-linux.cache instead of /tmp as usual because we'll probably run out of space there.
# Since we're building a live image, replace the main UKI with the live one.
cp "$LIVE_UKI" "${OUTPUT}/efi/EFI/Linux/$EFI"
cp "$LIVE_UKI" "${OUTPUT}/efi-template/EFI/Linux/$EFI"
# Change to kde-linux.cache since we'll be working there.
cd kde-linux.cache
@@ -119,8 +120,8 @@ mkfs.fat -F 32 esp.raw
mkdir -p esp.raw.mnt # The -p prevents failure if directory already exists
mount esp.raw esp.raw.mnt
# Copy everything from /efi into esp.raw.mnt.
cp --archive --recursive "${OUTPUT}/efi/." esp.raw.mnt
# Copy everything from /efi-template into esp.raw.mnt.
cp --archive --recursive "${OUTPUT}/efi-template/." esp.raw.mnt
# We're done, unmount esp.raw.mnt.
umount esp.raw.mnt
@@ -128,7 +129,7 @@ umount esp.raw.mnt
# Now, the root.
# Copy back the main UKI for the root.
cp "$MAIN_UKI" "${OUTPUT}/efi/EFI/Linux/$EFI"
cp "$MAIN_UKI" "${OUTPUT}/efi-template/EFI/Linux/$EFI"
# Create an 8G large btrfs filesystem inside of root.raw.
# Don't fret, we'll shrink this down to however much we actually need later.

View File

@@ -22,7 +22,7 @@ KernelCommandLine=
[Build]
WithNetwork=true
# Make sure kernel-install knows where we expect the ESP to be mounted so it can create correct loader entries.
Environment=BOOT_MNT=/efi
@Environment=BOOT_MNT=/efi-template
[Runtime]
Console=gui

View File

@@ -0,0 +1,9 @@
# SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
# SPDX-FileCopyrightText: 2023 Harald Sitter <sitter@kde.org>
#
# Set up for unified kernel image use
---
dontChroot: false
timeout: 300
script:
- cp -rfv /efi-template/* /efi/

View File

@@ -10,7 +10,7 @@ mkdir --mode 0700 /system # for the kde-linux-overlay.service
mkdir /snap # for snapd (will get a subvolume mounted into that snapd then mounts the snaps into)
export SYSTEMD_ESP_PATH="$BOOT_MNT"
mkdir --parents --mode 0700 "$SYSTEMD_ESP_PATH"
mkdir --mode 0700 "$SYSTEMD_ESP_PATH"
bootctl install
echo 'timeout 5' >> "$SYSTEMD_ESP_PATH/loader/loader.conf"
cp /usr/share/edk2-shell/x64/Shell.efi "$SYSTEMD_ESP_PATH/shellx64.efi"