From 90f4faae0bcd35bcad6daba79f0efb7442061f22 Mon Sep 17 00:00:00 2001 From: Michal Skrivanek Date: Fri, 30 May 2025 19:22:05 +0200 Subject: [PATCH] use FIT image for ti_j784s4 flasher using latest Fedora kernel. include DTBs for J784S4XEVM and SK-AM69 --- .../ti_j784s4xevm/build_flasher.sh | 11 +++ .../oci_bundles/ti_j784s4xevm/flasher.its | 77 +++++++++++++++++++ .../ti_j784s4xevm/kernel_and_rootfs_defconfig | 30 ++++++++ .../oci_bundles/ti_j784s4xevm/manifest.yaml | 19 +++-- .../etc/network/if-pre-up.d/wait-carrier.sh | 19 +++++ 5 files changed, 148 insertions(+), 8 deletions(-) create mode 100755 packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh create mode 100644 packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its create mode 100644 packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig create mode 100755 packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh new file mode 100755 index 000000000..77acfbb73 --- /dev/null +++ b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +dnf install --setopt=install_weak_deps=false -y git make gcc gcc-c++ which file diffutils wget cpio rsync bc lzop zip patch perl tar qemu-system-aarch64 qemu-img unzboot uboot-tools kmod awk + +git clone --depth 1 --branch 2025.05 https://github.com/buildroot/buildroot /buildroot + +#./replace_kernel.sh +cp -R overlay /buildroot +cp kernel_and_rootfs_defconfig /buildroot/configs/ +( cd /buildroot; make kernel_and_rootfs_defconfig && make ) +mkimage -f flasher.its data/flasher.itb diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its new file mode 100644 index 000000000..b29272f14 --- /dev/null +++ b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its @@ -0,0 +1,77 @@ +/dts-v1/; + +/ { + description = "TI flasher FIT Image"; + #address-cells = <1>; + + images { + kernel { + description = "Kernel"; + data = /incbin/("/buildroot/output/images/Image"); + type = "kernel"; + arch = "arm64"; + os = "linux"; + compression = "none"; + load = <0x80000000>; + entry = <0x80000000>; + hash { + algo = "sha256"; + }; + }; + initrd { + description = "Initrd"; + data = /incbin/("/buildroot/output/images/rootfs.cpio.lzo"); + type = "ramdisk"; + arch = "arm64"; + os = "linux"; + compression = "none"; + hash { + algo = "sha256"; + }; + }; + fdt-j784s4 { + description = "DTB J784S4EVM"; + data = /incbin/("/buildroot/output/images/k3-j784s4-evm.dtb"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + load = <0x88000000>; + hash { + algo = "sha256"; + }; + }; + fdt-am69 { + description = "DTB SK-AM69"; + data = /incbin/("/buildroot/output/images/k3-am69-sk.dtb"); + type = "flat_dt"; + arch = "arm64"; + compression = "none"; + load = <0x88000000>; + hash { + algo = "sha256"; + }; + }; + }; + + configurations { + default = "j784s4"; + j784s4 { + description = "Boot J784S4"; + kernel = "kernel"; + fdt = "fdt-j784s4"; + ramdisk = "initrd"; + hash { + algo = "sha256"; + }; + }; + am69 { + description = "Boot AM69"; + kernel = "kernel"; + fdt = "fdt-am69"; + ramdisk = "initrd"; + hash { + algo = "sha256"; + }; + }; + }; +}; diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig new file mode 100644 index 000000000..9d30a61c2 --- /dev/null +++ b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig @@ -0,0 +1,30 @@ +BR2_aarch64=y +BR2_TOOLCHAIN_EXTERNAL=y +BR2_TARGET_GENERIC_HOSTNAME="flasher" +BR2_TARGET_GENERIC_ISSUE="flasher" +BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y +BR2_TARGET_GENERIC_ROOT_PASSWD="" +BR2_SYSTEM_DHCP="eth0" +BR2_ROOTFS_OVERLAY="$(CONFIG_DIR)/overlay" +BR2_PACKAGE_CA_CERTIFICATES=y +BR2_PACKAGE_OPENSSL=y +BR2_PACKAGE_LIBCURL=y +BR2_PACKAGE_LIBCURL_CURL=y +BR2_PACKAGE_NTP=y +BR2_PACKAGE_NTP_SNTP=y +BR2_PACKAGE_NTP_NTPDATE=y +BR2_TARGET_ROOTFS_CPIO=y +BR2_TARGET_ROOTFS_CPIO_LZO=y +BR2_PACKAGE_DROPBEAR=n +# BR2_TARGET_ROOTFS_TAR is not set +# +# include initramfs within the kernel Image +# on J784S4 the size exceeds uboot's CONFIG_SYS_BOOTM_LEN +# BR2_TARGET_ROOTFS_INITRAMFS=y +BR2_LINUX_KERNEL=y +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y +BR2_LINUX_KERNEL_LZO=y +BR2_LINUX_KERNEL_IMAGE=y +BR2_LINUX_KERNEL_DTS_SUPPORT=y +BR2_LINUX_KERNEL_INTREE_DTS_NAME="ti/k3-j784s4-evm ti/k3-am69-sk" + diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml index 029671178..2336e29c0 100644 --- a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml +++ b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml @@ -5,7 +5,9 @@ metadata: spec: manufacturer: Texas Instruments link: "https://www.ti.com/tool/PROCESSOR-SDK-J784S4" - bootcmd: "booti 0x82000000 - 0x84000000" +# boot using the default configuration built-in flasher.itb, j784s4 +# you can boot included alternative configurations, e.g. for SK-AM69 use "bootm 0x90000000#am69" + bootcmd: "bootm 0x90000000" shelltype: "busybox" login: login_prompt: "login:" @@ -24,11 +26,12 @@ spec: # preflash_commands: # - "dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=34" # - "dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=34" +# +# supply custom DTB by loading your own re-using the included kernel and initrd by e.g: +# bootcmd: "bootm 0x90000000:kernel 0x90000000:initrd 0x88000000" +# dtb: +# file: my.dtb +# address: "0x88000000" kernel: - file: data/J784S4XEVM.flasher.img - address: "0x82000000" - dtb: - default: k3-j784s4-evm - address: "0x84000000" - variants: - k3-j784s4-evm: data/dtbs/k3-j784s4-evm.dtb + file: data/flasher.itb + address: "0x90000000" diff --git a/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh new file mode 100755 index 000000000..7afc9a34a --- /dev/null +++ b/packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +IF_WAIT_DELAY=30 + +if [ "${IFACE}" != "lo" ]; then + ip link set ${IFACE} up + printf "Waiting for interface %s carrier" "${IFACE}" + while [ ${IF_WAIT_DELAY} -gt 0 ]; do + if [ "$(cat /sys/class/net/${IFACE}/carrier)" = "1" ]; then + printf "\n" + exit 0 + fi + sleep 1 + printf "." + : $((IF_WAIT_DELAY -= 1)) + done + printf " timeout!\n" + exit 1 +fi