Skip to content

Commit 7ad9288

Browse files
committed
feat: allow modular kernel config snippets
1 parent 865b9f8 commit 7ad9288

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

kernel/mkosi.build

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,20 @@ if [[ -n "${KERNEL_CONFIG_SNIPPETS:-}" ]]; then
1515
IFS=',' read -ra snippets <<< "$KERNEL_CONFIG_SNIPPETS"
1616
for snippet in "${snippets[@]}"; do
1717
snippet_file="$SRCDIR/$snippet"
18-
[[ -f "$snippet_file" ]] && cat "$snippet_file" >> "$config_file"
18+
if [[ -f "$snippet_file" ]]; then
19+
cat "$snippet_file" >> "$config_file" || true
20+
fi
1921
done
2022
fi
23+
for snippets_var in "${!KERNEL_CONFIG_SNIPPETS_@}"; do
24+
IFS=',' read -ra snippets <<< "${!snippets_var}"
25+
for snippet in "${snippets[@]}"; do
26+
snippet_file="$SRCDIR/$snippet"
27+
if [[ -f "$snippet_file" ]]; then
28+
cat "$snippet_file" >> "$config_file" || true
29+
fi
30+
done
31+
done
2132

2233
# Calculate cache key and paths
2334
config_hash=$(sha256sum "$config_file" | cut -d' ' -f1 | cut -c1-12)
@@ -43,6 +54,9 @@ else
4354
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" make olddefconfig
4455
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" make -j "$(nproc 2>/dev/null || echo 2)" bzImage ARCH=x86_64 CONFIG_EFI_STUB=y
4556

57+
echo "# kernel config:"
58+
mkosi-chroot --chdir "/build/kernel-${KERNEL_VERSION}" cat .config
59+
4660
# Cache result
4761
mkdir -p "$cache_dir"
4862
cp arch/x86_64/boot/bzImage "$cache_dir/"

0 commit comments

Comments
 (0)