rockbox/utils
Andrew Rice aed1945c5d mks5lboot: support the iPod Nano 3G
Registers the Nano 3G (platform ipodnano3g, model number 117, "nn3g"
header) so mks5lboot can build DFU installers and uninstallers for it,
adds its original bootloader to the dualboot code, and lists the
platform in the usage text and the README.

The target has to be named ipodnano3g rather than nano3g: the dualboot
Makefile derives the source directory and the piezo driver's file name
from it.

The per-target OF hash table is the substantive change. identify_fw()
decrypts the IM3 header's data_sign with the hardware UKEY and looks it
up in of_sha[], and anything not listed is taken to be a Rockbox
bootloader. The table held only iPod Classic firmware, so on a Nano 3G
the installer took Apple's own bootloader for a Rockbox one and gave up,
and the uninstaller would have refused to restore it. Both bail out
before writing, so nothing is damaged, but neither can work. The table
is now per target, and lists the bootloader of every Nano 3G firmware
release, 1.0.1 to 1.1.3.

The decrypted data_sign is the first 16 bytes of the SHA-1 of the
plaintext bootloader, so it is the same on every unit. Each release's
updater image (aupd, GID-encrypted, in the ipsw) carries that bootloader,
0x1f800 bytes, at the start of a NOR image. The aupd of each release was
decrypted on a Nano 3G with the hardware GID key and hashed on the host.
For 1.1.3 the result matches the data_sign read from a 4GB unit (model
MA978) whose NOR had never been written to, and the bootloader in its
aupd is byte-identical to the decrypted copy the installer relocated on
that unit. 1.1.2 and 1.1.3 ship the same bootloader.

dualboot.c is generated, and only the Nano 3G arrays are added. The iPod
Classic arrays are left byte-for-byte as they were: rebuilding them with
a different compiler changes their bytes, which would ship an untested
installer to Classic users for no reason.

The dualboot Makefile did not build from the current tree for any
target, which the committed blobs, older than both problems, had hidden.
config.h needs autoconf.h, which tools/configure generates per target,
so each target now takes a CONFIGDIR_<target> pointing at a configured
bootloader build for it, e.g.

  make CONFIGDIR_ipod6g=../../../build-ipod6g-bl \
       CONFIGDIR_ipodnano3g=../../../build-nano3g-bl

And the linker script is preprocessed with __ASSEMBLER__ defined, under
which config.h now emits the ldmpc/ldrpc assembler macros that ld
rejects; the sed that cleans it now also drops .macro, .endm and .syntax
lines and the macro bodies. Before these fixes the iPod Classic build
failed first on the missing autoconf.h and then with a linker syntax
error; with them it builds both blobs.

Tested on that unit, with s5l8702pwnage delivering the images through
Apple's DFU, and again with mks5lboot's own --bl-inst and --bl-uninst:
the installer put Rockbox in NOR, the unit then booted
Rockbox, and holding MENU booted Apple's firmware from the relocated
original bootloader; the uninstaller restored it and the unit booted
Apple's firmware again. Those images carried a table holding only the
1.1.3 entry. The Nano 3G blobs in dualboot.c were then rebuilt with the
Makefile for the full table - with the one-entry table the rebuild was
byte-identical to what the tested images carried - and mks5lboot
--bl-inst with them installed Rockbox on the same unit, which booted
Rockbox and, holding MENU, Apple's firmware. The uninstaller built with
the full table has not been run, and no firmware other than 1.1.3 has
been installed to or uninstalled from on hardware. For the iPod Classic,
the uninstaller DFU this builds is byte-identical to the one built
before this change.

AI provenance: developed with Claude Opus 5 (Anthropic), used through
Claude Code. The model wrote most of the code and this message under
Andrew Rice's direction. Any hardware testing described above was
carried out by Andrew Rice, who is responsible for this change.

Change-Id: I4b2fa692ac4110192ccbde0f1790b0ae2d1c73f5
2026-09-15 16:22:11 -04:00
..
AMS/hacking amsinfo: save files with .bin extension 2011-12-13 03:01:16 +00:00
analysis chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
atj2137 chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
bootchart chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
bspatch bspatch: Fix compile warnings on Apple Clang 21 2026-06-29 23:11:33 -04:00
bzip2 chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
chinachippatcher tools: fix up build warnings 2026-06-26 21:38:57 -04:00
cmake rbutilqt/themeeditor: Allow specifying the Apple code signing ID using an environment variable 2026-07-29 22:55:40 +03:00
common rbutil: Update tarball scripts 2025-04-02 08:21:38 -04:00
disassembler/arm Make sure files which aren't windows-specific use \n line endings only 2010-06-17 16:59:51 +00:00
e200rpatcher chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
e200tool chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
editors chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
hwpatcher chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
hwstub chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ibassoboot/jni rbutil: Merge rbutil with utils folder. 2021-12-24 18:05:53 +01:00
imxtools mkimxboot: Fix up a large pile of compile warnings with -Wextra 2026-06-22 20:59:18 -04:00
ingenic_tools chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ipod chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
ipodpatcher ipodpatcher: Correct use of FormatMessageA() for windows builds 2026-07-04 12:36:38 -04:00
jz4740_tools chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
jz4760_tools chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
jztool chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mkamsboot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mkimxboot mkimxboot: Fix potentially unaligned pointer access of a packed structure 2026-07-01 17:27:49 +03:00
mkmpioboot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mknwzboot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mkrk27boot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mks5lboot mks5lboot: support the iPod Nano 3G 2026-09-15 16:22:11 -04:00
mktccboot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
mkzenboot chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
MTP chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
nwztools utils: Fix a small pile of warnings 2026-06-17 10:39:57 -04:00
rbpms Add iPod Nano 2G post-mortem memory dumper by Michael Sparmann 2025-08-14 20:45:19 -04:00
rbutilqt FS#13993 - rbutl push decompression onto a separate thread (Alessio Lenzi) 2026-09-01 07:36:48 -04:00
reggen-ng stm32h743: add intitial register definitions 2025-04-21 14:15:31 -04:00
regtools chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rk27utils utils: More warning fixes 2026-06-17 13:56:29 -04:00
rknanoutils chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
rockbox_api chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
samsungtools chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
sansapatcher sansapatcher: Correct use of FormatMessageA() for windows builds 2026-07-04 13:04:05 -04:00
scsi chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
skinupdater chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
tcctool chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
themeeditor desktop: Drop the 'version' fields 2026-07-29 10:27:35 -04:00
time-sync time-sync: Fix arguments order in linker command 2025-01-16 16:05:18 -05:00
tomcrypt tomcrypt: Set target macOS version. 2020-10-31 19:20:36 +01:00
tools rbutil: Merge rbutil with utils folder. 2021-12-24 18:05:53 +01:00
ypr0tools Samsung YP-R1: fix OF boot shortcut 2020-07-07 17:52:17 +00:00
zenutils chore: Get rid of *all* vestigal CVS '$Id:$' tags 2026-06-01 16:01:18 -04:00
CMakeLists.txt rbutil: Rephrase optional component "not found" messages 2026-07-09 22:40:44 -04:00
libtools.make rbutil: Merge rbutil with utils folder. 2021-12-24 18:05:53 +01:00
parse_testcodec.rb utils/parse_testcodec.rb: add support for Opus files 2015-07-17 00:51:22 +02:00