Skip to content

Commit 6585674

Browse files
committed
kernel: introduce hook kernel_extra_create_patches
- immediately after `kernel_drivers_create_patches` - immediately before actually applying kernel sources - this helps boards/families/extensions that need to stage out-of-tree patches into eg userpatches, without impacting the patches hash - the hook itself is hashed, so changes to it do impact the hooks hash
1 parent 911887c commit 6585674

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

lib/functions/artifacts/artifact-kernel.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,10 @@ function artifact_kernel_prepare_version() {
151151
declare var_config_hash_short="${vars_config_hash:0:${short_hash_size}}"
152152

153153
# Hash the extension hooks
154-
declare -a extension_hooks_to_hash=("pre_package_kernel_image" "kernel_copy_extra_sources" "pre_package_kernel_headers")
154+
declare -a extension_hooks_to_hash=(
155+
"pre_package_kernel_image" "kernel_copy_extra_sources" "pre_package_kernel_headers"
156+
"kernel_extra_create_patches"
157+
)
155158
declare -a extension_hooks_hashed=("$(dump_extension_method_sources_functions "${extension_hooks_to_hash[@]}")")
156159
declare hash_hooks="undetermined"
157160
hash_hooks="$(echo "${extension_hooks_hashed[@]}" | sha256sum | cut -d' ' -f1)"

lib/functions/compilation/kernel-patching.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,14 @@ function kernel_main_patching() {
7575
declare kernel_drivers_patch_file kernel_drivers_patch_hash
7676
LOG_SECTION="kernel_drivers_create_patches" do_with_logging do_with_hooks kernel_drivers_create_patches "${kernel_work_dir}" "${kernel_git_revision}"
7777

78+
call_extension_method "kernel_extra_create_patches" <<- 'KERNEL_EXTRA_CREATE_PATCHES'
79+
*stage more patches for kernel, after kernel_drivers*
80+
This is called after kernel_drivers_create_patches (wifi-drivers) and can be used to stage more patches
81+
to be applied. This is done immediately before actually patching, and thus, after any hashing is done.
82+
This allows implementors to stage custom patches (eg, from an out-of-tree driver into userpatches) without
83+
impacting the kernel version/hash.
84+
KERNEL_EXTRA_CREATE_PATCHES
85+
7886
# Python patching will git reset to the kernel SHA1 git revision, and remove all untracked files.
7987
LOG_SECTION="kernel_main_patching_python" do_with_logging do_with_hooks kernel_main_patching_python
8088

0 commit comments

Comments
 (0)