Repository navigation
nor: split layout on the hi3516ev200 family - #48
Conversation
CONFIG_OPENIPC_NOR_SPLIT for hi3516ev200, hi3516ev300, hi3518ev300 and hi3516dv200, now that their kernel (OpenIPC/linux hisilicon-hi3516ev200) finds the split layout from its device tree. The scan then takes a uImage at 0x50000 with the squashfs at the next 64 KiB as the split image and boots it with a root-less command line; fwupd and SD recovery take firmware.bin.<soc>. Fixed-slot cameras boot as before: a squashfs at the 2 or 3 MiB slot boundary is still fixed slots. The NAND builds compile the split code out and are unchanged. NOR images: u-boot-hi3516ev300-nor.bin 209413 bytes, u-boot-hi3516ev200-nor.bin 208693, inside the 256K boot area; the NAND images build as before. Tested in qemu-hisilicon: hi3516ev200 (8 and 16 MB) and hi3518ev300 split firmware.bin -> "Found RootFS at 0x00210000" / "0x00230000", root-less command line, the kernel's split; the fixed-slot packages -> "Found RootFS at 0x00250000" / "0x00350000", fixed-slot mtdparts, root on 31:3. hi3516ev300's published fixed package (a uImage padded to the full 2 MiB slot) is still taken as fixed slots. Not run on hardware.
Code Review by Qodo
1.
|
PR Summary by QodoEnable split NOR layout on the hi3516ev200 family
AI Description
Diagram
High-Level Assessment
Files changed (5)
|
|
/review |
|
Code review by qodo was updated up to the latest commit 4e08fc6 |
From review, for every split board:
- openipc_helper() saved the default environment, and
altbootcmd_migrate() the whole environment, after firmware_scan(),
so a split boot could persist its RAM-only bootargs without root= and
mtdparts=; a fixed-slot image written later then had no root. Both
saves now come before the scan, whose settings stay for this boot.
- fwwrite erases the firmware area only for a file that is not empty and
fits ${fwsize}: an oversized download no longer erases what it cannot
replace. One command string serves the default environment and the
scan's RAM override.
- A saved fwupd that is exactly the pre-split "run ur; run uk" takes the
firmware file first (in RAM; an edited one is left alone), and fwfile
is supplied when absent.
Checked in qemu-hisilicon (hi3516ev200, 8 MB, this U-Boot):
- first boot of a split image on a blank env: saved bootargs keep
"root=/dev/mtdblock3 ... mtdparts=${mtdparts}", the boot's own command
line is root-less, root on 31:4; a fixed-slot image then written under
that env: "Found RootFS at 0x00250000", 6 cmdlinepart partitions, root
on 31:3, login;
- setenv fwupd 'run ur; run uk'; saveenv; reset: fwupd reads the split
command again; filesize 0x1000000 against fwsize 0x7b0000 and filesize
0: "nothing written", the squashfs at 0x250000 untouched.
hi3516cv300 and gk7205v200 build too.
From review: a build that saved its environment after the scan could
already have stored a split boot's bootargs without root= and mtdparts=.
On fixed slots, when both are missing, the scan appends
"root=/dev/mtdblock3 mtdparts=${mtdparts}" for this boot; a command line
naming either is the owner's and is left alone.
Checked in qemu-hisilicon (hi3516ev200, fixed slots): bootargs saved as
"mem=${osmem} console=ttyAMA0,115200 panic=20 rootfstype=squashfs
init=/init", reset: the kernel gets root=/dev/mtdblock3 and the fixed
mtdparts, 6 cmdlinepart partitions, root on 31:3, login.
…dv200 (#160) Their firmware now ships the split NOR package beside the fixed-slot one (OpenIPC/firmware#2655, on OpenIPC/linux#131), and their OpenIPC/u-boot NOR build scans for it (OpenIPC/u-boot#48), so they join `NOR_SPLIT_SOCS`: one `firmware.bin.<soc>` at 0x50000, the rest of the chip erased. They already take `u-boot-<soc>-nor.bin` (`PER_FLASH_TYPE_UBOOT`). hi3516ev300 stays on fixed slots: its uImage (2009K with the split options) fills the 2 MiB slot, over the 1983K a fixed-slot package beside a split one may use, so its firmware ships no split package. A test keeps it out even though its profile is an alias of hi3516ev200. The split package appears with the next nightly. Until the U-Boot publish workflow runs again, the published `u-boot-<soc>-nor.bin` predates #48: the split image still boots under it (the kernel ignores its fixed mtdparts, checked in QEMU), but its scan and `fwupd` for the split image come with the republished build. Not run on hardware; the firmware side was checked in qemu-hisilicon (hi3516ev200, hi3518ev300; 8 and 16 MB). `pytest tests/ --ignore=tests/fuzz`: 1084 passed. ruff and mypy are clean.
hi3516ev300's firmware now ships only the split NOR package, like hi3516cv6xx (OpenIPC/firmware#2656): its uImage (2008K with the split options) fills the 2 MiB slot, so a fixed-slot package cannot ship beside a split one. hi3518ev300 went split-only in the same PR; it is already in `NOR_SPLIT_SOCS` (#160). - hi3516ev300 joins `NOR_SPLIT_SOCS`, so `install` writes `firmware.bin.hi3516ev300` at 0x50000 and erases the rest of the chip; its U-Boot is the published `u-boot-hi3516ev300-nor.bin` (split mode since OpenIPC/u-boot#48). - The refusal test that used hi3516ev300 as a chip without the split layout now uses hi3518ev200. CLAUDE.md lists it. The split package appears with the next nightly. Not run on hardware; the firmware side was checked in qemu-hisilicon (8 MB lite, 16 MB ultimate: root on the split rootfs, overlay kept across a reboot). `pytest tests/ --ignore=tests/fuzz`: 1084 passed. ruff and mypy are clean.
From review: boards set verify=n before openipc_helper() so the split scan can clear it for bootm (#48, and this PR for xm720xxx/xm72050500), and recovery then ran with verify=n: source skipped the data CRC of a uImage-wrapped script.txt. openipc_helper() now drops verify while firmware_recovery() runs and puts it back for the boot, on every board. QEMU (gk7205v500, 8 MB, split image): 'Verifying Checksum ... OK' before the kernel, split, root on 31:4, login; hi3516ev300 builds.
* nor: split layout on the gk7205v500 family CONFIG_OPENIPC_NOR_SPLIT for gk7205v500, gk7205v510 and gk7205v530 (xm720xxx_config, which build.sh uses for all three, and xm72050500_config), now that their kernel (OpenIPC/linux goke-gk7205v500) finds the split layout from its device tree. The scan takes a uImage at 0x50000 with the squashfs at the next 64 KiB as the split image and boots it with a root-less command line; fwupd and recovery take firmware.bin.<soc>. Fixed-slot cameras boot as before. The NAND builds compile the split code out. misc_init_r() on xm720xxx and xm72050500 set verify=n after openipc_helper(), undoing the scan's clearing of it for a split image so bootm never checked the uImage CRC; it is set before the scan, as #48 did for the boards that had it then. NOR images: u-boot-gk7205v500/v510/v530-nor.bin 225792 bytes each, inside the 256K boot area; NAND images build as before. Tested in qemu-hisilicon with a gk7205v500_lite build: gk7205v500 8 MB and gk7205v510/v530 16 MB, the split firmware.bin -> "Found RootFS at 0x00240000", "Verifying Checksum ... OK", root-less command line, the kernel's split, root on 31:4, login; the fixed-slot uImage + rootfs -> "Found RootFS at 0x00250000", fixed mtdparts, root on 31:3. Not run on hardware. * openipc: recovery checks what it runs, whatever verify the board set From review: boards set verify=n before openipc_helper() so the split scan can clear it for bootm (#48, and this PR for xm720xxx/xm72050500), and recovery then ran with verify=n: source skipped the data CRC of a uImage-wrapped script.txt. openipc_helper() now drops verify while firmware_recovery() runs and puts it back for the boot, on every board. QEMU (gk7205v500, 8 MB, split image): 'Verifying Checksum ... OK' before the kernel, split, root on 31:4, login; hi3516ev300 builds.
* nor-split: the Hi3516EV200 family, Hi3516EV300 split-only - nor-split-layout: Hi3516EV200, Hi3518EV300 and Hi3516DV200 ship the split package beside the fixed-slot one (OpenIPC/firmware#2655, on OpenIPC/linux#131 and OpenIPC/u-boot#48); Hi3516EV300 lite and ultimate ship the split package only, its kernel filling the 2 MiB kernel slot (neo keeps fixed slots). Going back to fixed slots lists them accordingly. - sysupgrade: `sysupgrade -k -r` installs the split layout on them. Checked in qemu-hisilicon (hi3516ev200, hi3518ev300, hi3516ev300; 8 and 16 MB). Not run on hardware. * nor-split: the GK7205V500 family GK7205V500 ships the split package beside the fixed-slot one (OpenIPC/firmware#2658, on OpenIPC/linux#137 and OpenIPC/u-boot#52). GK7205V510 and GK7205V530 install that one gk7205v500 build, as defib (OpenIPC/defib#163) and the site's installer do. Each keeps its own u-boot-<soc>-nor.bin. sysupgrade -k -r takes the split package on them too, and they go back to fixed slots the same way. Checked in qemu-hisilicon (gk7205v500 8 and 16 MB, gk7205v510/v530 16 MB). Not run on hardware. * sysupgrade: the split list is for NOR cameras, and Hi3516EV300 lite and ultimate From review: the list of SoCs whose sysupgrade -k -r installs the split package now says it is about NOR flash, and points NAND cameras to their own layout page. Hi3516EV300 is listed for lite and ultimate only: neo keeps fixed slots, as the layout page says.
CONFIG_OPENIPC_NOR_SPLITfor hi3516ev200, hi3516ev300, hi3518ev300 and hi3516dv200, now that their kernel finds the split layout from its device tree (OpenIPC/linux#131, merged onhisilicon-hi3516ev200). The scan takes a uImage at 0x50000 with the squashfs at the next 64 KiB as the split image and boots it with a root-less command line;fwupdand SD recovery takefirmware.bin.<soc>. Fixed-slot cameras boot as before: a squashfs at the 2 or 3 MiB slot boundary is still fixed slots. The NAND builds compile the split code out and are unchanged.NOR images:
u-boot-hi3516ev300-nor.bin209413 bytes,u-boot-hi3516ev200-nor.bin208693,hi3518ev300208661,hi3516dv200202129, all inside the 256K boot area; the NAND images build as before.Tested in qemu-hisilicon:
firmware.bin:Found RootFS at 0x00210000/0x00230000, root-less command line, the kernel's split, root on 31:4, login prompt;Found RootFS at 0x00250000/0x00350000, fixed-slot mtdparts, root on 31:3;Not run on hardware.