|
19 | 19 | # - Provide a Debian kernel package (.deb) as input. |
20 | 20 | # - The script extracts the .deb via `dpkg-deb -R` into a temp directory. |
21 | 21 | # - DTBs are expected to be present under: |
22 | | -# $DEB_DIR/lib/firmware/$BASE_KERNEL_VERSION/device-tree |
| 22 | +# $DEB_DIR/usr/lib/firmware/$BASE_KERNEL_VERSION/device-tree (usrmerge layout) |
| 23 | +# $DEB_DIR/lib/firmware/$BASE_KERNEL_VERSION/device-tree (legacy layout) |
23 | 24 | # where $BASE_KERNEL_VERSION can be anything. |
24 | | -# - The script assumes there is exactly ONE: |
25 | | -# $DEB_DIR/lib/firmware/*/device-tree |
| 25 | +# - The script assumes there is exactly ONE device-tree directory across |
| 26 | +# both search paths. |
26 | 27 | # |
27 | 28 | # (B) DTB source directory mode (dev/kernel-tree mode) |
28 | 29 | # - Provide the DTB source directory directly (e.g. a kernel build tree): |
@@ -170,7 +171,9 @@ usage() { |
170 | 171 | Usage: $0 (--kernel-deb <kernel.deb> | --dtb-src <path>) --manifest <file> [--size <MB>] [--out <file>] |
171 | 172 |
|
172 | 173 | --kernel-deb, -kernel-deb Path to Debian kernel package (.deb). DTBs read from: |
173 | | - <extract>/lib/firmware/*/device-tree (must be exactly one) |
| 174 | + <extract>/usr/lib/firmware/*/device-tree (usrmerge layout) |
| 175 | + <extract>/lib/firmware/*/device-tree (legacy layout) |
| 176 | + Exactly one device-tree directory must be found. |
174 | 177 |
|
175 | 178 | --dtb-src, -dtb-src Path to DTB source directory |
176 | 179 | (e.g. arch/arm64/boot/dts/qcom) |
@@ -360,13 +363,21 @@ if [[ -n "${KERNEL_DEB}" ]]; then |
360 | 363 | echo "[INFO] Extracting kernel .deb to: ${DEB_DIR}" |
361 | 364 | dpkg-deb -R "${KERNEL_DEB}" "${DEB_DIR}" |
362 | 365 |
|
363 | | - # Locate exactly one device-tree directory under lib/firmware/*/device-tree |
| 366 | + # Locate exactly one device-tree directory. |
| 367 | + # Modern packages (usrmerge / pkg-linux-qcom) install the compat symlink under |
| 368 | + # usr/lib/firmware/<KVER>/device-tree; legacy packages used lib/firmware/. |
| 369 | + # Check usr/lib/firmware/ first; fall back to lib/firmware/. |
364 | 370 | shopt -s nullglob |
365 | | - dt_dirs=( "${DEB_DIR}/lib/firmware"/*/device-tree ) |
| 371 | + dt_dirs=( "${DEB_DIR}/usr/lib/firmware"/*/device-tree ) |
| 372 | + if (( ${#dt_dirs[@]} == 0 )); then |
| 373 | + dt_dirs=( "${DEB_DIR}/lib/firmware"/*/device-tree ) |
| 374 | + fi |
366 | 375 | shopt -u nullglob |
367 | 376 |
|
368 | 377 | if (( ${#dt_dirs[@]} == 0 )); then |
369 | | - echo "[ERROR] No DTB directory found at '${DEB_DIR}/lib/firmware/*/device-tree'." >&2 |
| 378 | + echo "[ERROR] No DTB directory found under:" >&2 |
| 379 | + echo " '${DEB_DIR}/usr/lib/firmware/*/device-tree'" >&2 |
| 380 | + echo " '${DEB_DIR}/lib/firmware/*/device-tree'" >&2 |
370 | 381 | exit 1 |
371 | 382 | fi |
372 | 383 | if (( ${#dt_dirs[@]} > 1 )); then |
|
518 | 529 | if (( dtb_count == 0 )); then |
519 | 530 | echo "[ERROR] No DTB files found under ${DTB_SRC}" >&2 |
520 | 531 | echo " Verify the kernel package was built with DTB support" >&2 |
521 | | - echo " and that lib/firmware/*/device-tree resolves correctly." >&2 |
| 532 | + echo " and that usr/lib/firmware/*/device-tree resolves correctly." >&2 |
522 | 533 | exit 1 |
523 | 534 | fi |
524 | 535 | echo "[INFO] Staged ${dtb_count} DTB file(s) to ${DTB_STAGE}" |
|
0 commit comments