@@ -188,6 +188,13 @@ function write_uboot_script() {
188
188
declare fat32_root_dir=" ${1} "
189
189
declare boot_cmd_file=" ${fat32_root_dir} /boot.cmd"
190
190
191
+ # It is absolutely unlikely that a (vendor/legacy) boot script will be used with a board that has fdtfile preset correctly.
192
+ # Thus check UBOOT_KERNEL_DTB is set, or bomb.
193
+ if [[ -z " ${UBOOT_KERNEL_DTB} " ]]; then
194
+ log error " UBOOT_KERNEL_DTB is unset -- vendor/boot.scr requires a DTB to be set"
195
+ exit 2
196
+ fi
197
+
191
198
declare console_extra_args=" ${bootable_info['CONSOLE_EXTRA_ARGS']:- " " } "
192
199
cat << - BOOT_CMD > "${boot_cmd_file} "
193
200
# Hook u-boot bootscript; mkimage -C none -A arm -T script -d /boot.cmd /boot.scr
@@ -233,14 +240,25 @@ function write_uboot_extlinux() {
233
240
mkdir -p " ${fat32_root_dir} /extlinux"
234
241
declare extlinux_conf=" ${fat32_root_dir} /extlinux/extlinux.conf"
235
242
cat << - EXTLINUX_CONF > "${extlinux_conf} "
236
- DEFAULT hook
237
- LABEL hook
243
+ DEFAULT Tinkerbell Hook ${BOARD} ${BRANCH}
244
+ LABEL Tinkerbell Hook ${BOARD} ${BRANCH}
238
245
linux /vmlinuz
239
246
initrd /initramfs
240
247
append ${bootargs} ${tinkerbell_args}
241
- fdt /dtb/${UBOOT_KERNEL_DTB}
242
248
EXTLINUX_CONF
243
- # @TODO: fdtdir when UBOOT_KERNEL_DTB is unset
249
+
250
+ # If UBOOT_KERNEL_DTB is not set, just pass the fdtdir
251
+ if [[ -z " ${UBOOT_KERNEL_DTB} " ]]; then
252
+ log info " UBOOT_KERNEL_DTB is unset; using fdtdir instead"
253
+ cat << - EXTLINUX_CONF_FDTDIR >> "${extlinux_conf} "
254
+ fdtdir /dtb/
255
+ EXTLINUX_CONF_FDTDIR
256
+ else
257
+ log info " UBOOT_KERNEL_DTB is set (${UBOOT_KERNEL_DTB} ); using it in extlinux.conf"
258
+ cat << - EXTLINUX_CONF_DTB >> "${extlinux_conf} "
259
+ fdt /dtb/${UBOOT_KERNEL_DTB}
260
+ EXTLINUX_CONF_DTB
261
+ fi
244
262
245
263
log_file_bat " ${extlinux_conf} " " info" " Produced Armbian u-boot extlinux.conf"
246
264
0 commit comments