A successful attempt on flashing to /e/os on Fairphone 4

Hi there! This is a follow up post to the issues I ran into and expressed in this topic here: Trapped in fastboot mode with locked bootloader and corrupted /e/ OS

I decided to post my step-by-step, “type the process as I go” notes in this separate topic if by chance there would be of any use of it to the people of the forum thread above. It’s kind of lengthy, but I wanted to make sure that it’s a one-to-one thing of exactly everything I did with the phone as it came through the mail to me.

A thing to note for the people that haven’t followed along on my particular journey: This phone JUST came back from the repair shop. The phone was previously bricked because the system being “corrupted” and the get_unlock_ability flag set to 0 when trying to revert back to the official Fairphone OS. I don’t claim to be knowledgeable at all in flashing ROMs as this is my first successful attempt I’ve ever made, and all I’ve done is to follow the instructions as given here: Install /e/ on a Fairphone FP4

With all that said, here’s by lengthy list, enjoy!


Phone just received from repair, it’s unbricked and running what I’m assuming is factory settings:


Android version

11

Android security update

5 April 2022

Google Play system update

1 October 2021

Baseband version

MPSS.HI.2.0.1.c6-00447-BITRA_GEN_PACK-1,MPSS.HI.2.0.1.c6-00447-BITRA_GEN_PACK-1

Kernel version

4.19.157-perf+

#1 Thu Apr 14 02:28:28 CST 2022

Build number

FP4.FP3v.A.116.20220414

Being prompted that there’s a new update, I will ignore it this time and NOT update the system.

Wants to update to: Fairphone 4 (FP3W.A.0128)

Developer settings set:

  • OEM unlocking

  • USB debugging

/e/ image ROM downloaded:

IMG-e-1.0-r-20220526188860-stable-FP4.zip (SHA256: a72ba99e6ab2a20239972e224ccf4a13797e94c3a1084b04511fbea90beee794)

Using Windows 11 with Windows Powershell 7

Hash is correct (checked using shell):


> Get-FileHash .\IMG-e-1.0-r-20220526188860-stable-FP4.zip

Algorithm       Hash                                                                   Path

---------       ----                                                                   ----

SHA256          A72BA99E6AB2A20239972E224CCF4A13797E94C3A1084B04511FBEA90BEEE794

Assuming that “…20220526…” in the zip name is the security patch date, meaning 26th of May 2022. The documentation is out of date stating to pick security patch 2022-04-05 (which is not present in the list of downloadable stable ROMs?)

As stated on https://doc.e.foundation/devices/FP4/install:

Caution: Ensure that you flash an image with a security patch level greater than the level of the existing security patch. Failure to do so will prevent you from locking your bootloader.

26th of May 2022 is greater than my phone’s current security patch of 5th of April 2022.

Phone is currently at 63% battery before pluging it into the computer. Will be using a USB-C → USB-C cable, compatible data cable.

Reboots onto fastboot by running adb reboot bootloader directly in powershell

Doublechecking my unlock ability:

fastboot flashing get_unlock_ability

(bootloader) get_unlock_ability: 1

Phone screen (bootloader mode) states at this time “DEVICE STATE - locked”

Asking for unlock with fastboot flashing unlock

After automatic reboot, I power it off at the “first-setup” screen, hold down Volume Down and inserts the USB-C cable again to get into bootloader mode. It now states “DEVICE STATE - unlocked”. The flag “get_unlock_ability” still remains 1.

Asking for unlocking critical with fastboot flashing unlock_critical

Same reboot into bootloader mode procedure as previous step. Exact same statements and flags.

I copy the commands stated in the documentation into a file called “install.ps1” that I save in the same folder as the unzipped ROM folder:


fastboot flash bluetooth_b bluetooth.img

fastboot flash devcfg_a devcfg.img

fastboot flash devcfg_b devcfg.img

fastboot flash dsp_a dsp.img

fastboot flash dsp_b dsp.img

fastboot flash modem_a modem.img

fastboot flash modem_b modem.img

fastboot flash xbl_a xbl.img

fastboot flash xbl_b xbl.img

fastboot flash tz_a tz.img

fastboot flash tz_b tz.img

fastboot flash hyp_a hyp.img

fastboot flash hyp_b hyp.img

fastboot flash keymaster_a keymaster.img

fastboot flash keymaster_b keymaster.img

fastboot flash abl_a abl.img

fastboot flash abl_b abl.img

fastboot flash boot_a boot.img

fastboot flash boot_b boot.img

fastboot flash recovery_a recovery.img

fastboot flash recovery_b recovery.img

fastboot flash dtbo_a dtbo.img

fastboot flash dtbo_b dtbo.img

fastboot flash vbmeta_system_a vbmeta_system.img

fastboot flash vbmeta_system_b vbmeta_system.img

fastboot flash vbmeta_a vbmeta.img

fastboot flash vbmeta_b vbmeta.img

fastboot flash super super.img

fastboot flash aop_a aop.img

fastboot flash aop_b aop.img

fastboot flash featenabler_a featenabler.img

fastboot flash featenabler_b featenabler.img

fastboot flash imagefv_a imagefv.img

fastboot flash imagefv_b imagefv.img

fastboot flash multiimgoem_a multiimgoem.img

fastboot flash multiimgoem_b multiimgoem.img

fastboot flash qupfw_a qupfw.img

fastboot flash qupfw_b qupfw.img

fastboot flash uefisecapp_a uefisecapp.img

fastboot flash uefisecapp_b uefisecapp.img

fastboot flash xbl_config_a xbl_config.img

fastboot flash xbl_config_b xbl_config.img

fastboot flash core_nhlos_a core_nhlos.img

fastboot flash core_nhlos_b core_nhlos.img

fastboot erase userdata

fastboot erase metadata

fastboot --set-active=a

I initiate the script with .\install.ps1


Sending 'bluetooth_a' (940 KB)                     OKAY [  0.028s]

Writing 'bluetooth_a'                              OKAY [  0.005s]

Finished. Total time: 0.073s

Sending 'bluetooth_b' (940 KB)                     OKAY [  0.029s]

Writing 'bluetooth_b'                              OKAY [  0.005s]

Finished. Total time: 0.043s

Sending 'devcfg_a' (42 KB)                         OKAY [  0.003s]

Writing 'devcfg_a'                                 OKAY [  0.002s]

Finished. Total time: 0.021s

Sending 'devcfg_b' (42 KB)                         OKAY [  0.013s]

Writing 'devcfg_b'                                 OKAY [  0.002s]

Finished. Total time: 0.024s

Sending 'dsp_a' (65536 KB)                         OKAY [  1.501s]

Writing 'dsp_a'                                    OKAY [  0.181s]

Finished. Total time: 1.704s

Sending 'dsp_b' (65536 KB)                         OKAY [  1.501s]

Writing 'dsp_b'                                    OKAY [  0.146s]

Finished. Total time: 1.656s

Sending 'modem_a' (146252 KB)                      OKAY [  3.380s]

Writing 'modem_a'                                  OKAY [  0.356s]

Finished. Total time: 3.748s

Sending 'modem_b' (146252 KB)                      OKAY [  3.379s]

Writing 'modem_b'                                  OKAY [  0.325s]

Finished. Total time: 3.713s

Sending 'xbl_a' (3298 KB)                          OKAY [  0.078s]

Writing 'xbl_a'                                    OKAY [  0.011s]

Finished. Total time: 0.102s

Sending 'xbl_b' (3298 KB)                          OKAY [  0.083s]

Writing 'xbl_b'                                    OKAY [  0.010s]

Finished. Total time: 0.104s

Sending 'tz_a' (2940 KB)                           OKAY [  0.071s]

Writing 'tz_a'                                     OKAY [  0.010s]

Finished. Total time: 0.112s

Sending 'tz_b' (2940 KB)                           OKAY [  0.075s]

Writing 'tz_b'                                     OKAY [  0.011s]

Finished. Total time: 0.094s

Sending 'hyp_a' (395 KB)                           OKAY [  0.020s]

Writing 'hyp_a'                                    OKAY [  0.004s]

Finished. Total time: 0.037s

Sending 'hyp_b' (395 KB)                           OKAY [  0.018s]

Writing 'hyp_b'                                    OKAY [  0.004s]

Finished. Total time: 0.033s

Sending 'keymaster_a' (237 KB)                     OKAY [  0.016s]

Writing 'keymaster_a'                              OKAY [  0.004s]

Finished. Total time: 0.032s

Sending 'keymaster_b' (237 KB)                     OKAY [  0.008s]

Writing 'keymaster_b'                              OKAY [  0.004s]

Finished. Total time: 0.024s

Sending 'abl_a' (148 KB)                           OKAY [  0.006s]

Writing 'abl_a'                                    OKAY [  0.002s]

Finished. Total time: 0.022s

Sending 'abl_b' (148 KB)                           OKAY [  0.012s]

Writing 'abl_b'                                    OKAY [  0.003s]

Finished. Total time: 0.024s

Sending 'boot_a' (98304 KB)                        OKAY [  2.257s]

Writing 'boot_a'                                   OKAY [  0.227s]

Finished. Total time: 2.500s

Sending 'boot_b' (98304 KB)                        OKAY [  2.257s]

Writing 'boot_b'                                   OKAY [  0.262s]

Finished. Total time: 2.531s

Sending 'recovery_a' (98304 KB)                    OKAY [  2.262s]

Writing 'recovery_a'                               OKAY [  0.213s]

Finished. Total time: 2.489s

Sending 'recovery_b' (98304 KB)                    OKAY [  2.264s]

Writing 'recovery_b'                               OKAY [  0.221s]

Finished. Total time: 2.497s

Sending 'dtbo_a' (24576 KB)                        OKAY [  0.562s]

Writing 'dtbo_a'                                   OKAY [  0.056s]

Finished. Total time: 0.631s

Sending 'dtbo_b' (24576 KB)                        OKAY [  0.567s]

Writing 'dtbo_b'                                   OKAY [  0.059s]

Finished. Total time: 0.637s

Sending 'vbmeta_system_a' (4 KB)                   OKAY [  0.008s]

Writing 'vbmeta_system_a'                          OKAY [  0.001s]

Finished. Total time: 0.022s

Sending 'vbmeta_system_b' (4 KB)                   OKAY [  0.003s]

Writing 'vbmeta_system_b'                          OKAY [  0.001s]

Finished. Total time: 0.014s

Sending 'vbmeta_a' (8 KB)                          OKAY [  0.009s]

Writing 'vbmeta_a'                                 OKAY [  0.002s]

Finished. Total time: 0.023s

Sending 'vbmeta_b' (8 KB)                          OKAY [  0.010s]

Writing 'vbmeta_b'                                 OKAY [  0.001s]

Finished. Total time: 0.022s

Sending sparse 'super' 1/4 (768921 KB)             OKAY [ 17.798s]

Writing 'super'                                    OKAY [  0.000s]

Sending sparse 'super' 2/4 (732017 KB)             OKAY [ 28.289s]

Writing 'super'                                    OKAY [  0.001s]

Sending sparse 'super' 3/4 (740578 KB)             OKAY [ 17.608s]

Writing 'super'                                    OKAY [  0.001s]

Sending sparse 'super' 4/4 (584331 KB)             OKAY [ 20.839s]

Writing 'super'                                    OKAY [  0.001s]

Finished. Total time: 84.752s

Sending 'aop_a' (173 KB)                           OKAY [  0.005s]

Writing 'aop_a'                                    OKAY [  0.004s]

Finished. Total time: 27.490s

Sending 'aop_b' (173 KB)                           OKAY [  0.010s]

Writing 'aop_b'                                    OKAY [  0.004s]

Finished. Total time: 0.022s

Sending 'featenabler_a' (84 KB)                    OKAY [  0.007s]

Writing 'featenabler_a'                            OKAY [  0.004s]

Finished. Total time: 0.024s

Sending 'featenabler_b' (84 KB)                    OKAY [  0.008s]

Writing 'featenabler_b'                            OKAY [  0.004s]

Finished. Total time: 0.022s

Sending 'imagefv_a' (524 KB)                       OKAY [  0.017s]

Writing 'imagefv_a'                                OKAY [  0.004s]

Finished. Total time: 0.034s

Sending 'imagefv_b' (524 KB)                       OKAY [  0.019s]

Writing 'imagefv_b'                                OKAY [  0.004s]

Finished. Total time: 0.034s

Sending 'multiimgoem_a' (13 KB)                    OKAY [  0.004s]

Writing 'multiimgoem_a'                            OKAY [  0.002s]

Finished. Total time: 0.019s

Sending 'multiimgoem_b' (13 KB)                    OKAY [  0.010s]

Writing 'multiimgoem_b'                            OKAY [  0.002s]

Finished. Total time: 0.021s

Sending 'qupfw_a' (53 KB)                          OKAY [  0.007s]

Writing 'qupfw_a'                                  OKAY [  0.001s]

Finished. Total time: 0.022s

Sending 'qupfw_b' (53 KB)                          OKAY [  0.011s]

Writing 'qupfw_b'                                  OKAY [  0.006s]

Finished. Total time: 0.026s

Sending 'uefisecapp_a' (121 KB)                    OKAY [  0.005s]

Writing 'uefisecapp_a'                             OKAY [  0.004s]

Finished. Total time: 0.023s

Sending 'uefisecapp_b' (121 KB)                    OKAY [  0.008s]

Writing 'uefisecapp_b'                             OKAY [  0.003s]

Finished. Total time: 0.023s

Sending 'xbl_config_a' (94 KB)                     OKAY [  0.011s]

Writing 'xbl_config_a'                             OKAY [  0.003s]

Finished. Total time: 0.033s

Sending 'xbl_config_b' (94 KB)                     OKAY [  0.011s]

Writing 'xbl_config_b'                             OKAY [  0.003s]

Finished. Total time: 0.024s

Sending 'core_nhlos_a' (108412 KB)                 OKAY [  2.507s]

Writing 'core_nhlos_a'                             OKAY [  0.242s]

Finished. Total time: 2.764s

Sending 'core_nhlos_b' (108412 KB)                 OKAY [  2.505s]

Writing 'core_nhlos_b'                             OKAY [  0.242s]

Finished. Total time: 2.758s

******** Did you mean to fastboot format this ext4 partition?

Erasing 'userdata'                                 OKAY [  0.684s]

Finished. Total time: 0.691s

Erasing 'metadata'                                 OKAY [  0.017s]

Finished. Total time: 0.023s

Setting current slot to 'a'                        OKAY [  0.008s]

Finished. Total time: 0.010s

get_unlock_ability flag is still 1 at this point. Decide to boot into the OS before doing ANY further step (locking the bootloader) by pressing “START” on the bootloader screen.

e logo with a bouncing dot is showing as a splash screen. “First-time setup” screen for e is displaying. I go through the setup process as minimally as possible. I take screenshots of the important phone information on the settings pages just in case.

OEM unlocking in developer options are still unlocked. USB debugging is turned off, turning it back on again.

Now for the scariest part… trying to lock the bootloader…

Powering off the phone and starts it up in bootloader mode. It states “DEVICE STATE - unlocked” and get_unlock_ability is set to 1. I’m running ´´´fastboot flashing lock_critical´´´.

It reboots, e splash logo showing, “first-time setup” screen shows. I go through it again to verify no bootloader settings have been changed. Screenshots I took previously matches with this. OEM unlocking is still on, USB debugging once again defaulted to off, I’m switching it on again.

I boot the phone back into bootloader. “DEVICE STATE - unlocked”, get_unlock_ability is 1. I cross my fingers and runs fastboot flashing lock

SUCCESS! It boots like normal!

OEM unlocking is still on, and at this point I think it should be okay to turn it off… But I’ll wait for someone else’s input on it first before I move on with that.

(EDIT: A lot of markdown errors displaying things wrong, my apologies)

5 Likes

This is date of this update and will give no hint about the security patch date, thats normal.although I would have expected the May security patch to be included in an update end of may…so for you it would mean it was actually not greater🤔

The Android security patches are always coming only once per month (I think 5th is normal) and will then be included by the OS developer (just very rough explanation).

4 Likes

Hello,

@AmberHearts: First, thank you very much to offer a detailed tutorial to install E/OS on the Fairphone 4. I’m looking for this kind of thing.

I have some questions to ask to you.

  1. Have you enabled and connected Wifi as the install guide ask ? I really want to know why we need to enable and connect Wifi. Is it really necessary ?
  2. As you I don’t update my system. So, the security patch level of my device (default) is lower than the e/os security patch level. I guess that I will not encounter problems when I will lock the bootloader ?
  3. Before running the first ‘adb reboot bootloader’ command, I guess that the USB-C cable is plugged to the computer ?

Thanks.

Hi Aln,
I don’t this should be treated as a tutorial per say, more like a reference point what someone else did :open_mouth: Although I’ve been thorough here with my notes I don’t want to take responsibility in case it won’t work for you or anyone else (Your phone might have some setting or update mine didn’t have etc.).

However, I don’t mind answering the questions you have :slightly_smiling_face:

  1. I did not bother with any WiFi things, it didn’t seem necessary at all
  2. This part I am a bit unsure of myself. As @yvmuell explained in the comment above, the custom rom you download doesn’t seem to give a clue of what security patch it is (at least not by its filename).
    However, if you go to Settings → About phone → Android version, and your Android security patch is “5 April 2022”, it should be the same as the one I had when I did this process.
    A question back: Do you mean you have never done any kind of update on the phone since you received it? How long ago did you buy it? :thinking:
  3. Yeah, the USB-C cable was plugged in and Settings → System → Developer options → USB debugging was enabled. I have no idea if this is only necessary to have the phone go into bootloader directly, because every other time I needed to have the system go into bootloader, I only used the method described in this section: How to boot into bootloader mode

Hope it helps a bit at least! ^^ As I mentioned before, it’s not really a tutorial, more like a thing to refer to that seemed to work, and once again I cannot guarantee it will work for anyone else (but it’s better than nothing I guess :open_mouth:)

@AmberHearts: Hi,

A question back: Do you mean you have never done any kind of update on the phone since you received it? How long ago did you buy it?

No, I don’t update my phone since I received it (a few weeks) because I want to install e/os on it. So, is it a problem if I want to install e/os on it ? I check the security patch level on my phone and it is older than the last security level of e/os and yours.

Regards.

Hello,

I have a question. The IMG-e-1.0-r-20220526188860-stable-FP4.zip file contains img files. Three files in the zip file are not used: dtb.img, ramdisk.img, ramdisk-recovery.img. In the installation guide, there is no fastboot flashing commands for these three files. Why ? Is the installation guide is update or are these files not necessary ? I want to understand.

Thanks.