Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions agent/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,10 @@ Requires `arm-none-eabi-gcc` (Arch: `pacman -S arm-none-eabi-gcc arm-none-eabi-n
| hi3536dv100 | 0x12080000 | 0x14000000 | 0x80000000 | 0x81000000 |

gk7205v500 also serves gk7205v510/v530. The V500 bootrom has no SPL stage:
`defib agent upload` puts the agent in the boot-code slot of an OpenIPC
u-boot-xmedia image (downloaded, or `-f` for your own), whose DDR-init code
runs first; the bootrom then executes the slot in place at `0x41007000`.
`defib agent upload` puts the agent in the boot-code slot of OpenIPC's
`u-boot-<chip>-nor.bin` (downloaded from the OpenIPC/firmware `latest`
release, or `-f` for your own), whose DDR-init code runs first; the bootrom
then executes the slot in place at `0x41007000`.

hi3536dv100 also covers the "Hi3536E" that Xiongmai puts in its NVRs, a
variant of the same die. Its UART runs off a fixed 24 MHz clock, so
Expand Down
2 changes: 1 addition & 1 deletion src/defib/cli/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,7 +1087,7 @@ def agent_upload(
chip: str = typer.Option(..., "-c", "--chip", help="Chip model name"),
port: str = typer.Option("/dev/ttyUSB0", "-p", "--port", help="Serial device (/dev/ttyUSB0), tcp://host:port, rfc2217://host:port, or socket:///path"),
output: str = typer.Option("human", "--output", help="Output mode: human, json"),
file: str | None = typer.Option(None, "-f", "--file", help="CV6xx: composite boot file (GSL+DDR+U-Boot), required. V500: U-Boot image whose header and DDR-init code carry the agent (default: OpenIPC u-boot-xmedia download). Ignored for other protocols"),
file: str | None = typer.Option(None, "-f", "--file", help="CV6xx: composite boot file (GSL+DDR+U-Boot), required. V500: U-Boot image whose header and DDR-init code carry the agent (default: OpenIPC u-boot-<chip>-nor.bin download). Ignored for other protocols"),
power_cycle: bool = typer.Option(False, "--power-cycle", help="Auto power-cycle via configured controller (DEFIB_POWER_TYPE)"),
poe_port_override: str = typer.Option("", "--poe-port", help="Explicit MikroTik ether port (e.g. ether3) — overrides comment-based auto-discovery. Requires --power-cycle."),
) -> None:
Expand Down
16 changes: 8 additions & 8 deletions src/defib/firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,13 @@ def _download(
raise ConnectionError(f"Failed to download firmware: {e}") from e


# V500-family (gk7205v500/v510/v530) U-Boot is built in OpenIPC/u-boot-xmedia,
# not OpenIPC/firmware. defib only needs its boot-image header and DDR-init
# (aux) code to carry the flash agent, and those do not depend on the flash
# type, so the smaller NOR build is the donor.
XMEDIA_UBOOT_BASE_URL = (
"https://github.com/OpenIPC/u-boot-xmedia/releases/download/latest"
)
# V500-family (gk7205v500/v510/v530) U-Boot is OpenIPC/u-boot's NOR build on
# the OpenIPC/firmware release, as for every other per-flash-type SoC (the
# retired OpenIPC/u-boot-xmedia published it before). defib only needs its
# boot-image header and DDR-init (aux) code to carry the flash agent, and
# those do not depend on the flash type, so the smaller NOR build is the donor.
# Both builds carry the same key area and aux area byte for byte, so the agent
# boot image does not change with the source.


def download_v500_donor(chip: str) -> Path:
Expand All @@ -502,4 +502,4 @@ def download_v500_donor(chip: str) -> Path:
if dest.exists():
logger.info("Using cached V500 donor: %s", dest)
return dest
return _download(f"{XMEDIA_UBOOT_BASE_URL}/{name}", dest)
return _download(f"{OPENIPC_BASE_URL}/{name}", dest)
Comment thread
qodo-free-for-open-source-projects[bot] marked this conversation as resolved.
2 changes: 1 addition & 1 deletion src/defib/protocol/hisilicon_v500.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ def v500_member(chip: str) -> str | None:
def wrap_v500_payload(donor: bytes, payload: bytes, load_addr: int) -> bytes:
"""Put ``payload`` in the boot-code area of a V500 boot image.

``donor`` is a complete V500 U-Boot image (e.g. OpenIPC u-boot-xmedia's
``donor`` is a complete V500 U-Boot image (e.g. OpenIPC's
``u-boot-gk7205v500-nor.bin``). Its key area, params and aux (DDR init)
area are kept verbatim; its boot code is replaced by ``payload`` and the
two length fields are patched to match. The bootrom runs the boot code
Expand Down
9 changes: 5 additions & 4 deletions tests/test_firmware.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,10 @@ def fake_urlopen(req, timeout=None):
first = firmware.download_v500_donor("gk7205v510")
again = firmware.download_v500_donor("gk7205v510")
assert first == again == get_cache_dir() / "u-boot-gk7205v510-nor.bin"
# OpenIPC/u-boot's build on the firmware release; the retired
# u-boot-xmedia release carries the same key and DDR-init areas.
assert urls == [
"https://github.com/OpenIPC/u-boot-xmedia/releases/download/latest/"
"https://github.com/OpenIPC/firmware/releases/download/latest/"
"u-boot-gk7205v510-nor.bin"
]

Expand Down Expand Up @@ -377,9 +379,8 @@ def offline(url, dest, on_progress=None):
download_firmware(soc)

def test_gk7205v5xx_shares_the_v500_donor_cache_entry(self, tmp_path, monkeypatch):
# download_v500_donor() caches u-boot-xmedia's NOR build under the
# same name the OpenIPC/firmware release uses, so either source
# satisfies the other.
# download_v500_donor() caches the NOR build under the same name the
# install path uses, so either one satisfies the other.
monkeypatch.setenv("XDG_CACHE_HOME", str(tmp_path))
monkeypatch.setattr("sys.platform", "linux")
donor = get_cache_dir() / "u-boot-gk7205v510-nor.bin"
Expand Down
Loading