Writing /var/lib/dokuwiki/wiki.project-insanity.org/data/meta/iphone7.meta failed
iphone7
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
iphone7 [2020/04/22 10:16] – [new writeup (18.04.20)] 46.223.163.211 | iphone7 [2021/10/31 10:42] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | * checkra.in | ||
+ | * https:// | ||
+ | * https:// | ||
+ | <code bash> | ||
+ | pacman -S usbmuxd libusbmuxd checkra1n-cli sshpass wget git unzip | ||
+ | iproxy 2222 44 | ||
+ | cd /tmp | ||
+ | git clone https:// | ||
+ | cd projectsandcastle/ | ||
+ | wget https:// | ||
+ | unzip linux-sandcastle.zip | ||
+ | sshpass -p " | ||
+ | sshpass -p " | ||
+ | make | ||
+ | # enter dfu | ||
+ | checkra1n -cp | ||
+ | ./ | ||
+ | </ | ||
+ | * some commands need root access | ||
+ | ===== linux-buildroot ===== | ||
+ | <code bash> | ||
+ | pacman -S cpio rsync bc | ||
+ | git clone https:// | ||
+ | cd sandcastle-buildroot | ||
+ | make menuconfig # exit and save | ||
+ | make | ||
+ | lzma -z output/ | ||
+ | mv output/ | ||
+ | </ | ||
+ | ===== linux-sandcastle ===== | ||
+ | <code bash> | ||
+ | pacman -S arm-none-eabi-gcc | ||
+ | git clone https:// | ||
+ | cd linux-sandcastle | ||
+ | #export PATH="/ | ||
+ | export ARCH=arm64 | ||
+ | #export CROSS_COMPILE=arm-none-eabi- | ||
+ | export CROSS_COMPILE=aarch64-unknown-linux-gnu- | ||
+ | make hx_h9p_defconfig | ||
+ | make -j6 | ||
+ | make dtbs | ||
+ | </ | ||
+ | new | ||
+ | <code bash> | ||
+ | pacman -S aarch64-linux-gnu-gcc | ||
+ | git clone https:// | ||
+ | cd linux-sandcastle | ||
+ | export ARCH=arm64 | ||
+ | export CROSS_COMPILE=aarch64-linux-gnu- | ||
+ | make hx_h9p_defconfig | ||
+ | # copy ramdisk.cpio.gz from buildroot (file has maybe other name) | ||
+ | make -j4 | ||
+ | lzma -z arch/ | ||
+ | # make dtbs | ||
+ | </ | ||
+ | |||
+ | ===== custom rootfs ===== | ||
+ | <code bash> | ||
+ | find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > / | ||
+ | </ | ||
+ | extract cpio | ||
+ | <code bash> | ||
+ | cpio --extract --make-directories --format=newc --no-absolute-filenames < initramfs.cpio | ||
+ | </ | ||
+ | |||
+ | ===== complete new writeup ===== | ||
+ | create rootfs | ||
+ | <code bash> | ||
+ | sudo pacman -S pmbootstrap | ||
+ | [onny@onnuex postmarketos_rootfs]$ pmbootstrap init | ||
+ | [10:16:43] Location of the ' | ||
+ | [10:16:43] Work path [/ | ||
+ | [10:16:45] NOTE: pmaports path: / | ||
+ | [10:16:45] Choose your target device vendor (either an existing one, or a new one for porting). | ||
+ | [10:16:45] Available vendors (48): alcatel, amazon, asus, bq, chuwi, fairphone, finepower, fujitsu, google, gp, hisense, htc, huawei, infocus, jolla, leeco, lenovo, lg, medion, meizu, motorola, nextbit, nobby, nokia, oneplus, oppo, ouya, pine64, planet, purism, qemu, raspberry, samsung, semc, sharp, sony, surftab, t2m, tablet, teclast, tokio, wiko, wileyfox, wingtech, xiaomi, yu, zte, zuk | ||
+ | [10:16:45] Vendor [qemu]: | ||
+ | [10:16:47] Available codenames (2): aarch64, amd64 | ||
+ | [10:16:47] Device codename [aarch64]: | ||
+ | [10:16:49] Which kernel do you want to use with your device? | ||
+ | [10:16:49] Available kernels (2): | ||
+ | [10:16:49] * lts: Alpine LTS kernel | ||
+ | [10:16:49] * virt: Alpine Virt kernel (minimal, no audio) | ||
+ | [10:16:49] Kernel [lts]: virt | ||
+ | [10:17:07] Username [onny]: | ||
+ | [10:17:08] Available user interfaces (12): | ||
+ | [10:17:08] * none: No graphical environment | ||
+ | [10:17:08] * gnome: (Wayland) Gnome Shell (not for armhf) | ||
+ | [10:17:08] * i3wm: (X11) Tiling WM (keyboard required) | ||
+ | [10:17:08] * kodi: (Wayland) 10-foot UI useful on TV's | ||
+ | [10:17:08] * mate: (X11) MATE Desktop Environment, | ||
+ | [10:17:08] * phosh: (Wayland) Mobile UI developed for the Librem 5 (works only with numeric passwords!) | ||
+ | [10:17:08] * plasma-desktop: | ||
+ | [10:17:08] * plasma-mobile: | ||
+ | [10:17:08] * plasma-mobile-extras: | ||
+ | [10:17:08] * shelli: Plain console with touchscreen gesture support | ||
+ | [10:17:08] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION!) | ||
+ | [10:17:08] * weston: (Wayland) Reference compositor (demo, not a phone interface) | ||
+ | [10:17:08] * xfce4: (X11) Lightweight GTK+2 desktop (stylus recommended) | ||
+ | [10:17:08] User interface [weston]: phosh | ||
+ | [10:17:19] Build options: Parallel jobs: 5, ccache per arch: 5G | ||
+ | [10:17:19] Change them? (y/n) [n]: | ||
+ | [10:17:24] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or " | ||
+ | [10:17:24] Extra packages [none]: | ||
+ | [10:17:31] Your host timezone: Europe/ | ||
+ | [10:17:31] Use this timezone instead of GMT? (y/n) [y]: | ||
+ | [10:17:35] Device hostname (short form, e.g. ' | ||
+ | [10:17:38] Zap existing chroots to apply configuration? | ||
+ | [sudo] password for onny: | ||
+ | [10:17:46] % rm -rf / | ||
+ | [10:17:46] % rm -rf / | ||
+ | [10:17:47] Cleared up ~1223 MB of space | ||
+ | [10:17:47] WARNING: The chroots and git repositories in the work dir do not get updated automatically. | ||
+ | [10:17:47] Run ' | ||
+ | [10:17:47] Done! | ||
+ | pmbootstrap install | ||
+ | cd ~/ | ||
+ | sudo find . -print0 | cpio --null --create --verbose --format=newc | gzip --best > / | ||
+ | </ | ||
+ | compile kernel | ||
+ | <code bash> | ||
+ | sudo pacman -S aarch64-linux-gnu-gcc | ||
+ | cd /tmp | ||
+ | git clone https:// | ||
+ | cd linux-sandcastle | ||
+ | export ARCH=arm64 | ||
+ | export CROSS_COMPILE=aarch64-linux-gnu- | ||
+ | make hx_h9p_defconfig | ||
+ | cp / | ||
+ | make -j4 | ||
+ | </ | ||
+ | flash kernel | ||
+ | <code bash> | ||
+ | sudo pacman -S checkra1n-cli git unzip # custom pi repo required | ||
+ | cd /tmp | ||
+ | git clone https:// | ||
+ | cd projectsandcastle/ | ||
+ | wget https:// | ||
+ | unzip linux-sandcastle.zip | ||
+ | make | ||
+ | sudo checkra1n -cp # reboot into pogo, might require dfu mode on phone | ||
+ | cp / | ||
+ | lzma -z linux-sandcastle/ | ||
+ | sudo ./ | ||
+ | </ | ||
+ | kernel boot args | ||
+ | < | ||
+ | earlycon=hx_uart, | ||
+ | |||
+ | CONFIG_CMDLINE=" | ||
+ | </ | ||
+ | ===== boot from nand and apfs partition ===== | ||
+ | < | ||
+ | / | ||
+ | mount apfs / | ||
+ | /apfs/nand | ||
+ | |||
+ | +#define LOOP_SET_FD | ||
+ | +#define LOOP_SET_STATUS | ||
+ | +#define LOOP_SET_BLOCK_SIZE | ||
+ | + | ||
+ | +#define LOOP_DEVICE_NAME | ||
+ | +#define LOOP_BACKING_FILE | ||
+ | + | ||
+ | +#define APFS_MOUNT_POINT | ||
+ | +#define APFS_DEVICE_NAME | ||
+ | +#define APFS_MAX_VOL | ||
+ | |||
+ | </ | ||
+ | * look for | ||
+ | * nvme | ||
+ | * fstab | ||
+ | * apfs | ||
+ | < | ||
+ | ls / | ||
+ | / | ||
+ | create new: newfs_apfs -A -v Android -e / | ||
+ | mkdir -p /tmp/mnt | ||
+ | mount -t apfs ${DISK} / | ||
+ | / | ||
+ | / | ||
+ | # reclaiming space, just mount volume and remove nand | ||
+ | </ | ||
+ | |||
+ | ===== new writeup (18.04.20) ===== | ||
+ | access dfu | ||
+ | <code bash> | ||
+ | checkra1n -c | ||
+ | iproxy 2222 44 # leave this process running in the background during ssh access | ||
+ | </ | ||
+ | Wait until reboot, than access the iPhone via ssh | ||
+ | <code bash> | ||
+ | sshpass -p " | ||
+ | newfs_apfs -A -v Android -e / | ||
+ | / | ||
+ | mkdir /tmp/mnt | ||
+ | mount -t apfs / | ||
+ | umount /tmp/mnt | ||
+ | </ | ||
+ | on host | ||
+ | <code bash> | ||
+ | pmbootstrap init | ||
+ | pmbootszrap install | ||
+ | sshpass -p " | ||
+ | </ | ||
+ | * access dfu mode (volume + power ...) | ||
+ | bla | ||
+ | * next steps | ||
+ | * xterm mount partition | ||
+ | * list files | ||
+ | * ssh via wifi | ||
+ | <code bash> | ||
+ | pacman -S create_ap | ||
+ | create_ap wlan0 wlan0 test | ||
+ | </ | ||
+ | <code bash> | ||
+ | /bin/mount -t apfs -o ro, | ||
+ | /bin/ls /mnt | ||
+ | /bin/mknod -m755 loop0 b 7 0 | ||
+ | /bin/mount -t ext4 -o loop, | ||
+ | /bin/ls /hostfs | ||
+ | /bin/cat / | ||
+ | </ | ||
+ | try | ||
+ | <code bash> | ||
+ | /bin/mknod -m755 / | ||
+ | </ | ||
+ | * next mount image | ||
+ | * init pivot_root | ||
+ | * initrd | ||
+ | possible kernel boot arguments | ||
+ | <code bash> | ||
+ | /vmlinuz ro initrd=/ | ||
+ | kernel ... root=/ | ||
+ | </ | ||
+ | <file - custom-cpio/ | ||
+ | #!/bin/sh | ||
+ | # devtmpfs does not get automounted for initramfs | ||
+ | /bin/mount -t devtmpfs devtmpfs /dev | ||
+ | |||
+ | /bin/mount -t apfs -o ro, | ||
+ | / | ||
+ | mkdir /tmp/hostfs | ||
+ | /bin/mount -t ext4 -o ro /dev/loop0 /tmp/hostfs | ||
+ | |||
+ | exec 0</ | ||
+ | exec 1>/ | ||
+ | exec 2>/ | ||
+ | exec /sbin/init " | ||
+ | </ | ||
+ | <file - init> | ||
+ | #!/bin/sh | ||
+ | # devtmpfs does not get automounted for initramfs | ||
+ | /bin/mount -t devtmpfs devtmpfs /dev | ||
+ | |||
+ | /bin/mkdir -p /proc /dev /sys /mnt /tmp | ||
+ | /bin/mount -t proc proc /proc | ||
+ | /bin/mount -t sysfs sysfs /sys | ||
+ | /bin/mknod / | ||
+ | /sbin/mdev -s | ||
+ | /bin/mkdir -p /new_root | ||
+ | |||
+ | /bin/mount -t apfs -o ro, | ||
+ | / | ||
+ | /bin/mount -t ext4 -o ro /dev/loop0 /new_root | ||
+ | |||
+ | exec 0</ | ||
+ | exec 1>/ | ||
+ | exec 2>/ | ||
+ | |||
+ | exec / | ||
+ | #exec /sbin/init " | ||
+ | </ | ||
+ | * init reference postmarketos https:// | ||
+ | * http:// | ||
+ | * next | ||
+ | * use small postmarketos initramfs | ||
+ | * https:// | ||
+ | * steps mounting tmpfs, overlayfs https:// | ||
+ | * (nich so wichtig, custom initramfs bootstrap https:// | ||
+ | * overlayfs script https:// | ||
+ | * notes on entering dfu | ||
+ | * turn off phone | ||
+ | * press 4+10 seconds after logo appears | ||
+ | <file - custom-cpio/ | ||
+ | #!/bin/sh | ||
+ | # devtmpfs does not get automounted for initramfs | ||
+ | /bin/mount -t devtmpfs devtmpfs /dev | ||
+ | |||
+ | /bin/mkdir -p /proc /dev /sys /mnt /tmp | ||
+ | /bin/mount -t proc proc /proc | ||
+ | /bin/mount -t sysfs sysfs /sys | ||
+ | /bin/mknod / | ||
+ | /sbin/mdev -s | ||
+ | |||
+ | /bin/mkdir -p /mnt/apfs /mnt/ro /mnt/rw | ||
+ | |||
+ | /bin/mount -t apfs -o ro, | ||
+ | |||
+ | / | ||
+ | /bin/mount -t ext4 -o ro /dev/loop0 /mnt/ro | ||
+ | |||
+ | /bin/mount -t tmpfs tmpfs /mnt/rw | ||
+ | /bin/mkdir -p / | ||
+ | /bin/mkdir -p /sysroot | ||
+ | |||
+ | /bin/mount -t overlay -o lowerdir=/ | ||
+ | |||
+ | exec 0</ | ||
+ | exec 1>/ | ||
+ | exec 2>/ | ||
+ | |||
+ | killall telnetd mdev msm-fb-refresher 2>/ | ||
+ | umount /boot | ||
+ | umount /proc | ||
+ | umount /sys | ||
+ | umount /dev/pts | ||
+ | umount /dev | ||
+ | |||
+ | exec switch_root /sysroot /sbin/init | ||
+ | #exec /sbin/init " | ||
+ | </ | ||
+ | uncompress initramfs | ||
+ | <code bash> | ||
+ | sfdisk -l ~/ | ||
+ | mount -t ext4 -o loop, | ||
+ | zcat / | ||
+ | </ | ||
+ | < | ||
+ | CONFIG_USB_ETH=y | ||
+ | CONFIG_USB_RNDIS=y | ||
+ | </ | ||
+ | * next debug initramfs bootup via usb ethernet | ||
+ | * https:// | ||
+ | <code bash> | ||
+ | echo MESSAGE > /dev/kmsg | ||
+ | dmesg > / | ||
+ | </ | ||
+ | * telnet debug shell https:// | ||
+ | * https:// | ||
+ | usb cdc acm | ||
+ | * https:// | ||
+ | * CONFIG_USB_G_SERIAL https:// | ||
+ | on iphone | ||
+ | <code bash> | ||
+ | modprobe g_serial | ||
+ | </ | ||
+ | on archlinux | ||
+ | <code bash> | ||
+ | modprobe cdc_acm | ||
+ | </ | ||
+ | next | ||
+ | <code bash> | ||
+ | make hx_h9p_defconfig_2 | ||
+ | </ | ||
+ | * console=ttyGS0, | ||
+ | <code bash> | ||
+ | pmbootstrap chroot -r | ||
+ | $ echo " | ||
+ | </ | ||
+ | * https:// | ||
+ | <code bash> | ||
+ | echo ' | ||
+ | |||
+ | ttyGS0:: | ||
+ | </ | ||
+ | <code bash> | ||
+ | sudo minicom -D / | ||
+ | </ | ||
+ | ===== new ===== | ||
+ | <code bash> | ||
+ | rc-service lightdm restart | ||
+ | logread | ||
+ | / | ||
+ | / | ||
+ | </ | ||
+ | |||
+ | <file - / | ||
+ | [...] | ||
+ | # Run gnome-session through a login shell so it picks | ||
+ | # variables from / | ||
+ | [ -z " | ||
+ | export WLR_BACKENDS | ||
+ | exec " | ||
+ | </ | ||
+ | <code bash> | ||
+ | dbus-run-session / | ||
+ | </ | ||
+ | * fbdev | ||
+ | * llvmpipe, LIBGL_ALWAYS_SOFTWARE=1 + mesa | ||
+ | * softpipe | ||
+ | <code bash> | ||
+ | LIBGL_ALWAYS_SOFTWARE=1 SKIP_GNOME_SESSION=1 / | ||
+ | </ | ||
+ | * https:// |