Skip to content

Commit 2d73b58

Browse files
efectnigorpecovnik
authored andcommitted
rockchip64: add multiple SPI images support to armbian-install
1 parent 9c5eddf commit 2d73b58

File tree

1 file changed

+35
-3
lines changed

1 file changed

+35
-3
lines changed

config/sources/families/include/rockchip64_common.inc

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -299,10 +299,42 @@ write_uboot_platform() {
299299

300300
# @TODO: this is not ready for BOOT_SCENARIO=binman yet
301301
write_uboot_platform_mtd() {
302-
if [[ -f $1/rkspi_loader.img ]]; then
303-
dd if=$1/rkspi_loader.img of=$2 conv=notrunc status=none > /dev/null 2>&1
302+
FILES=$(find "$1" -maxdepth 1 -type f -name "rkspi_loader*.img")
303+
if [ -z "$FILES" ]; then
304+
echo "No SPI image found."
305+
exit 1
306+
fi
307+
308+
MENU_ITEMS=()
309+
i=1
310+
311+
# Read the files into an array
312+
while IFS= read -r file; do
313+
filename=$(basename "$file")
314+
MENU_ITEMS+=("$i" "$filename" "")
315+
((i++))
316+
done <<< "$FILES"
317+
318+
# If there is only one image, we can skip the dialog
319+
if [[ $i -eq 2 ]]; then
320+
dd if=$1/${MENU_ITEMS[1]} of=$2 conv=notrunc status=none > /dev/null 2>&1
321+
return
322+
fi
323+
324+
[[ -f /etc/armbian-release ]] && source /etc/armbian-release
325+
backtitle="Armbian for $BOARD_NAME install script, https://www.armbian.com"
326+
327+
CHOICE=$(dialog --no-collapse \
328+
--title "armbian-install" \
329+
--backtitle $backtitle \
330+
--radiolist "Choose SPI image:" 0 56 4 \
331+
"${MENU_ITEMS[@]}" \
332+
3>&1 1>&2 2>&3)
333+
334+
if [ $? -eq 0 ]; then
335+
dd if=$1/${MENU_ITEMS[($CHOICE*3)-2]} of=$2 conv=notrunc status=none > /dev/null 2>&1
304336
else
305-
echo "SPI u-boot image not found!"
337+
echo "No SPI image chosen."
306338
exit 1
307339
fi
308340
}

0 commit comments

Comments
 (0)