Assembles a ready-to-write disk image via Gitea Actions. Mainline has carried sdm850-lenovo-yoga-c630.dts since 5.5 and Fedora ships it in kernel-core, so unlike aarch64-laptops/build there is no kernel or GRUB to compile — what is left is producing an image that boots on firmware which hands Linux no device tree. The build runs in an aarch64 container under qemu-user and builds filesystems from directory trees with mke2fs -d and mcopy rather than mounting loop devices, so it works on runners that will not hand out /dev/loop-control. A kernel-install hook writes the devicetree line into each BLS entry; without it the first `dnf update kernel` would produce an unbootable system. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XWRjNJMistCy6ngXH5aJLS
48 lines
1.6 KiB
Bash
Executable File
48 lines
1.6 KiB
Bash
Executable File
#!/usr/bin/bash
|
|
#
|
|
# Teach kernel-install about the C630's device tree.
|
|
#
|
|
# The C630's UEFI hands Linux no device tree, so GRUB has to load one. Fedora's
|
|
# BLS snippets have a `devicetree` key for exactly this, but nothing in the
|
|
# stock toolchain populates it — which means a plain `dnf update kernel` would
|
|
# otherwise produce an unbootable entry. This hook runs after 20-grub.install
|
|
# and patches the entry it just wrote.
|
|
|
|
set -eu
|
|
|
|
COMMAND="${1:?}"
|
|
KERNEL_VERSION="${2:?}"
|
|
|
|
DTB_REL="@DEVICE_DTB@"
|
|
BOOT_ROOT="${KERNEL_INSTALL_BOOT_ROOT:-/boot}"
|
|
ENTRIES_DIR="${BOOT_ROOT}/loader/entries"
|
|
|
|
case "$COMMAND" in
|
|
add)
|
|
dtb_path="/dtb-${KERNEL_VERSION}/${DTB_REL}"
|
|
if [ ! -e "${BOOT_ROOT}${dtb_path}" ]; then
|
|
echo "95-c630-devicetree: ${BOOT_ROOT}${dtb_path} is missing;" \
|
|
"leaving boot entries alone rather than writing a bad one" >&2
|
|
exit 0
|
|
fi
|
|
|
|
shopt -s nullglob
|
|
for entry in "${ENTRIES_DIR}"/*-"${KERNEL_VERSION}".conf; do
|
|
# Drop any stale devicetree line, then append the current one. Doing it
|
|
# in that order makes the hook idempotent across re-installs.
|
|
tmp="${entry}.c630.$$"
|
|
grep -v '^devicetree[[:space:]]' "$entry" > "$tmp"
|
|
printf 'devicetree %s\n' "$dtb_path" >> "$tmp"
|
|
mv -f "$tmp" "$entry"
|
|
echo "95-c630-devicetree: set devicetree ${dtb_path} in ${entry}"
|
|
done
|
|
;;
|
|
remove)
|
|
# The build writes its own bootstrap entry under a fixed name, which
|
|
# kernel-install would not otherwise clean up when the kernel goes away.
|
|
rm -f "${ENTRIES_DIR}/c630-${KERNEL_VERSION}.conf"
|
|
;;
|
|
esac
|
|
|
|
exit 0
|