summaryrefslogtreecommitdiff
path: root/alt-rootfs-installer/socs.d/Rockchips-aarch64.sh
diff options
context:
space:
mode:
Diffstat (limited to 'alt-rootfs-installer/socs.d/Rockchips-aarch64.sh')
-rw-r--r--alt-rootfs-installer/socs.d/Rockchips-aarch64.sh60
1 files changed, 60 insertions, 0 deletions
diff --git a/alt-rootfs-installer/socs.d/Rockchips-aarch64.sh b/alt-rootfs-installer/socs.d/Rockchips-aarch64.sh
new file mode 100644
index 0000000..fccd090
--- /dev/null
+++ b/alt-rootfs-installer/socs.d/Rockchips-aarch64.sh
@@ -0,0 +1,60 @@
+#!/bin/bash
+# vim:sw=8:noet
+
+MEDIATABLE=msdos
+ROOTPART_NUM=1
+START_SECTOR=16 # MiB
+[ -n "$SYSCON" ] || SYSCON=ttyS2,1500000n8
+
+soc_write_bootloader() {
+ [ -n "$TMPROOT" ] || mount_partition
+ # Write U-Boot
+ set_path_to_uboot
+ local IDBSPL IDBLOADER FIT FIT_SEEK_FILE FIT_SEEK
+ UBOOT="$UBOOT/u-boot-rockchip.bin"
+ UBOOT_ZST="$UBOOT.zst"
+ IDBSPL="$UBOOT/idbspl.img"
+ IDBLOADER="$UBOOT/idbloader.img"
+ FIT="$UBOOT/u-boot.itb"
+ FIT_SEEK_FILE="$UBOOT/u-boot.itb.seek"
+ FIT_SEEK=16384
+
+ if [ -f "$UBOOT_ZST" ]; then
+ UBOOT="$UBOOT_ZST"
+ CAT="unzstd -c"
+ else
+ CAT=cat
+ fi
+ if [ -f "$UBOOT" ]; then
+ print_message "Writing u-boot-rockchip.bin..."
+ $CAT "$UBOOT" | dd of="$MEDIA" seek=64 || fatal_error "Error: Failed to write u-boot-rockchip.bin!!!"
+ sync
+ print_done
+ else
+ print_message "Warning: $UBOOT is missing. Try find idbspl.img..."
+ if [ -f "$IDBSPL" ]; then
+ print_message "Writing idbspl.img..."
+ dd if="$IDBSPL" of="$MEDIA" seek=64 || fatal_error "Error: Failed to write idbspl.img"
+ sync
+ print_done
+ else
+ print_message "Warning: idbspl.img is missing. Try find idbloader.img..."
+ if [ -f "$IDBLOADER" ]; then
+ print_message "Writing idbloader.img..."
+ dd if="$IDBLOADER" of="$MEDIA" seek=64 || fatal_error "Error: Failed to write idbloader.img"
+ sync
+ print_done
+ else
+ print_message "Warning: idbloader.img is missing. Try find and write u-boot.itb without first loader..."
+ fi
+ fi
+ [ -f "$FIT" ] || fatal_error "Error: u-boot.itb not found!!!"
+ print_message "Writing U-Boot FIT image..."
+ if [ -f "$FIT_SEEK_FILE" ]; then
+ FIT_SEEK="$(cat FIT_SEEK_FILE | head -n1)"
+ fi
+ dd if="$FIT" of="$MEDIA" seek="$FIT_SEEK" || fatal_error "Error: failed to write u-boot.itb!!!"
+ sync
+ print_done
+ fi
+}