-
Notifications
You must be signed in to change notification settings - Fork 4
Add combined DTB image tooling and DTB-agnostic GRUB configuration #83
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…ation Introduce build-dtb-image.sh, a standalone tool to generate a FAT-formatted image containing a single combined DTB for Qualcomm-based ARM64 platforms. The script: - Consumes a manifest listing DTB filenames (one per line), supporting both absolute and DTB source–relative paths. - Normalizes and sanitizes the manifest into a temporary list, skipping blank and comment lines. - Validates that: - The manifest file exists and yields at least one DTB entry. - All referenced DTB files exist under the specified DTB source tree. - The requested FAT image size (-size) is a positive integer (MB). - Concatenates DTBs in manifest order into <DTB_SRC>/combined-dtb.dtb - Creates a FAT image of configurable size (default 7 MB), attaches it to a loop device, formats it, mounts it on a temporary directory, and copies the combined DTB into the root of the filesystem. - Installs an EXIT trap with a robust cleanup path that: - Preserves the original exit status. - Unmounts the temporary mountpoint only if mounted. - Detaches the loop device only if it was successfully created. - Removes all temporary files and directories. This provides a reproducible, automation-friendly way to package a curated DTB set into a single combined DTB and corresponding FAT image suitable for boot flows and CI pipelines. Signed-off-by: Bjordis Collaku <[email protected]>
Update build-ubuntu-rootfs.sh to align the generated GRUB configuration with the new UEFI-based combined DTB flow.
Changes:
- Replace the previous GRUB setup (three menu entries for EVK, CRD and QLI, each with an explicit devicetree directive) with a single, DTB-agnostic menu entry: "Ubuntu ${CODENAME}".
- Drop the CRD/EVK-specific DTB path variables:
/lib/firmware/$kernel_ver/device-tree/x1e80100-crd.dtb
/lib/firmware/$kernel_ver/device-tree/hamoa-iot-evk.dtb
since GRUB no longer selects or loads DTBs directly.
- Keep the existing kernel command line (root=LABEL=system, cma, clock and power domain flags, efi=noruntime, etc.) and initrd handling unchanged.
Rationale:
With the introduction of a UEFI-loaded combined DTB image (dtb.bin), DTB selection now happens entirely at the firmware layer. GRUB only needs to locate the "system" filesystem label, load the appropriate vmlinuz/initrd pair and pass the standard kernel parameters. Removing per-board DTB handling in GRUB reduces duplication and prevents drift between what UEFI loads and what the bootloader assumes.
Signed-off-by: Bjordis Collaku <[email protected]>
|
I'd suggest generating the fat as non-root; you can use mtools for that: |
…dency Refine build-dtb-image.sh to operate as a root-only tool and eliminate its runtime dependency on sudo, improving compatibility with minimal and containerized CI environments. Changes: - Add an explicit EUID check at startup and fail fast if the script is not executed as root, clarifying the requirement for losetup/mkfs/mount operations. - Remove all internal sudo invocations around: - losetup --show -fP - mkfs.vfat - mount / umount - loop-device detach - DTB copy into the mounted FAT filesystem - Keep the existing EXIT trap semantics intact, still guaranteeing: - sync() best-effort flush, - unmount of the temporary mountpoint (if present and mounted), - loop device detachment, - removal of the temporary sanitized manifest file. Behavior of the tool is otherwise unchanged: it still normalizes and validates DTB paths from the manifest, produces <DTB_SRC>/combined-dtb.dtb by concatenation in manifest order, and creates a FAT-formatted dtb.bin image containing only the combined DTB. The script is now better aligned with containerized CI usage patterns, where the entrypoint already runs as root and sudo is typically absent. Signed-off-by: Bjordis Collaku <[email protected]>
Signed-off-by: Bjordis Collaku <[email protected]>
This commit 388f7a9 already addresses this. It was mandatory to be able to invoke the tool through a --privileged docker in workflow : ) |
Update build-dtb-image.sh to format the DTB FAT image with a 4096-byte logical sector size by passing `-S 4096` to mkfs.vfat. This aligns the dtb.bin filesystem layout with 4K sector expectations on target boot flows while keeping the overall image size and DTB payload unchanged. Signed-off-by: Bjordis Collaku <[email protected]>
Summary
This PR adds end-to-end support for booting via a single combined DTB
image loaded by UEFI, and updates the Ubuntu rootfs builder to be
DTB-agnostic at the GRUB layer.
Concretely, it introduces a new
build-dtb-image.shhelper for buildinga FAT image containing a combined DTB, and simplifies the GRUB
configuration generated by
build-ubuntu-rootfs.shto no longer selectper-platform DTBs.
Changes
1. New DTB image tooling:
build-dtb-image.shAdds a standalone script that generates a FAT-formatted image containing
a single combined DTB for Qualcomm-based ARM64 platforms.
Key behavior:
-dtb-src).#).-sizeargument is a positive integer (MB).<DTB_SRC>/combined-dtb.dtb.-size(default: 4 MB).ddto create the image.losetup.mkfs.vfat.mktemp-generated directory.combined-dtb.dtbinto the root of the FAT filesystem.Robustness and cleanup:
set -euo pipefail.EXITtrap at startup.cleanup():This provides a reproducible, automation-friendly way to package a
curated DTB set into a single combined DTB binary and corresponding FAT
image (
dtb.bin) suitable for UEFI-driven boot flows and CI pipelines.2. DTB-agnostic GRUB config in
build-ubuntu-rootfs.shUpdates the Ubuntu rootfs builder script to align with the new UEFI DTB
loading model:
devicetreeline, pointing into
/lib/firmware/<kernel>/device-tree/....dtb.bin(the combined DTB FATimage) before transferring control to GRUB.
devicetreedirectives.
New behavior:
Generates a single DTB-agnostic GRUB entry: