Skip to content

Commit dbf5b95

Browse files
authored
Merge branch 'main' into add_board_lubancat_5io
2 parents fe3c659 + 317c52f commit dbf5b95

10 files changed

Lines changed: 152 additions & 52 deletions

File tree

config/sources/families/ls1046a.conf

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,10 @@ function write_uboot_platform() {
146146
)
147147
for part in "${parts[@]}"; do
148148
local file="${part%%:*}" seek="${part##*:}"
149-
[[ -f "$1/${file}" ]] || { echo "write_uboot_platform: missing $1/${file}" >&2; return 1; }
149+
[[ -f "$1/${file}" ]] || {
150+
echo "write_uboot_platform: missing $1/${file}" >&2
151+
return 1
152+
}
150153
dd if="$1/${file}" of="$2" bs=512 seek="${seek}" conv=notrunc status=noxfer > /dev/null 2>&1 || return 1
151154
done
152155
}

config/sources/families/rk35xx.conf

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ esac
4545

4646
prepare_boot_configuration
4747

48-
pre_config_uboot_target__warn_modern_hosts() {
48+
function pre_config_uboot_target__warn_modern_hosts() {
4949
# Check if building Radxa U-Boot on a host other than Ubuntu Jammy
5050
if [[ "${BOOTSOURCE}" == "https://github.com/radxa/u-boot.git" ]]; then
5151
if [[ "${HOSTRELEASE}" != "jammy" ]]; then
@@ -54,6 +54,25 @@ pre_config_uboot_target__warn_modern_hosts() {
5454
fi
5555
}
5656

57+
function check_uboot_produced_binary_file__check_vendor_uboot_for_0_byte_dtb() {
58+
# this hook is called with those two variables
59+
: "${base_binfile:?base_binfile is not set}"
60+
: "${binfile:?binfile is not set}"
61+
62+
[[ "${BOOTSOURCE}" != "https://github.com/radxa/u-boot.git" ]] && return 0 # Check if building Radxa U-Boot
63+
[[ "${base_binfile}" != "u-boot.itb" ]] && return 0 # Only check 'u-boot.itb' file
64+
display_alert "u-boot for ${BOARD}::${BRANCH} built on ${HOSTRELEASE}" "Checking for 0-byte DTB: ${base_binfile}" "info"
65+
66+
# Run dumpimage -l, grep it for string 'Data Size: 0 Bytes', if found, exit_with_error
67+
if dumpimage -l "${binfile}" | grep -q "Data Size: 0 Bytes"; then
68+
exit_with_error "u-boot for ${BOARD}::${BRANCH}::${base_binfile}: ERROR: The produced u-boot.itb file contains a 0-byte DTB; built on ${HOSTRELEASE} (${RUNNER_NAME}::${RUNNER_ENVIRONMENT}::${RUNNER_ARCH})"
69+
else
70+
display_alert "u-boot for ${BOARD}::${BRANCH}::${base_binfile}" "OK, produced u-boot.itb does NOT have 0-byte-dtb; built on ${HOSTRELEASE} (${RUNNER_NAME}::${RUNNER_ENVIRONMENT}::${RUNNER_ARCH})" "notice" # logs to CI log
71+
fi
72+
73+
return 0
74+
}
75+
5776
family_tweaks_bsp() {
5877
:
5978
}

config/sources/families/rockchip-rk3588.conf

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ esac
4343

4444
prepare_boot_configuration
4545

46-
pre_config_uboot_target__warn_modern_hosts() {
46+
function pre_config_uboot_target__warn_modern_hosts() {
4747
# Check if building Radxa U-Boot on a host other than Ubuntu Jammy
4848
if [[ "${BOOTSOURCE}" == "https://github.com/radxa/u-boot.git" ]]; then
4949
if [[ "${HOSTRELEASE}" != "jammy" ]]; then
@@ -52,6 +52,25 @@ pre_config_uboot_target__warn_modern_hosts() {
5252
fi
5353
}
5454

55+
function check_uboot_produced_binary_file__check_vendor_uboot_for_0_byte_dtb() {
56+
# this hook is called with those two variables
57+
: "${base_binfile:?base_binfile is not set}"
58+
: "${binfile:?binfile is not set}"
59+
60+
[[ "${BOOTSOURCE}" != "https://github.com/radxa/u-boot.git" ]] && return 0 # Check if building Radxa U-Boot
61+
[[ "${base_binfile}" != "u-boot.itb" ]] && return 0 # Only check 'u-boot.itb' file
62+
display_alert "u-boot for ${BOARD}::${BRANCH} built on ${HOSTRELEASE}" "Checking for 0-byte DTB: ${base_binfile}" "info"
63+
64+
# Run dumpimage -l, grep it for string 'Data Size: 0 Bytes', if found, exit_with_error
65+
if dumpimage -l "${binfile}" | grep -q "Data Size: 0 Bytes"; then
66+
exit_with_error "u-boot for ${BOARD}::${BRANCH}::${base_binfile}: ERROR: The produced u-boot.itb file contains a 0-byte DTB; built on ${HOSTRELEASE} (${RUNNER_NAME}::${RUNNER_ENVIRONMENT}::${RUNNER_ARCH})"
67+
else
68+
display_alert "u-boot for ${BOARD}::${BRANCH}::${base_binfile}" "OK, produced u-boot.itb does NOT have 0-byte-dtb; built on ${HOSTRELEASE} (${RUNNER_NAME}::${RUNNER_ENVIRONMENT}::${RUNNER_ARCH})" "notice" # logs to CI log
69+
fi
70+
71+
return 0
72+
}
73+
5574
family_tweaks_bsp() {
5675
:
5776
}

extensions/gateway-dk-ask.sh

Lines changed: 76 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ function post_family_config__000_ask_override_family() {
5252
# Uses post_family_config because the kernel patch staging hook needs it before fetch_sources_tools runs
5353
function post_family_config__ask_fetch_repo() {
5454
# Skip during config-dump-json: no $HOME is set, fetch_from_repo would fail in git_ensure_safe_directory
55-
[[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && { declare -g ASK_CACHE_DIR="${SRC}/cache/sources/ask-repo"; return 0; }
55+
[[ "${CONFIG_DEFS_ONLY}" == "yes" || "${ARMBIAN_COMMAND}" == "download-artifact" ]] && {
56+
declare -g ASK_CACHE_DIR="${SRC}/cache/sources/ask-repo"
57+
return 0
58+
}
5659
# For local file:// repos in Docker, safe.directory is needed (container runs as root)
5760
# Use env vars instead of git config --global to avoid persistent side effects
5861
if [[ "${ASK_REPO}" == file://* ]]; then
@@ -62,7 +65,7 @@ function post_family_config__ask_fetch_repo() {
6265
export GIT_CONFIG_KEY_1="safe.directory" GIT_CONFIG_VALUE_1="${local_path}/.git"
6366
fi
6467
fetch_from_repo "${ASK_REPO}" "ask-repo" "${ASK_BRANCH}"
65-
unset GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0 GIT_CONFIG_KEY_1 GIT_CONFIG_VALUE_1 2>/dev/null
68+
unset GIT_CONFIG_COUNT GIT_CONFIG_KEY_0 GIT_CONFIG_VALUE_0 GIT_CONFIG_KEY_1 GIT_CONFIG_VALUE_1 2> /dev/null
6669
declare -g ASK_CACHE_DIR="${SRC}/cache/sources/ask-repo"
6770
}
6871

@@ -90,25 +93,31 @@ function custom_kernel_config__ask_modules() {
9093
local ask_drv="${kernel_work_dir}/drivers/net/ethernet/freescale/ask"
9194
local bsp_dir="${SRC}/packages/bsp/gateway-dk"
9295

96+
# Cleanup previous tree if it exists (otherwise copying again creates 1-deep duplicates)
97+
if [[ -d "${ask_drv}" ]]; then
98+
display_alert "ASK extension" "removing previous ASK module tree in kernel" "info"
99+
run_host_command_logged rm -rf "${ask_drv}"
100+
fi
101+
93102
# Copy module sources and Kbuild files from ASK cache
94103
# (Kbuild files coexist with old Makefiles — kbuild prefers Kbuild when both exist)
95-
mkdir -p "${ask_drv}"
96-
cp -a "${ASK_CACHE_DIR}/${ASK_CDX_DIR}" "${ask_drv}/cdx"
97-
cp -a "${ASK_CACHE_DIR}/${ASK_FCI_DIR}" "${ask_drv}/fci"
98-
cp -a "${ASK_CACHE_DIR}/${ASK_AUTOBRIDGE_DIR}" "${ask_drv}/auto_bridge"
104+
run_host_command_logged mkdir -pv "${ask_drv}"
105+
run_host_command_logged cp -av "${ASK_CACHE_DIR}/${ASK_CDX_DIR}" "${ask_drv}/cdx"
106+
run_host_command_logged cp -av "${ASK_CACHE_DIR}/${ASK_FCI_DIR}" "${ask_drv}/fci"
107+
run_host_command_logged cp -av "${ASK_CACHE_DIR}/${ASK_AUTOBRIDGE_DIR}" "${ask_drv}/auto_bridge"
99108

100109
# Parent Kconfig and Makefile from ASK repo
101-
cp "${ASK_CACHE_DIR}/Kconfig" "${ask_drv}/Kconfig"
102-
cp "${ASK_CACHE_DIR}/Kbuild.mk" "${ask_drv}/Makefile"
110+
run_host_command_logged cp -v "${ASK_CACHE_DIR}/Kconfig" "${ask_drv}/Kconfig"
111+
run_host_command_logged cp -v "${ASK_CACHE_DIR}/Kbuild.mk" "${ask_drv}/Makefile"
103112

104113
# Board-specific modules (not part of ASK repo — from Armbian BSP)
105114
if [[ "${BOARD}" == "gateway-dk" ]]; then
106-
mkdir -p "${ask_drv}/sfp_led" "${ask_drv}/leds_lp5812"
107-
cp "${bsp_dir}/sfp-led.c" "${ask_drv}/sfp_led/"
108-
cp "${bsp_dir}/sfp-led.Kbuild" "${ask_drv}/sfp_led/Kbuild"
109-
cp "${bsp_dir}/leds-lp5812.c" "${ask_drv}/leds_lp5812/"
110-
cp "${bsp_dir}/leds-lp5812.h" "${ask_drv}/leds_lp5812/"
111-
cp "${bsp_dir}/leds-lp5812.Kbuild" "${ask_drv}/leds_lp5812/Kbuild"
115+
run_host_command_logged mkdir -pv "${ask_drv}/sfp_led" "${ask_drv}/leds_lp5812"
116+
run_host_command_logged cp -v "${bsp_dir}/sfp-led.c" "${ask_drv}/sfp_led/"
117+
run_host_command_logged cp -v "${bsp_dir}/sfp-led.Kbuild" "${ask_drv}/sfp_led/Kbuild"
118+
run_host_command_logged cp -v "${bsp_dir}/leds-lp5812.c" "${ask_drv}/leds_lp5812/"
119+
run_host_command_logged cp -v "${bsp_dir}/leds-lp5812.h" "${ask_drv}/leds_lp5812/"
120+
run_host_command_logged cp -v "${bsp_dir}/leds-lp5812.Kbuild" "${ask_drv}/leds_lp5812/Kbuild"
112121

113122
# Add board-specific entries to ASK Kconfig and Makefile
114123
patch -p1 -d "${ask_drv}" < "${bsp_dir}/ask-kconfig-board-modules.patch"
@@ -118,11 +127,18 @@ function custom_kernel_config__ask_modules() {
118127

119128
# Wire into parent freescale Kconfig and Makefile
120129
local fsl_dir="${kernel_work_dir}/drivers/net/ethernet/freescale"
121-
if ! grep -q 'source.*ask/Kconfig' "${fsl_dir}/Kconfig" 2>/dev/null; then
130+
if ! grep -q 'source.*ask/Kconfig' "${fsl_dir}/Kconfig"; then
131+
display_alert "ASK extension" "adding ASK Kconfig to freescale Kconfig" "info"
122132
sed -i '/endif.*NET_VENDOR_FREESCALE/i source "drivers/net/ethernet/freescale/ask/Kconfig"' "${fsl_dir}/Kconfig"
133+
else
134+
display_alert "ASK extension" "ASK Kconfig already present in freescale Kconfig" "info"
123135
fi
124-
if ! grep -q 'ask/' "${fsl_dir}/Makefile" 2>/dev/null; then
136+
137+
if ! grep -q 'ask/' "${fsl_dir}/Makefile"; then
138+
display_alert "ASK extension" "adding ASK modules to freescale Makefile" "info"
125139
echo 'obj-y += ask/' >> "${fsl_dir}/Makefile"
140+
else
141+
display_alert "ASK extension" "ASK modules already present in freescale Makefile"
126142
fi
127143

128144
display_alert "ASK extension" "ASK module sources and Kbuild files placed in kernel tree" "info"
@@ -138,21 +154,35 @@ function custom_kernel_config__ask_modules() {
138154
fi
139155
}
140156

141-
# 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.
142158
# userpatches/ is the Armbian-standard location for extension-provided patches — the build
143-
# framework merges them with patches from patch/kernel/ at build time. The directory is
144-
# gitignored and ephemeral; it does not persist across clean builds.
145-
function post_family_config__ask_kernel_patch() {
146-
[[ "${CONFIG_DEFS_ONLY}" == "yes" ]] && return 0 # cache wasn't populated during config-dump-json
147-
local patch_src="${ASK_CACHE_DIR}/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch"
159+
# framework merges them with patches from patch/kernel/ at build time.
160+
function kernel_extra_create_patches__ask_kernel_patch() {
161+
display_alert "ASK extension" "ASK kernel patch being staged in userpatches" "wrn"
162+
declare patch_src="${ASK_CACHE_DIR}/patches/kernel/002-mono-gateway-ask-kernel_linux_6_12.patch"
148163
[[ -f "${patch_src}" ]] || exit_with_error "ASK kernel patch not found" "${patch_src}"
149-
local patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
150-
mkdir -p "${patch_dst}"
164+
declare patch_dst="${SRC}/userpatches/kernel/${KERNELPATCHDIR}"
165+
declare patch_dst_file="${patch_dst}/003-mono-gateway-ask-kernel_linux_6_12.patch"
166+
run_host_command_logged mkdir -pv "${patch_dst}"
151167
# Renamed to 003- to apply after 001-ina234 and 002-device-tree in the Armbian patch dir
152-
cp "${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
153170
display_alert "ASK extension" "ASK kernel patch staged in userpatches" "info"
154171
}
155172

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+
}
156186

157187
# Install module autoload config (modules are in the kernel .deb, just need the load list)
158188
function post_install_kernel_debs__ask_module_autoload() {
@@ -211,8 +241,8 @@ function pre_customize_image__001_build_ask_userspace() {
211241
chroot_sdcard "cd /tmp/ask-userspace/fmlib && \
212242
patch -p1 < /tmp/ask-userspace/01-mono-ask-extensions.patch && \
213243
make KERNEL_SRC=${kdir} libfm-arm.a && \
214-
make DESTDIR=/ PREFIX=/usr LIB_DEST_DIR=/usr/lib/${ASK_HOST_TRIPLET} install-libfm-arm" \
215-
|| exit_with_error "fmlib build failed"
244+
make DESTDIR=/ PREFIX=/usr LIB_DEST_DIR=/usr/lib/${ASK_HOST_TRIPLET} install-libfm-arm" ||
245+
exit_with_error "fmlib build failed"
216246

217247
# --- fmc ---
218248
display_alert "ASK extension" "building fmc" "info"
@@ -233,8 +263,8 @@ function pre_customize_image__001_build_ask_userspace() {
233263
install -m 644 source/fmc.h /usr/include/fmc/ && \
234264
install -m 644 source/libfmc.a /usr/lib/${ASK_HOST_TRIPLET}/ && \
235265
install -d /etc/fmc/config && \
236-
install -m 644 etc/fmc/config/* /etc/fmc/config/" \
237-
|| exit_with_error "fmc build failed"
266+
install -m 644 etc/fmc/config/* /etc/fmc/config/" ||
267+
exit_with_error "fmc build failed"
238268

239269
# --- libcli ---
240270
display_alert "ASK extension" "building libcli" "info"
@@ -243,8 +273,8 @@ function pre_customize_image__001_build_ask_userspace() {
243273

244274
chroot_sdcard "cd /tmp/ask-userspace/libcli && \
245275
make CFLAGS='-Wno-calloc-transposed-args' && \
246-
make PREFIX=/usr DESTDIR=/ install" \
247-
|| exit_with_error "libcli build failed"
276+
make PREFIX=/usr DESTDIR=/ install" ||
277+
exit_with_error "libcli build failed"
248278

249279
# --- libfci ---
250280
display_alert "ASK extension" "building libfci" "info"
@@ -253,8 +283,8 @@ function pre_customize_image__001_build_ask_userspace() {
253283
chroot_sdcard "cd /tmp/ask-userspace/libfci && \
254284
make && \
255285
install -m 644 libfci.a /usr/lib/${ASK_HOST_TRIPLET}/ && \
256-
install -m 644 include/libfci.h /usr/include/" \
257-
|| exit_with_error "libfci build failed"
286+
install -m 644 include/libfci.h /usr/include/" ||
287+
exit_with_error "libfci build failed"
258288

259289
# --- dpa-app ---
260290
display_alert "ASK extension" "building dpa-app" "info"
@@ -269,8 +299,8 @@ function pre_customize_image__001_build_ask_userspace() {
269299
-I/usr/include/fmc -I/usr/include/fmd -I/usr/include/fmd/integrations \
270300
-I/usr/include/fmd/Peripherals -I/usr/include/fmd/Peripherals/common -I/usr/include/cdx' \
271301
LDFLAGS='-lfmc -lfm-arm -lstdc++ -lxml2 -lpthread -lcli' && \
272-
install -m 755 dpa_app /usr/bin/" \
273-
|| exit_with_error "dpa-app build failed"
302+
install -m 755 dpa_app /usr/bin/" ||
303+
exit_with_error "dpa-app build failed"
274304

275305
# Install DPA-App config files (from ASK repo)
276306
cp "${ASK_CACHE_DIR}/config/gateway-dk/cdx_cfg.xml" "${SDCARD}/etc/"
@@ -295,8 +325,8 @@ function pre_customize_image__001_build_ask_userspace() {
295325
install -d /usr/lib/${ASK_HOST_TRIPLET}/xtables && \
296326
for name in ${ask_xtables_modules[*]}; do \
297327
install -m 644 \"\${name}.so\" /usr/lib/${ASK_HOST_TRIPLET}/xtables/ || exit 1; \
298-
done" \
299-
|| exit_with_error "xtables extensions build failed"
328+
done" ||
329+
exit_with_error "xtables extensions build failed"
300330

301331
# --- Patched system libraries (must be before CMM which depends on patched libnetfilter-conntrack) ---
302332
build_ask_patched_libraries
@@ -318,8 +348,8 @@ function pre_customize_image__001_build_ask_userspace() {
318348
LIBFCI_DIR=/tmp/ask-userspace/libfci \
319349
ABM_DIR=/usr \
320350
SYSROOT=/ && \
321-
install -m 755 src/cmm /usr/bin/" \
322-
|| exit_with_error "cmm build failed"
351+
install -m 755 src/cmm /usr/bin/" ||
352+
exit_with_error "cmm build failed"
323353

324354
# Install and enable CMM service (from ASK repo)
325355
# Guarded by ConditionPathExists=/dev/cdx_ctrl — won't start without ASK FMAN ucode on NOR
@@ -379,7 +409,7 @@ function pre_customize_image__001_build_ask_userspace() {
379409
# Libraries — snapshot all ASK-installed libs from chroot
380410
mkdir -p "${pkgdir}/usr/lib/${ASK_HOST_TRIPLET}"
381411
for lib in libfm-arm.a libfmc.a; do
382-
[[ -f "${SDCARD}/usr/lib/${ASK_HOST_TRIPLET}/${lib}" ]] && \
412+
[[ -f "${SDCARD}/usr/lib/${ASK_HOST_TRIPLET}/${lib}" ]] &&
383413
cp -a "${SDCARD}/usr/lib/${ASK_HOST_TRIPLET}/${lib}" "${pkgdir}/usr/lib/${ASK_HOST_TRIPLET}/"
384414
done
385415
for pattern in libcli libfci; do
@@ -463,11 +493,11 @@ CONFFILES
463493
# Build .deb once, install in chroot and save to output
464494
local debfile="${pkgname}_${ask_version}_arm64.deb"
465495
mkdir -p "${SRC}/output/debs"
466-
run_host_command_logged dpkg-deb -b "${pkgdir}" "${SRC}/output/debs/${debfile}" \
467-
|| exit_with_error "dpkg-deb failed for ${debfile}"
496+
run_host_command_logged dpkg-deb -b "${pkgdir}" "${SRC}/output/debs/${debfile}" ||
497+
exit_with_error "dpkg-deb failed for ${debfile}"
468498
cp "${SRC}/output/debs/${debfile}" "${SDCARD}/root/"
469-
chroot_sdcard "DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /root/${debfile}" \
470-
|| exit_with_error "apt install failed for ${debfile}"
499+
chroot_sdcard "DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /root/${debfile}" ||
500+
exit_with_error "apt install failed for ${debfile}"
471501
rm -f "${SDCARD}/root/${debfile}"
472502

473503
rm -rf "${pkgdir}"
@@ -494,10 +524,9 @@ function build_ask_patched_libraries() {
494524
"01-nxp-ask-nonblocking-heap-buffer.patch" \
495525
"libnfnetlink0_*.deb libnfnetlink-dev_*.deb"
496526

497-
498527
# Copy patched .debs to output for distribution
499528
mkdir -p "${SRC}/output/debs"
500-
cp "${SDCARD}"/tmp/ask-patched-debs/*.deb "${SRC}/output/debs/" 2>/dev/null || true
529+
cp "${SDCARD}"/tmp/ask-patched-debs/*.deb "${SRC}/output/debs/" 2> /dev/null || true
501530
rm -rf "${SDCARD}/tmp/ask-patched-debs"
502531
}
503532

@@ -528,6 +557,5 @@ function rebuild_patched_deb() {
528557
DEB_BUILD_OPTIONS=nocheck dpkg-buildpackage -b -uc -us && \
529558
cd '${workdir}' && dpkg -i ${debs} && \
530559
cp ${debs} /tmp/ask-patched-debs/ && \
531-
rm -rf '${workdir}'" \
532-
|| exit_with_error "${pkg} rebuild failed"
560+
rm -rf '${workdir}'" || exit_with_error "${pkg} rebuild failed"
533561
}

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/artifacts/artifact-uboot.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ function artifact_uboot_prepare_version() {
8181
declare -a extension_hooks_to_hash=(
8282
"post_uboot_custom_postprocess" "fetch_custom_uboot" "build_custom_uboot"
8383
"pre_config_uboot_target" "post_config_uboot_target" "pre_package_uboot_image"
84+
"check_uboot_produced_binary_file"
8485
)
8586
declare -a extension_hooks_hashed=("$(dump_extension_method_sources_functions "${extension_hooks_to_hash[@]}")")
8687
declare hash_hooks="undetermined"

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

lib/functions/compilation/uboot.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -490,6 +490,15 @@ function compile_uboot() {
490490
declare target="${SRC}/output/uboot-bin-${uboot_name}-${base_binfile}-host-${HOSTRELEASE}.bin"
491491
run_host_command_logged cp -v "${binfile}" "${target}"
492492
fi
493+
494+
# Delegate to a hook for any extra analysis of the u-boot binary file
495+
call_extension_method "check_uboot_produced_binary_file" <<- 'CHECK_UBOOT_PRODUCED_BINARY_FILE'
496+
*check one produced u-boot binary*
497+
This is called once for *each* produced u-boot binary file, before packaging them into the .deb package.
498+
You can use this to analyze the produced binary for correctness, or to extract some information from it.
499+
You can use the variable binfile to access the full path to the binary file, and base_binfile to access just the filename.
500+
CHECK_UBOOT_PRODUCED_BINARY_FILE
501+
493502
done
494503

495504
artifact_package_hook_helper_board_side_functions "postinst" uboot_postinst_base "${postinst_functions[@]}"

0 commit comments

Comments
 (0)