Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

use FIT image for ti_j784s4 flasher#510

Closed
michalskrivanek wants to merge 1 commit intojumpstarter-dev:mainfrom
michalskrivanek:j784s4
Closed

use FIT image for ti_j784s4 flasher#510
michalskrivanek wants to merge 1 commit intojumpstarter-dev:mainfrom
michalskrivanek:j784s4

Conversation

@michalskrivanek
Copy link
Copy Markdown
Contributor

@michalskrivanek michalskrivanek commented May 30, 2025

using latest Fedora kernel.
It doesn't boot with bootm properly, perhaps due to some uboot misconfig, but we can still use the FIT format.

Summary by CodeRabbit

  • New Features
    • Added scripts and configuration files to enable building and flashing unified boot images for TI J784S4X EVM and AM69 platforms.
    • Introduced a script to wait for network interfaces to become active before startup.
    • Provided a new Buildroot configuration for streamlined kernel and root filesystem generation.
  • Improvements
    • Simplified the boot process by switching to a single combined image format and updating boot commands accordingly.

@netlify
Copy link
Copy Markdown

netlify Bot commented May 30, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 90f4faa
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/685beece19bce200085bbd34
😎 Deploy Preview https://deploy-preview-510--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 30, 2025

Walkthrough

Several new files and scripts were added to the ti_j784s4xevm OCI bundle to enable building and booting a unified flasher image using Buildroot. The manifest was updated to use a combined FIT image (flasher.itb) and a new pre-up network script was introduced. The changes consolidate kernel, initrd, and DTB handling for the TI platform.

Changes

File(s) Change Summary
.../ti_j784s4xevm/build_flasher.sh New shell script to automate Buildroot environment setup, configuration, build, and FIT image creation for the flasher.
.../ti_j784s4xevm/flasher.its New Device Tree Source file describing a FIT image with kernel, initrd, and DTBs for TI platforms, including boot configurations.
.../ti_j784s4xevm/kernel_and_rootfs_defconfig New Buildroot configuration file specifying system, kernel, rootfs, and package options for the flasher environment.
.../ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh New script to wait for network carrier before interface activation, with timeout and progress indication.
.../ti_j784s4xevm/manifest.yaml Updated: boot command now uses unified FIT image (bootm 0x90000000), kernel file and address changed, DTB section removed.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant build_flasher.sh
    participant Buildroot
    participant mkimage

    User->>build_flasher.sh: Execute script
    build_flasher.sh->>Buildroot: Clone repository and copy overlay/defconfig
    build_flasher.sh->>Buildroot: Configure and build kernel/rootfs
    build_flasher.sh->>mkimage: Create flasher.itb from flasher.its
    mkimage-->>build_flasher.sh: flasher.itb created
    build_flasher.sh-->>User: Build complete, FIT image ready
Loading
sequenceDiagram
    participant U-Boot
    participant flasher.itb
    participant Kernel
    participant Initrd
    participant DTB

    U-Boot->>flasher.itb: Load FIT image at 0x90000000
    U-Boot->>Kernel: Extract and boot kernel
    U-Boot->>Initrd: Pass initrd to kernel
    U-Boot->>DTB: Pass DTB to kernel
    Kernel->>System: Boot system with initrd and DTB
Loading

Suggested reviewers

  • mangelajo

Poem

In the land of silicon, where TI boards gleam,
A bunny built a flasher, with scripts supreme!
Kernel and rootfs, all bundled with care,
Networks now wait for their carrier in air.
With FIT images unified, the process is neat—
Hop, hop, hooray, the build is complete! 🐇✨

✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (3)

5-7: Quote variable expansions for safety
Commands like ip link set ${IFACE} up and the printf call should quote $IFACE to prevent word-splitting or globbing if the variable is empty or contains special characters:

-ip link set ${IFACE} up
+ip link set "${IFACE}" up

8-16: Use portable arithmetic and guard comparisons
Relying on assignment inside an arithmetic expansion (: $((IF_WAIT_DELAY -= 1))) isn’t guaranteed in all shells. Also, wrap numeric comparisons in quotes:

-while [ ${IF_WAIT_DELAY} -gt 0 ]; do
+while [ "$IF_WAIT_DELAY" -gt 0 ]; do-   : $((IF_WAIT_DELAY -= 1))
+   IF_WAIT_DELAY=$((IF_WAIT_DELAY - 1))
done

17-18: Improve timeout message formatting
The timeout message is concatenated to the dots. Prepend a newline and include the interface in the message for clarity:

-printf " timeout!\n"
+printf "\nTimeout waiting for carrier on %s!\n" "${IFACE}"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9a72726 and e71b824.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e
🔇 Additional comments (3)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1)

1-74: New FIT image tree definition looks solid
The FIT source correctly embeds the kernel, two DTBs, and the initrd with proper metadata and configurations. No issues detected.

packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1)

1-29: Verify external toolchain and overlay integration
This defconfig enables BR2_TOOLCHAIN_EXTERNAL but doesn’t set an external toolchain path or prefix, which can cause build failures unless provided elsewhere (e.g., CI environment variables). Also, confirm that BR2_ROOTFS_OVERLAY="$(CONFIG_DIR)/overlay" correctly resolves to your overlay directory.

Could you confirm that the external toolchain location is specified in your build environment and that the overlay path resolves as expected?

packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (1)

28-29: Verify FIT image file path and memory address
Ensure data/flasher.itb matches the bundled artifact location and that address: "0x90000000" aligns with your memory map.

Comment thread packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh Outdated
Comment thread packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml Outdated
# - "dd if=/dev/zero of=/dev/mmcblk0 bs=512 count=34"
# - "dd if=/dev/zero of=/dev/mmcblk1 bs=512 count=34"
kernel:
file: data/J784S4XEVM.flasher.img
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/jumpstarter-dev/jumpstarter/actions/runs/15352215504/job/43202958209?pr=510#step:8:400

Ok, so there is a problem with itb images.

We stop declaring the dtb section, which tells the flasher what the expected address is,
also I suspect that the current code does not support dtb to be empty.

The reason why we at least want that info and a separate dtb, is that we want to let customers switch the DTB
in realtime, for example, when they have a derivative of the board that they have evolved into product.

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.
Also we may want to let customers derive the OCI images and put their dtb in they want.

Can we provide an image with just the kernel + initrd , and then two separate .dtbs, one for
J784S4EVM and another for SK-AM69?

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".

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added example of custom dtb

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

>           v = cls.model_validate(yaml.safe_load(f))
E           pydantic_core._pydantic_core.ValidationError: 1 validation error for FlasherBundleManifestV1Alpha1
E           spec.dtb
E             Field required [type=missing, input_value={'manufacturer': 'Texas I...address': '0x90000000'}}, input_type=dict]
E               For further information visit https://errors.pydantic.dev/2.11/v/missing

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..)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The 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?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (2)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (2)

1-1: 🛠️ Refactor suggestion

Enable strict shell mode
Add set -euo pipefail immediately after the shebang to catch errors, unset variables, and pipeline failures early.

Proposed diff:

 #!/bin/bash
+set -euo pipefail

9-10: ⚠️ Potential issue

Correct defconfig reference and handle cd failure
The script currently uses renesas_s4_defconfig, but this directory provides ti_defconfig. Also wrap cd in a failure guard.

Proposed diff:

-cp renesas_s4_defconfig  /buildroot/configs/
-( cd /buildroot; make renesas_s4_defconfig && make )
+cp ti_defconfig /buildroot/configs/ti_defconfig
+cd /buildroot || { echo "Failed to enter /buildroot"; exit 1; }
+make ti_defconfig
+make
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🧹 Nitpick comments (3)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (3)

3-3: Improve package installation reproducibility
Consider splitting the long dnf install into multiple lines for readability and pinning metadata or disabling plugins (e.g., --disableplugin=subscription-manager) to ensure consistent CI builds.


7-8: Check add_kernel.sh and overlay before use
Ensure add_kernel.sh succeeds and that overlay exists to avoid silent failures:

./add_kernel.sh || { echo "add_kernel.sh failed"; exit 1; }
[ -d overlay ]    || { echo "overlay directory missing"; exit 1; }
cp -R overlay /buildroot

11-11: Verify FIT image tool availability
Check that mkimage (from uboot-tools) is present before invoking it, to fail fast if prerequisites are missing:

command -v mkimage >/dev/null 2>&1 || { echo "mkimage not found"; exit 1; }
mkimage -f flasher.its flasher.itb
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e71b824 and 5ff8f84.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e
🔇 Additional comments (1)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1)

5-5: Guard against existing /buildroot directory
If /buildroot already exists, git clone will fail. You may want to remove or rename any preexisting directory, or clone into a fresh path and then symlink.

Would you like assistance adding an idempotent clone wrapper?

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1)

1-2: Enable strict mode at script start
Add error-handling flags immediately after the shebang to catch pipeline failures, unset variables, and any command errors early.

 #!/bin/bash
+set -euo pipefail
🧹 Nitpick comments (4)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (4)

3-3: Refactor long package install command for readability
The single-line dnf install is hard to scan and maintain. Consider splitting the package list across multiple lines with backslashes or grouping related packages together.


5-5: Ensure a clean Buildroot clone
If /buildroot already exists, git clone will fail. Add a cleanup or existence check before cloning to make this step idempotent. For example:

- git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot
+ rm -rf /buildroot
+ git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot

7-9: Validate and invoke add_kernel.sh explicitly
Before running, verify add_kernel.sh exists and is executable. Then invoke it with an explicit shell to ensure consistent behavior:

- ./add_kernel.sh
+ if [[ ! -x ./add_kernel.sh ]]; then
+   echo "Error: add_kernel.sh not found or not executable" >&2
+   exit 1
+ fi
+ bash ./add_kernel.sh

11-11: Specify target architecture in FIT image generation
Be explicit about the architecture when invoking mkimage to avoid defaults and improve clarity:

-mkimage -f flasher.its flasher.itb
+mkimage -A aarch64 -f flasher.its flasher.itb
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 5ff8f84 and afb074b.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e

Comment thread packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh Outdated
@michalskrivanek
Copy link
Copy Markdown
Contributor Author

the current version has initramfs embedded in the kernel, exceeding the default size uboot can handle. i'll try with separate initrd as well....

@michalskrivanek
Copy link
Copy Markdown
Contributor Author

keeping separate initrd the size is within the default CONFIG_SYS_BOOTM_LEN (64MB) so let's go with that, we can boot with a simple "bootm"

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (2)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (2)

1-2: 🛠️ Refactor suggestion

Enable strict Bash mode
Add set -euo pipefail immediately after the shebang to catch errors, treat unset variables as failures, and handle pipeline errors reliably.


10-10: 🛠️ Refactor suggestion

Harden and parallelize the Buildroot build step
Add a directory-change failure check and use all CPU cores:

-( cd /buildroot; make ti_defconfig && make )
+( cd /buildroot || exit 1
+  make ti_defconfig
+  make -j"$(nproc)"
+)

This guarantees the script fails fast if cd fails and speeds up the build.

🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🧹 Nitpick comments (4)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (4)

3-3: Refactor long package install command for readability
Consider breaking the dnf install invocation into multiple lines or loading the package list from an array/variable. This will make future updates (adding/removing packages) much easier to maintain.


5-5: Guard against existing /buildroot directory
To make this script idempotent, check if /buildroot already exists before cloning. You could exit with a clear message or remove the directory if it's safe to do so.


7-7: Remove or document commented-out code
The #./add_kernel.sh line is orphaned. Either delete it or add a TODO/HACK comment explaining when it should be enabled to avoid confusion.


11-11: Add input validation and logging for mkimage
Verify that flasher.its exists before running mkimage and emit a log line:

[ -f flasher.its ] || { echo "ERROR: flasher.its not found"; exit 1; }
echo "Building FIT image: flasher.itb"
mkimage -f flasher.its flasher.itb

This makes failures easier to diagnose.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between afb074b and bd7f9cd.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: e2e

Comment thread packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh Outdated
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (3)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (3)

1-2: 🛠️ Refactor suggestion

Enable strict error handling
Add set -euo pipefail immediately after the shebang to catch errors early, treat unset variables as failures, and propagate pipeline errors.

 #!/bin/bash
+set -euo pipefail

7-9: 🛠️ Refactor suggestion

Use script‐absolute paths for resources
Relative cp calls can break when invoked from another CWD. Capture the script directory and reference assets via $SCRIPT_DIR.

 #!/bin/bash
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

- cp -R overlay /buildroot
- cp ti_defconfig  /buildroot/configs/
+cp -R "${SCRIPT_DIR}/overlay" /buildroot
+cp "${SCRIPT_DIR}/ti_defconfig" /buildroot/configs/

10-10: 🛠️ Refactor suggestion

Harden and parallelize the Buildroot build
Check cd success and leverage all cores for faster builds:

-( cd /buildroot; make ti_defconfig && make )
+( cd /buildroot || exit 1
+  make ti_defconfig
+  make -j"$(nproc)"
+)
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🧹 Nitpick comments (2)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (2)

11-11: Quote FIT recipe and validate paths
To avoid ambiguity, reference the ITS file via the script directory and ensure the output directory exists:

-mkimage -f flasher.its data/flasher.itb
+mkdir -p data
+mkimage -f "${SCRIPT_DIR}/flasher.its" data/flasher.itb

7-7: Remove or document commented-out add_kernel.sh
The #./add_kernel.sh line appears stale. Either remove it or add a comment explaining why it remains disabled.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bd7f9cd and e20994b.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
🔇 Additional comments (1)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1)

3-3: The dnf install line is straightforward and uses -y and disables weak deps. No immediate action needed here.


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

git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Harden the git clone step
Ensure the script exits if the clone fails, preventing downstream errors:

-git clone --depth 1 --branch 2025.05-rc2  https://github.com/buildroot/buildroot /buildroot
+git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot || exit 1
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot
git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot || exit 1
🤖 Prompt for AI Agents
In
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh
at line 5, the git clone command does not currently check for failure. Modify
the script to immediately exit if the git clone fails by adding error handling,
such as using 'set -e' at the script start or appending '|| exit 1' after the
git clone command to prevent downstream errors.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (4)

1-2: Enable strict mode at script start
Add set -euo pipefail immediately after the shebang to exit on errors, treat unset variables as errors, and catch pipeline failures.


5-5: Harden Buildroot clone step
Check the exit status of the git clone command to avoid downstream failures:

-git clone --depth 1 --branch 2025.05-rc2  https://github.com/buildroot/buildroot /buildroot
+git clone --depth 1 --branch 2025.05-rc2 https://github.com/buildroot/buildroot /buildroot || exit 1

8-9: Use absolute paths for overlay and defconfig copies
Relative paths can break if the script is invoked from another directory. Capture the script’s directory and use it:

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
cp -R "${SCRIPT_DIR}/overlay" /buildroot
cp "${SCRIPT_DIR}/ti_defconfig" /buildroot/configs/

10-10: Improve build reliability and performance
Ensure cd failure is caught and parallelize the Buildroot compilation:

-( cd /buildroot; make ti_defconfig && make )
+( cd /buildroot || exit 1
+   make ti_defconfig
+   make -j"$(nproc)"
+)
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

🧹 Nitpick comments (1)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1)

11-11: Validate FIT image creation
Verify that mkimage succeeds and provide feedback:

-mkimage -f flasher.its data/flasher.itb
+mkimage -f flasher.its data/flasher.itb || exit 1
+echo "FIT image created at data/flasher.itb"
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e20994b and 9c48d55.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (4)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/ti_defconfig
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: e2e
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (macos-15, 3.13)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)

@@ -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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure script is run with root privileges
The dnf install command requires root. Exit early if the script is not executed as root:

if [ "$(id -u)" -ne 0 ]; then
  echo "Please run as root" >&2
  exit 1
fi
🤖 Prompt for AI Agents
In
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh
at line 3, the script runs a dnf install command that requires root privileges.
Add a check at the start of the script to verify if the user ID is 0 (root). If
not, print "Please run as root" to stderr and exit with status 1 to prevent the
script from continuing without necessary permissions.

using latest Fedora kernel.
include DTBs for J784S4XEVM and SK-AM69
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

♻️ Duplicate comments (5)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (5)

10-10: Check cd success and parallelise the Buildroot build
ShellCheck (SC2164) still complains. Also, make -j"$(nproc)" dramatically reduces build time.

-( cd /buildroot; make kernel_and_rootfs_defconfig && make )
+( cd /buildroot || exit 1
+  make kernel_and_rootfs_defconfig
+  make -j"$(nproc)"
+)

1-2: Enable strict & safe-execution mode at script start
set -euo pipefail (plus an optional IFS=$'\n\t') catches command failures, unset variables, and broken pipelines early. This was flagged in earlier reviews but is still missing.

 #!/bin/bash
+set -euo pipefail

1-3: Verify root privileges before running package installs
dnf install will fail for non-root users. Add a quick UID check and exit with a clear message.

 set -euo pipefail
+
+if [ "$(id -u)" -ne 0 ]; then
+  echo "Please run as root" >&2
+  exit 1
+fi

5-5: Harden the git clone step (again)
Either rely on strict mode (preferred) or append || exit 1 so a network/auth failure stops the build. Also trim the double space after the branch specifier.

-git clone --depth 1 --branch 2025.05  https://github.com/buildroot/buildroot /buildroot
+git clone --depth 1 --branch 2025.05 https://github.com/buildroot/buildroot /buildroot

(strict mode will catch failures)


8-9: Use script directory for asset copying to avoid path issues
Running the script from outside its directory breaks these relative cp commands.

-SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
-cp -R overlay /buildroot
-cp kernel_and_rootfs_defconfig  /buildroot/configs/
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+cp -R "${SCRIPT_DIR}/overlay" /buildroot
+cp "${SCRIPT_DIR}/kernel_and_rootfs_defconfig" /buildroot/configs/
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9c48d55 and 90f4faa.

📒 Files selected for processing (5)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig (1 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml (2 hunks)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh (1 hunks)
✅ Files skipped from review due to trivial changes (1)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/kernel_and_rootfs_defconfig
🚧 Files skipped from review as they are similar to previous changes (3)
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/overlay/etc/network/if-pre-up.d/wait-carrier.sh
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/manifest.yaml
  • packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/flasher.its
🧰 Additional context used
🪛 Shellcheck (0.10.0)
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh

[warning] 10-10: Use 'cd ... || exit' or 'cd ... || return' in case cd fails.

(SC2164)

⏰ Context from checks skipped due to timeout of 90000ms (7)
  • GitHub Check: pytest-matrix (macos-15, 3.11)
  • GitHub Check: pytest-matrix (macos-15, 3.13)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
  • GitHub Check: pytest-matrix (macos-15, 3.12)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
  • GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
  • GitHub Check: e2e

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
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Ensure output directory exists before running mkimage
mkimage -f flasher.its data/flasher.itb will fail if data/ is absent. Guard against this:

mkdir -p data
mkimage -f flasher.its data/flasher.itb
🤖 Prompt for AI Agents
In
packages/jumpstarter-driver-flashers/oci_bundles/ti_j784s4xevm/build_flasher.sh
at line 11, the command mkimage writes to data/flasher.itb but will fail if the
data directory does not exist. Fix this by adding mkdir -p data before the
mkimage command to ensure the output directory exists.

@mangelajo
Copy link
Copy Markdown
Member

This was finally implemented in https://github.com/jumpstarter-dev/jumpstarter/pull/535/files

@mangelajo mangelajo closed this Jul 29, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants