Conversation
📝 WalkthroughWalkthroughThe shell script Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~8 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
extensions/jethub-burn.sh (1)
103-103: Fix correctly addresses the root cause with minimal scope.
env -u QEMU_CPUcleanly isolates the environment variable change to the packer subprocess, preventing ARM64-specific CPU models set in config from interfering with x86 binary execution. The fix is safe on native x86 hosts whereQEMU_CPUis typically absent, and mirrors the established pattern inrun_host_x86_binary_logged. Error handling is preserved, and no other packer invocations require the same treatment.Optional: Consider a
run_host_i386_binary_loggedhelper inlib/functions/logging/runners.sh(analogous to the x86-64 version) for future consistency if additional i386 host tools are added.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@extensions/jethub-burn.sh` at line 103, The packer subprocess can fail on hosts that export QEMU_CPU; update the invocation that runs PACKER to run it with QEMU_CPU removed (use env -u QEMU_CPU "$PACKER" -r "$tmpdir/image.cfg" "$tmpdir" "$OUT_IMG") so the variable change is scoped to the subprocess, preserve the existing exit_with_error handling, and mirror the established pattern used by run_host_x86_binary_logged; optionally consider adding a run_host_i386_binary_logged wrapper in lib/functions/logging/runners.sh for future i386 host tools to centralize this behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@extensions/jethub-burn.sh`:
- Line 103: The packer subprocess can fail on hosts that export QEMU_CPU; update
the invocation that runs PACKER to run it with QEMU_CPU removed (use env -u
QEMU_CPU "$PACKER" -r "$tmpdir/image.cfg" "$tmpdir" "$OUT_IMG") so the variable
change is scoped to the subprocess, preserve the existing exit_with_error
handling, and mirror the established pattern used by run_host_x86_binary_logged;
optionally consider adding a run_host_i386_binary_logged wrapper in
lib/functions/logging/runners.sh for future i386 host tools to centralize this
behavior.
|
Hmm. I guess i386 needs a runner.sh helper just like x86 has. |
I can do that instead of this lazy fix lol |
sure, but can we try to keep some code-reuse too? that is, the only difference is in which |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: Length of output: 12763 🏁 Script executed: Length of output: 6031 🏁 Script executed: Length of output: 0 🏁 Script executed: Length of output: 113 🏁 Script executed: Length of output: 344 🏁 Script executed: Length of output: 3636
Here's my analysis: Current implementation already detects architecture: target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)"file command output patterns:
Proposed extension approach: You could extend function run_host_x86_binary_logged() {
local -a qemu_invocation target_bin_arch
target_bin_arch="unknown"
if [[ -f /usr/bin/file ]]; then
target_bin_arch="$(file -b "$1" | cut -d "," -f 1,2 | xargs echo -n)"
fi
qemu_invocation=("$@") # Default: no qemu
if [[ "$(uname -m)" != "x86_64" ]]; then
# Detect if i386 or x86_64 from file output
if [[ "${target_bin_arch}" =~ "Intel 80386" ]] || [[ "${target_bin_arch}" =~ "80386" ]]; then
# i386 binary
if [[ -f /usr/bin/qemu-i386-static ]]; then
display_alert "Using qemu-i386-static for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
qemu_invocation=("/usr/bin/qemu-i386-static" "-L" "/usr/i386-linux-gnu" "$@")
elif [[ -f /usr/bin/qemu-i386 ]]; then
display_alert "Using qemu-i386 (non-static) for running on $(uname -m)" "$1 (${target_bin_arch})" "debug"
qemu_invocation=("/usr/bin/qemu-i386" "-L" "/usr/i386-linux-gnu" "$@")
else
exit_with_error "Can't find qemu-i386 for running '$1' on $(uname -m)"
fi
elif [[ "${target_bin_arch}" =~ "x86-64" ]] || [[ "${target_bin_arch}" =~ "x86_64" ]]; then
# x86_64 binary (existing logic)
if [[ -f /usr/bin/qemu-x86_64-static ]]; then
# ... existing x86_64 logic
fi
else
exit_with_error "Unsupported x86 architecture: ${target_bin_arch}"
fi
fi
run_host_command_logged env -u QEMU_CPU "${qemu_invocation[@]}"
}Benefits:
Considerations:
Would you like me to help prepare a more complete implementation that QwaSeeK could use instead of the current inline fix? 🧠 Learnings used |
Description
Fix JetHub burn image build on aarch64 hosts. The extension uses Amlogic tool "aml_image_v2_packer_new" which is an i386 binary, on aarch64 it runs via binfmt_misc/qemu-i386, which inherits QEMU_CPU=cortex-a53 from arm64.conf and fails because cortex-a53 is not a valid x86 CPU model. The uses fix env -u QEMU_CPU to unset it only for the packer process.
Note: run_host_x86_binary_logged added in d8e24d7 already does env -u QEMU_CPU, but it only supports x86_64 binaries not i386.
How Has This Been Tested?
Build works on aarch64 and x86 platforms
Summary by CodeRabbit