English

FP2: How to disable ZIP file verification on self-compiled recovery?

Continuing the discussion from FP2 Softbricked - Recovery Help:

I’ve read the complete wiki post and searched that forum thread, but am still not sure what you’re referring to. @lklaus Can you quote the actual changes that have to be made to the source?

Are you keen on building your own custom recovery or do you just need to turn off zip file verification? In the latter case the easiest solution would be the one i pointed out here:

It’s under the point

But I think it’s definitely better to check twrp. I forgot that when posting, as my “solution” was just an ugly hack

Ultimately, I’d like to have a completely (or as far as feasible) self-compiled system on my FP2. And I think I currently have that, including a self-compiled recovery, as I’ve successfully followed the build instructions at [quote=“wiki, post:1, topic:11600”]
Compile your own FP2 ROM
[/quote] but without the [quote=“wiki, post:1, topic:11600”]
Modifying the official image by installing a modified recovery and side-loading the packages you want
[/quote]
part (I’ve used Max_S’s approach for rooting) and a recovery.img image was part of the build results that I flashed onto my FP2. After flashing that and other images from the build results to the partitions of the respective name, the recovery mode’s menu showed my computer’s username, as did the kernel and system info within Android, so I’m reasonably confident that building and flashing actually worked.

I’d now like to (temporarily) switch back to the official ROM (see below why) but hadn’t made any backups of it that I could flash onto my FP2.

In SatStat (installed from F-Droid), I noticed that no measurements for the sensors (acceleration/gravity, rotation, magnetic field, orientation, temperature, air pressure, light, relative humidity, proximity) were displayed. I don’t know whether FP2 has all of these sensors, but it must have some of them. I suspected it might be a problem with the app, thus looked for another one that would show sensor readings. Found and installed Androsens 2, but that also didn’t show any values. I then noticed that (e.g. in the pre-shipped SMS app) orientation didn’t change with the phone’s position, although auto-rotate was enabled in the settings.

So I now like to know whether I’ve got a hardware problem or a (probably kernel-/driver-/operating system-level) software problem that keeps Android from reading the sensors. As FP2 doesn’t seem to have an operating system independent (started from the recovery mode, IIRC) test mode as the FP1 had, I think the easiest way to check is by trying with the official ROM. Unfortunately, I didn’t test that when I still had that installed (but I think at least auto-rotate worked) and hadn’t made backups before flashing my self-built images.

I was able to revert the kernel to the stock one by extracting and flashing boot.img from http://storage.googleapis.com/fairphone-updates/FP2-gms36-1.1.7-ota.zip

But I don’t know how to flash the images for the other partitions (especially system.img) from the zip file. They don’t seem to be included, or at least not in .img format. Applying the ZIP file whole (without extracting manually) through the recovery menu failed due to the signature verification that my self-built recovery seems to do.

Ah, I did see that, but didn’t recognize it was what you were referring to, as I thought you were talking about disabling the stock recovery’s validation mechanism by changing its source, rather than using a completely different recovery system.

1 Like

My hacked solution did change the recovery as delivered with osos, which I guess is the same as stock recovery. I deactivated the zip verification, and also added a few busybox commands, as only then it was possible to install SuperSU. But as this recovery is very minimalistic, I think twrp is a way better solution

1 Like

My phone got softbricked in early january because I didn’t know how easy it is to accomplish this.
But this thread gave me motivation and I could finally get my FP2 to boot again. Yay!
Hopefully this will be useful to someone, here is what I did:

  1. Format a sdcard using the FP2 of my spouse
  2. Copy the FP2-gms36-1.1.7-ota.zip to the sdcard
  3. Insert the sdcard into my FP2
  4. Modify the source code and build recovery.img (see below for details)
  5. fastboot flash recovery out/target/product/FP2/recovery.img

  6. Boot FP2 into bootloader by pressing and holding vol down(edit: thanks, @tphysm) while it is powered on
  7. fastboot reboot

  8. Wait a few minutes
  9. ???
  10. PROFIT

Modify the source code to disable signature verification

Please help me improving this step!

In the docker container:

$ vi bootable/recovery/verifier.h

Edit the line

#define VERIFY_FAILURE        1

to

#define VERIFY_FAILURE        0

This will still display the error message while updating the OTA.zip, but it won’t abort.

Build the recovery.img:

# make recoveryimage
1 Like

Nice to hear that you were able to get your phone working again! :wink: I want to note that you may have a typo in here:

You need Vol Down (instead of Vol Up) + Power Button to get into bootloader mode. Moreover, you should do that before flashing the recovery (i.e. before step 5). :wink: