Skip to content

hi3519dv500: load the media zone the kernel laid out - #2632

Merged
widgetii merged 4 commits into
masterfrom
hisi/mem-userspace
Oct 19, 2026
Merged

widgetii merged 4 commits into
masterfrom
hisi/mem-userspace

Conversation

@widgetii

@widgetii widgetii commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

The step #2240 took for the Goke V200 and hi3516ev200 families, for hi3519dv500. A kernel that measures DRAM itself (OpenIPC/linux, hisi_mem; the hisilicon-hi3519dv500 branch follows) publishes its layout in /sys/module/hisi_mem/parameters -- dram, osmem, allocator, mmz -- and load_hisilicon now loads open_mmz with exactly that, under any bootloader, without reading or writing the environment.

That matters on hi3519dv500, whose U-Boot passes mem=512M and no totalmem: load_hisilicon took the 64M default, found the OS share over it and exited before loading a single module.

On a kernel without hisi_mem the zone still comes from totalmem/osmem and the command line, as before, minus the first-boot fw_setenv of mmz_allocator, which nothing on this part reads back. set_allocator, the user's override (ot|cma|auto|mmz), is the hi3516ev200 one with the carve-out named "ot" as the V5 SDK names it.

From review: set_allocator takes the OS share in whole MiB only (a bare "48" became mem=48, 48 bytes, and an unbootable camera), within what the kernel accepts, defaulting to the share the camera runs with; and an older kernel's two-cell (arm64) memory node is read. Fixed in the hi3516ev200 copy too.

hi3516cv6xx is left out: its lite rootfs is exactly full (5120K of 5120K) and the same change took it to 5124K. It comes with the move to the split NOR package, which holds the rootfs to the chip rather than a fixed slot.

test_load_hisilicon_layout.sh runs load_hisilicon and set_allocator for hi3516ev200 and hi3519dv500 under busybox sh and awk.

Tested in qemu-hisilicon with a hi3519dv500 kernel that publishes hisi_mem, at 512M/1G/2G (cma 376M/516M/1540M): open_mmz loaded with the published zone, login. Not run on hardware: no hi3519dv500 board in the lab.

The step #2240 took for the Goke V200 and hi3516ev200 families, for the
two V5 SDK packages. A kernel that measures DRAM itself (OpenIPC/linux,
hisi_mem: the hisilicon-hi3516cv6xx and -hi3519dv500 branches follow)
publishes its layout in /sys/module/hisi_mem/parameters -- dram, osmem,
allocator, mmz -- and load_hisilicon now loads open_mmz with exactly
that, under any bootloader, without reading or writing the environment.

That matters most on hi3519dv500, whose U-Boot passes mem=512M and no
totalmem: load_hisilicon took the 64M default, found the OS share over
it and exited before loading a single module.

On a kernel without hisi_mem the zone still comes from totalmem/osmem
and the command line, as before, minus the first-boot fw_setenv of
mmz_allocator, which nothing on these parts reads back. set_allocator,
the user's override (ot|cma|auto|mmz), is the hi3516ev200 one with the
carve-out named "ot" as the V5 SDK names it, and hi3516cv6xx now installs
it as hi3519dv500 does.

test_load_hisilicon_layout.sh runs the same cases for all three packages
under busybox sh and awk: the kernel's zone taken over a vendor mem=,
nothing written to the environment, the older kernel's path unchanged.

Tested in qemu-hisilicon with the kernels that publish hisi_mem:
hi3516cv610 at 128M/256M/512M (cma 96M/224M/480M), hi3516cv608 at 64M
("ot", 32M), hi3519dv500 at 512M/1G/2G (cma 376M/516M/1540M): "mmz:
anony=1 mmz_allocator=... mmz=anonymous,0,..." loaded, login. Not run on
hardware: no board of either family in the lab.
@qodo-free-for-open-source-projects

Copy link
Copy Markdown

PR Summary by Qodo

Load V5 media zones from the kernel's memory layout

🐞 Bug fix ✨ Enhancement 🧪 Tests 🕐 20-40 Minutes

Grey Divider

AI Description

• Load hi3516cv6xx and hi3519dv500 media zones from hisi_mem when available, avoiding incorrect
 bootloader defaults.
• Preserve older-kernel layout handling without writing the U-Boot environment during module
 loading.
• Install the hi3516cv6xx allocator override and test all three HiSilicon package paths.
Diagram

graph TD
  A["Boot state"] --> B{"hisi_mem available?"} -->|yes| C["Kernel layout"] --> E["V5 loaders"] --> F["open_mmz"]
  B -->|no| D["Bootargs and env"] --> E
  G["set_allocator"] -->|next boot| D
Loading
High-Level Assessment

The following are alternative approaches to this PR:

1. Share V5 memory-selection logic
  • ➕ Keeps the two packages' fallback and kernel-layout behavior synchronized.
  • ➖ Adds a shared runtime dependency to otherwise self-contained package scripts and broadens the packaging change.

Recommendation: Prefer the PR's kernel-authoritative layout with an older-kernel fallback: userspace cannot reliably reconstruct the kernel's chosen zone from bootloader defaults. Retain the parallel package scripts for this change, but consider a shared helper if their memory-selection logic continues to evolve together.

Files changed (6) +311 / -149

Enhancement (2) +148 / -14
set_allocatorSupport kernel-aware allocator overrides on hi3516cv6xx +74/-7

Support kernel-aware allocator overrides on hi3516cv6xx

• Adds ot, cma, auto, and mmz behavior for kernels publishing hisi_mem while retaining older-kernel boot-argument handling. Uses the device-tree memory size when totalmem is absent.

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator

set_allocatorSupport kernel-aware allocator overrides on hi3519dv500 +74/-7

Support kernel-aware allocator overrides on hi3519dv500

• Adds next-boot ot and cma overrides, auto selection, and MMZ reporting for hisi_mem kernels. Updates the older-kernel path to use ot naming and fall back to device-tree memory size when totalmem is absent.

general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator

Bug fix (2) +84 / -78
load_hisiliconPrefer the kernel-published MMZ layout on hi3516cv6xx +42/-39

Prefer the kernel-published MMZ layout on hi3516cv6xx

• Passes the hisi_mem allocator and zone directly to open_mmz when available. Otherwise retains command-line and environment-based zone selection while removing the first-boot allocator write.

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon

load_hisiliconPrefer the kernel-published MMZ layout on hi3519dv500 +42/-39

Prefer the kernel-published MMZ layout on hi3519dv500

• Loads open_mmz from hisi_mem values rather than relying on a potentially absent totalmem value and the 64 MiB default. Preserves the older-kernel fallback without writing an allocator setting during startup.

general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon

Tests (1) +78 / -57
test_load_hisilicon_layout.shExercise media-zone selection across three HiSilicon packages +78/-57

Exercise media-zone selection across three HiSilicon packages

• Parameterizes the BusyBox harness for hi3516ev200, hi3516cv6xx, and hi3519dv500. Checks kernel-published zones, older-kernel fallbacks, and whether module loading writes the U-Boot environment.

.github/scripts/test_load_hisilicon_layout.sh

Other (1) +1 / -0
hisilicon-osdrv-hi3516cv6xx.mkInstall the hi3516cv6xx allocator command +1/-0

Install the hi3516cv6xx allocator command

• Adds set_allocator to the package's target installation so users can apply allocator overrides.

general/package/hisilicon-osdrv-hi3516cv6xx/hisilicon-osdrv-hi3516cv6xx.mk

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

qodo-free-for-open-source-projects Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Code Review by Qodo

🐞 Bugs (1) 📘 Rule violations (1) 📎 Requirement gaps (0) 🎨 UX issues (0) 🔗 Cross-repo conflicts (0) 📜 Skill insights (0)

Grey Divider


Action required

1. Camera boot behavior is unverified 📘 Rule violation ☼ Reliability
Description
load_hisilicon now changes which memory zone is passed to open_mmz, and set_allocator changes
boot arguments installed for hi3516cv6xx and hi3519dv500 cameras. The PR says it was tested only in
qemu-hisilicon and not on hardware, so the affected boards have no real-boot or stream evidence for
these changes.
Code

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon[R340-342]

+if [ -n "$kernel_alloc" ]; then
+	echo "Memory laid out by the kernel: DRAM ${mem_total}M, OS ${os_mem_size}M, ${kernel_alloc}"
+	mmz_args="anony=1 mmz_allocator=$kernel_alloc mmz=$kernel_mmz"
Evidence
The compliance gate requires real-camera boot and stream evidence for changes that can alter
firmware behavior. The changed scripts select the kernel-published memory zone for open_mmz, and
the PR description states that testing was performed in qemu-hisilicon only and was not run on
hardware.

Rule 3: Hardware evidence is present and honest
general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon[340-357]
general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon[336-353]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The memory-layout changes alter camera boot behavior, but the PR reports only QEMU testing and explicitly says no hi3516cv6xx or hi3519dv500 hardware testing was performed.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon[340-357]
- general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon[336-353]
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[40-70]
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[40-70]
## Recommended Fix
Test the affected changes on real hi3516cv6xx and hi3519dv500 cameras, recording the memory-layout output, boot result, and stream behavior before and after the change, then include that evidence in the pull request.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Remediation recommended

2. A requested OS share is not passed to the kernel 🐞 Bug ≡ Correctness
Description
set_allocator cma [osmem] uses the requested size to construct mmz= but writes no osmem=
argument, despite this branch identifying osmem= as the kernel's OS-share override. On a kernel
using hisi_mem, the next boot receives mem= for the whole DRAM and an explicit zone, but not the
requested value through the documented OS-share parameter.
Code

general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[R58-60]

+      osm=$(( ($(echo ${os} | tr -d 'M') + 3) / 4 * 4 ))
+      zone=$(printf 'anonymous,0,0x%x,%dM' $(( 0x40000000 + osm * 1048576 )) $(( dram - osm )))
+      newbootargs="mem=${dram}M ${kept}mmz_allocator=cma mmz=${zone}"
Evidence
Both new scripts say that hisi_mem reads osmem= and obtain the optional OS size, but their CMA
branches emit only mem=, mmz_allocator=, and mmz=. The loaders then use the kernel-published
OS share rather than recalculating it from the utility's argument.

general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[40-60]
general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[40-60]
general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon[25-30]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
The new CMA override calculates a zone from the requested OS share but omits the documented `osmem=` override from the resulting bootargs.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[53-63]
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[53-63]
## Recommended Fix
Include the effective, rounded OS share in the bootargs parameter consumed by `hisi_mem`, while retaining the explicit zone needed by the legacy path. Test the generated bootargs for a non-default `[osmem]` value.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. hi3519dv500 cma override still writes mem=64M ✓ Resolved
Description
dt_mem_total accepts only a 16-hex-digit /proc/device-tree/memory/reg value and discards a
decoded size of 512 MiB. On aarch64 hi3519dv500, the memory node has 32 hex digits, and on a 512 MiB
device the size is valid; either case can leave totalmem unset, causing the legacy `set_allocator
cma path to calculate its zone from 64 MiB and write mem=64M`.
Code

general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[R9-12]

+  reg=$(hexdump -v -e '1/1 "%02x"' /proc/device-tree/memory/reg 2>/dev/null)
+  [ ${#reg} -eq 16 ] || return 0
+  reg=$((0x${reg#????????} / 1048576))
+  [ "$reg" -gt 0 ] && [ "$reg" -ne 512 ] && echo ${reg}M
Evidence
The parser’s length check rejects the 32-hex-digit reg produced by hi3519dv500’s 64-bit address
and size cells, while its size check separately suppresses 512 MiB, a supported DV500 memory size.
When no totalmem value is saved, calc_mmz defaults to 64 and the legacy CMA branch writes
mem=${totalmem:=64M}.

br-ext-chip-hisilicon/configs/hi3519dv500_ultimate_defconfig[16-17]
general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[103-110]
general/package/hisilicon-osdrv-hi3516ev200/files/script/set_allocator[7-13]
general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[7-12]
general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[23-25]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
`dt_mem_total` in hi3519dv500’s `set_allocator` assumes a 16-hex-digit device-tree memory value and rejects 512 MiB. Either condition can leave `totalmem` unset, so the no-`totalmem` legacy CMA path uses a 64 MiB layout.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[7-13]
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[7-12]
## Recommended Fix
Accept a 32-hex-digit `reg` by taking its last 16 digits as the size (`reg=${reg#????????????????}` when `${#reg} -eq 32`), while retaining the 16-digit case; alternatively, derive the size from the System RAM range in `/proc/iomem`. Do not reject a valid 512 MiB measurement solely by size. If a device tree can report a placeholder, distinguish it using other evidence, and test the no-`totalmem` legacy CMA path.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


4. A unitless OS share bricks the next boot ✓ Resolved
Description
In the hisi_mem branch of set_allocator, os=${2:-...} is written verbatim as mem=${os}
(auto/ot) and osmem=${os}, while the cma branch strips M and does arithmetic on the number as
MiB. Running set_allocator ot 48 writes mem=48, which the kernel reads as 48 bytes, so the
camera does not boot again until someone recovers it over serial.
Code

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[R50-52]

+    os=${2:-${osmem:-32M}}
+    if [ "$1" = auto ]; then
+      newbootargs="mem=${os} ${kept}"
Evidence
Line 50 takes $2 unvalidated; line 52 and line 63 emit mem=${os}; line 58 treats the same value as a
MiB number with an optional M, showing that both forms are expected input. The usage text
set_allocator ot|cma [osmem] gives no unit. The same code is in the hi3519dv500 copy.

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[48-71]
general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[48-71]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
set_allocator's hisi_mem branch writes the user-supplied osmem verbatim into mem=/osmem=; a bare number becomes a byte count and the next boot fails.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[48-64]
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[48-64]
## Recommended Fix
After computing `os`, strip a trailing M, check that the remainder is a positive integer smaller than `$(cat $p/dram)` (else print usage and exit 1), then set `os=${n}M` before building newbootargs.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Informational

5. Comments claim load script calls set_allocator ✓ Resolved
Description
The copied header of dt_mem_total says load_hisilicon calls this script with the same fallback,
and the mmz block says the load script compares its zone with the booted one. Neither hi3516cv6xx
nor hi3519dv500 load_hisilicon ever invokes set_allocator, so a reader trusting these comments will
think the old-kernel mmz path and fallback are in use.
Code

general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[R85-88]

+# The zone `cma` would write, without writing it. The load script compares it
+# with the zone the kernel booted with: bootargs are written once, so an osmem
+# or totalmem changed afterwards never reached them on their own.
+if [ "$1" = 'mmz' ]; then
Evidence
The V5 load_hisilicon scripts only call modprobe open_osal/open_mmz using mmz_args built inline;
set_allocator is never called (the PR's test passes legacy_picks=no for both V5 packages for this
reason).

general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon[50-53]
general/package/hisilicon-osdrv-hi3519dv500/files/script/load_hisilicon[336-353]
.github/scripts/test_load_hisilicon_layout.sh[143-145]

Agent prompt
The issue below was found during a code review. Follow the provided context and guidance below and implement a solution

## Issue description
Comments copied from hi3516ev200 describe load_hisilicon calling set_allocator, which the V5 load scripts do not do.
## Fix Focus Areas
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[3-6]
- general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator[85-87]
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[3-6]
- general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator[85-87]
## Recommended Fix
Rewrite both comments to say the script is a user-invoked override only, or remove them.

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Tip of the day
💡 Did you know, you can import rules and skills only from the repositories your team follows

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment thread general/package/hisilicon-osdrv-hi3516cv6xx/files/script/load_hisilicon Outdated
Comment thread general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator Outdated
Comment thread general/package/hisilicon-osdrv-hi3519dv500/files/script/set_allocator Outdated
Comment thread general/package/hisilicon-osdrv-hi3516cv6xx/files/script/set_allocator Outdated
From review. On a kernel with hisi_mem, set_allocator wrote the OS share
it was given as it was: `set_allocator ot 48` put mem=48 -- 48 bytes --
on the next boot's command line, and the camera did not come up again
until someone recovered it over serial. It now takes N or NM, refuses
anything else, and refuses a share below the 32M the kernel accepts or
leaving under 8M of DRAM, as the kernel would. With no size given it
keeps the share this boot runs with (128M on hi3519dv500), not a fixed
32M. Same in the hi3516ev200 package, where the bug came from.

For an older kernel without totalmem, dt_mem_total read only a one-cell
memory node (32-bit ARM). hi3519dv500's is two cells, and its U-Boot
fixes it up from 0x40030000 (the 512M less ATF's 0x30000), so the size
is now rounded up to whole 64 MiB there; the one-cell 512M stays the
device tree's placeholder, as before.

`set_allocator cma` still writes no osmem=: the kernel takes an explicit
mmz= as the whole layout, and the OS share is what lies below the zone.

test_load_hisilicon_layout.sh runs set_allocator for the three packages
under busybox sh: 48 and 48M, 48K, 16M, 508M of 512M, cma's default, the
two-cell and one-cell memory nodes. The scripts before this change fail
six cases in each package.
@widgetii

Copy link
Copy Markdown
Member Author

Re the summary's finding 5 (comments claiming load_hisilicon calls set_allocator): fixed in 2f8c5a3. The cv6xx/dv500 set_allocator header no longer says so.

The lite rootfs is exactly full on master (rootfs.squashfs 5120K of its
5120K slot), and the script tipped it 4K over. It is installed with the
move to the split NOR package, where the rootfs is no longer held to a
fixed slot. Nothing here calls it: load_hisilicon reads the kernel's
layout, or the command line on an older kernel.
hi3516cv6xx_lite's rootfs is exactly full on master: 5120K of its 5120K
fixed slot. The load_hisilicon change alone took it to 5124K. The cv6xx
side moves to the change that publishes cv6xx as the split NOR package,
where the rootfs is held to the chip, not a fixed slot. This PR is now
hi3519dv500, and the set_allocator fix in hi3516ev200.
@widgetii widgetii changed the title hi3516cv6xx, hi3519dv500: load the media zone the kernel laid out hi3519dv500: load the media zone the kernel laid out Oct 19, 2026
@widgetii
widgetii merged commit 1d7613e into master Oct 19, 2026
42 of 43 checks passed
@widgetii
widgetii deleted the hisi/mem-userspace branch October 19, 2026 05:07
widgetii added a commit that referenced this pull request Oct 19, 2026
…amily (#2638)

* hi3516cv6xx, hi3519dv500: the split NOR image, as on the gk7205v200 family

No separate cases are left for hi3516cv6xx or hi3519dv500 in how the
firmware is packed, upgraded or assembled; what differs is data.

The image. One post-image script for every board on the split NOR
layout, general/scripts/post-image-split.sh, in place of the gk7205v200,
hi3516cv6xx and hi3519dv500 post-image.sh and both fit-image.its:
firmware.bin is a legacy uImage, then the squashfs at the next 64 KiB.
32-bit ARM takes the kernel's own uImage (the zImage with its DTB
appended, CONFIG_BUILD_ARM_APPENDED_DTB_IMAGE_NAMES); arm64 cannot append
a DTB, so there it is a legacy multi-file uImage -- Image.gz, a
trailer-only initramfs, the DTB -- which bootm unpacks the same way. The
kernels (OpenIPC/linux #101-#109) find the layout from their device tree
and divide "firmware" into kernel, rootfs and rootfs_data at boot.

- Config.in: BR2_OPENIPC_NOR_FIRMWARE_OFFSET (0x50000; 0xC0000 on
  hi3519dv500, whose signed boot image needs 512k boot + 256k env) and
  BR2_OPENIPC_NOR_FIXED_PACKAGE (the Goke boards, which also publish the
  fixed-slot package). The Makefile's cv6xx and dv500 branches go; one
  branch packs every board that builds firmware.bin, checks it against
  the chip less the offset and an overlay, and publishes -split.
- hi3516cv6xx/hi3519dv500 kernel configs: MTD_SPLIT_*, root from the
  split; cv6xx UIMAGE with its DTB appended, CMA; dv500 drops mem=128M and
  gains OVERLAY_FS, which it never had (its overlay stayed read-only).
- The cv6xx memory userspace held back from #2632 (its lite rootfs was
  full on the FIT layout): load_hisilicon from hisi_mem, set_allocator
  installed.

Upgrades. sysupgrade knows the split layout without a SoC list: a camera
is split when its "firmware" partition holds the kernel's own partitions,
the offset is read from /proc/mtd, and the -split package is fetched
wherever the release publishes one. The FIT combined path, used by
nobody else, is gone. Boards that publish only the split package are
listed in the manifest under a new flash key, nor_split (consumers match
the column exactly, so one asking for "nor" never takes it), and
--build/--channel/--list fall back to it. Older scripts asking for the
plain cv6xx package get a 404 and stop -- they cut firmware.bin at its
4th-7th bytes as a FIT size, and a uImage's header CRC sits there --
while every -k/-r run fetches this script first.

CI. image.yml assembles the cv6xx (lite on 8 MiB, ultimate on 16 MiB)
and hi3519dv500 (dmeb, dmebpro, 16 MiB) full images with one
create_split: the boot image at 0, firmware.bin where the boot area ends,
the rest erased; split_layout holds each board's boot and env sizes, and
nothing else differs. hisi_layout/create_hisi and the withdrawal step go
(#2460). build.yml and build-one.yml take the -split package as the NOR
one where there is no plain one.

Tested in qemu-hisilicon with the published boot images (OpenIPC/u-boot
f8747f7b): full images from create_split -- hi3516cv610 DDR3-128M lite,
rootfs_data at 7552 KiB as create_split reports, login; hi3519dv500 dmeb
ultimate at 1G, cma 888M, rootfs_data at 14976 KiB. Packages: cv6xx lite
at 64M/128M/256M/512M, dv500 at 128M-2G, overlay kept across a reboot.
gk7205v200's firmware.bin and packages unchanged by the shared script
(only the uImage header's time and CRC). Shell suites, lint, ci-matrix
self-test pass. Not run on hardware: no hi3516cv6xx or hi3519dv500 board
in the lab.


* nor split: the uImage within what a bootloader in the field reads

From review. The split image boots under any bootloader that reads a
uImage from the firmware offset, but the ones in the field read a fixed
amount: 2 MiB on hi3516cv6xx (its published U-Boot before it scanned the
flash, and vendor ones), 6 MiB on hi3519dv500's. The fixed-slot package's
2 MiB check went with it for cv6xx, and nothing else bounded the kernel:
a cv6xx uImage past 2 MiB would build, publish and assemble, and then be
read short and fail its CRC on those bootloaders. cv6xx's is 2021K now.

BR2_OPENIPC_NOR_KERNEL_READ_SIZE holds that read (0x200000; 0x600000 on
hi3519dv500), and every split build checks the uImage against it in
bytes -- CHECK_SIZE counts whole KB, which would let one byte over
through. image.yml's create_split refuses the same.

Checked: repack for hi3516cv6xx_lite (uImage 2021KB/2048KB) and
hi3519dv500_ultimate (5630KB/6144KB) pass; with the limit set to
0x100000 the cv6xx repack stops, "size exceeded by: 1021261 bytes";
create_split from the workflow file passes both images and refuses the
cv6xx one at a 1024 KiB read.


* nor split: measure the uImage from firmware.bin's header

CHECK_KERNEL_READ stat'ed images/uImage, which the fixed-slot package's
repack has already renamed to uImage.<soc> on the boards that ship one:
every Goke split build (and the GCC rows, which build gk7205v200) stopped
there. It now reads the size as a bootloader does, from firmware.bin's own
uImage header -- 64 bytes, then the data size at byte 12.

Checked locally: a full gk7205v200_lite build (uImage 1879KB/2048KB read
by the bootloader, both packages), hi3516cv6xx_lite (2021KB/2048KB) and
hi3519dv500_ultimate (5630KB/6144KB) repacks; at 0x100000 the cv6xx one
still stops, "size exceeded by: 1021261 bytes".


Closes #2460.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant