Get lk fixed for flashing the system partition
A patch for not requiring this step is submitted to the Fairphone Gerrit and hopefully will be accepted soon.
Install a arm eabi toolchain (eg arm-none-eabi-gcc
on Arch Linux - you have to change the toolchain prefix below to make it fit).
Also the mkbootimg
tool has to be a proper one, e.g. from LineageOS or from EFIDroid
git clone https://github.com/z3ntu/android_kernel_lk_fairphone_FP2 -b fastboot-fix
cd android_kernel_lk_fairphone_FP2
make FP2 TOOLCHAIN_PREFIX=arm-none-eabi- -j5
# get the dt.img either from lineage or compile or self etc (efidroid has one: https://github.com/efidroid/device/blob/fairphone/fp2/dt.img)
mkbootimg --base 0 --pagesize 2048 --kernel_offset 0x00008000 --ramdisk_offset 0x01000000 --second_offset 0x00f00000 --tags_offset 0x00000100 --dt dt.img --kernel build-FP2/lk.bin -o lk_boot.img
# sign_img script from https://z3ntu.github.io/2017/06/16/Signing-boot-images.html
sign_img lk_boot.img
# hold the volume button down while running the next command
fastboot boot lk_boot.img.signed
Compile and install postmarketOS
Follow https://wiki.postmarketos.org/wiki/Installation_guide (and select the Fairphone 2 in the menu).
Then run:
./pmbootstrap.py install --no-fde
./pmbootstrap.py flasher flash_kernel
./pmbootstrap.py flasher flash_system
After that, run fastboot reboot
to reboot your phone and into postmarketOS. Now you should be able to login using ssh user@172.16.42.1
with USB connected. Due to weird framebuffers on Qualcomm devices, you need to run
su; while [ ! ]; do cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode; done
in the SSH connection to get your screen to refresh (otherwise your screen will be stuck on the Fairphone splash screen).
This wont touch your data partition, so you can simply flash Android (using adb sideload for example), to get back.
If you have any general questions or need help about postmarketOS, please ask in their Matrix/IRC help channel.
Most other useful information is found in the postmarketOS Wiki.
If something Fairphone specific doesn’t work, please message me!