Make ROOT Permanet / System Read and Write to all Android ROMS for Tenderloin - TouchPad Development

Extracting ramdisk image to change fstab.tenderloin to make system read and write allowing permanent root access using any ROM ever created for the HP Touchpad.
I am using Ubuntu 18.04.1 LTS 64-bit (All the software is open source and free, you can get the packages necessary for your distro)
Create a folder in /home (root) name it hpboot ( on the PC ) all work is done on the PC.
Open the custom ROM zip file and extract boot.img to the created directory hpboot
Open Terminal in the hpboot directory, all the commands needs to be enter there.
Text beginning with –>># are for information only. Do not paste into the Linux terminal window.
–>># The following will extract images from boot.img file located in the hpboot direcory.
–>># Copy and paste each individual line in the Terminal window one by one and wait until each command finish processing.
dumpimage -i boot.img kernel.uImage
dumpimage -i boot.img -p 1 ram
dd if=ram of=ramdisk.img.gz bs=64 skip=1
gunzip ramdisk.img.gz
mkdir ramdisk; cd ramdisk
cpio -i < ../ramdisk.img
–>>#The ramdisk files are uncompress in the hpboot/ramdisk directory
–>>#Open file fstab.tenderloin using (text editor) change mnt_flags of/system ext4 from ro to rw
–>>#Look like this when change from (ro ) read only to ( rw ) read and write.
–>>#<src> <mnt_point> <type> <mnt_flags and options>
–>>#/dev/store/cm-system /system ext4 rw,errors=panic
–>># Save and close the fstab.tenderloin file
–>># The next 3 steps will repack the files into the ramdisk and merge Kernel to create the finish boot image.
find . | cpio --create --format=’newc’ | gzip > ../ramdiskRW.img
cd ~/hpboot
mkimage -A arm -O linux -T ramdisk -C none -a 0x00000000 -n “TENDERLOIN RW SYSTEM RAMDISK” -d ./ramdiskRW.img ./ramdisk.uImage
mkimage -A arm -T multi -C none -n “Tenderloin RW System” -d kernel.uImage:ramdisk.uImage uImage.Android_RW
–>>#Boot the touchpad into TWRP, connect to PC, copy uImage.Android_RW to the external Micro SDCard.
–>>#Select MOUNT and touch Boot, go back, touch Advanced, File Manager, touch external_sd, select uImage.Android_RW, touch Copy File, touch boot, touch select Current Folder.
–>>#You should have free space on your boot for both images. At the boot screen you will have the option of Android (with no permanet ROOT access) and Android_RW (RW System), you need to install SuperSu. You can use any of the two options or delete uImage.Android and then rename uImage.Android_RW to uImage.Android for one boot option.
You do not need to re flash the ROM, you can add this boot file and use it with your current installed working ROM.
The process works for all boot.img created for the HP Touchpad. If you have a ROM and would like to have system read and write access then you can do this.
Hopefully a Linux Guru will create a script for this, which will automate the process to 3 seconds!

I like tinkering with my TP but I am running @Windows 7 on a 32 bit.. any suggestions?

Android is base on Linux OS.
Install vmware player and run ubuntu as a virtual machine, both are free.

--SNIP--
Hopefully a Linux Guru will create a script for this, which will automate the process to 3 seconds!
Click to expand...
Click to collapse
Here's a shell script that automates the process (rename the extension from .txt to .sh). Put the script and boot image file in any directory and type
Code:
./rwcreate.sh
If it doesn't execute, it probably needs its permissions changed.. Right click the file you created, select 'properties'. In the properties window, select "Permissions" and check "allow executing as ..." or type
Code:
chmod +x rwcreate.sh
in a terminal window

Thanks for your help and dedicating your time to make it easier for others.
I made suggestion to the script on correcting an error, on DU forum.
Now is just a click to get it done, but if we were in a perfect computer world, it could be even easier as to connect the HP Touchpad to PC using USB.
Then run the script and everything is complete!
Using adb pull command to get (boot.uImage) from hp boot directory, to PC.
Changes are done as per script.
adb push command new boot.uImage to hp boot directory, all done!
But making it easier, will make it more complicated and having to install more software and confusing!

HP_TOUCHPAD said:
Thanks for your help and dedicating your time to make it easier for others.
I made suggestion to the script on correcting an error, on DU forum.
Now is just a click to get it done, but if we were in a perfect computer world, it could be even easier as to connect the HP Touchpad to PC using USB.
Then run the script and everything is complete!
Using adb pull command to get (boot.uImage) from hp boot directory, to PC.
Changes are done as per script.
adb push command new boot.uImage to hp boot directory, all done!
But making it easier, will make it more complicated and having to install more software and confusing!
Click to expand...
Click to collapse
Done. Thanks.

shumash said:
Done. Thanks.
Click to expand...
Click to collapse
The script on this forum is correct, but in the DU the file was wrong, corrected now.
Thanks for the fix and help!

Related

Android img files

Okay I know this is a very noob question, how do I open android .img files And I have run a number of different search queries and still haven't found the answer.
jimmydafish said:
Okay I know this is a very noob question, how do I open android .img files And I have run a number of different search queries and still haven't found the answer.
Click to expand...
Click to collapse
what do you want to do with the img? dump it or just flash it?
if you got some kind of linux distro installed, just go (in terminal) to the dir where the image file is located, and type "file filename.img" if it returns something like ext2 filesystem, simply do:
mount -o loop filename.img /mnt
and the file will be mounted on /mnt, so you can access it using cd /mnt
if it returns something like VMS Alpha executable, you will have to download unyaffs, and if you want to repackage it later on, mkfs.yaffs2,
to get the file's content, just run unyaffs filename.img, and you will have the file content right in the folder with the img file...
if you don't have a linux distro installed, you can simply get virtualbox, and download the latest ubuntu iso file... mount the file in virtualbox and install ubuntu (it's quite easy)...
oh and incase you need them some basic commands:
Code:
ls - lists current folder content
cd folder - allows you to switch to a specific folder, like if you type ls, and you get the folder android listed just type cd android... if you want to go back to your home folder, type ~/...
sudo command - allows you to run specific commands as superuser (root... you can also just switch to user root by typing sudo su, so you won't need sudo every single time)
rm file / rm -R folder/file - allows you to remove files and with the parameter -R also folders ;)
hope this helped
emulator
What if i want to use the .imgs in the emulator/AVD? Any tips?
Thanks.
tdh_andy said:
What if i want to use the .imgs in the emulator/AVD? Any tips?
Thanks.
Click to expand...
Click to collapse
use mkfs.yaffs2.

editing IMG files

Can anyone recommend any good tools for windows to edit the IMG files.
Thanks
Winimage can open and extract but I need to insert a file back in.
Thanks
Get Linux and you'll have all the tools for free.
Use Linux live CD!
Sent from my Nexus One using Tapatalk
I don't know how to do it in Windows, but you can do it with the ubuntu .2 for HD2. What I do is copy my data.img and mount the original in ubuntu. the commands I use are:
In Terminal cd to the directory where your data.img is and enter:
mount -o data.img /media/data
You may have to enter if it says the mount point doesn't exist:
mkdir /media/data
Then you can open the img file like any other drive with the file manger.

[Solution] Customize or update the factory image for stock recovery

The stock recovery on the Nook Simple Touch has a routine to restore the device to factory state, wiping everything in the process. It is initiated on the 8th unsuccessful boot (unsuccessful := interrupted before the boot counter could be reset). The image is stored on the "/misc" partition, /dev/block/mmcblk0p3, as /factory.zip. On my device, it's version 1.0.1 (file size: 108460423, MD5 sum: 3ae0d4d9869330dec639a7da9c50fa72). Not very useful. So, how about customizing it? Or at least upgrading it to stock 1.2.1?
When restoring to factory state, the /cache and /data partitions are wiped independently by the stock recovery. As for the files inside the ZIP, there is no difference between the factory image and the OTA (over-the-air) update (nook_*_update.zip). The format of both files is the standard Edify ("updater-script") style. If you have your own script you can put it there for easy restoration. If you don't, you can at least upgrade the factory image there to 1.2.1, the latest version. The example is for the latter case, but all the steps will be the same, except the first one.
Please do not follow these instructions blindly. Instead, read them critically and adjust to your situation, adding extra steps such as backups where necessary. Make sure that you don't mind if everything from your device is erased in the process.
Remove B&N cruft from the ZIP update header
Start with the file nook_1_2_update.zip (get it here from B&N). Make sure you have the right file: size 121323347, MD5 sum: 30822c2927482380c325a47dc060daee. Note that while a well-formed ZIP file starts with the letters "PK" (from the initials of Phil Katz, the original developer of the ZIP format), the B&N ZIP has some proprietary gibberish at the beginning:
Code:
...............'1.2.1.24.carbon1_2.gossamer.rrdp.s70455.......XOLBsPWsxv0saXev7rdGBBrQLzdM74ai2CM4h6oD/D3S9xeKq8eFYW7j0+MgLohN4x/3tyIYaZV6YiLEi7gLXq+7XjvWV4KaTGvNw0wM6x11IPOEzYwmHryagnY91XjkfKTjwKR8XC3SkSRu4TT01DZ6lfqsw6MZO18AFz48GEjXcxKy8SQZyhA++kobYWlcC8jNa/EmkGgVJien7QJ4LvR8N5Bftk11WRTOy6+BSQQgdBh4K/i2WI0TqfpH7JC+6vNp5rb61KTXpZIMLHGyZloYca68mnn4rmr1SKqodpffgSmYI+f7DPt7RgBEkXGz20x+3kKA+OcPbd1QKvIwd+A==.........;=.
First 418 bytes of nook_1_2_update.zip. Unprintable characters replaced with dots.
Unzip and other unpackers will get through this just fine so you might not even notice it but it will prevent the file from working as factory image for the stock recovery, so let's start by getting rid of the cruft. There are at least three options here: (1) use dd(1) (UNIX shell or Windows CLI), (2) use Free Hex Editor (Windows GUI), (3) unzip and repack again. The dd command if you're lucky to have a recent version is:
Code:
dd if=nook_1_2_update.zip of=factory.zip skip=418bytes
- or -
Code:
dd if=nook_1_2_update.zip of=factory.zip iflag=skip_bytes skip=418
Option (3) will break the B&N signature on the ZIP. Theoretically, if the signature is preserved, the file should work as-is as the new factory image as it matches the key stored in the recovery). It didn't work for me but I didn't try too hard because what I want to do is to use a custom image anyway so feel free to check for yourself (skip to the last step).
Otherwise, if you are using the stock update file that you want to sign again, you need to remove the signature that is already there. Supposing your soon-to-be new factory image file is called factory.zip, the way to do it is:
Code:
zip -d -q factory.zip META-INF\CERT.SF META-INF\CERT.RSA META-INF\MANIFEST.MF
Insert your key into stock recovery RAM disk image
For customized factory.zip signed with your own key, we need to tweak the recovery image a bit.
Extract the image from the update ZIP:
Code:
unzip -j nook_1_2_update.zip ramdisk-recovery.img
Replace the file res/keys (see attachment) in the image, using XDA user Renate NST's bootutil.exe tool:
Code:
bootutil /r ramdisk-recovery.img res\keys
You can also leave the old key in place and append the new one, just make sure there is nothing in between them (not even whitespace). And here are the alternative steps to unpack and repack the image using just the standard tools, which might come handy on UNIX:
Unpack:
Code:
dd if=ramdisk-recovery.img bs=64 skip=1 | gzip -cd | cpio -id
Repack:
Code:
find . -not -name ramdisk-recovery.img | cpio -oc | gzip -c9 | mkimage -A arm -O linux -T ramdisk -C gzip -a 0 -e 0 -d - ramdisk-recovery.new.img
Now the image just needs to be installed:
Code:
adb shell mkdir /data/boot
adb shell mount -t vfat /dev/block/mmcblk0p1 /data/boot
adb push ramdisk-recovery.img /data/boot/uRecRam
adb shell umount /data/boot
adb shell rm /data/boot
Sign and install the customized factory image ZIP
Suppose our new factory image is called factory.zip. Then to sign it:
Code:
java -jar signapk.jar [B]-w[/B] testkey.x509.pem testkey.pk8 factory.zip factory.signed.zip
See the attachment below for the necessary files. Note the -w switch, which is particularly important in this case.
Now just for the installation part:
Code:
adb shell mkdir /data/factory
adb shell mount -t ext2 /dev/block/mmcblk0p3 /data/factory
adb push -p factory.signed.zip /data/factory/factory.zip
adb umount /data/factory
adb rm /data/factory
Restore to factory image to check if it works
For an easy alternative to the power button marathon:
Code:
adb shell
echo -n -e "\x08\x00\x00\x00" >/rom/devconf/BootCnt
reboot
Warning: this wipes everything, all your data on the device will be lost.
Bonus: What if you want to use your own key?
The testkey.{pk8,x509.pem} is one of these ubiquitous Android debug keys, used all around. Apparently, it was good enough for B&N as well, as they used a version of it too for their OTAs (see /system/etc/security/otacert.zip). If it's not good enough for you though, and you have your own key, the attached keys file will not work for you; instead, you need to generate the key dump in the right format for yourself using the dumpkey utility also provided in the attachment:
Code:
java -jar dumpkey.jar testkey.x509.pem >>res/keys
Replace the references to testkey with the name of your key throughout the examples. If you're doing this on Windows, remember to convert the line ending to UNIX format (CR+LF to LF), not doing so might make the key not work.
General note: If at any stage you need to debug why a key is rejected, there is a log being saved by the stock recovery under /cache/recovery/log.
Disclaimer: Please do not follow these instructions blindly, but instead adjust them to your situation. This is the minimal set of necessary actions, with any optional steps removed for the clarity of illustration. I don't do it this way myself: personally, I'd make a backup here and there, verify MD5 sums after copying large files, etc. In any case, if something goes wrong, you will have to boot from SD card and restore your device. If everything goes right, you will lose all the data on the device. These instructions are provided on an "as is" basis. I will not provide support if anything doesn't work as expected for you. Anything you decide to do based on the above instructions is your sole responsibility.
dumpkey.jar really helped, thanks for that. Had to make exponent 3 type android key else it gets rejected, if you compiled the class, can you remove that check? Out of thanks for today.
Just a short note:
"bootutil" is now called "imgutil" and can be found in the signature.
There are more options than before, but I forget which ones.

Unpack and Repack Allwinner OS .img

I have a head unit with allwinner T3L.
I have asked for the OS update file from the seller to reinstall and fix an issue. I used Phoenixcard to create the sd card and installed it successfully.
I want to unpack and repack the OS to remove a system app and replace it with another. Also I want to change the boot animation.
I found a few information about unpacking/repacking .img for allwinner but none for my processor and there are not many details on each step.
I tried to create an edited .img file but I’m afraid to test it in case it’s corrupted and I won’t be able to use my head unit.
Here are the steps i followed to build it:
-Unpack img on Windows (I used imgRePacker_206)
Put xxx.img in imgRePacker folder
Run runner.bat and drag xxx.img in cmd window
Get system.fex from xxx.img.dump
-Unpack system.fex on Linux (I used allwinner-kitchen tools)
Put system.fex in allwinner-kitchen folder
Code:
tools/simg2img system.fex system.img
mkdir system
sudo mount -o loop system.img system
cd system
I changed the bootanimation_800.zip in media folder.
I deleted an app from "app" folder and added another.
I changed the ownership to root:root for the added files.
Code:
cd ../tools
sudo ./mkuserimg.sh -s ../system ../new-system.fex ext4 ../tmp 2048M
cd ..
sudo umount system
(here I used 2048M because I was getting errors with 1024M or less)
-Building the new image on Windows
Deleted system.fex from xxx.img.dump
Added the new-system.fex in xxx.img.dump and renamed to system.fex
(system.fex size is different even if I don't make any changes to system folder)
Run runner.bat and drag xxx.img.dump in cmd window
Use xxx.img and create sd card with Phoenixcard
I want to know if I did anything wrong or if I missed any step that would brick my unit.
Thank you
Anyone? I just want to verify if I miss any step in the process.
koroji said:
Anyone? I just want to verify if I miss any step in the process.
Click to expand...
Click to collapse
Unpack first level only with this tool - https://forum.xda-developers.com/showthread.php?t=1753473
Then you can use a kitchen to edit the system/vendor partitions.
Good luck

GSI Porting Tools for Android (Auto Script A to A/B wip)

I wanted a way to easily work on GSIs with my phone. These are the fruits of my labor.
Prerequisites:
* Magisk manager > settings > mount namespace mode > global
* Termux
How to dump, edit, and convert your stock OS into a GSI?​
1. Using Termux run the following commands. This assumes you have root.
Code:
su
ls /dev/block/bootdevice/by-name
cd /data/local/tmp
For me system is labeled as system_a, so this is what we're going to use. This name may differ by device so it's always a good idea to check. Next command...
Code:
dd if=/dev/block/bootdevice/by-name/system_a of=/data/local/tmp/system.img
2. About 1-2min after running the previous command you'll have a raw system image in your tmp directory. Now we need to mount it like so...
Code:
mkdir /mnt/a && chmod 0755 /mnt/a
mount -o loop system.img /mnt/a
3. If everything went smoothly your raw image is now mounted at /mnt/a and visible with a root explorer. Not only that, it's also live! So any changes you make while it's mounted will be permanent. Simply make any edits as you see fit using a root explorer, then unmount the image when you're done like this...
Code:
umount /mnt/a
Tip: If you can't unmount due to device or resource busy, back out of /mnt/a or any subfolders with your root explorer. If the files are being accessed then you can't unmount them until you get out.
4. Now that the raw image we dumped into /data/local/tmp has been edited, we need to convert it into a sparse image for flashing. Download arm_img_binaries.zip. Extract the files and copy img2simg to /data/local/tmp and set permissions to 0755. From termux run the following commands...
Code:
./img2simg system.img name-of-gsi.img
cp /name-of-gsi.img /sdcard/name-of-gsi.img
You're done! Now just install it like any other GSI using twrp or fastboot.
To clean up everything simply run...
Code:
rm -rf /data/local/tmp/*
How to edit a GSI that's already in sparse format?​
Again we're going to need our arm_img_binaries. This time copy simg2img to /data/local/tmp & chmod 0755 just like before. Copy your GSI to the same location then run...
Code:
./simg2img name-of-gsi.img system.img
From there, just follow the guide starting at step #2.
Sources & Tools used:
Termux: Clang, build-essential, git, and python for compiling arm versions of the needed binaries with my Moto G7 Play. **(Supports Android 8, 9, & 10)**
android-simg2img repo - https://github.com/anestisb/android-simg2img.git
A to AB Port Script -- wip​
1. Copy both GSIs and tools.tar.gz to the root of your internal storage. Then rename your A only GSI to a.img and your AB GSI to ab.img. I believe a stock dump converted to a sparse image can also be used for this.
2. Download port_gsi.sh.txt and remove .txt from the name. Then place it in /data/local/tmp and set permissions on the file 0755.
3.Run the script and wait. You're moving gigs of data, so it will take several minutes. To do this with Termux, use the following commands.
Code:
su
cd /data/local/tmp
./port_gsi.sh
4. Once the script finishes check the root of your sdcard. Your new GSI will be named new_gsi.img. Install it with fastboot or twrp and cross your fingers.
Notes:
* I recommend that you have at least 12gb of storage available for this process. To get a rough estimate of how much space you actually need, add the size of both GSIs together then multiply by 3. For the images I tested, this comes out to around 10.8gb
* This will put selinux into permissive mode for the duration of the script. Selinux is returned to enforcing at the end of the script.
* The script has been optimized for storage space. It's also self cleaning. The script doesn't remove itself though. port_gsi.sh will be left in /data/local/tmp. You need to remove it manually. This was by design so I wouldn't have to keep copying it every time I want to run the script.
* In theory some small edits to the script would allow it to port AB to A, or a stock dump to an A or AB GSI.
* The arm binaries provided should also work for converting oem or vendor images between sparse and raw. Android 8, 9, & 10 are supported.
* If anyone can improve upon my work, please do! I'm grateful for any suggestions or ideas.
Tips and Tricks
Backup partitions to inactive slots...
Code:
su
dd if=/dev/block/by-name/oem_a of=/dev/block/by-name/oem_b
dd if=/dev/block/by-name/vendor_a of=/dev/block/by-name/vendor_b
dd if=/dev/block/by-name/system_a of=/dev/block/by-name/system_b
dd if=/dev/block/by-name/boot_a of=/dev/block/by-name/boot_b
How to mount and edit inactive partitions...
Code:
su
mkdir /mnt/a && chmod 0755 /mnt/a
mount -o loop /dev/block/by-name/system_b /mnt/a
Navigate to /mnt/a with a root explorer and make any changes you want. The changes will be permanent. To unmount simply back root explorer out of /mnt/a or any subfolders then run...
Code:
umount /mnt/a
This works on system, oem, and vendor partitions.
U r an inspiration. Great job! I think I was merely hours from jus walking into oncoming traffic over the frustration this A & B **** has given me for nearly two months. I probably bricked it 15 or more times EVERY SINGLE DAY trying all sorts of things with fastboot and ramdisk combo attacks. Never did better than achieving root shell thru adbd from PC and recovery. I tried every SuperSU zip I could find to try even to jus give magisk root to accomplish and that didn't work either. I have security updates thru Feb '20 and I have a suspicion it plays a part in this. Everything I've read on it when I'd give up for awhile all date six months or more and nothing y'all were doing then we worked much at all. It would but for very temporary....anyhow this is exactly direction we needed to go to fix this very unfriendly to developing trap they call A/B...This phone scrambled my eggs man. Anytime my phone reboots I have an anxiety attack
kapmino269 said:
Nice , good start .
I sugest to add more tools, like convert to dat and rhe opposite ( img2dat.py - dat2img.py ) and ither stuff .... scripts and make android kitchen tool which works on android , I got this idea 2 weeks ago but no time for me (NOW) .
Which I meant :
Tool u can use it like AIK magisk by @osm0sis , but with more better way , better way means to make it easy for user also us ex :
Script :
1- unpack
2- repack
3- convert
4- compress
5- etc...
User : 1
Script :
1- unpack img .
2- unpack squashfs img .
3- unpack (recovery / boot) img .
.....etc
Like that....
User : 1
Script :
Chose which one ?
1- s.img 2- v.img
If convert :
User : 3
Script :
1- convert img to (dat || dat.br) .
2- convert a img to ab img .
Etc .......
And so on ..... That will be very awesome , hope I can see it by u , if no luck np I will try to write scripts for that later .
Hope that my suggest will help u .
Click to expand...
Click to collapse
I get what you're saying. That's actually an awesome idea. I'll see what I can do!
Great guide, many thanks
Successfully made image of my system.. Located in /dev/block/mapper
Getting an error when trying to mount it though, wonder if you have seen it before?
I've got a Redmi Note 9s with dynamic partitioning
Code:
dd if=/dev/block/mapper/system of=systemmiui.img
4838824+0 records in
4838824+0 records out
2477477888 bytes (2.3 G) copied, 23.800180 s, 99 M/s
mkdir /mnt/miui11 && chmod 0755 /mnt/miui11
mount -o loop systemmiui.img /mnt/miui11
mount: '/dev/block/loop9'->'/mnt/miui11': Block device required
I did however manage to unpack and repack on pc.
... That alone has been a saviour with my device only having a closed sourcd twrp clone
Spaceminer said:
A to AB Port Script -- wip​
1. Copy both GSIs and tools.tar.gz to the root of your internal storage. Then rename your A only GSI to a.img and your AB GSI to ab.img. I believe a stock dump converted to a sparse image can also be used for this.
2. Download port_gsi.sh.txt and remove .txt from the name. Then place it in /data/local/tmp and set permissions on the file 0755.
3.Run the script and wait. You're moving gigs of data, so it will take several minutes. To do this with Termux, use the following commands.
Code:
su
cd /data/local/tmp
./port_gsi.sh
4. Once the script finishes check the root of your sdcard. Your new GSI will be named new_gsi.img. Install it with fastboot or twrp and cross your fingers.
Notes:
* I recommend that you have at least 12gb of storage available for this process. To get a rough estimate of how much space you actually need, add the size of both GSIs together then multiply by 3. For the images I tested, this comes out to around 10.8gb
* This will put selinux into permissive mode for the duration of the script. Selinux is returned to enforcing at the end of the script.
* The script has been optimized for storage space. It's also self cleaning. The script doesn't remove itself though. port_gsi.sh will be left in /data/local/tmp. You need to remove it manually. This was by design so I wouldn't have to keep copying it every time I want to run the script.
* In theory some small edits to the script would allow it to port AB to A, or a stock dump to an A or AB GSI.
* The arm binaries provided should also work for converting oem or vendor images between sparse and raw. Android 8, 9, & 10 are supported.
* If anyone can improve upon my work, please do! I'm grateful for any suggestions or ideas.
Click to expand...
Click to collapse
thank you very much for your work,
so can i use this on a linux computer? and how ti use?
awesome,realy cool,thanx!!!
hello how to do the opposite. from A/B to A-only. I have an AB img and I want to convert it to A-only. Thanks
Spaceminer said:
I wanted a way to easily work on GSIs with my phone. These are the fruits of my labor.
Prerequisites:
* Magisk manager > settings > mount namespace mode > global
* Termux
How to dump, edit, and convert your stock OS into a GSI?​
1. Using Termux run the following commands. This assumes you have root.
Code:
su
ls /dev/block/bootdevice/by-name
cd /data/local/tmp
For me system is labeled as system_a, so this is what we're going to use. This name may differ by device so it's always a good idea to check. Next command...
Code:
dd if=/dev/block/bootdevice/by-name/system_a of=/data/local/tmp/system.img
2. About 1-2min after running the previous command you'll have a raw system image in your tmp directory. Now we need to mount it like so...
Code:
mkdir /mnt/a && chmod 0755 /mnt/a
mount -o loop system.img /mnt/a
3. If everything went smoothly your raw image is now mounted at /mnt/a and visible with a root explorer. Not only that, it's also live! So any changes you make while it's mounted will be permanent. Simply make any edits as you see fit using a root explorer, then unmount the image when you're done like this...
Code:
umount /mnt/a
Tip: If you can't unmount due to device or resource busy, back out of /mnt/a or any subfolders with your root explorer. If the files are being accessed then you can't unmount them until you get out.
4. Now that the raw image we dumped into /data/local/tmp has been edited, we need to convert it into a sparse image for flashing. Download arm_img_binaries.zip. Extract the files and copy img2simg to /data/local/tmp and set permissions to 0755. From termux run the following commands...
Code:
./img2simg system.img name-of-gsi.img
cp /name-of-gsi.img /sdcard/name-of-gsi.img
You're done! Now just install it like any other GSI using twrp or fastboot.
To clean up everything simply run...
Code:
rm -rf /data/local/tmp/*
How to edit a GSI that's already in sparse format?​
Again we're going to need our arm_img_binaries. This time copy simg2img to /data/local/tmp & chmod 0755 just like before. Copy your GSI to the same location then run...
Code:
./simg2img name-of-gsi.img system.img
From there, just follow the guide starting at step #2.
Sources & Tools used:
Termux: Clang, build-essential, git, and python for compiling arm versions of the needed binaries with my Moto G7 Play. **(Supports Android 8, 9, & 10)**
android-simg2img repo - https://github.com/anestisb/android-simg2img.git
Click to expand...
Click to collapse
hello how to do the opposite. from A / B to A-only. I have an AB img and I want to convert it to A-only
i'm trying to mount a gsi image but it says that requires -t option, what should i do?

Categories

Resources