Format:OpenWrt sysupgrade tar
| On this wiki | Facts · Code · Notes · Topics |
|---|
The OpenWrt sysupgrade archive for NAND devices: a tar (optionally gzipped) holding one sysupgrade-<board>/ directory with a CONTROL file and the kernel, root and optional dtb images.
Layout
Built by OpenWrt scripts/sysupgrade-tar.sh (lines 63-83): directory sysupgrade-<board>/ containing
CONTROL: one lineBOARD=<board>(line 64);root: the rootfs, for SquashFS padded to a multiple of 1024 with ddconv=sync(lines 65-73);kerneland optionallydtb, copied unchanged (lines 75-76);
then tar --sort=name --owner=0 --group=0 --numeric-owner -cvf sysupgrade.tar sysupgrade-<board> (line 83), so entries are sorted and owned by uid/gid 0.
The NAND upgrade code (package/base-files lib/upgrade/nand.sh) accepts such a tar if the directory sysupgrade-<board> has a non-empty CONTROL, where commas in the board name are replaced by underscores in the directory name (lines 480-501), and it takes the first sysupgrade-*/ directory of the archive (line 319). The file may be gzip compressed (identify_if_gzip). Board names look like vendor,model.
Reversing notes
- Extract with
tar, then identifykernel(often a Format:U-Boot legacy uImage or Format:FIT image) androot(Format:SquashFS or UBI, see Format:UBI and UBIFS). - Unverified: the fwtool metadata and signature trailers described in Format:OpenWrt fwtool trailer are appended by the image build (
append-metadata) to images that use that build step, which for a tar would put them after the tar's end-of-archive blocks. - Unverified: other sysupgrade images (non-NAND) are raw flash images rather than a tar.