Skip to content

Latest commit

 

History

History
338 lines (278 loc) · 16.8 KB

install.md

File metadata and controls

338 lines (278 loc) · 16.8 KB

install

orchard install NAME

installs a distribution on the connected iPad or iPhone. It is the graphical installer's flow on a terminal: it shows the same steps, asks the same questions, and takes an option where a script cannot answer.

The source

orchard install [SOURCE], or --index SOURCE:

SOURCE Is
a distribution's name the newest release of OrchardLinux/NAME on GitHub (its index.toml)
an https:// URL a release index, or one release's manifest
a file the same, with the files it names read from beside it
nothing, in a distribution checkout the release its last orchard build made

A release index (kind = "orchard.index") pins one release's manifest by size and SHA-256; a manifest (kind = "orchard.install") pins every file of the release. Each file is checked before it is used.

What happens

  1. The device. Connect it running iPadOS or iOS, unlocked and trusted. The run says what it found and in which mode (Finding the device).
  2. The storage. The system goes into the space after iPadOS. --split [GB] resizes iPadOS first to make that space: with a number it is the system's size, without one it is asked. --no-split installs into the existing split. With a terminal and neither, the run offers both to choose from. Resizing runs a helper in iPadOS (The helper that resizes). On iPadOS 12 to 14 a system snapshot (iPadOS's update snapshot, or checkra1n's orig-fs) can keep APFS from shrinking far below its size although iPadOS uses much less. The run shows what iPadOS uses and what the snapshot holds, and asks before the size whether to remove it, whatever the room (it can't be undone; apps and data stay). Where iPadOS runs from the snapshot, it asks whether to restart and remove it: the snapshot is renamed, the device restarts without it, the round into DFU mode and the start follow, and the run removes it without asking again. --remove-snapshot or --yes answer the question for scripts.
  3. DFU mode. To start the install system, orchard restarts the device into recovery mode and guides it from there into DFU mode (DFU mode).
  4. Erasing. Partitions after iPadOS are erased. They are listed, and the run goes on after a typed yes, or with --yes.
  5. The account. The user's password (8 characters or more) and the lock screen PIN (6 digits) are asked twice each, or read from --password-file FILE and --pin-file FILE (-: the next line of stdin, password first). --ssh lets this computer sign in over SSH with its keys, and remembers the user for orchard shell (remote.md); --no-ssh doesn't and doesn't ask.
  6. Writing. The system is written and finished on the device, which then starts it.

A storage that is not split, with no --split, ends the run with exit status 5 and says so.

Into a disk file

--disk [FILE] installs the system into a disk file on this computer instead of the device's storage: the device and iPadOS stay as they are. The run is the same until the install system is up; then the file is named, made and served to the device over the USB cable, and the install system installs onto it as onto its own storage. The device then restarts into iPadOS.

  • Without FILE (orchard install omarchy-a --disk) the file is <distribution>-<board>.img, such as omarchy-a-j71b.img, in Orchard's disks folder: ~/Library/Application Support/Orchard/disks on macOS, ~/.local/share/orchard/disks on Linux. It holds the user's data, so it is not in the cache.
  • A file of that name already there is never overwritten without asking: the run asks whether to make another one beside it (-2, -3 …, the default) or replace it, which erases it and asks again. --another and --replace answer without a terminal.
  • A new file is 32 GB (ORCHARD_DISK_GB changes it) and sparse: it takes only the space written. It is a whole disk with a GPT, laid out as an install on the device; its boot partition says which device and system it was made for (orchard/disk.json).

--disk takes the place of --split and --no-split.

Without a terminal

Nothing is asked. What no option answers ends the run with exit status 5 and names the option: --yes, --password-file, --pin-file, --split GB, --replace or --another (with --disk), --apple-id with --apple-password-file. Apple's sign-in code can only be typed, so a first sign-in with the Dopamine or Amethyst helper needs a terminal. Resizing and SSH are off unless their options are given, and a system snapshot stays unless --remove-snapshot or --yes is given.

orchard --json install NAME --yes --no-ssh \
    --password-file pw --pin-file pin --wait 600

A preview of the next release

Every merge to main publishes the nightly: the command line, the graphical installer and the launcher, everything a release carries. The next release is that nightly, promoted: the same files with only the version written in. To try it before it is one, this installs the nightly command line and the nightly graphical installer, stamped as Omarchy A's, which then installs the newest Omarchy A release:

curl -fsSL https://github.com/OrchardLinux/omarchy-a/releases/latest/download/install.sh | ORCHARD_TOOLS_SCRIPT=https://github.com/OrchardLinux/tools/releases/download/nightly/install.sh ORCHARD_RELEASE_URL=https://github.com/OrchardLinux/omarchy-a/releases/download/installer-nightly sh

--cli after sh -s -- runs the nightly installer in the terminal instead. Omarchy A stamps its installer-nightly from tools' nightly within ten minutes of it. Orchard, the launcher, is replaced only when the installed one is older than the nightly's. orchard update (without --nightly) later returns to the release.

Finding the device

  • Nothing is connected: the run asks for the device and waits.
  • Running iPadOS or iOS: the run goes on from there.
  • In recovery or DFU mode: the run goes on too. The device can't say which iPadOS it has then, so with --split the run asks whether it is 15 or later, or 12 to 14; --ios VERSION answers that.
  • In pwned DFU mode: the install comes next. With --split the run asks for a normal restart first, since resizing needs iPadOS.
  • Running Linux, or in a loader: the run says how to restart it normally and goes on once it runs iPadOS.
  • A device that needs a board of its own to start (iPhone XR and the other A12 devices): the run says so, and later waits for the device in pwned DFU mode, which you bring it into with that board.
  • More than one iPhone or iPad is connected: nothing goes on until only one is. --ecid or --location names the one a run is for; then no other is found or started, but two connected still stop it (devices.md).
  • Another orchard works on the device: it is shown as in use, and the run goes on when that has finished (devices.md).
  • --wait SECONDS ends the run with exit status 3 when no device shows up in that time; 0, the default, waits for ever.

The helper that resizes

--access ROUTE names how iPadOS is entered for the resize; without it the first route that fits the device and its version is taken.

Route Is
palera1n the device goes through DFU mode, and palera1n starts iPadOS with the helper (iPadOS 15 and later)
checkra1n the same with checkra1n (iOS 12 to 14)
dopamine a helper app is signed with your Apple ID and installed while iPadOS runs; no DFU mode for this step
amethyst the same in the Amethyst app, for iOS 12.0 to 13.7 (where the data puts it); the device restarts once on the way

With dopamine and amethyst the run asks for the Apple ID and its password (--apple-id ID, --apple-password-file FILE), then for the code Apple sends to your devices, where Apple asks for one. They go only to Apple. A sign-in that Xcode or an earlier run left on this computer is used without asking. The run then lists the steps on the device (Developer Mode, trusting the Apple ID, opening the app) and goes on when the app answers; r installs the app again.

amethyst always signs with xtool: Xcode builds nothing for iOS 12 and 13, so an Xcode sign-in is not used, and a computer xtool has no build for can't take this route (the run says so). iOS 12 and 13 have no Developer Mode: the steps are trusting the Apple ID and opening the app. The first time, the device restarts once: open Orchard Installer again when it is back and tap Continue again.

DFU mode

  • In a terminal: orchard restarts the device into recovery mode, and a guided run takes it into DFU mode. Enter starts it; the lit step counts down while you hold the buttons, and orchard restarts the device at the right moment. Esc (or q) stops it until that restart has gone out. When the device comes back in recovery mode instead, the steps stand again. DFU mode reached by hand counts as before; t shows tips.
  • Left in recovery mode: orchard recovery auto-boot on switches auto-boot back on, saves it and restarts the device into iOS (low-level.md).
  • Without a terminal (stdin or stderr is piped or redirected): nobody can press Enter, so the DFU steps show, and the run waits for DFU mode reached by hand. With --json the recovery events are written either way (reference.md).
  • A start that fails asks for DFU mode again and tries again.
  • --wait SECONDS also limits this wait.

Which devices

A board the orchard data marks supported. A board it does not know, or one it marks otherwise, is refused with exit status 4 before anything is started on it. The release must cover the board: for a 32-bit board (iPad mini, iPad 2) it needs a 32-bit root, which a release's index names beside the 64-bit one.

The 32-bit boards

The 32-bit boards (A5 to A6X) install and start the same way as every other board; only the way in differs. The device has to be in DFU mode from a Raspberry Pi Pico (checkm8), or in kDFU from its jailbroken iOS, before install or launch runs, as for run: nothing of ours enters their boot ROM, and no helper runs in their iOS.

  • The install system starts behind m1n1's 32-bit build by the ibss route (the default), or through Cascadia's loader (--autogo).
  • The disk is iOS's, partitioned with LwVM. The system goes into free space of at least 8 GiB, or replaces a Linux partition; nothing of iOS is resized or touched, so the free space has to be there already.
  • The install adds two entries to the partition header: a boot partition of 512 MiB, which m1n1 starts the system from, and the root. The boot partition goes into the smallest other free run that holds it, so that the root keeps the whole chosen free space (on an iPhone 5, the piece of Data's released tail that lies apart from the rest), else into the first chunks of the chosen free space. The install system writes the new header only if it adds exactly these over free space and changes nothing else.
  • launch then starts m1n1 by the same route, which boots the boot partition's default entry, as on every other board.
  • A board whose firmware recipe takes files from iOS's kernel or root file system cannot have its firmware made yet: their IMG3 kernel and encrypted disk image are not read yet (TODO.md), and the install stops there.

How the device is entered

A boot route takes the device from DFU mode to the install system. Which routes a device has follows from its chip, by routes.toml in the board data; the first that fits is taken.

Route Is
palera1n palera1n runs the boot ROM exploit and starts Pongo, which takes the install system
checkra1n the same with checkra1n
ibss gaster enters the boot ROM, and Apple's own iBSS (and iBEC, where the chip loads one), patched, takes the install system. The firmware is fetched from Apple, and its keys are read from the device the first time

The data also names autogo (--autogo), the 32-bit boards' route into Cascadia's loader, taken only when asked for by name: install starts the install system through it, run a payload.

--boot ROUTE names one, else ORCHARD_BOOT (reference.md). --ibss is short for --boot ibss. A route that does not work on the device's chip ends the run and says which do. palera1n and checkra1n are pinned by size and SHA-256 and kept in the cache, as is gaster.

Resizing iPadOS has its own route, whatever the boot route (The helper that resizes).

--palera1n-version 3 (the 3.0 beta, the default) or 2.4 names the palera1n that runs, else ORCHARD_PALERA1N_BETA. launch takes it too.

When the device doesn't come back

On some Linux computers the device drops off USB after the exploit and stays away. orchard then switches its USB port off and on again, 10 seconds after it dropped. --port-reset SECONDS sets that wait (up to 15), and 0 turns the reset off; else ORCHARD_PORT_RESET_SECONDS. launch takes it too.

When the exploit never gets in

On some Linux computers palera1n and checkra1n keep trying the boot ROM exploit without ever getting in while the computer is idle, and get in within seconds while it is under load. --busy-cpu (or ORCHARD_BUSY_CPU=1, which the installer and launcher windows read too) makes that load: the exploit tool runs on one CPU core of its own and every other core is kept busy until the tool has ended (palera1n and checkra1n: when PongoOS is up; gaster, which gets the same: when it is in the boot ROM). The fans may spin up for that time. install, launch and run take it.

--m1n1 FILE starts a local m1n1 instead of the published one: the plain build for palera1n and checkra1n, the Mach-O build for ibss. launch takes it too.

Board data from before routes.toml has the one route there was then, palera1n; to name another, use newer data (--data DIR).

On an Apple silicon Mac

If the device never reaches PongoOS while it is plugged straight into a USB-C port of an Apple silicon Mac, connect it through a USB 2.0 hub, such as a USB-C dock, and start again. Seen on a MacBook Pro (M1 Pro) with an iPad 6 (Wi-Fi) on iPadOS 17.7.11: plugged in directly, it never got into DFU mode; with the same cable through a dock whose ports sit behind a USB 2.0 hub (1a40:0801), palera1n reached PongoOS on the first try.

A kernel of your own

orchard install NAME --kernel DIR [--device BOARD]

installs the published release with the kernel built from the kernel tree DIR: the release's root image as it is, and in place of its platform layer (kernel, modules, device trees, initrd) one made here.

  • Which board: --device BOARD, else the device attached in DFU mode. The kernel is built for that board's platform, so with neither the run ends and asks for one. A device of another platform that then shows up is refused.
  • The build comes first and is build's: the same cache, the same recipes (--data DIR, else orchard's nightly), the tree built as it is, inside itself. What the recipes print goes to stderr. The layer is then made by the recipe a release's layers come from and kept in the cache (work/platform-layer/).
  • The install goes on as any other. The layer is checked by size and SHA-256 like a download, the install system starts with its kernel, and its files go into the system as they are: no published kernel package wraps a layer built here, so the system's package manager does not own or update this kernel.

A board that no release covers yet can be installed on this way: --data DIR with board data that describes it, --kernel DIR with a kernel that has its device tree, and --m1n1 FILE where the published m1n1 does not start it. The layer covers every board the data lists for the platform.

What it uses

  • The release's root image, platform layer, install tools and logo. With --kernel DIR the platform layer is built here (A kernel of your own).
  • Orchard's Pongo and m1n1, and the board data: orchard's newest release's, or --data DIR.
  • The kernel package of a pacman-based release, from OrchardLinux/packages.
  • The board's peripheral firmware, built from Apple's firmware by its recipe (data-and-firmware.md).

The run's log is --log FILE, else logs/DATE-TIME-cli.log in the cache (reference.md).

Ctrl-C

At a question it ends the run at once. While the storage is split or the system is written the first press only warns. Otherwise it ends the run; a device still running the resize helper is restarted first. Exit status 8.

Events and exit statuses: reference.md.