Commit 388f7a9
authored
kernel tools: make build-dtb-image.sh root-only and remove sudo dependency
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]>1 parent fc09a51 commit 388f7a9
1 file changed
+14
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
| 44 | + | |
48 | 45 | | |
49 | 46 | | |
50 | 47 | | |
| |||
59 | 56 | | |
60 | 57 | | |
61 | 58 | | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
62 | 65 | | |
63 | 66 | | |
64 | 67 | | |
| |||
79 | 82 | | |
80 | 83 | | |
81 | 84 | | |
82 | | - | |
| 85 | + | |
83 | 86 | | |
84 | 87 | | |
85 | 88 | | |
| |||
95 | 98 | | |
96 | 99 | | |
97 | 100 | | |
98 | | - | |
| 101 | + | |
99 | 102 | | |
100 | 103 | | |
101 | 104 | | |
102 | 105 | | |
103 | 106 | | |
104 | 107 | | |
105 | 108 | | |
106 | | - | |
| 109 | + | |
107 | 110 | | |
108 | 111 | | |
109 | 112 | | |
| |||
208 | 211 | | |
209 | 212 | | |
210 | 213 | | |
211 | | - | |
212 | 214 | | |
213 | 215 | | |
214 | 216 | | |
| |||
219 | 221 | | |
220 | 222 | | |
221 | 223 | | |
222 | | - | |
| 224 | + | |
223 | 225 | | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
227 | 229 | | |
228 | 230 | | |
229 | 231 | | |
230 | | - | |
| 232 | + | |
231 | 233 | | |
232 | 234 | | |
233 | 235 | | |
234 | | - | |
| 236 | + | |
235 | 237 | | |
236 | 238 | | |
237 | 239 | | |
238 | | - | |
| 240 | + | |
239 | 241 | | |
240 | 242 | | |
241 | 243 | | |
| |||
0 commit comments