1 # y3-image 2 3 `y3-image` packages a prepared UBI image in the legacy Inteno/Genexis Y3 4 version-8 format. It is intended for OpenWrt factory images using the 5 `singlepureubi bpartit32` layout. It does not generate UBI, UBIFS, kernels, 6 Broadcom boot bundles, or boot metadata. Its input is copied unchanged. 7 8 The output contains a 1024-byte NUL-padded text header, the UBI payload, 9 and a 32-byte lowercase hexadecimal MD5 over the header and payload. All 10 offsets are absolute byte offsets in the Y3 file. There is no timestamp, 11 random identifier, signature, or installation script. 12 13 ## Building and testing 14 15 Build with the repository's CMake configuration, or build just this tool: 16 17 ```sh 18 cc -O2 -Wall -Wextra -o y3-image src/y3-image.c src/md5.c 19 python3 tests/test_y3_image.py ./y3-image 20 ``` 21 22 The tests use Python's independent MD5 implementation. Optional 23 `--vendor FILE.y3` arguments verify existing legacy vendor checksums, 24 extract their UBI sections and check that repackaging preserves those 25 sections exactly. Vendor firmware files are not included in this repository. 26 27 ## Genexis XG6846B example 28 29 Given a complete `openwrt-xg6846b.ubi`, prepared by the board image recipe: 30 31 ```sh 32 y3-image -i openwrt-xg6846b.ubi -o openwrt-xg6846b.y3 \ 33 -c 6846 -m PANTHER -a 'all arm_xscale' \ 34 -r OpenWrt-SNAPSHOT -u GNX -g '<source-revision>' 35 ``` 36 37 Chip, model and architecture identifiers are supplied by the caller, so 38 the packager can also serve other routers using this Y3 layout. Use the 39 identifiers expected by the target firmware, which may differ from the 40 OpenWrt build architecture or marketing name. This does not imply support 41 for newer GenXOS loader/bootfs migration images or signed-only updaters. 42 43 For the XG6846B single-bank layout, the prepared UBI image should contain: 44 45 | Volume ID | Name | Type | Contents | 46 |---:|---|---|---| 47 | 0 | `rootfs_0` | dynamic | OpenWrt UBIFS root filesystem | 48 | 1 | `METADATA` | dynamic | Committed bank-0 metadata | 49 | 2 | `METADATACOPY` | dynamic | Redundant bank-0 metadata | 50 | 10 | `kernel_0` | static | Broadcom boot bundle | 51 52 `kernel_0` must include the existing **`cferam.000`** RAM-stage loader, 53 alongside the appropriately wrapped new kernel (`vmlinux.lz`) and board 54 DTB (`96846.dtb`). The first 4 MiB alone does not contain the complete CFE 55 boot chain. Volume names, IDs, filesystem sizing and boot records are the 56 board recipe's responsibility; this utility only checks the input's UBI 57 magic and version, not its volume layout or bootability. 58 59 Writable UBIFS can use the remaining UBI space without a second rootfs or 60 a separate `rootfs_data` volume. The board recipe should generate a compact 61 UBI image with rootfs autoresize, not pad the file to NAND capacity. The 62 default maximum **total Y3 size** is `0x03a20000` (58.125 MiB), the limit in 63 the examined XG6846B CFE. `-s` can set another target's limit, up to 64 `INT32_MAX`; increasing it does not change the target bootloader's limit. 65 66 ## Loader preservation and installation 67 68 The header explicitly sets `cfe`, `rescue`, `vmlinux` and `ubifs` section 69 lengths to zero: the kernel and filesystem are inside the sole `ubi` 70 payload. No option adds a replacement CFE ROM, rescue or newer-style loader 71 payload. The required zero-length section fields and offsets remain in 72 the header because the CFE parser requires some of them even when absent. 73 74 Static analysis of XG6846B CFE `1.0.38-164.255-IOP2.2` shows that its 75 singlepureubi Y3 installer skips ROM/rescue replacement for these lengths, 76 erases the whole old UBI area, writes the new UBI image and commits its 77 first bank. On the 256 MiB NAND with 128 KiB eraseblocks, that UBI area is 78 `[0x00400000, 0x0ff80000)`. The final 512 KiB reserved for bad-block tables 79 is excluded. The kernel partition definition and UBI sizing must agree 80 with the intended target geometry. 81 82 **The stock CFE installer still rewrites NVRAM in the first 4 MiB.** An 83 image with no ROM payload preserves loader code, but does not guarantee 84 that region is byte-for-byte unchanged or never erased. For a strict 85 no-write requirement below `0x00400000`, a separate RAM-resident installer 86 must extract the UBI section and write only the UBI MTD partition. 87 88 The vendor Linux `sysupgrade` instead extracts individual volumes and 89 updates an alternate bank. Giving it a single-bank Y3 does not cause it to 90 replace the complete existing UBI layout. These are installer behaviors, 91 not actions that a Y3 container can enforce. 92 93 Do not append an OpenWrt metadata trailer after the Y3 checksum: the CFE 94 parser checks the total length and expects the MD5 in the final 32 bytes. 95 Successful packaging and checksum verification do not validate the new 96 kernel's load address, DTB handoff, root mount or hardware operation.
This page was automatically generated by LXR 0.3.1. • OpenWrt