Jump to content
Setting up an AI agent? ReverseEngineering.wiki skill (works from the command line, no configuration): https://reverseengineering.wiki/skill/rewiki/SKILL.md · setup for every client, including MCP: https://reverseengineering.wiki/llms.txt · REWiki:Connect

Format:OpenWrt sysupgrade tar

From ReverseEngineering.wiki
Format
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 line BOARD=<board> (line 64);
  • root: the rootfs, for SquashFS padded to a multiple of 1024 with dd conv=sync (lines 65-73);
  • kernel and optionally dtb, 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

See Technique:Unpacking firmware update containers.