How To Guide Full ROM dump of T-Mobile variant & guide on gaining root access without magisk

Search This thread

GloriamSemper

Member
Apr 20, 2022
40
6
Yea, that I can't give up for VPN Hotspot app, so convenient compared to PDANet+
This is exactly what I am trying to do. I have a stock N200, waiting on my bootloader unlock token. I was going to flash a GSI to remove the cap from the hotspot but it appears the TMO variant has issues doing that. Do you recommend I do what you did instead, and just root the stock? If so, which root method do you recomend? The TMO variant seems to be different than all the others which makes me nervous to try anything... your input would be greatly appreciated! :)
 

lentm

Senior Member
Dec 3, 2008
472
106
This is exactly what I am trying to do. I have a stock N200, waiting on my bootloader unlock token. I was going to flash a GSI to remove the cap from the hotspot but it appears the TMO variant has issues doing that. Do you recommend I do what you did instead, and just root the stock? If so, which root method do you recomend? The TMO variant seems to be different than all the others which makes me nervous to try anything... your input would be greatly appreciated! :)
I've been told that the GSI roms are not really stable on this device, so I'm staying on the stock rooted. VPN Hotspot seems to work fine, but I sometimes get disconnected while using it.
 
  • Like
Reactions: GloriamSemper

GloriamSemper

Member
Apr 20, 2022
40
6
I've been told that the GSI roms are not really stable on this device, so I'm staying on the stock rooted. VPN Hotspot seems to work fine, but I sometimes get disconnected while using it.
Thanks for the heads up. Which root method did you use/recommend for your TMO variant? I found multiple methods in this forum and want to go with the verified method that worked for you. Magisk? TWRP?
 

lentm

Senior Member
Dec 3, 2008
472
106
Thanks for the heads up. Which root method did you use/recommend for your TMO variant? I found multiple methods in this forum and want to go with the verified method that worked for you. Magisk? TWRP?

Did you unlock the device? If so, I will try to find the magisk patched boot img, boot to that image through fastboot, backup the original boot img, install magisk through the app.
 
  • Love
Reactions: GloriamSemper

Aselloph

Member
Jun 1, 2022
21
7
I did the following to try to replicate what EnumC did and I got the same stock boot.img but in partition A instead of partition B:

Used MSMDownloadTool to reset to factory image

Unlocked bootloader with one line adb command

Download phhusson's GSI as EnumC mentioned

Installed msys2 with mingw64 tool chain, base devel, and mingw64 gettext, add an include statement and include asprintf in order to build simg2img on Windows (I've attached my build for 64 bit Win 10 here)

Unzip GSI.xz and then unsparse it using simg2img

Follow instructions here to install GSI. The $(du) is to calculate disk usage of the system_raw.img on your PC

adb reboot fastboot, fastboot getvar all to get active partition (factory image should be a)

You can now adb shell, su, and then dd to extract /dev/block/bootdevice/by-name/boot_a
Hi towardsdan.

I completed the first three steps you outlined, but when it came to the fourth, I wasted many hours trying to figure it out with no great success.

I downloaded both MinGW and MSYS2, and I tried a variety of things, but nothing ended up working for me. MSY2 brought me the farthest, and the steps I took are listed below:

1. Installed MSY2
2. Ran "MSYS2 MSYS" Application
3. Pasted pacman -S mingw-w64-x86_64-toolchain into the application
LzQrmiOM4n.png

- I clicked enter (So I selected "All" by default)
- I proceeded with installation (Y)

4. Pasted pacman -S base-devel into the application
n2p6c5CUWx.png

- I proceeded with installation (Y)

5. Pasted pacman -S mingw-w64-gettext into the application
6Fpbd1PBuQ.png

- I get an error saying "target not found: mingw-w64-gettext"
- This confuses me because from what I can see, I put in the correct package name

This is where I get stuck, unfortunately. I'm not sure how to install "mingw64 gettext," and I'm not sure how to complete the other steps you indicate, such as adding "an include statement" and including "asprintf in order to build simg2img on Windows". I think I'll be able to do your other steps when I get to them. When it comes to your other steps, I think I'll be able to do them.

I know you've already completed all of the work. You've installed the simg2img build on Windows, and you've archived a lot of the T-mobile boot images for the OnePlus Nord N200 5G. However, if it's feasible for you, I'd want to understand how you accomplished it so that I may do it myself the next time a comparable situation arises.

Thank you for your assistance.
 

Aselloph

Member
Jun 1, 2022
21
7
Hi everyone! I lost my OP8 daily driver the other day and decided to pick up a N200 as a stopgap measure. Thanks to Android 11, I'm able to dump all partitions from the DE2118 model of this device.

AFH: https://www.androidfilehost.com/?fid=7161016148664787728

Here's the partition map:

Code:
phhgsi_arm64_ab:/dev/block/by-name # ls -la
total 0
drwxr-xr-x 2 root root 2080 1970-01-12 18:02 .
drwxr-xr-x 6 root root 3080 1970-01-12 18:02 ..
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ALIGN_TO_128K_1 -> /dev/block/sdd1
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ALIGN_TO_128K_2 -> /dev/block/sdf1
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 abl_a -> /dev/block/sde6
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 abl_b -> /dev/block/sde26
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 abl_log -> /dev/block/sde53
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 android_log -> /dev/block/sde55
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 apdp -> /dev/block/sde40
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 bluetooth_a -> /dev/block/sde5
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 bluetooth_b -> /dev/block/sde25
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 boot_a -> /dev/block/sde9
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 boot_b -> /dev/block/sde29
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 carrier -> /dev/block/sda8
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 catecontentfv -> /dev/block/sde50
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 catefv -> /dev/block/sde49
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 cateloader -> /dev/block/sde42
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 cdt -> /dev/block/sdd2
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 core_nhlos_a -> /dev/block/sde15
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 core_nhlos_b -> /dev/block/sde36
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ddr -> /dev/block/sdd3
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devcfg_a -> /dev/block/sde10
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devcfg_b -> /dev/block/sde30
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devinfo -> /dev/block/sde39
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 dinfo -> /dev/block/sdd7
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 dsp_a -> /dev/block/sde7
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dsp_b -> /dev/block/sde27
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dtbo_a -> /dev/block/sde13
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dtbo_b -> /dev/block/sde33
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 engineering_cdt_a -> /dev/block/sdd4
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 engineering_cdt_b -> /dev/block/sdd5
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 featenabler_a -> /dev/block/sde17
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 featenabler_b -> /dev/block/sde18
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 frp -> /dev/block/sda5
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 fsc -> /dev/block/sdf14
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 fsg -> /dev/block/sdf13
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 hyp_a -> /dev/block/sde3
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 hyp_b -> /dev/block/sde23
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 imagefv_a -> /dev/block/sde14
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 imagefv_b -> /dev/block/sde34
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 kernel_log -> /dev/block/sde54
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 keymaster_a -> /dev/block/sde8
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 keymaster_b -> /dev/block/sde28
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 keystore -> /dev/block/sda4
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logdump -> /dev/block/sde43
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logfs -> /dev/block/sde41
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logo_a -> /dev/block/sde20
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logo_b -> /dev/block/sde38
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 metadata -> /dev/block/sda14
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 misc -> /dev/block/sda3
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modem_a -> /dev/block/sde4
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 modem_b -> /dev/block/sde24
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modemst1 -> /dev/block/sdf6
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modemst2 -> /dev/block/sdf7
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 multiimgoem_a -> /dev/block/sde45
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 multiimgoem_b -> /dev/block/sde46
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ocdt -> /dev/block/sdd6
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusdycnvbk -> /dev/block/sdf2
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 opluslog -> /dev/block/sda7
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusreserve1 -> /dev/block/sdf8
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusreserve2 -> /dev/block/sdf9
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve3 -> /dev/block/sdf10
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve4 -> /dev/block/sdf11
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve5 -> /dev/block/sdf12
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusstanvbk_a -> /dev/block/sdf3
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusstanvbk_b -> /dev/block/sdf4
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 param -> /dev/block/sdf5
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 persist -> /dev/block/sda2
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 persist_bkp -> /dev/block/sda6
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 qupfw_a -> /dev/block/sde11
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 qupfw_b -> /dev/block/sde31
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 rawdump -> /dev/block/sda15
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 rpm_a -> /dev/block/sde1
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 rpm_b -> /dev/block/sde21
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sda -> /dev/block/sda
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdb -> /dev/block/sdb
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdc -> /dev/block/sdc
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdd -> /dev/block/sdd
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sde -> /dev/block/sde
lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdf -> /dev/block/sdf
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 secdata -> /dev/block/sde48
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ssd -> /dev/block/sda1
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 storsec -> /dev/block/sde44
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 super -> /dev/block/sda9
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 tz_a -> /dev/block/sde2
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 tz_b -> /dev/block/sde22
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefisecapp_a -> /dev/block/sde16
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefisecapp_b -> /dev/block/sde35
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefivarstore -> /dev/block/sde47
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 userdata -> /dev/block/sda16
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_a -> /dev/block/sde12
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_b -> /dev/block/sde32
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_system_a -> /dev/block/sda10
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_system_b -> /dev/block/sda11
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vendor_boot_a -> /dev/block/sde19
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vendor_boot_b -> /dev/block/sde37
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-data -> /dev/block/sde52
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-keystore -> /dev/block/sde51
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-system_a -> /dev/block/sda12
lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-system_b -> /dev/block/sda13
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_a -> /dev/block/sdb1
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_b -> /dev/block/sdc1
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_config_a -> /dev/block/sdb2
lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_config_b -> /dev/block/sdc2


To gain root access in the absence of magisk and firmware, I used the DSU feature that was introduced back in Android 10 (https://developer.android.com/topic/dsu).
Note: This will cause your device to brick if you did NOT unlock your bootloader first!

Then, get the latest phhusson GSI build w/ root. I used https://github.com/phhusson/treble_...wnload/v312/system-roar-arm64-ab-floss.img.xz

You can then unsparse the system img, gzip it, then use that to launch DSU with a custom image.

A more in-depth tutorial and a simplified firmware dump script will be coming soon a bit later in the afternoon. Hope that helps anyone looking for the firmware in the meantime :)
Hi EnumC,

Thank you so much for your tutorial.

Unfortunately, I've been stuck on one of your steps. Do you have any suggestions on how I might "unsparse the system img"?

I have reset my phone to factory image using MSM tools, and then I proceeded to unlocking my bootloader. I've downloaded the most recent phhusson GSI build w/root (I think), but now that I am on your "unsparse the system img" step, I don't know what to do.

Is it feasible that you may assist me? I'd be grateful if you could help me out.

Thank you very much.
 

towardsdawn

Member
Sep 26, 2021
37
19
Hi towardsdan.

I completed the first three steps you outlined, but when it came to the fourth, I wasted many hours trying to figure it out with no great success.

I downloaded both MinGW and MSYS2, and I tried a variety of things, but nothing ended up working for me. MSY2 brought me the farthest, and the steps I took are listed below:

1. Installed MSY2
2. Ran "MSYS2 MSYS" Application
3. Pasted pacman -S mingw-w64-x86_64-toolchain into the application
View attachment 5627727
- I clicked enter (So I selected "All" by default)
- I proceeded with installation (Y)

4. Pasted pacman -S base-devel into the application
View attachment 5627729
- I proceeded with installation (Y)

5. Pasted pacman -S mingw-w64-gettext into the application
View attachment 5627731
- I get an error saying "target not found: mingw-w64-gettext"
- This confuses me because from what I can see, I put in the correct package name

This is where I get stuck, unfortunately. I'm not sure how to install "mingw64 gettext," and I'm not sure how to complete the other steps you indicate, such as adding "an include statement" and including "asprintf in order to build simg2img on Windows". I think I'll be able to do your other steps when I get to them. When it comes to your other steps, I think I'll be able to do them.

I know you've already completed all of the work. You've installed the simg2img build on Windows, and you've archived a lot of the T-mobile boot images for the OnePlus Nord N200 5G. However, if it's feasible for you, I'd want to understand how you accomplished it so that I may do it myself the next time a comparable situation arises.

Thank you for your assistance.

I don't remember why I had to install gettext but if you do
Code:
pacman -Ss gettext
you will find a list of packages you can install. I find the package mingw-w64-x86_64-gettext installed on my system because I'm running 64bit Windows.

I will walk you through my line of thinking, because this is all dependent on your system build and these specific steps might not work for you because packages get updated all the time, etc.:
  1. To unsparse the system image, I needed a build of simg2img on Windows 10 64 bit because that's my computer and I couldn't find an existing build floating around online
  2. Following the repo instructions to install zlib, libasprintf. Use
    Code:
    pacman -Ss packagename
    to search for each package and then install with
    Code:
    pacman -S packagename
  3. git clone simg2img repository
  4. Following repo instructions to run mingw32-make in simg2img, finding each error, googling the error, and fixing it
    1. Msys64 can't find mingw32-make, google the error, find this link and I need to fix my msys64 PATH
    2. -Werror flag is on in the makefile which treats all warnings as errors, disable that flag in the makefile
    3. asprintf is not declared in this scope in append2simg.cpp, google the error, find this link, add the files in a folder and then add
      Code:
      #include "folder/asprintf.h"
      to append2simg.cpp
  5. Successfully built the simg2img.exe, run the exe as the repo instructs
 
  • Like
Reactions: Aselloph

Aselloph

Member
Jun 1, 2022
21
7

I don't remember why I had to install gettext but if you do
Code:
pacman -Ss gettext
you will find a list of packages you can install. I find the package mingw-w64-x86_64-gettext installed on my system because I'm running 64bit Windows.

I will walk you through my line of thinking, because this is all dependent on your system build and these specific steps might not work for you because packages get updated all the time, etc.:
  1. To unsparse the system image, I needed a build of simg2img on Windows 10 64 bit because that's my computer and I couldn't find an existing build floating around online
  2. Following the repo instructions to install zlib, libasprintf. Use
    Code:
    pacman -Ss packagename
    to search for each package and then install with
    Code:
    pacman -S packagename
  3. git clone simg2img repository
  4. Following repo instructions to run mingw32-make in simg2img, finding each error, googling the error, and fixing it
    1. Msys64 can't find mingw32-make, google the error, find this link and I need to fix my msys64 PATH
    2. -Werror flag is on in the makefile which treats all warnings as errors, disable that flag in the makefile
    3. asprintf is not declared in this scope in append2simg.cpp, google the error, find this link, add the files in a folder and then add
      Code:
      #include "folder/asprintf.h"
      to append2simg.cpp
  5. Successfully built the simg2img.exe, run the exe as the repo instructs
Thank you for your response towardsdawn.

Here is what I did:
1. pacman -S mingw-w64-x86_64-gettext
2. pacman -S zlib
3. pacman -S libasprintf
4. cd'd into the directory where the decompressed "android-simg2img-master" folder was in
5. Set all the proper path variables

Here is the error I ran into:
5. CFLAGS="-DUSE_MINGW" LDFLAGS="-lasprintf" mingw32-make (I ran this in the "MSYS2 MinGw x64" application)
1654102684285.png

- I attempted a few other possible remedies, but they all ended in the same problem or an error.

Some examples of these potential fixes I tried were below:
1. I ran CFLAGS="-DUSE_MINGW" "-Wno-error" LDFLAGS="-lasprintf" mingw32-make, and got "bash: -Wno-error: command not found" as a result
2. I tried setting an environmental variable export CFLAGS="-Wno-error"
3. I attempted to directly remove it via ./configure by doing ./configure --disable-werror and failed

I'd appreciate it if you could assist me figure out what my next actions should be. Thank you very much.
 

towardsdawn

Member
Sep 26, 2021
37
19
Thank you for your response towardsdawn.

Here is what I did:
1. pacman -S mingw-w64-x86_64-gettext
2. pacman -S zlib
3. pacman -S libasprintf
4. cd'd into the directory where the decompressed "android-simg2img-master" folder was in
5. Set all the proper path variables

Here is the error I ran into:
5. CFLAGS="-DUSE_MINGW" LDFLAGS="-lasprintf" mingw32-make (I ran this in the "MSYS2 MinGw x64" application)
View attachment 5628099
- I attempted a few other possible remedies, but they all ended in the same problem or an error.

Some examples of these potential fixes I tried were below:
1. I ran CFLAGS="-DUSE_MINGW" "-Wno-error" LDFLAGS="-lasprintf" mingw32-make, and got "bash: -Wno-error: command not found" as a result
2. I tried setting an environmental variable export CFLAGS="-Wno-error"
3. I attempted to directly remove it via ./configure by doing ./configure --disable-werror and failed

I'd appreciate it if you could assist me figure out what my next actions should be. Thank you very much.
The -Werror flag in the makefile treats all warnings as errors. The easiest thing to do is to comment out the CPPFLAGS line in the makefile and replace it with the same line but no -Werror flag

Your solutions might work if you do CPPFLAGS instead of CFLAGS, not sure.
 
  • Like
Reactions: Aselloph

Aselloph

Member
Jun 1, 2022
21
7
The -Werror flag in the makefile treats all warnings as errors. The easiest thing to do is to comment out the CPPFLAGS line in the makefile and replace it with the same line but no -Werror flag

Your solutions might work if you do CPPFLAGS instead of CFLAGS, not sure.
Thank you for your reply towardsdawn.

Here's what I did:
1. Went into make file and removed -Werror
2. Copied everything from asprintf.insanecoding.org download into a new folder called "folder" in the android-simg2img-master folder
3. Opened and edited append2simg.cpp, added #include "folder/asprintf.h"
4. Ran CFLAGS="-DUSE_MINGW" LDFLAGS="-lasprintf" mingw32-make command - simg2img.exe seems to be successfully built
5. I run "simg2img.exe" and I run into a few errors (zlib1.dll missing, libstdc++-6.dll missing, libgcc_s_seh-1.dll missing, and libwinpthread-1.dll missing)
6. I download the dll files and put them in the source foulder, and "simg2img.exe" runs, but then I get a "The application was unable to start correctly (0x000007b)" error.

Is this typical towardsdawn? What might have gone wrong?

Thank you for your assistance.
 

towardsdawn

Member
Sep 26, 2021
37
19
Thank you for your reply towardsdawn.

Here's what I did:
1. Went into make file and removed -Werror
2. Copied everything from asprintf.insanecoding.org download into a new folder called "folder" in the android-simg2img-master folder
3. Opened and edited append2simg.cpp, added #include "folder/asprintf.h"
4. Ran CFLAGS="-DUSE_MINGW" LDFLAGS="-lasprintf" mingw32-make command - simg2img.exe seems to be successfully built
5. I run "simg2img.exe" and I run into a few errors (zlib1.dll missing, libstdc++-6.dll missing, libgcc_s_seh-1.dll missing, and libwinpthread-1.dll missing)
6. I download the dll files and put them in the source foulder, and "simg2img.exe" runs, but then I get a "The application was unable to start correctly (0x000007b)" error.

Is this typical towardsdawn? What might have gone wrong?

Thank you for your assistance.
If you are on a 32bit computer you need to do a 32bit build instead of 64bit (so all of the msys packages should be for i686 32 bit) and if you are somehow on an ARM64 processor you would need to get the aarch64 instead.
Msys2 PATH variable and Windows command prompt PATH variables are different, I ran simg2img.exe from Windows command prompt and I didn't have to add dll files or get errors.

I don't know any more besides that, best of luck :)
 
  • Like
Reactions: Aselloph

Aselloph

Member
Jun 1, 2022
21
7
If you are on a 32bit computer you need to do a 32bit build instead of 64bit (so all of the msys packages should be for i686 32 bit) and if you are somehow on an ARM64 processor you would need to get the aarch64 instead.
Msys2 PATH variable and Windows command prompt PATH variables are different, I ran simg2img.exe from Windows command prompt and I didn't have to add dll files or get errors.

I don't know any more besides that, best of luck :)
Thank you for your response towardsdawn once again. I was eventually able to get it to function.

Here are the exact steps in case anybody wishes to duplicate what was done (Credits to towardsdawn for the substantial help)
Note: The steps below were performed on a 64-bit Windows 10 computer; however, the steps may vary depending on the operating system and/or system architecture.

1. Install MSYS2
1a. Download the latest phhusson GSI build w/ root
2. Run "MSYS2 MinGW x64" application

3. Paste pacman -S mingw-w64-x86_64-toolchain into the application
- Click enter (Selecting "All" by default)
- Proceed with installation (Y)
4. Paste pacman -S base-devel into the application
- Proceed with installation (Y)
5. Paste pacman -S mingw-w64-x86_64-gettext into the application
- Proceed with installation (Y)
6. Paste pacman -S zlib into the application
- Proceed with installation (Y)
7. Paste pacman -S libasprintf into the application
- Proceed with installation (Y)

8. Git clone simg2img (By anestisb)
- I downloaded the zip, and then decompressed it
9. In the "MSYS2 MinGW x64" application", cd into the directory where the decompressed "android-simg2img-master" folder is stored
- Example command: cd /c/Users/YourPCNameHere/Downloads/Compressed/android-simg2img-master

10. Set all the proper path variables
- Run command prompt as admin, cd into mingw64\bin directory (Ex: cd C:\msys64\mingw64\bin), paste mklink make mingw32-make.exe and click enter
- Add mingw64/bin directory to path (Ex: I pasted C:\msys64\mingw64\bin into my path)

11. Download the asprintf and vasprintf implementations zip and decompress it
12. Create a new folder in the "android-simg2img-master" folder
- I titled mine "folder"
13. Paste everything that's inside the asprintf folder (asprintf.h is all that is required; you can keep or remove everything else if you want) into the new folder you created in the "android-simg2img-master" folder

14. Edit the "Makefile" inside the "android-simg2img-master" folder with notepad or a similar application
- There should be a line that says CPPFLAGS += -std=gnu++17 -O2 -W -Wall -Werror -Wextra \ -D__STDC_FORMAT_MACROS -D__STDC_CONSTANT_MACROS, delete the -Werror from the line and save

15. Edit the "append2simg.cpp" file inside the "android-simg2img-master" folder with notepad or a similar application and add #include "TheNewFolderYouNamedHere/asprintf.h"
- Ex: I added #include "folder/asprintf.h" to the file

16. Close out, and then open again the "MSYS2 MinGW x64" application, make sure your directory is set to the one where android-simg2img-master is stored (Refer to step 8 if you forgot how to change directory)

17. Run CFLAGS="-DUSE_MINGW" LDFLAGS="-lasprintf" mingw32-make into the application
- simg2img should have been successfully built

18. Run command prompt again, cd into the simg2img directory
19. Decompress the GSI built you download from step 1a, and put it into the "android-simg2img-master" folder
20. Run simg2img.exe system-roar-arm64-ab-floss.img system-raw.img into the command prompt
- If you ran the above command, you should now have an unsparsed system image (named system-raw.img) that can be gzipped and used to run DSU with a custom image
 
  • Like
Reactions: towardsdawn

towardsdawn

Member
Sep 26, 2021
37
19
As an update if anyone is trying to install the latest phhusson Treble, it's much easier now. I don't know why but at least for the latest AOSP 12.1 phhusson build I downloaded you don't need to unsparse it. I also recommend using the DSU-Sideloader apk (available here) because when I followed Google's DSU instructions they didn't work. All you need to do is download the xz file from phhusson straight to your device and then open it in DSU-Sideloader.
 
Last edited:

Top Liked Posts

  • There are no posts matching your filters.
  • 11
    Hi everyone! I lost my OP8 daily driver the other day and decided to pick up a N200 as a stopgap measure. Thanks to Android 11, I'm able to dump all partitions from the DE2118 model of this device.

    AFH: https://www.androidfilehost.com/?fid=7161016148664787728

    Here's the partition map:

    Code:
    phhgsi_arm64_ab:/dev/block/by-name # ls -la
    total 0
    drwxr-xr-x 2 root root 2080 1970-01-12 18:02 .
    drwxr-xr-x 6 root root 3080 1970-01-12 18:02 ..
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ALIGN_TO_128K_1 -> /dev/block/sdd1
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ALIGN_TO_128K_2 -> /dev/block/sdf1
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 abl_a -> /dev/block/sde6
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 abl_b -> /dev/block/sde26
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 abl_log -> /dev/block/sde53
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 android_log -> /dev/block/sde55
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 apdp -> /dev/block/sde40
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 bluetooth_a -> /dev/block/sde5
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 bluetooth_b -> /dev/block/sde25
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 boot_a -> /dev/block/sde9
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 boot_b -> /dev/block/sde29
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 carrier -> /dev/block/sda8
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 catecontentfv -> /dev/block/sde50
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 catefv -> /dev/block/sde49
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 cateloader -> /dev/block/sde42
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 cdt -> /dev/block/sdd2
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 core_nhlos_a -> /dev/block/sde15
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 core_nhlos_b -> /dev/block/sde36
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ddr -> /dev/block/sdd3
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devcfg_a -> /dev/block/sde10
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devcfg_b -> /dev/block/sde30
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 devinfo -> /dev/block/sde39
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 dinfo -> /dev/block/sdd7
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 dsp_a -> /dev/block/sde7
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dsp_b -> /dev/block/sde27
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dtbo_a -> /dev/block/sde13
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 dtbo_b -> /dev/block/sde33
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 engineering_cdt_a -> /dev/block/sdd4
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 engineering_cdt_b -> /dev/block/sdd5
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 featenabler_a -> /dev/block/sde17
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 featenabler_b -> /dev/block/sde18
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 frp -> /dev/block/sda5
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 fsc -> /dev/block/sdf14
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 fsg -> /dev/block/sdf13
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 hyp_a -> /dev/block/sde3
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 hyp_b -> /dev/block/sde23
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 imagefv_a -> /dev/block/sde14
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 imagefv_b -> /dev/block/sde34
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 kernel_log -> /dev/block/sde54
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 keymaster_a -> /dev/block/sde8
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 keymaster_b -> /dev/block/sde28
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 keystore -> /dev/block/sda4
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logdump -> /dev/block/sde43
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logfs -> /dev/block/sde41
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logo_a -> /dev/block/sde20
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 logo_b -> /dev/block/sde38
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 metadata -> /dev/block/sda14
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 misc -> /dev/block/sda3
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modem_a -> /dev/block/sde4
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 modem_b -> /dev/block/sde24
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modemst1 -> /dev/block/sdf6
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 modemst2 -> /dev/block/sdf7
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 multiimgoem_a -> /dev/block/sde45
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 multiimgoem_b -> /dev/block/sde46
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ocdt -> /dev/block/sdd6
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusdycnvbk -> /dev/block/sdf2
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 opluslog -> /dev/block/sda7
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusreserve1 -> /dev/block/sdf8
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusreserve2 -> /dev/block/sdf9
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve3 -> /dev/block/sdf10
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve4 -> /dev/block/sdf11
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 oplusreserve5 -> /dev/block/sdf12
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusstanvbk_a -> /dev/block/sdf3
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 oplusstanvbk_b -> /dev/block/sdf4
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 param -> /dev/block/sdf5
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 persist -> /dev/block/sda2
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 persist_bkp -> /dev/block/sda6
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 qupfw_a -> /dev/block/sde11
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 qupfw_b -> /dev/block/sde31
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 rawdump -> /dev/block/sda15
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 rpm_a -> /dev/block/sde1
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 rpm_b -> /dev/block/sde21
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sda -> /dev/block/sda
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdb -> /dev/block/sdb
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdc -> /dev/block/sdc
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdd -> /dev/block/sdd
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sde -> /dev/block/sde
    lrwxrwxrwx 1 root root   14 1970-01-12 18:02 sdf -> /dev/block/sdf
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 secdata -> /dev/block/sde48
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 ssd -> /dev/block/sda1
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 storsec -> /dev/block/sde44
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 super -> /dev/block/sda9
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 tz_a -> /dev/block/sde2
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 tz_b -> /dev/block/sde22
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefisecapp_a -> /dev/block/sde16
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefisecapp_b -> /dev/block/sde35
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 uefivarstore -> /dev/block/sde47
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 userdata -> /dev/block/sda16
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_a -> /dev/block/sde12
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_b -> /dev/block/sde32
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_system_a -> /dev/block/sda10
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vbmeta_system_b -> /dev/block/sda11
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vendor_boot_a -> /dev/block/sde19
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vendor_boot_b -> /dev/block/sde37
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-data -> /dev/block/sde52
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-keystore -> /dev/block/sde51
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-system_a -> /dev/block/sda12
    lrwxrwxrwx 1 root root   16 1970-01-12 18:02 vm-system_b -> /dev/block/sda13
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_a -> /dev/block/sdb1
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_b -> /dev/block/sdc1
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_config_a -> /dev/block/sdb2
    lrwxrwxrwx 1 root root   15 1970-01-12 18:02 xbl_config_b -> /dev/block/sdc2


    To gain root access in the absence of magisk and firmware, I used the DSU feature that was introduced back in Android 10 (https://developer.android.com/topic/dsu).
    Note: This will cause your device to brick if you did NOT unlock your bootloader first!

    Then, get the latest phhusson GSI build w/ root. I used https://github.com/phhusson/treble_...wnload/v312/system-roar-arm64-ab-floss.img.xz

    You can then unsparse the system img, gzip it, then use that to launch DSU with a custom image.

    A more in-depth tutorial and a simplified firmware dump script will be coming soon a bit later in the afternoon. Hope that helps anyone looking for the firmware in the meantime :)
    3
    11.0.1.5 DE18CB firmware has been uploaded. The active partition is in slot B.
    2
    Oh..right...I should've booted a patched img file before I flash. arrghhh.
    Can you share a stock 11.0.1.8 boot.img file when you have a chance?
    I appreciate it!
    Here you go (I've also included factory stock boot.img and factory patched boot.img). I figured out an even better method which is:
    1. Uninstall Magisk, Restore images
    2. Get OTA. Make sure "Automatic system updates" is turned off under Developer Options, this way the device won't automatically reboot after the OTA
    3. Before rebooting, adb su and then dd the new boot.img
    4. Continue system update and reboot the phone
    5. Install Magisk by patching the new boot.img
    I would suggest avoiding using Magisk's "install to inactive slot after OTA" because that bricked my phone for whatever reason and I had to factory reset.
    2
    I did the steps in the guide I wrote here and I also installed the OTA after factory resetting. If you want stock boot.img for the current installed version you can skip the factory reset step.

    However, as long as there wasn't a major Android version update (which changes boot.img drastically), there is a much easier way.

    The boot.img is probably similar enough between OTAs that you can
    1. uninstall Magisk if it is installed, get OTA
    2. fastboot getvar all to get active partition
    3. boot a Magisk patched boot.img from a previous system version by
      Code:
      fastboot boot patched_old_boot.img
      to get root. make sure to avoid doing fastboot flash because that would get rid of the new boot.img and replace it with the old boot.img.
    4. do the final dd step in the above guide.

    Oh..right...I should've booted a patched img file before I flash. arrghhh.
    Can you share a stock 11.0.1.8 boot.img file when you have a chance?
    I appreciate it!
    2
    I did the following to try to replicate what EnumC did and I got the same stock boot.img but in partition A instead of partition B:

    Used MSMDownloadTool to reset to factory image

    Unlocked bootloader with one line adb command

    Download phhusson's GSI as EnumC mentioned

    Installed msys2 with mingw64 tool chain, base devel, and mingw64 gettext, add an include statement and include asprintf in order to build simg2img on Windows (I've attached my build for 64 bit Win 10 here)

    Unzip GSI.xz and then unsparse it using simg2img

    Follow instructions here to install GSI. The $(du) is to calculate disk usage of the system_raw.img on your PC

    adb reboot fastboot, fastboot getvar all to get active partition (factory image should be a)

    You can now adb shell, su, and then dd to extract /dev/block/bootdevice/by-name/boot_a