Conversation
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Prebuilt-tool validation rejects PATH-resolved executables, and ARMclang builds still discard extra linker flags.
Review effort: Balanced
Findings: 2
Open (2)
What changed in this PR
Improves wolfBoot builds with Yocto cross toolchains, particularly for PolarFire SoC.
Changes:
- Adds explicit FDT byte swaps for RISC-V without Zbb.
- Skips rebuilding keytools when both prebuilt tools are supplied.
- Appends
LDFLAGS_EXTRAto linker flags.
| File | Description |
|---|---|
| src/fdt.c | Adds RISC-V byte-swap implementations. |
| options.mk | Incorporates extra linker flags. |
| Makefile | Validates prebuilt keytools instead of rebuilding them. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Found building the PolarFire SoC M-mode target with a Yocto RISC-V Linux toolchain through meta-wolfssl. Three independent problems; none changes the output of a bare-metal toolchain build.
1. fdt.c pulled __bswapsi2 from libgcc
cpu_to_fdt32()used__builtin_bswap32. On rv64imac without Zbb, gcc expands that to a call into libgcc, and a Linux toolchain only ships libgcc for its own ABI (lp64d), which cannot be linked into the soft-float lp64 image. The byte swap is now open-coded; targets with a byte-swap instruction still get it from the compiler.2. keytools_check rebuilt the in-tree keytools even when prebuilt tools were given
The keystore rule depends on
keytools_check, which always builttools/keytools. A build that supplies native tools (Yocto'swolfboot-keytools-native) still rebuilt keygen with whateverCCwas in effect, which under a cross compiler fails or produces a binary that cannot run on the host. When bothKEYGEN_TOOLandSIGN_TOOLcome from the command line the rule now checks that they resolve (command -v, so a bare name on PATH works) instead; with only one of them given the in-tree tools are still built, since the signing steps fall back to the in-treesign.3. LDFLAGS_EXTRA was documented but never consumed
arch.mkdescribesLDFLAGS_EXTRAas the way to add link flags, but nothing appended it, andMakefileresetsLDFLAGSafter.configis read, so a config cannot add link flags at all.options.mknow addsLDFLAGS_EXTRAnext toCFLAGS_EXTRA, and the ARMclang paths that rebuildLDFLAGSfrom scratch (Makefile,test-app/Makefile) re-append it.Hardware / test status
Built with both the bare-metal SoftConsole toolchain and the Yocto riscv64 Linux toolchain for
polarfire_mpfs250_m.config; the Yocto build boots Linux from an SD FIT on the PolarFire SoC Video Kit.sim.configand the unit tests pass.