[MOD] Boot Bridge for Sony ELF

AdrianDC

Recognized Developer
Dec 22, 2009
2,206
12,943
208
Île-de-France
adriandc.github.io


Code:
#include <std_disclaimer.h>
/*
 * Your warranty is now void.
 *
 * I am not responsible for bricked devices, dead SD cards,
 * thermonuclear war, or you getting fired because the alarm app failed. Please
 * do some research if you have any concerns about features included in this ROM
 * before flashing it! YOU are choosing to make these modifications, and if
 * you point the finger at me for messing up your device, I will laugh at you.
 */


About the project
Boot Bridge for Sony ELF is born out of an idea to create support
of systemless tools like SuperSU on the Sony ELF bootimages.

The structure being different from regular Android boot partitions,
these tools never worked to edit the content of the boot image
present on devices like the Xperia SP, T, TX, V, ...

Boot Bridge for Sony ELF allows you to choose the systemless zip
by simply replacing the file install/install.zip with the one to flash.

Warning: BootBridge for Sony ELF is meant to be used on custom ROMs.
For stock ROMs, you'd need to patch the ROM (bootimage securities) first.
Please refer to the currently supported devices list in the second post.

When you flash the Boot Bridge zip, a fake regular bootimage is created
with the contents of the original ELF partition, mapped in the fstab,
then the install.zip is automatically flashed as if you did yourself,
and finally the ELF partition is updated accordingly.

Boot Bridge for Sony ELF also supports being used with MultiROM secondary ROMs.

The project is an extension of the libbootimg originally created by Tasssadar,
that I then reworked to add Sony ELF boot support for Xperia MultiROM.​



Downloads (Unlocked Bootloader only)


Preview of the installation


OPTION 1) Root with Magisk by topjohnwu
Magisk (Latest version) : https://forum.xda-developers.com/apps/magisk/official-magisk-v7-universal-systemless-t3473445

  • Rename the downloaded zip to install.zip
  • Open the Boot Bridge zip with a zip manager
  • Replace the file install/install.zip with the new one
  • Flash the new Boot Bridge zip in the TWRP recovery
  • Reboot to Android


OPTION 2) Root with SuperSU by Chainfire
In order to get root access on AOSP based ROMs (2.78 SR5 or newer for 7.1.x),
you need to download the SuperSU project by Chainfire.

SuperSU zip (Latest version) : http://forum.xda-developers.com/apps/supersu

  • Rename the downloaded zip to install.zip
  • Open the Boot Bridge zip with a zip manager
  • Replace the file install/install.zip with the new one
  • Flash the new Boot Bridge zip in the TWRP recovery
  • Reboot to Android


OPTION 3) Root with phhSuperUser by phhusson
In order to get root access on AOSP based ROMs (7.1.1 included),
you need to download the phhSuperUser project by phhusson.

superuser.zip : http://forum.xda-developers.com/android/software-hacking/wip-selinux-capable-superuser-t3216394

  • Rename the downloaded zip to install.zip
  • Open the Boot Bridge zip with a zip manager
  • Replace the file install/install.zip with the new one
  • Flash the new Boot Bridge zip in the TWRP recovery
  • Reboot to Android
  • Install the phh's SuperUser application


Source code
Project sources - https://github.com/AdrianDC/android_boot_bridge (branch master)
libbootimg sources - https://github.com/AdrianDC/multirom_libbootimg (branch master)
MultiROM sources - https://github.com/AdrianDC/multirom_core (branch master)


Boot Bridge for Sony ELF created also thanks to :
- Tasssadar for the original libbootimg / MultiROM sources
- The XperiaMultiROM team for our evolution of MultiROM
- Chainfire for the flashable OUTFD export and boot detection
- Everyone involved in testing it​


XDA:DevDB Information
Android Boot Bridge for Sony ELF, Tool/Utility for the OEM Cross Device Development

Contributors
Adrian DC

Version Information
Status: No Longer Updated

Created 2016-11-25
Last Updated 2020-08-29
 
Last edited:

AdrianDC

Recognized Developer
Dec 22, 2009
2,206
12,943
208
Île-de-France
adriandc.github.io
Reserved

Changelog
Code:
Boot Bridge for Sony ELF - 26/12/2018
======================================
* Resolve compatibility with Magisk v17+ due to an
  internal evolution of its boot partitions detection

Boot Bridge for Sony ELF - 28/05/2017
======================================
* Use android_boot as potential bridge to fix SuperSU

Boot Bridge for Sony ELF - 20/12/2016
======================================
* Fix the 32/64 bits dual support

Boot Bridge for Sony ELF - 18/12/2016
======================================
* Added support for Sony Stock ELF (64 bits) bootimages
* libbootimg changes from my recent updates

Boot Bridge for Sony ELF - 29/11/2016
======================================
* Fix the boot partition detection with symlinks
* Restore phhSuperuser support

Boot Bridge for Sony ELF - 27/11/2016
======================================
* Add support for newer Sony ELF partitions
* Allows to root Stock Sony ROMs on the Xperia Z2
* Updated in collaboration with Alexander Diewald

Boot Bridge for Sony ELF - 25/11/2016
======================================
* Initial public release on XDA

Devices supported
Code:
Sony Xperia SP (Huashan): Magisk, SuperSU, phhSuperSU
Sony Xperia T/TX/V (Mint, Hayabusa, Tsubasa): Magisk, SuperSU, phhSuperSU
Sony Xperia Z2 (Sirius): SuperSU on Stock ROMs
Sony Xperia X Performance (Dora): Stock ROM patching
...
 
Last edited:

mickybart

Senior Member
Sep 22, 2014
1,122
5,623
0
Montreal
hi @Adrian DC,

Thanks for your mail that pointing me on this thread.
As you now I'm maintaining a ROM for Xperia S and your project can be a good fit for it :)

For now I have a built-in support of root but no solution for those who wants SuperSU.

I'm generating the boot.img for Xperia S with the commandline :

python $(MKELF) -o [email protected] $(PRODUCT_OUT)/[email protected]$(BOARD_KERNEL_ADDR) $(PRODUCT_OUT)/[email protected]$(BOARD_RAMDISK_ADDR),ramdisk $(RPMBIN)@$(BOARD_RPM_ADDR),rpm

With parameters below :
# boot image
BOARD_KERNEL_ADDR := 0x40208000
BOARD_RAMDISK_ADDR := 0x41500000
BOARD_RPM_ADDR := 0x20000

Is your project compatible with the way I'm generating boot.img for Xperia S ?

If yes, I will test it with SuperSU (sepolicy for SuperSU systemless is already supported on the ROM).

Thanks for your feedback and work on that topic :)
 
  • Like
Reactions: mirhl and AdrianDC

AdrianDC

Recognized Developer
Dec 22, 2009
2,206
12,943
208
Île-de-France
adriandc.github.io
Thanks for your mail that pointing me on this thread.
No problem.

Normally the full port of Sony ELF partitions I made inside libbootimg for MultiROM
is compatible with all bootimages structures from these series of Sony devices.

I invite you to have your ROM's boot.img flashed into boot directly,
then flash my Boot Bridge as it is, even without a rooting zip, like in my screenshot,
and let it run to see the bridge creation then restore perform.

If anything goes wrong and the bootimage is not readable,
the process will stop and nothing will be done.

In the very worst case, the rebuilt boot image doesn't start
and you simply fastboot the image you came from.

Also recently I worked with Diewi (Alexander) to extend ELF support
to the newer version of Sony's last ELF devices, the 8974 (Z2) boot
that had ELF Stock images but also support for Android normal ones.
Once fully tested and confirmed, the update will be done on this project too.

On a side note, about root, SuperSU works fine on my devices on 6.0 & less,
for 7.1 the installation is fine too but the root features failed (with sepolicies totally fixed),
this is apparently common / randomly affecting some devices,
Chainfire is aware of it, so do not be surprised if that happens on yours,
and give phhSuperUser a go too as it is the fully working method on my AOSP 7.1 now.

Bye !
 

Miggystar

Senior Member
May 10, 2013
103
49
0
Caracas
Hi Adrian, Sorry if is a noob question but im facing ERROR: 7 after instaling the BootBridge-SonyELF.zip, i've already replace the install.zip, it says in TWRP ------> Found bootimg @ /dev/block/platform/msm_sdcc.1/by-name/kernel ----> assert failed: run_program(''/tmp/boot_bridge/flash_zip.sh'', ''/tmp/boot_ brdge'', ''install.zip'') == 0 .... what i'm doing wrong? .. Im on AOSP 25/11 . Thanks for your time
 

MichaBit

Senior Member
May 6, 2015
269
110
73
Hi Adrian, Sorry if is a noob question but im facing ERROR: 7 after instaling the BootBridge-SonyELF.zip, i've already replace the install.zip, it says in TWRP ------> Found bootimg @ /dev/block/platform/msm_sdcc.1/by-name/kernel ----> assert failed: run_program(''/tmp/boot_bridge/flash_zip.sh'', ''/tmp/boot_ brdge'', ''install.zip'') == 0 .... what i'm doing wrong? .. Im on AOSP 25/11 . Thanks for your time
I've got the same error, did everything exactly according to instructions.
Where could the error be?
 

Attachments

AdrianDC

Recognized Developer
Dec 22, 2009
2,206
12,943
208
Île-de-France
adriandc.github.io
I've got the same error, did everything exactly according to instructions.
Where could the error be?
Thanks for reporting the issue.
It was introduced with the new update to support Z2 devices, and affected only phhSuperuser.

The issue is now fully fixed, please download the new version and try again.
 

MichaBit

Senior Member
May 6, 2015
269
110
73
Thanks for reporting the issue.
It was introduced with the new update to support Z2 devices, and affected only phhSuperuser.

The issue is now fully fixed, please download the new version and try again.
Installation completed! :)
#root successfully :good:
Many thanks and greetings Adrian :highfive:
 
  • Like
Reactions: AdrianDC

myxomop25

Member
Aug 24, 2011
23
4
0
27
Lesozavodsk
Greetings Adrian,

So nice that you still support our old Sony devices, particularly Xperia V. :good:

The thing is I used your Elf Bridge and succeeded to install Magisk 11.6. But then a new version of it came, 12.0. And I did all the same way as with 11.6 but failed. It was written that the boot image was so small.:( However, I flashed Magisk 12.0 with no Elf Bridge. And the weird thing that that time there was enough space. I knew that flashing without the Bridge would cause soft-brick, but I knew what to do next in that case, I flashed the proper boot image after all and the device started working again. :D

The question is following: is it possible to flash Magisk 12.0?:confused: I also forget to tell that the size of these two versions are almost similar. The log is attached here.

Thanks!:)
 

Attachments

AdrianDC

Recognized Developer
Dec 22, 2009
2,206
12,943
208
Île-de-France
adriandc.github.io
Greetings Adrian,

So nice that you still support our old Sony devices, particularly Xperia V. :good:

The thing is I used your Elf Bridge and succeeded to install Magisk 11.6. But then a new version of it came, 12.0. And I did all the same way as with 11.6 but failed. It was written that the boot image was so small.:( However, I flashed Magisk 12.0 with no Elf Bridge. And the weird thing that that time there was enough space. I knew that flashing without the Bridge would cause soft-brick, but I knew what to do next in that case, I flashed the proper boot image after all and the device started working again. :D

The question is following: is it possible to flash Magisk 12.0?:confused: I also forget to tell that the size of these two versions are almost similar. The log is attached here.

Thanks!:)
Thanks.
Yes I got reports on that, but I think the faulty half-ELF support causes the issues you are having.
Better stick to the working version for the time being.

magisk 11.6 and above have elf support
Not really, it's faulty and breaks ELF bootimages (tunrs them back to regular bootimages,
which is where BootBridge plays a role to have proper read and write of the ELF bootimages
structures (32bits 8960 or newer 64 bits like 8996 Stock) without ELF support in the tools.
 
Last edited: