Few notes about iOS 10 dualboot

This isn't comprehensive guide, just few notes about problems you might run into if you're trying to dualboot iOS 10 manually and their solving. I haven't dug in it deep, so there must be more elegant solutions

Bootchain

boot-command=upgrade

In iOS 10 bootloaders, upgrade boot-command's behaviour is slightly changed. For some unobvious reason iBEC (iBEC and iBoot are same thing now, by the way) refuses to mount upgrade partition. Well, at least it did in my case. Also now it doesn't spawn shell after upgrade failure, but writes failure reports to NVRAM and then reboots instead

How upgrade partition is mounted in iOS 6

Let's look how upgrade partition was mounted in old iOS 6 bootloader:


First it sets boot-partition variable to 2, without syncing with NVRAM though:

set_iboot_variable("boot-partition", "2", 0);

Then it calls special function (mount_hfs_with_iboot_vars()) which mounts HFS with index set in boot-partition variable from block device which name is set in boot-device variable. Its (partial) disassembly:


If partition was mounted succesfully, iBEC loads APTicket, Apple logo, Device Tree and so on

How upgrade partition is mounted in iOS 10

In iBoot Stage 2 from iOS 10 mount_hfs_with_iboot_vars() function was replaced by some new one:


As was mentioned above, for some unobvious reason it doesn't work when you set up everything manually. Luckily mount_hfs_with_iboot_vars() is still here (it's used to load diags image from filesystem, for example):


Patch upgrade routines to make it use mount_hfs_with_iboot_vars() as it has always been in iOS 4, 5, 6 and 7 (not sure about 8):


Now upgrade partition should be mounted just fine

Apple logo patch

It's not needed anymore. It's hard to believe, but iOS 10 bootloaders are able to load and show it to you without any patches

no-effaceable-storage

How no-effaceable-storage works in iOS 6: But in iOS 10 LwVM locker is ignored:


...and fixed key used instead. You can try deal with it by removing encryption flag from partition entry, but I simply left Effaceable Storage enabled. In this case you have to copy system keybag from first system to second one

Activation

Apple disallows activation on iOS versions lower than 10.0 if your device was ever activated on iOS 10.0 or newer. Although today (20.01.18) this policy seems to be cancelled, I still don't recommend to take a risk. Instead you should copy your activation record from first system to second one

Activation is just plist called activation_record.plist if your device has got baseband or pod_record.plist if not. On old devices (e.g. iPhone 4 or 3GS) it was called wildcard_record.plist
Not sure about other versions. Although iOS 10 stores its activation record plist somewhere else, it still can read it from /private/var/root/Library/Lockdown/activation_records

Important note: in order to prevent reactivation add albert.apple.com to /etc/hosts

Also don't try to remove setup assistant application, this will make your device stuck with Apple logo and progress line on display forever

Data volume

If you set protect flag to HFS volume and it has ever been mounted on iOS 9+, this volume won't be mountable on iOS 8 and lower. Don't forget about it and copy all the data you want (keybag, activation records, something else maybe) before first boot of iOS 10

Also don't forget to copy /private/var/* directory structure to iOS 10's data volume, it's important

What you should never do on dualbooted iOS 10

Never do anything related to data-protection — changing passcode, obliteration and probably backups. These actions lead to wipe of keys in Effaceable Storage, that would also affect your first system. As result, you won't be able to boot it and will be forced to restore

Known issues

For some unobvious reason, applications signed with developer certificate (e.g. installed through Xcode or Cydia Impactor) can't be installed