@@ -41,6 +41,7 @@ function build_bootable_armbian_uboot_rockchip() {
4141function list_bootable_armbian_uboot_rockchip_vendor() {
4242 declare -g -A bootable_boards=()
4343 bootable_boards[" r58x" ]=" BOARD=mekotronics-r58x-pro BRANCH=vendor"
44+ bootable_boards[" blade3" ]=" BOARD=mixtile-blade3 BRANCH=vendor"
4445}
4546
4647function build_bootable_armbian_uboot_rockchip_vendor() {
@@ -187,6 +188,19 @@ function write_uboot_script_or_extlinux() {
187188function write_uboot_script() {
188189 declare fat32_root_dir=" ${1} "
189190 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']:- " " } "
190204 cat << - BOOT_CMD > "${boot_cmd_file} "
191205 # Hook u-boot bootscript; mkimage -C none -A arm -T script -d /boot.cmd /boot.scr
192206 echo "Starting Tinkerbell Hook boot script..."
@@ -195,7 +209,7 @@ function write_uboot_script() {
195209 setenv ramdisk_addr_r "0x40000000"
196210 test -n "\$ {distro_bootpart}" || distro_bootpart=1
197211 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} "
199213 echo "Booting with: \$ {bootargs}"
200214
201215 echo "Loading initramfs... \$ {ramdisk_addr_r} /uinitrd"
@@ -212,6 +226,9 @@ function write_uboot_script() {
212226 booti \$ {kernel_addr_r} \$ {ramdisk_addr_r} \$ {fdt_addr_r}
213227 BOOT_CMD
214228
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+
215232 log_file_bat " ${boot_cmd_file} " " info" " Produced Armbian u-boot boot.cmd/boot.scr"
216233
217234 return 0
@@ -221,7 +238,7 @@ function write_uboot_extlinux() {
221238 declare fat32_root_dir=" ${1} "
222239
223240 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} "
225242 log info " Writing extlinux.conf; kernel cmdline: ${bootargs} "
226243
227244 declare -g -a bootable_tinkerbell_kernel_params=()
@@ -231,14 +248,25 @@ function write_uboot_extlinux() {
231248 mkdir -p " ${fat32_root_dir} /extlinux"
232249 declare extlinux_conf=" ${fat32_root_dir} /extlinux/extlinux.conf"
233250 cat << - EXTLINUX_CONF > "${extlinux_conf} "
234- DEFAULT hook
235- LABEL hook
251+ DEFAULT Tinkerbell Hook ${BOARD} ${BRANCH}
252+ LABEL Tinkerbell Hook ${BOARD} ${BRANCH}
236253 linux /vmlinuz
237254 initrd /initramfs
238255 append ${bootargs} ${tinkerbell_args}
239- fdt /dtb/${UBOOT_KERNEL_DTB}
240256 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
242270
243271 log_file_bat " ${extlinux_conf} " " info" " Produced Armbian u-boot extlinux.conf"
244272
0 commit comments