From e6864df1cbad72f806d1ae2ad2c250b6cc7df6c7 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin <6576495+widgetii@users.noreply.github.com> Date: Sat, 24 Oct 2026 10:55:37 +0300 Subject: [PATCH] install: gk7201v200 installs its own U-Boot and firmware, on the split layout CHIP_TO_FIRMWARE mapped gk7201v200 to gk7205v200 since #4, when it had nothing published of its own, so install wrote gk7205v200's U-Boot and firmware onto it. OpenIPC now publishes u-boot-gk7201v200-nor.bin and -nand.bin (OpenIPC/u-boot, xm72010200) and openipc.gk7201v200-nor-lite.tgz, built on the gk7205v500 kernel tree with gk7201v200's own vendor modules (OpenIPC/firmware#2478). The alias is dropped: gk7201v200 takes its -nor/-nand U-Boot (PER_FLASH_TYPE_UBOOT) and its own firmware. It also joins NOR_SPLIT_SOCS. Its kernel finds the split layout since OpenIPC/linux#140, its U-Boot scans it since OpenIPC/u-boot#61, and its firmware ships the -split package beside the fixed-slot one since OpenIPC/firmware#2668. gk7201v300 keeps its alias: it has U-Boot builds of its own but no firmware package. Tests: test_gk7201v200_installs_its_own_build (no alias, its own nor/nand U-Boot names, split, its own package board) and the per-flash-type U-Boot list. pytest (1087 passed), ruff and mypy clean. The firmware side was checked in qemu-hisilicon (gk7201v200, 8 MB; OpenIPC/firmware#2668). Not run on hardware. --- CLAUDE.md | 4 ++-- src/defib/firmware.py | 4 ++-- src/defib/install/layout.py | 4 ++-- tests/test_firmware.py | 2 +- tests/test_install_nor_split.py | 21 ++++++++++++++++++++- 5 files changed, 27 insertions(+), 8 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 82b7ebf..32b2312 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -168,14 +168,14 @@ Backends: `spi_flash.c` (fmc100), `spi_flash_hisfc350.c` (V1-era parts), `u-boot--universal.bin`; the SoCs in `PER_FLASH_TYPE_UBOOT` (the u-boot-xmedia ones: hi3516ev200/ev300, hi3518ev300, hi3516dv200, gk7205v500/v510/v530; and the OpenIPC/u-boot gk7202v300, gk7205v200/v300, - gk7605v100, hi3516cv300, hi3516ev100 -- ev100 has no NAND build) publish `u-boot--nor.bin` and `-nand.bin` instead, so + gk7605v100, gk7201v200, hi3516cv300, hi3516ev100 -- ev100 has no NAND build) publish `u-boot--nor.bin` and `-nand.bin` instead, so callers pass `flash_type` (NOR when unknown). On NAND those SoCs install the UBI-only layout (`NAND_UBI_LAYOUT` in `install/layout.py`: 768k boot, 256k env, rest ubi), whose mtdparts/bootcmd/bootargs come from the U-Boot default env; `NAND_LAYOUT` is the legacy split layout for other chips. The `NOR_SPLIT_SOCS` (gk7205v200 family, hi3516cv6xx, hi3519dv500, hi3516cv300/ev100, the hi3516ev200 family -- hi3516ev300 split-only -- - and the gk7205v500 family; keyed by package board, `FIRMWARE_PACKAGE_BOARD` + the gk7205v500 family and gk7201v200; keyed by package board, `FIRMWARE_PACKAGE_BOARD` maps cv608/cv610/cv613 to `hi3516cv6xx`, hi3516dv500 to `hi3519dv500` and gk7205v510/v530 to `gk7205v500`) install the split NOR package: one `firmware.bin.` where the boot area ends (0x50000; diff --git a/src/defib/firmware.py b/src/defib/firmware.py index 4f0c536..7d71636 100644 --- a/src/defib/firmware.py +++ b/src/defib/firmware.py @@ -55,6 +55,7 @@ "hi3516ev200", "hi3516ev300", "hi3518ev300", "hi3516dv200", "gk7205v500", "gk7205v510", "gk7205v530", "gk7202v300", "gk7205v200", "gk7205v300", "gk7605v100", + "gk7201v200", "hi3516cv300", "hi3516ev100", }) @@ -91,7 +92,7 @@ "hi3516cv6xx", "hi3519dv500", "hi3516cv300", "hi3516ev100", "hi3516ev200", "hi3518ev300", "hi3516dv200", - "gk7205v500", + "gk7205v500", "gk7201v200", # Split-only, like hi3516cv6xx: its kernel fills the 2 MiB slot, so no # fixed-slot package can ship beside the split one. "hi3516ev300", @@ -143,7 +144,6 @@ CHIP_TO_FIRMWARE: dict[str, str] = { "hi3518ev201": "hi3518ev200", "hi3516dv100": "hi3516dv100", - "gk7201v200": "gk7205v200", "gk7201v300": "gk7205v200", "gk7205v210": "gk7205v200", } diff --git a/src/defib/install/layout.py b/src/defib/install/layout.py index 01a6601..72e1ba8 100644 --- a/src/defib/install/layout.py +++ b/src/defib/install/layout.py @@ -65,7 +65,7 @@ def ubi_nand_boards(chip: str) -> set[str]: """The ``rootfs.ubi.`` suffixes a NAND package for ``chip`` may carry. - An aliased chip (gk7201v200, gk7205v210, ...) installs the U-Boot of the SoC + An aliased chip (gk7205v210, hi3518ev201, ...) installs the U-Boot of the SoC it is published under, and that SoC's package with it. """ from defib.firmware import CHIP_TO_FIRMWARE @@ -77,7 +77,7 @@ def ubi_nand_boards(chip: str) -> set[str]: def split_boards(chip: str) -> set[str]: """The ``firmware.bin.`` suffixes a split NOR package for ``chip`` may carry. - Aliased chips (gk7205v210, gk7201v200, ...) install the image of the SoC + Aliased chips (gk7205v210, hi3518ev201, ...) install the image of the SoC they are published under, and a family built once (hi3516cv610 -> hi3516cv6xx) the family's. """ diff --git a/tests/test_firmware.py b/tests/test_firmware.py index f2b2cf4..e2aac4b 100644 --- a/tests/test_firmware.py +++ b/tests/test_firmware.py @@ -274,7 +274,7 @@ class TestPerFlashTypeUBoot: "hi3516ev200", "hi3516ev300", "hi3518ev300", "hi3516dv200", "gk7205v500", "gk7205v510", "gk7205v530", "gk7202v300", "gk7205v200", "gk7205v300", "gk7605v100", - "hi3516cv300", + "gk7201v200", "hi3516cv300", ) NOR_ONLY = ("hi3516ev100",) diff --git a/tests/test_install_nor_split.py b/tests/test_install_nor_split.py index f0311f0..fcfe716 100644 --- a/tests/test_install_nor_split.py +++ b/tests/test_install_nor_split.py @@ -306,10 +306,29 @@ async def test_split_install_refusals(monkeypatch, tmp_path, capsys, kwargs, cod def test_aliased_chip_accepts_the_nand_package_it_is_published_under(): from defib.install.layout import ubi_nand_boards - assert "gk7205v200" in ubi_nand_boards("gk7201v200") + assert "gk7205v200" in ubi_nand_boards("gk7205v210") assert "gk7205v500" in ubi_nand_boards("gk7205v510") +def test_gk7201v200_installs_its_own_build(): + """gk7201v200 publishes its own U-Boot (nor and nand) and firmware, on the + gk7205v500 kernel tree with the split layout; it is no gk7205v200 alias.""" + from defib.firmware import ( + CHIP_TO_FIRMWARE, PER_FLASH_TYPE_UBOOT, asset_name, package_board, + supports_nor_split, + ) + from defib.install.layout import split_boards, ubi_nand_boards + + assert "gk7201v200" not in CHIP_TO_FIRMWARE + assert "gk7201v200" in PER_FLASH_TYPE_UBOOT + assert package_board("gk7201v200") == "gk7201v200" + assert supports_nor_split("gk7201v200") + assert split_boards("gk7201v200") == {"gk7201v200"} + assert ubi_nand_boards("gk7201v200") == {"gk7201v200"} + assert asset_name("gk7201v200", "nor") == "u-boot-gk7201v200-nor.bin" + assert asset_name("gk7201v200", "nand") == "u-boot-gk7201v200-nand.bin" + + @pytest.mark.asyncio async def test_split_erase_timeout_scales_with_the_chip(monkeypatch, tmp_path): """0x50000 to the end of a 32 MiB chip is 507 blocks, not one partition."""