Skip to content

lite <-> ultimate without a UART: sysupgrade on the 16 MB layout, ipctool on the 8 MB one - #599

Merged
openipc-ai merged 2 commits into
masterfrom
lite-ultimate-migration
Oct 14, 2026
Merged

openipc-ai merged 2 commits into
masterfrom
lite-ultimate-migration

Conversation

@openipc-ai

Copy link
Copy Markdown
Collaborator

A page, in English and Russian, for moving a camera with 16 MB NOR between lite and ultimate and back, over the network, keeping its settings. Ultimate is where the CPU person detector ships, and object detection and PTZ Follow on NPU-less chips need it. Until now, moving a camera there meant a UART and a reflash.

What the page covers

Which case you're in, read off /proc/mtd: chip size, then the size of rootfs.

16 MB layout already (rootfs 10 MB): sysupgrade --url=<the other variant> --force_ver.

  • --force_ver matters: a night's lite and ultimate carry the same version, and without it sysupgrade prints Same version, nothing to update and reboots having written nothing.
  • A device profile also needs --force_soc and its own builder image.

8 MB layout on a 16 MB chip (rootfs 5 MB): ipctool upgrade with a bundle from tools/upgrade_bundle.py --layout nor16m. It repartitions in place, keeps the bootloader and everything in front of the kernel, edits the bootloader environment, and carries /overlay across. For device profiles, -e upgrade= points future upgrades at the right image.

Before you start

  • A full-flash backup over ssh.
  • A rehearsal of the whole move on that backup in qemu-hisilicon, the camera's own bootloader included. The same recipe lets us reproduce a user's failure from the backup alone.

Also: what ipctool refuses before touching anything, and what each message means; --wipe-settings and the unclaimed camera it leaves; going back to lite (nor8m); what to send if something goes wrong, keeping the backup private.

Depends on

Tested

Every command path on the page was run:

  • 8 MB layout, XiongMai bootloader: a XiongMai 85H50AI (hi3516ev300, 16 MB NOR). Rehearsed in QEMU on its own flash dump, then run on the camera. Every file under /overlay was byte-identical afterwards, except the two the firmware rewrites on every boot.
  • 8 MB layout, OpenIPC bootloader: in QEMU, 16 MB → 8 MB layout (lite) and back (ultimate), settings carried both ways.
  • 16 MB layout: in QEMU, sysupgrade --url ... --force_ver from the GitHub releases, ultimate → lite → ultimate, settings kept. The run without --force_ver is where the Same version trap was found.

…tool on the 8 MB one

A page, in English and Russian, for moving a 16 MB NOR camera between lite
and ultimate and back over the network, keeping its settings. What to do
depends on the flash layout the camera already has, read off /proc/mtd:

- 16 MB layout: sysupgrade --url with the other variant. --force_ver is
  needed because a night's lite and ultimate carry the same version, and
  without it sysupgrade writes nothing. A device profile also needs
  --force_soc.
- 8 MB layout on a 16 MB chip: ipctool upgrade with a --layout bundle,
  which repartitions in place, keeps the bootloader and carries the
  settings.

Also covers a full-flash backup taken first, a rehearsal of the whole
move on that backup in qemu-hisilicon, what ipctool refuses before
touching anything, going back to lite, and what to send when something
goes wrong.
@openipc-ai

Copy link
Copy Markdown
Collaborator Author

/review

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

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

Copy link
Copy Markdown

Code Review by Qodo

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

Grey Divider


Action required

1. The guide exposes private internals 📘 Rule violation ⛨ Security
Description
The migration pages publish bootloader environment fields, flash-read command details, and verbatim
diagnostic output instead of limiting the explanation to observable upgrade behaviour. Any reader of
the public English or Russian page can use these internal names and exact messages to inspect
implementation details that the checklist prohibits publishing.
Code

en/lite-ultimate-migration.md[R169-176]

+Before stopping anything it prints what it will do:
+
+```
+Keeping boot (256 KB)
+Keeping env (64 KB)
+Settings: 56 entries in 576 of 2752 KB
+bootargs will be: ... mtdparts=hi_sfc:256k(boot),64k(env),3072k(kernel),10240k(rootfs),-(rootfs_data) ...
+bootcmd will be: ... sf read ... 0x50000 0x300000 ...
Evidence
The checklist prohibits publishing internal subsystem details, vendor or bootloader implementation
mechanisms, and verbatim log lines. The English page exposes bootloader environment and flash-read
details in the sample output, and also reproduces exact diagnostic messages in the refusal table;
the Russian page duplicates the same disclosures.

Rule 1: Documents behaviour, not the internals behind it
en/lite-ultimate-migration.md[169-191]
ru/lite-ultimate-migration.md[167-189]

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 public migration guide includes internal bootloader fields, flash-read details, and verbatim diagnostic messages, which violates the requirement to document closed components through externally observable behaviour rather than implementation internals.
## Fix Focus Areas
- en/lite-ultimate-migration.md[62-66]
- en/lite-ultimate-migration.md[169-191]
- ru/lite-ultimate-migration.md[62-64]
- ru/lite-ultimate-migration.md[167-189]
## Recommended Fix
Rewrite the affected sections using user-observable outcomes and operator actions. Describe that the tool preserves required boot data and refuses unsupported layouts without naming bootloader variables or flash-read commands, and summarize refusal conditions without reproducing exact internal log lines.

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


2. Profile cameras can lose board support ✓ Resolved
Description
The return-to-lite example passes a generic openipc.hi3516ev300-nor-lite.tgz image to
upgrade_bundle.py even though the surrounding text explicitly offers this route for a device
profile. When an operator follows it for such a camera, the installed image lacks the
profile-specific drivers and settings that the page says its board needs.
Code

en/lite-ultimate-migration.md[R219-220]

+```console
+$ python3 upgrade_bundle.py --layout nor8m -f openipc.hi3516ev300-nor-lite.tgz -o lite.bundle
Evidence
The new page says device profiles must move to the same device's builder image rather than generic
firmware. The repository's profile guide explains that generic images lack the board-specific files
used for sensor, pin and startup configuration.

en/lite-ultimate-migration.md[44-49]
en/lite-ultimate-migration.md[216-220]
en/per-device-settings.md[80-110]

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 return-to-lite example uses generic firmware for a device-profile camera, dropping its board-specific image contents.
## Fix Focus Areas
- en/lite-ultimate-migration.md[216-220]
- ru/lite-ultimate-migration.md[214-218]
## Recommended Fix
Show how to select the matching lite builder image for a device profile. Keep the generic image example explicitly limited to cameras using generic firmware.

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



Remediation recommended

3. Later upgrades can restore the old variant ✓ Resolved
Description
The generic layout-change bundles omit -e upgrade=..., while the page says the migration keeps the
bootloader environment and then recommends sysupgrade -k -r for future updates. If the saved
upgrade URL still points to the pre-migration image, that subsequent update fetches the old
variant instead of the one the operator just installed.
Code

en/lite-ultimate-migration.md[R134-136]

+$ curl -LO https://raw.githubusercontent.com/OpenIPC/ipctool/master/tools/upgrade_bundle.py
+$ curl -LO https://github.com/OpenIPC/firmware/releases/download/latest/openipc.hi3516ev300-nor-ultimate.tgz
+$ python3 upgrade_bundle.py --layout nor16m -f openipc.hi3516ev300-nor-ultimate.tgz -o ultimate.bundle
Evidence
The profile guide identifies upgrade as the URL fetched by sysupgrade. The page's bundle
commands do not set it for generic migrations or the reverse migration, despite describing the
environment as kept and recommending future source-based upgrades.

en/per-device-settings.md[130-142]
en/lite-ultimate-migration.md[133-145]
en/lite-ultimate-migration.md[169-176]
en/lite-ultimate-migration.md[208-220]

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

## Issue description
A layout-change bundle can retain an upgrade URL for the previous firmware variant, so later automatic-source upgrades can undo the migration.
## Fix Focus Areas
- en/lite-ultimate-migration.md[133-145]
- en/lite-ultimate-migration.md[208-220]
- ru/lite-ultimate-migration.md[131-143]
- ru/lite-ultimate-migration.md[206-218]
## Recommended Fix
Have operators check the saved `upgrade` value and set it to the destination image URL in each layout-change bundle, including the return-to-lite path. Explain when an existing value can safely be retained.

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


4. Some cameras cannot make the required backup ✓ Resolved
Description
The whole-flash backup command concatenates only /dev/mtd0 through /dev/mtd4, rather than the
partitions actually listed by /proc/mtd. On a 16 MB camera with additional partitions, its output
is incomplete and fails the page's required 16777216-byte check, leaving the operator without a
documented way to make the backup before migrating.
Code

en/lite-ultimate-migration.md[R87-90]

+```console
+$ ssh root@192.0.2.10 "cat /dev/mtd0 /dev/mtd1 /dev/mtd2 /dev/mtd3 /dev/mtd4" > camera-backup.bin
+$ ls -l camera-backup.bin
+-rw-r--r-- 1 user user 16777216 ... camera-backup.bin
Evidence
The existing backup guide defines a whole-chip dump as every partition in /proc/mtd order and
provides a loop for that purpose. The new command names only five devices, although its surrounding
text presents the result as the whole camera.

en/backup-stock-firmware.md[43-57]
en/lite-ultimate-migration.md[87-95]

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 prescribed whole-flash backup covers only the five partitions in the example layout, although the page applies to 16 MB cameras with other partition tables.
## Fix Focus Areas
- en/lite-ultimate-migration.md[83-95]
- ru/lite-ultimate-migration.md[82-94]
## Recommended Fix
Derive the ordered partition list from `/proc/mtd` as in the existing backup guide, stream every partition to the host, and retain the full-chip size check.

ⓘ 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 switch off images and animations for a plain-text comment

More tips ↗ | Customize Qodo ↗ | Qodo docs ↗

Grey Divider

Qodo Logo

Comment on lines +169 to +176
Before stopping anything it prints what it will do:

```
Keeping boot (256 KB)
Keeping env (64 KB)
Settings: 56 entries in 576 of 2752 KB
bootargs will be: ... mtdparts=hi_sfc:256k(boot),64k(env),3072k(kernel),10240k(rootfs),-(rootfs_data) ...
bootcmd will be: ... sf read ... 0x50000 0x300000 ...

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. The guide exposes private internals 📘 Rule violation ⛨ Security

The migration pages publish bootloader environment fields, flash-read command details, and verbatim
diagnostic output instead of limiting the explanation to observable upgrade behaviour. Any reader of
the public English or Russian page can use these internal names and exact messages to inspect
implementation details that the checklist prohibits publishing.
Agent Prompt
## Issue description
The public migration guide includes internal bootloader fields, flash-read details, and verbatim diagnostic messages, which violates the requirement to document closed components through externally observable behaviour rather than implementation internals.

## Fix Focus Areas
- en/lite-ultimate-migration.md[62-66]
- en/lite-ultimate-migration.md[169-191]
- ru/lite-ultimate-migration.md[62-64]
- ru/lite-ultimate-migration.md[167-189]

## Recommended Fix
Rewrite the affected sections using user-observable outcomes and operator actions. Describe that the tool preserves required boot data and refuses unsupported layouts without naming bootloader variables or flash-read commands, and summarize refusal conditions without reproducing exact internal log lines.

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

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not changing this one, and here's why. That rule covers components developed in closed repositories, which this wiki documents by behaviour only. Everything this page names comes from open-source software whose interfaces are its user-facing behaviour:

  • bootargs, bootcmd, sf read and fw_printenv are U-Boot's, public and documented elsewhere in this wiki (help-uboot.md, u-boot-settings.md).
  • The quoted messages are what OpenIPC/ipctool prints on the operator's terminal; its source is public.
  • Same version, nothing to update is what the firmware's sysupgrade prints.

Quoting them verbatim is deliberate: the refusal table only works if a reader can match the line on their screen to its meaning. No closed component is named or described here.

Comment thread en/lite-ultimate-migration.md
Comment thread en/lite-ultimate-migration.md
Comment thread en/lite-ultimate-migration.md
… the variant

Three findings from review, in both languages:

- The backup named five mtd devices, so a camera with another partition
  table got a short file and failed the size check the page asks for. It
  now reads every partition /proc/mtd lists, in order, as the backup page
  does.
- The upgrade address survives a move. One that names the variant being
  left would bring it back on the next sysupgrade -k -r. The page now has
  the reader check fw_printenv upgrade and replace the address with -e
  when it is set, or with fw_setenv after a profile's sysupgrade.
- Going back to lite showed the generic image even where it offered the
  route to device profiles, which need their own builder lite image.
@openipc-ai
openipc-ai merged commit eb25521 into master Oct 14, 2026
@openipc-ai
openipc-ai deleted the lite-ultimate-migration branch October 14, 2026 16:01
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