Skip to content

Commit 12b6bd9

Browse files
committed
gateway-dk-ask: use new hook kernel_extra_create_patches to stage ask patch
- before this, ask extension would stage a userpatch during post_family_config, if it was not in CONFIG_DEFS_ONLY mode - this would cause hashing to differ between matrix-prepare and actual build - matrix patches hash wouldn't have the patch - actual-build patches hash would - this caused infinite rebuilding of the kernel in CI - previous commit introduced a new hook made for this purpose - implement it here -- unconditionally, as it only ever run in actual build - also implement a cleanup (in post_family_config) so any leftovers are removed and won't affect further - remove claims that userpatches are gitignored (they aren't) and that they don't survive across builds (they do, unless handled as explained above)
1 parent 6585674 commit 12b6bd9

1 file changed

Lines changed: 22 additions & 8 deletions

File tree

extensions/gateway-dk-ask.sh

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -154,22 +154,36 @@ function custom_kernel_config__ask_modules() {
154154
fi
155155
}
156156

157-
# Copy ASK kernel patch to userpatches (gitignored) so it's applied during kernel build.
157+
# Copy ASK kernel patch to userpatches so it's applied during kernel build.
158158
# userpatches/ is the Armbian-standard location for extension-provided patches — the build
159-
# framework merges them with patches from patch/kernel/ at build time. The directory is
160-
# gitignored and ephemeral; it does not persist across clean builds.
161-
function post_family_config__ask_kernel_patch() {
159+
# framework merges them with patches from patch/kernel/ at build time.
160+
function kernel_extra_create_patches__ask_kernel_patch() {
162161
display_alert "ASK extension" "ASK kernel patch being staged in userpatches" "wrn"
163-
[[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # cache wasn't populated during config-dump-json
164-
local patch_src="${ASK_CACHE_DIR}/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch"
162+
declare patch_src="${ASK_CACHE_DIR}/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch"
165163
[[ -f "${patch_src}" ]] || exit_with_error "ASK kernel patch not found" "${patch_src}"
166-
local patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
164+
declare patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
165+
declare patch_dst_file="${patch_dst}/003-mono-gateway-ask-kernel_linux_6_12.patch"
167166
run_host_command_logged mkdir -pv "${patch_dst}"
168167
# Renamed to 003- to apply after 001-ina234 and 002-device-tree in the Armbian patch dir
169-
run_host_command_logged cp -v "${patch_src}" "${patch_dst}/003-mono-gateway-ask-kernel_linux_6_12.patch"
168+
run_host_command_logged cp -v "${patch_src}" "${patch_dst_file}"
169+
run_host_command_logged touch "${patch_dst_file}" # always recently-modified
170170
display_alert "ASK extension" "ASK kernel patch staged in userpatches" "info"
171171
}
172172

173+
function post_family_config__cleanup_ask_kernel_patch() {
174+
declare patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
175+
declare patch_dst_file="${patch_dst}/003-mono-gateway-ask-kernel_linux_6_12.patch"
176+
# if patch_dst_file exists, remove it -- it shouldn't be there in post_family_config stage (pre-hashing)
177+
# read: "the previous build left a staged ASK kernel patch in userpatches, remove it so patches hash doesn't change"
178+
if [[ -f "${patch_dst_file}" ]]; then
179+
display_alert "ASK extension" "removing staged ASK kernel patch from userpatches" "info"
180+
run_host_command_logged rm -f "${patch_dst_file}"
181+
else
182+
display_alert "ASK extension" "no staged ASK kernel patch found in userpatches, nothing to remove" "info"
183+
fi
184+
return 0
185+
}
186+
173187
# Install module autoload config (modules are in the kernel .deb, just need the load list)
174188
function post_install_kernel_debs__ask_module_autoload() {
175189
cp "${ASK_CACHE_DIR}/config/ask-modules.conf" "${SDCARD}/etc/modules-load.d/"

0 commit comments

Comments
 (0)