Skip to content

u-boot-z.bin: build the LZMA-wrapped ~250K binary end-to-end - #10

Merged
widgetii merged 2 commits into
masterfrom
fix/u-boot-z-bin-source
May 8, 2026
Merged

u-boot-z.bin: build the LZMA-wrapped ~250K binary end-to-end#10
widgetii merged 2 commits into
masterfrom
fix/u-boot-z-bin-source

Conversation

@widgetii

@widgetii widgetii commented May 7, 2026

Copy link
Copy Markdown
Member

Summary

Restores the LZMA-wrapped `u-boot-z.bin` build path for all four
gk SoCs in this repo, matching the ev200/cv500 family's release
format (~250 KiB versus the ~500 KiB raw `u-boot.bin` we've been
publishing). End-to-end CI gate, with a QEMU smoke test on the two
machines that have working flash boot.

Changes

  • `Makefile` (top-level `u-boot-z.bin` recipe): use `$(srctree)`
    fallback when `$(KBUILD_SRC)` is empty, stage the ddr_training
    source files and `arch/arm/lib/div0.c` into the sub-make build
    dir, and drop the `ENABLE_MINI_BOOT=y` flag (mismatched with
    startup.c's `CONFIG_MINI_BOOT` gating — see commit message for
    details). Mirrors the working ev200 sibling recipe.
  • `arch/arm/cpu/armv7//Makefile` (4 SoCs): replace the
    HiSi-internal `tools/utils/bin/gzip` path with system `gzip`.
  • `include/config_distro_defaults.h`: stop unconditionally defining
    `CONFIG_EFI_PARTITION` (compound-literal `static` init breaks on
    this gcc; gk SoCs boot from raw flash, not GPT).
  • `.github/workflows/build.yml`: `make u-boot-z.bin` step, plus
    re-added `qemu_smoke` matrix for `gk7205v200` / `gk7202v300`
    (gated by hi3516ev200 / hi3518ev300: u-boot "hardware decompress overtime" — HW decompressor unimplemented qemu-hisilicon#60, now fixed).

Test plan

  • Verified locally with `arm-hisiv300-linux`: all 4 SoCs build
    `u-boot-.bin` at ~250 KiB.
  • CI `build` job green for all 4 SoCs.
  • CI `qemu_smoke` job passes on `gk7205v200` and `gk7202v300`.
  • After merge: `OpenIPC/firmware/latest` `u-boot-gk*-universal.bin`
    assets refresh and shrink from ~500 KiB to ~250 KiB.

🤖 Generated with Claude Code

John-1 and others added 2 commits May 7, 2026 21:43
Three source-side fixes so `make u-boot-z.bin` works in this fork
without CI-time sed-patches:

* Top-level Makefile recipe (u-boot-z.bin): use $(srctree) when
  $(KBUILD_SRC) is empty (in-tree builds), stage drivers/ddr/goke/
  default/ddr_training_{impl,ctl,boot,console}.c and
  drivers/ddr/goke/$(SOC)/ddr_training_custom.c next to the SoC
  sources before the sub-make, and forward ENABLE_MINI_BOOT=y so the
  arch/arm/cpu/armv7/$(SOC)/Makefile selects u-boot-mini.lds and
  drops emmc_boot.o/div0.o (which live elsewhere) from COBJS. That
  matches the bootrom path that decompresses u-boot.bin.

* arch/arm/cpu/armv7/{gk7202v300,gk7205v200,gk7205v300,gk7605v100}/
  Makefile: replace the HiSi-internal
  $(OUTDIR)/../../../tools/utils/bin/gzip path with system `gzip`.
  The HiSi BSP layout the original path assumed doesn't exist in
  this fork.

* include/config_distro_defaults.h: stop unconditionally defining
  CONFIG_EFI_PARTITION. disk/part_efi.c's
  `static efi_guid_t = PARTITION_SYSTEM_GUID;` trips this gcc with
  "initializer element is not constant" because EFI_GUID() expands
  to a compound literal. The gk SoCs boot from raw NOR/NAND, not
  GPT, so the default never needed it. Boards that actually need it
  can set CONFIG_EFI_PARTITION in their own header.

CI workflow simplifies accordingly: drops the EFI_PARTITION sed and
gains a `make u-boot-z.bin` step that ships the LZMA-wrapped
~250 KiB binary instead of raw u-boot.bin, matching the historical
OpenIPC/firmware release-asset format.
Two follow-ups to the prior recipe attempt:

* Don't pass ENABLE_MINI_BOOT=y to the per-SoC sub-make. Doing so
  triggered an unresolved-symbol link error on gk7205v200/gk7202v300:
  arch/arm/cpu/armv7/<soc>/start.S inserts `bl timer_init` under
  `#ifdef ENABLE_MINI_BOOT`, but timer_init in startup.c is gated by
  `#ifdef CONFIG_MINI_BOOT` (the Kconfig symbol, only enabled by the
  separate `<soc>_mini_defconfig`). Mismatched gating === undefined
  reference. ev200's sibling u-boot-z.bin recipe also omits the flag,
  for the same reason. Drop it; start.S then compiles without the
  timer_init call, COBJS keeps emmc_boot.o + div0.o, and the link
  uses the full u-boot.lds. gk7205v300/gk7605v100 (which never had
  the ENABLE_MINI_BOOT guard or u-boot-mini.lds in their SoC
  Makefiles) also build cleanly under this path now.

* Stage arch/arm/lib/div0.c into the sub-make build dir alongside
  the ddr_training_*.c files. Without it, `div0.o` in COBJS has no
  source visible to the sub-make's `%.o: %.c` rule.

Re-add qemu_smoke for gk7205v200 / gk7202v300 — widgetii/qemu-
hisilicon#60 (the HW-gzip decompressor stub for ev200-family) is now
closed, which is the gap that previously blocked these mirrors.
gk7205v300 / gk7605v100 still emit no UART output in QEMU and
publish unguarded for now.

Verified locally with arm-hisiv300-linux: all four SoCs produce
~250 KiB u-boot-<soc>.bin, matching the ev200/cv500 family format.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@widgetii
widgetii merged commit 8d201eb into master May 8, 2026
7 checks passed
@widgetii
widgetii deleted the fix/u-boot-z-bin-source branch May 8, 2026 03:53
widgetii added a commit that referenced this pull request May 8, 2026
Real Goke V4 silicon's HW gzip decompressor only parses streams
compressed with WSIZE=8 KiB; system gzip emits 32 KiB-window
streams that the decompressor rejects with "Uncompress Fail!".
The QEMU model is more permissive (accepted both), so the
qemu_smoke gate didn't catch this on PR #10.

User reported the May 8 gk7205v300 binary fails this way on real
hardware (vs the May 6 raw 500 KiB baseline that booted cleanly).
Test on real hi3516ev300 silicon confirms ev200's wrapped binary
(uses hi_gzip) boots — Goke is a HiSilicon clone with the same
source tree, so the same compression tool applies.

Changes:
* Import tools/hi_gzip/ from u-boot-hi3516ev200. Same gzip-1.8 +
  HiSi window-size patch ev200 has shipped for years; not
  Goke-specific.
* arch/arm/cpu/armv7/<soc>/Makefile (4 SoCs): use ./gzip (the
  staged hi_gzip binary) instead of system gzip, mirroring
  ev200's hw_compressed/Makefile pattern.
* CI: build hi_gzip and stage it at arch/arm/cpu/armv7/<soc>/gzip
  before make u-boot-z.bin. The recipe's existing cp -raf carries
  it into the sub-make work dir as ./gzip. Same pattern u-boot-
  hi3516ev200's CI uses.

Verified locally with arm-hisiv300-linux: produces 252 KiB
u-boot-gk7205v200.bin (within 256 KiB partition gate). On-hardware
verification still TODO (user has the rig).

Co-authored-by: john-1 <john-1@users.noreply.github.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants