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
5 changes: 4 additions & 1 deletion .github/workflows/pr-build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,11 +141,14 @@ jobs:
cmake --build build --target cYAML_test reginfo_test longse_test \
sensors_test anyka_test hal_hisi_test \
report_test http_test mtd_alias_test \
nand_layout_test
nand_layout_test upgrade_env_test \
jffs2_test
./build/cYAML_test
./build/report_test
./build/http_test
./build/mtd_alias_test
./build/upgrade_env_test
./build/jffs2_test
./build/nand_layout_test
./build/reginfo_test
./build/longse_test
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,10 @@ message(STATUS "libipchw vendor HALs: hisi ${_ipchw_selected}")
set(IPCTOOL_SRC
src/backup.c
src/backup.h
src/jffs2.c
src/jffs2.h
src/upgrade_env.c
src/upgrade_env.h
src/nand_layout.c
src/nand_layout.h
src/nand_migrate.c
Expand Down Expand Up @@ -522,6 +526,13 @@ if(NOT ONLY_LIBRARY)
add_executable(mtd_alias_test src/mtd_alias_test.c src/mtd_alias.c)
target_include_directories(mtd_alias_test PRIVATE include src)

# What upgrade edits in the bootloader's environment, and the image it
# carries the settings across a repartition in.
add_executable(upgrade_env_test src/upgrade_env_test.c src/upgrade_env.c)
target_include_directories(upgrade_env_test PRIVATE include src)
add_executable(jffs2_test src/jffs2_test.c src/jffs2.c)
target_include_directories(jffs2_test PRIVATE include src)

# What nand-migrate decides before it touches the flash.
add_executable(nand_layout_test src/nand_layout_test.c src/nand_layout.c)
target_include_directories(nand_layout_test PRIVATE include src)
Expand Down
36 changes: 36 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,42 @@ sensors:
# sync
```

### Moving a NOR camera to another layout

`upgrade` writes a kernel and a rootfs in a new partition layout over the
running system: lite (2 MB kernel, 5 MB rootfs) to ultimate (3 MB, 10 MB) on
16 MB of NOR, for one. The bundle comes from the release archive:

```console
$ tools/upgrade_bundle.py --layout nor16m \
--firmware openipc.hi3516ev300-nor-ultimate.tgz \
--env upgrade=https://github.com/OpenIPC/builder/releases/download/latest/<profile>-nor.tgz \
-o ultimate.bundle
# ipctool upgrade /tmp/ultimate.bundle
```

What a `--layout` bundle does on the camera:

* keeps every partition in front of the kernel as it is, under this flash's
own names -- the bootloader, its environment and whatever a vendor put
there (`wtf` on XiongMai);
* edits `bootargs` and `bootcmd` rather than replacing them: only `root=`,
`mtdparts=` and the size of the kernel read change, so a vendor
bootloader's other arguments survive;
* carries the settings: the jffs2 overlay is copied, once it is read-only,
into a jffs2 image written where the new `rootfs_data` starts. The camera
comes back with its passwords, keys and configuration. `--wipe-settings`
starts it from defaults instead;
* sets the U-Boot variables given with `--env`, such as the address the new
firmware upgrades itself from.

Everything that can be refused is refused before any process is stopped:
an image larger than its partition, settings that will not fit the new
`rootfs_data`, a bootloader environment with no literal `mtdparts=` or no
single `sf read` to edit. After that every other process is stopped, the
flash filesystems go read-only, and the camera reboots when done. Keep a
backup and a UART at hand: a power cut mid-write leaves no kernel to boot.

### Sending a board to openipc.org

A camera nobody has reported yet reaches the [board
Expand Down
Loading
Loading