-
Notifications
You must be signed in to change notification settings - Fork 18
use FIT image for ti_j784s4 flasher #510
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 | ||
|
michalskrivanek marked this conversation as resolved.
|
||
|
|
||
| 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 | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Ensure output directory exists before running mkdir -p data
mkimage -f flasher.its data/flasher.itb🤖 Prompt for AI Agents |
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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"; | ||
| }; | ||
| }; | ||
| }; | ||
| }; |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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" | ||
|
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, so there is a problem with itb images. We stop declaring the dtb section, which tells the flasher what the expected address is, The reason why we at least want that info and a separate dtb, is that we want to let customers switch the DTB i.e. j flasher flash image.raw --dtb my-dtb.dtb The flasher needs to know the address where to put the dtb provided by customer in that case. Can we provide an image with just the kernel + initrd , and then two separate .dtbs, one for The other option is that we rewire the reflasher to fully understand fit, but it would still miss the ability to change the bundled dtb, kernel or ramdisk in "realtime".
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. empty dtb has been added by jumpstarter-dev/jumpstarter@f44dfec I think it is quite flexible this way, the bundling allows us to "ship" dtbs that we anyway ship in kernel-automotive, but it also allows anything else to be loaded. each FIT component is extractable by imxtract and swapped with anything else
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No file dtb could be ok, but, if we want to let customers pushing a custom dtb, we will need the loading address at least. With FIT is it possible to know where the .dtb address will land?
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah I see, yes 0x88000000 in this case. Can we keep the dtb structure, with just the address? we may need to verify that the client/driver are fine with empty file, just address.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. added example of custom dtb
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. it may work with am69 as well, supposedly it should try to load a compatible configuration. I havent' tried that. If it doesn't work the only change is to boot the right config with bootm 0x90000000#am69 or to supply another DTB externally
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's failing the unit tests there because it's looking for the .dtb field, I will propose some changes on top to make it compatible with embedded dtb, and also allow dtb injection in runtime (note this is not supported yet on the CLI, only planned and the drivers have a notion about it..)
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you add for now the dtb section of the yaml with the two variants for now? (just add a comment saying that it's redundant) I know it's redundant with the embedded itb?, but I would like to merge it now, and then later on we can add to the code the ability to understand embedded itb dtbs, externally provided, in the yaml, etc.. to make it flexible. But currently the code will fail if the dtb section is missing, and if we don't add it the later injection won't be possible.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't see a test failure. did benny fix that in his rcars4 mr? |
||
| 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" | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| #!/bin/sh | ||
|
|
||
| IF_WAIT_DELAY=30 | ||
|
|
||
|
michalskrivanek marked this conversation as resolved.
|
||
| 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 | ||
Uh oh!
There was an error while loading. Please reload this page.