@@ -41,6 +41,7 @@ function build_bootable_armbian_uboot_rockchip() {
41
41
function list_bootable_armbian_uboot_rockchip_vendor() {
42
42
declare -g -A bootable_boards=()
43
43
bootable_boards[" r58x" ]=" BOARD=mekotronics-r58x-pro BRANCH=vendor"
44
+ bootable_boards[" blade3" ]=" BOARD=mixtile-blade3 BRANCH=vendor"
44
45
}
45
46
46
47
function build_bootable_armbian_uboot_rockchip_vendor() {
@@ -187,6 +188,19 @@ function write_uboot_script_or_extlinux() {
187
188
function write_uboot_script() {
188
189
declare fat32_root_dir=" ${1} "
189
190
declare boot_cmd_file=" ${fat32_root_dir} /boot.cmd"
191
+
192
+ # It is absolutely unlikely that a (vendor/legacy) boot script will be used with a board that has fdtfile preset correctly.
193
+ # Thus check UBOOT_KERNEL_DTB is set, or bomb.
194
+ if [[ -z " ${UBOOT_KERNEL_DTB} " ]]; then
195
+ log error " UBOOT_KERNEL_DTB is unset -- vendor/boot.scr requires a DTB to be set"
196
+ exit 2
197
+ fi
198
+
199
+ declare -g -a bootable_tinkerbell_kernel_params=()
200
+ fill_array_bootable_tinkerbell_kernel_parameters " ${BOARD} "
201
+ declare tinkerbell_args=" ${bootable_tinkerbell_kernel_params[*]} "
202
+
203
+ declare console_extra_args=" ${bootable_info['CONSOLE_EXTRA_ARGS']:- " " } "
190
204
cat << - BOOT_CMD > "${boot_cmd_file} "
191
205
# Hook u-boot bootscript; mkimage -C none -A arm -T script -d /boot.cmd /boot.scr
192
206
echo "Starting Tinkerbell Hook boot script..."
@@ -195,7 +209,7 @@ function write_uboot_script() {
195
209
setenv ramdisk_addr_r "0x40000000"
196
210
test -n "\$ {distro_bootpart}" || distro_bootpart=1
197
211
echo "Boot script loaded from \$ {devtype} \$ {devnum}:\$ {distro_bootpart}"
198
- setenv bootargs "${UBOOT_EXTLINUX_CMDLINE} "
212
+ setenv bootargs "${UBOOT_EXTLINUX_CMDLINE} console=tty0 console= ${UBOOT_KERNEL_SERIALCON}${console_extra_args} ${tinkerbell_args} "
199
213
echo "Booting with: \$ {bootargs}"
200
214
201
215
echo "Loading initramfs... \$ {ramdisk_addr_r} /uinitrd"
@@ -212,6 +226,9 @@ function write_uboot_script() {
212
226
booti \$ {kernel_addr_r} \$ {ramdisk_addr_r} \$ {fdt_addr_r}
213
227
BOOT_CMD
214
228
229
+ log info " Marking uinitrd.wanted..."
230
+ touch " ${fat32_root_dir} /uinitrd.wanted" # marker file for utility run during fat32 image creation; see create_image_fat32_root_from_dir()
231
+
215
232
log_file_bat " ${boot_cmd_file} " " info" " Produced Armbian u-boot boot.cmd/boot.scr"
216
233
217
234
return 0
@@ -221,7 +238,7 @@ function write_uboot_extlinux() {
221
238
declare fat32_root_dir=" ${1} "
222
239
223
240
declare console_extra_args=" ${bootable_info['CONSOLE_EXTRA_ARGS']:- " " } "
224
- declare bootargs=" ${UBOOT_EXTLINUX_CMDLINE} console=${UBOOT_KERNEL_SERIALCON}${console_extra_args} "
241
+ declare bootargs=" ${UBOOT_EXTLINUX_CMDLINE} console=tty0 console= ${UBOOT_KERNEL_SERIALCON}${console_extra_args} "
225
242
log info " Writing extlinux.conf; kernel cmdline: ${bootargs} "
226
243
227
244
declare -g -a bootable_tinkerbell_kernel_params=()
@@ -231,14 +248,25 @@ function write_uboot_extlinux() {
231
248
mkdir -p " ${fat32_root_dir} /extlinux"
232
249
declare extlinux_conf=" ${fat32_root_dir} /extlinux/extlinux.conf"
233
250
cat << - EXTLINUX_CONF > "${extlinux_conf} "
234
- DEFAULT hook
235
- LABEL hook
251
+ DEFAULT Tinkerbell Hook ${BOARD} ${BRANCH}
252
+ LABEL Tinkerbell Hook ${BOARD} ${BRANCH}
236
253
linux /vmlinuz
237
254
initrd /initramfs
238
255
append ${bootargs} ${tinkerbell_args}
239
- fdt /dtb/${UBOOT_KERNEL_DTB}
240
256
EXTLINUX_CONF
241
- # @TODO: fdtdir when UBOOT_KERNEL_DTB is unset
257
+
258
+ # If UBOOT_KERNEL_DTB is not set, just pass the fdtdir
259
+ if [[ -z " ${UBOOT_KERNEL_DTB} " ]]; then
260
+ log info " UBOOT_KERNEL_DTB is unset; using fdtdir instead"
261
+ cat << - EXTLINUX_CONF_FDTDIR >> "${extlinux_conf} "
262
+ fdtdir /dtb/
263
+ EXTLINUX_CONF_FDTDIR
264
+ else
265
+ log info " UBOOT_KERNEL_DTB is set (${UBOOT_KERNEL_DTB} ); using it in extlinux.conf"
266
+ cat << - EXTLINUX_CONF_DTB >> "${extlinux_conf} "
267
+ fdt /dtb/${UBOOT_KERNEL_DTB}
268
+ EXTLINUX_CONF_DTB
269
+ fi
242
270
243
271
log_file_bat " ${extlinux_conf} " " info" " Produced Armbian u-boot extlinux.conf"
244
272
0 commit comments