Skip to content

Running it on the device

Read this first

There is no release build of Chikuma and no supported install path. Chikuma does run on a real iPod classic, one development unit in daily use. This page tells how it got there, so that nobody has to rebuild it from zero and so that the risky parts carry a label.

Two kinds of operation are involved, and they are not alike. Loading something into RAM costs a reset if it goes wrong. Writing flash, or the disk's firmware partition, can leave a device that no longer boots. On this hardware, recovering one can mean opening the case, and these iPods are not manufactured any more.

What the development unit runs

Three pieces sit on the unit, each a reproduction described elsewhere on this site.

Piece Where What it does
bootloader flash Chikuma's reproduction of Apple's NOR bootloader. Boots at every power-on, draws Chikuma's boot screens, picks what to start.
OS the disk's firmware partition, as an entry of its own Checked against Chikuma's own key before it starts. Apple's RetailOS stays beside it and still boots.
disk mode started by the bootloader when a host asks Chikuma's too, and the way the OS gets onto the disk in the first place.

The boot chain has what the bootloader does differently on silicon. Bring-up on a real iPod has what the hardware refused on the way.

The host tool

On the host, everything goes through shiro, the project's own command-line tool, kept in a repository of its own. For day-to-day work it replaces an earlier Go tool and freemyipod's wInd3x. It speaks the same protocols to the real device over USB and to the emulated machine over a socket.

It is pinned to the one development unit by USB serial number, and it writes to no other iPod. With more than one iPod attached and none pinned, it writes to none at all.

How an install goes

This is the outline only.

  1. The recovery stage. The boot ROM's USB DFU mode accepts a small recovery image into RAM. On a device that has never run Chikuma, the first run of Chikuma's recovery stage needs the boot-ROM DFU exploit that wInd3x implements. It patches the ROM in RAM only, and a power cycle undoes it. Chikuma's recovery stage reproduces Apple's, with a few commands of its own for flash writes and reboots.
  2. The bootloader goes into flash through the recovery stage. The recovery stage restarts the device only when the write succeeded. From then on the device boots Chikuma's bootloader by itself.
  3. The OS is planted into the firmware partition through Chikuma's disk mode, over SCSI. Only the blocks that differ get written, then read back, and a second dry run must report nothing left to write. A command then reboots the device into the OS.

A development build of the bootloader ends every boot back in the recovery stage, so the next change loads without a button press. That build is a compile-time switch, never the default.

Once the OS runs, it reboots into the recovery stage or into disk mode when the host asks. A working device never needs the button dance again. Boot screens in flash get replaced the same way, with one flash write each.

Hazards

Every hardware precondition on this path was proved on the device before anything relied on it. Three hazards matter before touching anything.

Apple's disk mode can rewrite block 0

A vendor SCSI command in Apple's disk mode looks like a harmless reboot request. On the device it replaced the partition table, and the disk stayed unreadable to the Mac until it was restored.

A mounted Mac volume gets written

Plant through a volume that macOS has mounted read-write, reboot without unmounting, and the volume is left dirty.

Plan the way back

A RetailOS image planted with nobody watching can leave the device in a state that only a manual recovery reaches. Know the way back before you plant.

What Chikuma leaves alone

Chikuma does not need Apple's servers. It reads the library the device already has, without reformatting it, and Apple's own firmware stays on the disk beside it. It touches no content that is not already on the device you own.

Address volumes by node

A script that finds a disk image by a name glob can match the real iPod first, and then a test library lands on the device. Rebuilding the database, the Genius data and the thumbnails after that takes a full re-sync.

Tools here address volumes by the node the mount returned, never by name. The test image mounts at a path of its own, and that path refuses anything else. Tools written around Chikuma should do the same.