Skip to contentSkip to conversation

configs/khadas_vim3_defconfig: new defconfig

Buildroot Romain Naour 1 participant 1 message Sep 30, 2023

lore
Share & tools
lore
#0 lore raw

commit: https://git.buildroot.net/buildroot/commit/?id=379a21b4f445d55466af0d035c6e423fa5bc310c
branch: https://git.buildroot.net/buildroot/commit/?id=refs/heads/master

Add defconfig for the Khadas VIM3 board which uses a A311D SoC with a 4x ARM Cortex-A73 + 2x ARM Cortex-A53 big.LITTLE architecture.

This defconfig includes the Linux mainline kernel version 6.3 as well as mainline uboot version 2023.04 with an in-tree .dts and uboot-defconfig. It also includes the host-tool amlogic-boot-fip which is necessary for signing the bootloader. This host tool is used in the post-image.sh script in order to generate the signed binary.

This binary is then flashed to the final sdcard.img after it is generated using genimage. It is done in this way because the bootloader image needs to be flashed in 2 steps. First the first 444 bytes need to be flashed to the beginning of the sdcard.img, then we need to skip 68 bytes in the source and the destination and then write the remaining bootloader image to the sdcard.img.
Ref: http://docs.khadas.com/products/sbc/vim3/development/create-bootable-tf-card

[Romain:
add BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_3=y add BR2_TARGET_UBOOT_NEEDS_OPENSSL=y
add BR2_PACKAGE_HOST_DOSFSTOOLS=y for genimage vfat support
]

---
 board/khadas/vim3/extlinux.conf |  4 +++
 board/khadas/vim3/genimage.cfg  | 33 +++++++++++++++++++
 board/khadas/vim3/post-build.sh |  5 +++
 board/khadas/vim3/post-image.sh | 23 +++++++++++++
 board/khadas/vim3/readme.txt    | 71 +++++++++++++++++++++++++++++++++++++++++
 configs/khadas_vim3_defconfig   | 47 +++++++++++++++++++++++++++
 6 files changed, 183 insertions(+)
board/khadas/vim3/extlinux.conf new file +4 -0
new file mode 100644
index 0000000000..fede99b502
@@ -0,0 +1,4 @@
+default buildroot
+label buildroot
+   kernel /Image
+append root=/dev/mmcblk0p2 rootwait console=ttyAML0,115200
board/khadas/vim3/genimage.cfg new file +33 -0
new file mode 100644
index 0000000000..79d7f9ca07
@@ -0,0 +1,33 @@
+image boot.vfat {
+	vfat {
+		files = {
+			"Image",
+			"meson-g12b-a311d-khadas-vim3.dtb",
+			"extlinux"
+		}
+
+		label = "boot"
+	}
+
+	size = 64M
+}
+
+image sdcard.img {
+	hdimage {
+	}
+
+	partition boot {
+		partition-type = 0xC
+		bootable = "true"
+		image="boot.vfat"
+		size = 64M
+		offset = 2M
+	}
+
+	partition rootfs {
+		partition-type = 0x83
+		image = "rootfs.ext2"
+		size = 128M
+		offset = 0
+	}
+}
board/khadas/vim3/post-build.sh new file +5 -0
new file mode 100755
index 0000000000..8dae08a47c
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+install -m 0644 -D "$BOARD_DIR"/extlinux.conf "$BINARIES_DIR"/extlinux/extlinux.conf
board/khadas/vim3/post-image.sh new file +23 -0
new file mode 100755
index 0000000000..db38421494
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+BOARD_DIR="$(dirname "$0")"
+
+support/scripts/genimage.sh -c "${BOARD_DIR}/genimage.cfg"
+
+AMLOGIC_DIR=${BINARIES_DIR}/amlogic-boot-fip
+FIP_DIR=${BINARIES_DIR}/fip
+
+mkdir -p "${FIP_DIR}"
+
+(cd "${AMLOGIC_DIR}" && \
+	./build-fip.sh khadas-vim3 \
+	"${BINARIES_DIR}"/u-boot.bin \
+	"${FIP_DIR}")
+
+dd if="${FIP_DIR}"/u-boot.bin.sd.bin \
+   of="${BINARIES_DIR}"/sdcard.img \
+   conv=fsync,notrunc bs=1 count=444
+
+dd if="${FIP_DIR}"/u-boot.bin.sd.bin \
+   of="${BINARIES_DIR}"/sdcard.img \
+   conv=fsync,notrunc bs=512 skip=1 seek=1
board/khadas/vim3/readme.txt new file +71 -0

71 lines not on this page · raw message

configs/khadas_vim3_defconfig new file +47 -0

47 lines not on this page · raw message

_______________________________________________
buildroot mailing list
[email protected]
https://lists.buildroot.org/mailman/listinfo/buildroot