Skip to content

XM: take the split firmware.bin when a board publishes no fixed-slot package - #56

Merged
widgetii merged 1 commit into
mainfrom
xm-split-firmware
Oct 30, 2026
Merged

widgetii merged 1 commit into
mainfrom
xm-split-firmware

Conversation

@widgetii

Copy link
Copy Markdown
Member

Since OpenIPC/firmware#2666 a board whose rootfs outgrows its 5 MiB slot
ships only openipc.-nor-lite-split.tgz. gk7201v200 is about to
(OpenIPC/firmware#2729: the G3-WQ-G's Wi-Fi driver takes it to 5340 KB),
and the fetch step's plain wget of the fixed-slot package would then fail
the whole release run.

The fetch step now tries both packages for every SoC, and _xm2oipc.sh
takes the fixed-slot one when it is there, else the split one. The split
firmware.bin -- the uImage padded to 64 KiB, then the squashfs -- is cut
at the squashfs and burned as the same uImage.img and rootfs.img, so
InstallDesc and the env are unchanged and the flash holds firmware.bin
byte for byte from the kernel's address. rootfs_data is blanked from its
end. The kernel recognises the layout and ignores the env's mtdparts and
root= (OpenIPC/linux#140).

Checked with the 2026-10-28 nightly and the stock G3-WQ-G image
(000929QB, V5.03.C01), each package's images applied to an 8 MB flash
the way "Burn" writes them:

  • split only: firmware.bin at 0x50000 byte-identical, 0x700000 to the
    end blank, U-Boot untouched. In qemu-hisilicon's gk7201v200 the stock
    XM U-Boot boots it: "sfc: split NOR layout, device tree partitions",
    "root=/dev/mtdblock3 ignored", root on 31:4, login. The overlay gets
    its jffs2 at 0x700000, and a second boot comes up clean.
  • both packages: the fixed-slot one is used, and the flash is
    byte-identical to what main's script produces.
    Not run on a camera, and the stock upgrader itself is not emulated.

…package

Since OpenIPC/firmware#2666 a board whose rootfs outgrows its 5 MiB slot
ships only openipc.<soc>-nor-lite-split.tgz. gk7201v200 is about to
(OpenIPC/firmware#2729: the G3-WQ-G's Wi-Fi driver takes it to 5340 KB),
and the fetch step's plain wget of the fixed-slot package would then fail
the whole release run.

The fetch step now tries both packages for every SoC, and _xm2oipc.sh
takes the fixed-slot one when it is there, else the split one. The split
firmware.bin -- the uImage padded to 64 KiB, then the squashfs -- is cut
at the squashfs and burned as the same uImage.img and rootfs.img, so
InstallDesc and the env are unchanged and the flash holds firmware.bin
byte for byte from the kernel's address. rootfs_data is blanked from its
end. The kernel recognises the layout and ignores the env's mtdparts and
root= (OpenIPC/linux#140).

Checked with the 2026-10-28 nightly and the stock G3-WQ-G image
(000929QB, V5.03.C01), each package's images applied to an 8 MB flash
the way "Burn" writes them:
- split only: firmware.bin at 0x50000 byte-identical, 0x700000 to the
  end blank, U-Boot untouched. In qemu-hisilicon's gk7201v200 the stock
  XM U-Boot boots it: "sfc: split NOR layout, device tree partitions",
  "root=/dev/mtdblock3 ignored", root on 31:4, login. The overlay gets
  its jffs2 at 0x700000, and a second boot comes up clean.
- both packages: the fixed-slot one is used, and the flash is
  byte-identical to what main's script produces.
Not run on a camera, and the stock upgrader itself is not emulated.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Support split NOR firmware packages in XM releases

✨ Enhancement ⚙️ Configuration changes 🕐 20-40 Minutes

Grey Divider

AI Description

• Fetch both NOR package variants so split-only boards do not fail the release job.
• Prefer fixed-slot packages; convert split firmware into the existing XM flash images when needed.
• Validate split boundaries while preserving the installer format and flash behavior for fixed-slot
 packages.
Diagram

graph TD
  Fetch["Release fetch"] --> Select{"Fixed archive?"} -->|yes| Fixed["Fixed-slot checks"] --> Images["XM flash images"] --> Flash["Camera flash"]
  Select -->|no| Split["Split-layout checks"] --> Images
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Flash split firmware.bin as one image
  • ➕ Avoids dividing the archive's image into kernel and rootfs outputs.
  • ➖ Requires changing the XM installer format or flash instructions instead of retaining the existing two-image path.
2. Fetch split archives only when fixed-slot downloads fail
  • ➕ Avoids downloading unused split archives when both variants are published.
  • ➖ Adds conditional download logic and couples fallback behavior to download failures, not just package availability.

Recommendation: Keep the proposed two-image conversion: it supports split-only releases without changing the XM installer and preserves fixed-slot precedence. Conditional downloads could reduce traffic, but are not necessary for compatibility.

Files changed (2) +66 / -26

Enhancement (1) +37 / -4
_xm2oipc.shConvert split NOR archives when fixed-slot archives are absent +37/-4

Convert split NOR archives when fixed-slot archives are absent

• Prefers the existing package and its size checks, falling back to firmware.bin from a split archive. Validates the uImage and flash boundaries, divides the image at the squashfs offset, and calculates rootfs_data after the resulting partition boundary.

.github/workflows/_xm2oipc.sh

Other (1) +29 / -22
xm.ymlFetch both NOR archive variants for every listed SoC +29/-22

Fetch both NOR archive variants for every listed SoC

• Replaces individual fixed-slot downloads with a SoC loop that attempts both fixed-slot and split packages. An unpublished variant no longer fails the release fetch step.

.github/workflows/xm.yml

@qodo-free-for-open-source-projects

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

Tip of the day
💡 Did you know, you can add REVIEW.md to your repo root and Qodo follows it on every PR

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

@widgetii
widgetii merged commit 553f1f3 into main Oct 30, 2026
@widgetii
widgetii deleted the xm-split-firmware branch October 30, 2026 07:35
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.

1 participant