@@ -82,21 +82,23 @@ stage_setup() {
8282 # apply the patch series into each tree, but only if it's still at the base
8383 # (unpatched). apply-series.sh commits via `git am`, so guard on HEAD==base.
8484 local linux_base uboot_base
85- # awk filters comment (#) + blank lines: pins/* has a multi-line header, so a
86- # bare '{print $2}' collects $2 from EVERY line (a multi-line blob) and breaks
87- # git rev-parse ("invalid object name 'pins/linux\nFormat'"). Latent bug — it
88- # made setup's patch-applied check always fall through to "skip apply" (base
89- # failed to resolve → HEAD != "" → else branch), masked only because the tree
90- # was already patched. A clean re-clone (at base) would mis-skip → unpatched build.
85+ # pins ref may be an annotated tag (linux = v7.1). `git rev-parse <tag>` returns
86+ # the TAG-OBJECT sha, but HEAD after `git clone --branch <tag>` is the COMMIT sha
87+ # — the two never compare equal, so a bare rev-parse made this guard ALWAYS skip
88+ # apply on a clean clone → unpatched tree → "No rule to make target
89+ # rk3506b-aes.dtb" (issue #6: zImage builds fine since it needs no board DT).
90+ # Peel the tag to its commit with ^{commit} (no-op for the uboot commit-sha pin).
91+ # The awk filter also strips pins/* comments + blank lines (a bare $2 would collect
92+ # a multi-line blob and break rev-parse).
9193 linux_base=$( awk ' !/^#/ && NF{print $2}' " ${_PROJECT_ROOT} /pins/linux" )
9294 uboot_base=$( awk ' !/^#/ && NF{print $2}' " ${_PROJECT_ROOT} /pins/uboot" )
93- if [[ " $( git -C " $LINUX_DIR " rev-parse HEAD) " == " $( git -C " $LINUX_DIR " rev-parse " $linux_base " ) " ]]; then
95+ if [[ " $( git -C " $LINUX_DIR " rev-parse HEAD) " == " $( git -C " $LINUX_DIR " rev-parse " ${ linux_base} ^{commit} " ) " ]]; then
9496 log_info " [setup] applying linux patch series"
9597 ( cd " $LINUX_DIR " && bash " ${_SCRIPT_DIR} /apply-series.sh" --component linux )
9698 else
9799 log_info " [setup] linux tree already patched ($( git -C " $LINUX_DIR " describe --tags 2> /dev/null || git -C " $LINUX_DIR " rev-parse --short HEAD) ) — skip apply"
98100 fi
99- if [[ " $( git -C " $UBOOT_DIR " rev-parse HEAD) " == " $( git -C " $UBOOT_DIR " rev-parse " $uboot_base " ) " ]]; then
101+ if [[ " $( git -C " $UBOOT_DIR " rev-parse HEAD) " == " $( git -C " $UBOOT_DIR " rev-parse " ${ uboot_base} ^{commit} " ) " ]]; then
100102 log_info " [setup] applying uboot patch series"
101103 ( cd " $UBOOT_DIR " && bash " ${_SCRIPT_DIR} /apply-series.sh" --component uboot )
102104 else
0 commit comments