Jump to content

Installation from recovery mode: Difference between revisions

From postmarketOS Wiki
Sideload: sideloading with pmbootstrap is fixed now :)
Fresh.job (talk | contribs)
link to recovery page
 
(16 intermediate revisions by 11 users not shown)
Line 4: Line 4:


== Preparation ==
== Preparation ==
* [[Installing_pmbootstrap|Install pmbootstrap]]
* Install [[pmbootstrap]]
* Install [https://twrp.me TWRP] (or another recovery system) on your phone
* Install [https://twrp.me TWRP] (or another [[Recovery|recovery system]]) on your phone


== Create the recovery zip image ==
== Create the recovery zip image ==
Similar to a [[Installation_guide|regular installation]], but add <code>--android-recovery-zip</code> this time. If your device supports full disk encryption (see the FDE column in [[Devices]]), you can remove the <code>--no-fde</code> argument.
Follow the [[pmbootstrap]] article to build your own image, but add <code>--android-recovery-zip</code> to the install action. If your device supports full disk encryption (see the FDE column in [[Devices]]), you can add the <code>--fde</code> argument.


<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
$ pmbootstrap init
$ pmbootstrap init
$ pmbootstrap install --no-fde --android-recovery-zip
$ pmbootstrap install --android-recovery-zip
</syntaxhighlight>
</syntaxhighlight>


By default, this will install to the <code>system</code> partition of your Android device. If you want to install to a different partition (e.g. because your <code>system</code> partition is too small), use the <code>--recovery-install-partition</code> parameter:
By default, this will install to the <code>system</code> partition of your Android device. If you want to install to a different partition (e.g. because your <code>system</code> partition is too small), use the <code>--recovery-install-partition</code> parameter. For example, to install to the data partition:


<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
$ pmbootstrap install --no-fde --android-recovery-zip --recovery-install-partition data
$ pmbootstrap install --android-recovery-zip --recovery-install-partition=data
</syntaxhighlight>
</syntaxhighlight>


Line 24: Line 24:
This allows downloading the zip file on the fly directly from your computer. If you don't want to sideload, you can also [[#Copy_the_generated_image_to_an_SD_card|copy the generated zip file to an SD card]].
This allows downloading the zip file on the fly directly from your computer. If you don't want to sideload, you can also [[#Copy_the_generated_image_to_an_SD_card|copy the generated zip file to an SD card]].
* Boot the recovery system
* Boot the recovery system
* Unmount the partitions (Click on "Mount", then deselect all checkboxes)
* Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
* Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
* Connect your phone to your PC
* Connect your phone to your PC
Line 51: Line 52:
</syntaxhighlight>
</syntaxhighlight>


== Copy the generated image to an SD card ==
== Photos ==
Instead of sideloading, you can run <code>pmbootstrap export</code> and copy the <code>pmos-*.zip</code> file to an SD card. Insert it into your phone, boot into the recovery system, and select "Install". Then navigate to the zip file, and the postmarketOS installation should begin.
<gallery>
 
File:Postmarketos-android-recovery-installer.jpeg|thumb|left|postmarketos-android-recovery-installer 1.0.1 running in TWRP on [[Google Nexus 4 (lg-mako)]]
== Rebooting ==
</gallery>
TWRP reports that no OS has been installed. This happens, because it can not detect postmarketOS installations ({{issue|1451}}). Just ignore it and reboot into your fresh postmarketOS installation.


== See also ==
== See also ==
* [https://postmarketos.org/blog/2017/09/03/100-days-of-postmarketos/#interoperability 100 days of postmarketOS: Interoperability]
* [https://postmarketos.org/blog/2017/09/03/100-days-of-postmarketos/#interoperability 100 days of postmarketOS: Interoperability]
* [https://gitlab.postmarketos.org/postmarketOS/postmarketos-android-recovery-installer Source code for the recovery installer]
* [[Android Recovery]]: general tips and tricks for postmarketOS and the recovery system
* [[Android Recovery]]: general tips and tricks for postmarketOS and the recovery system
[[Category:Guide]]

Latest revision as of 21:38, 23 January 2025

Most Android devices have a "recovery" partition, on which a second kernel and initramfs can be installed. The recovery systems installed there allow overwriting the main OS with a special zip file, and it is possible to generate such a file for postmarketOS.

Preparation

Create the recovery zip image

Follow the pmbootstrap article to build your own image, but add --android-recovery-zip to the install action. If your device supports full disk encryption (see the FDE column in Devices), you can add the --fde argument.

$ pmbootstrap init
$ pmbootstrap install --android-recovery-zip

By default, this will install to the system partition of your Android device. If you want to install to a different partition (e.g. because your system partition is too small), use the --recovery-install-partition parameter. For example, to install to the data partition:

$ pmbootstrap install --android-recovery-zip --recovery-install-partition=data

Sideload

This allows downloading the zip file on the fly directly from your computer. If you don't want to sideload, you can also copy the generated zip file to an SD card.

  • Boot the recovery system
  • Unmount the partitions (Click on "Mount", then deselect all checkboxes)
  • Click on "Advanced / ADB Sideload", then "Swipe to start sideload"
  • Connect your phone to your PC
  • Start the sideloading process from your PC:
$ pmbootstrap flasher --method=adb sideload

Sideload without pmbootstrap

If sideloading with pmbootstrap fails (it was broken in #1638), you can do it without pmbootstrap as a workaround. Install adb on your host Linux distribution (usually in an android-tools package that you can install with your distribution's package manager), then run the following commands. The special cd is necessary, because adb can't resolve the symlink on its own.

$ pmbootstrap export
[07:48:04] NOTE: To export the rootfs image, run 'pmbootstrap install' first (without the 'sdcard' parameter).
[07:48:07] Export symlinks to: /tmp/postmarketOS-export
[07:48:07]  * initramfs-lg-mako (Initramfs)
[07:48:07]  * boot.img-lg-mako (Fastboot compatible boot.img file, contains initramfs and kernel)
[07:48:07]  * vmlinuz-lg-mako (Linux kernel)
[07:48:07]  * pmos-lg-mako.zip (Android recovery flashable zip)
[07:48:07] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[07:48:07] Done
$ cd $(dirname $(readlink /tmp/postmarketOS-export/pmos-*.zip))
$ adb sideload pmos-lg-mako.zip
loading: 'pmos-lg-mako.zip'...
connecting...
Total xfer: 1.08x

Photos

See also