[DEV Q]VS980 ROM Port Debugging Help - G2 Q&A, Help & Troubleshooting

Hi all,
I am working on porting a ROM to the VS980. I am trying to get it to boot, but it sits with the kernel started on a black screen. The last_kmsg doesn't show anything that points me to a problem, but ADBD never starts so I can't logcat the boot. I am attempting to modify the stock kernel's RAMDISK and edit the init.rc to start ADBD as early as possible. Does anyone have any advice on how to extract the ramdisk? I downloaded the splitramdisk tool from here: http://forum.xda-developers.com/showthread.php?t=1477845 but the zip that comes out is not gzip or lzma. I can't open it with the archive tool in linux either.
Any help here would be appreciated.

PWn3R said:
Hi all,
I am working on porting a ROM to the VS980. I am trying to get it to boot, but it sits with the kernel started on a black screen. The last_kmsg doesn't show anything that points me to a problem, but ADBD never starts so I can't logcat the boot. I am attempting to modify the stock kernel's RAMDISK and edit the init.rc to start ADBD as early as possible. Does anyone have any advice on how to extract the ramdisk? I downloaded the splitramdisk tool from here: http://forum.xda-developers.com/showthread.php?t=1477845 but the zip that comes out is not gzip or lzma. I can't open it with the archive tool in linux either.
Any help here would be appreciated.
Click to expand...
Click to collapse
If it's a stock kernel the ramdisk should be *.lz4
Use this to decompress the ramdisk. :good:
Code:
chmod a+x lz4demo
./lz4demo -d ramdisk.lz4 output_ramdisk.cpio
To recompile, you can use lz4demo again, or you can use gzip, just make sure your rom supports it.
Code:
chmod a+x mkbootfs
./mkbootfs <path_to_ramdisk_dir> | gzip > ramdisk.gz

Savoca said:
If it's a stock kernel the ramdisk should be *.lz4
Use this to decompress the ramdisk. :good:
Code:
chmod a+x lz4demo
./lz4demo -d ramdisk.lz4 output_ramdisk.cpio
To recompile, you can use lz4demo again, or you can use gzip, just make sure your rom supports it.
Code:
chmod a+x mkbootfs
./mkbootfs <path_to_ramdisk_dir> | gzip > ramdisk.gz
Click to expand...
Click to collapse
THANK YOU!!!!!!!!!!!!!!!!!!!!

Savocca,
I was able to get unzipped, edit the init.rc and I zipped it back up. However, it doesn't boot. The original was 16mb and the version I created was 9mb. I used the perl script and pointed it at the kernel file and the folder where I extracted ramdisk. Did I do something wrong?

Bumping

Related

[Q] How to Create boot.img file

I couldn't find a thread on this. If there is one and I just missed it, please direct me that way and I apologize for the duplicate.
I hacked the .config file (kernel), compiled it, tested it in fastboot's boot mode (from the bootloader) and then flashed it to the phone with the instructions on this site:
credentiality2.blogspot.com/2010/08/nexus-one-htc-passion-compile-and-flash.html
It works and is wonderful, but I would love to find a way to create a boot.img file with the kernel I've hacked. Do any of you have any insight or know where I can look for more info.?
Do any of you know how to create the boot.img-ramdisk.gz file? I know how to put that with my hacked boot.img-kernel file and create a boot.img file that way.
Any help is much appreciated.
Fixed!
I figured out the problem was I couldn't the boot.img file from my Android 2.2 phone because the read-write permissions did not allow me to do the adb pull command. Now, I've pulled that boot.img file and can unpack and repack it with my hacked kernel using the directions on the website I originally referenced.
I used this command to change the permissions so I could pull the boot.img file:
#mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
Hi,
I have rooted my HTC Dream successfully. I have flashed in CyanogenMod ROM.
Now I have downloaded Android Kernel and rebuilt it. Now I have the zImage which is the kernel image. Now how do I use this new image? I guess must modify the boot.img to use this new kernel image.
Any idea how can I do this? I tried using "fastboot flash:raw boot <kernel directory> <ramdisk directory>"
For <ramdisk directory> I point to the one in the android-sdk. But after flashing it stuck in the "G1 T Mobile" screen and doesn't proceed. Not sure how to resolve.
Thanks In Advance,
Perumal
I downloaded the boot.img file, split it into boot.img-kernel and boot.img-ramdisk.gz. Then, renamed my newly-compiled kernel's "zImage" file as "boot.img-kernel" and zipped them back up into boot.img. Then, I flashed it to the phone with fastboot. All of the directions are on this website:
credentiality2.blogspot.com/2010/08/nexus-one-htc-passion-compile-and-flash.html
It was written for HTC Passion / Nexus One, so you may want to pull your existing boot.img file first in case it doesn't work on the HTC Dream and you need to go back to where you started. I found this tutorial helpful for that.
credentiality2.blogspot.com/2010/08/extract-bootimg-from-android-phone.html
You probably need to change your permissions to push and pull the boot.img file. I would do that on my computer (with it tethered to the phone), using the following commands in a terminal window:
$ adb shell
$ su
# mount -o remount,rw /dev

[Q] no /sbin/am

Hi.
My problem is on a SGSII, but I suppose it could be on any phone.
All last rom I flashed had problems with adb : after flashing, I am unable to use some adb command. For example :
Code:
$ adb uninstall <mypackage>
/sbin/sh: pm: not found
the pm script exists in /system/bin, but is not useable "as is" because it lacks of "#!/system/bin/sh" on the first line.
What I have to do is
Code:
mount -o remount,rw - /
echo '#!/system/bin/sh' >/sbin/am
cat /system/bin/am >>/sbin/am
chmod 0777 /sbin/am
echo '#!/system/bin/sh' >/sbin/pm
cat /system/bin/pm >>/sbin/pm
chmod 0777 /sbin/pm
mount -o remount,ro - /
And then it works again.
But my problem is that on each reboot I have to do this again.
So my questions are :
- do you know why those rom (I'm actually using Lite'ning) does not have those scripts ?
- how can I make those change permanent ? how /system is build ? for example, there is a "build.prop" file in it but it is nowhere else on my phone ...
Thanks a lot for your help !
Mike
The problem is twofold. First, a proper shell script should have the first line as a path to the command interpreter ("#!/system/bin/sh"), but for some reason, am and pm scripts don't have this. The second part of the problem is that the default shell as shipped in the AOSP code base ignores that line and happily executes these broken shell scripts. Depending on just how your rooted ROM was cooked, you may have any of a number of shell interpreters; bash, busybox sh, and the original sh being the most common. Bash is more tolerant of broken scripts, but the busybox interpreter won't execute these.
I don't know why your editing doesn't keep between boots though. It seems it should based on what's posted above. I don't have any knowledge of the internals of the SGSII so you probably need to ask that question in a forum dedicated to that device.
Tanks for your reply.
OK, it don't work anymore because default shell has been changed.
2 questions remains :
- why those scrips are not any more in /sbin
- why they don't stay when I reboot.
If anybody knows ...
I'll try to ask on the rom maker thread ...
Mike
I must have missed that. /sbin is part of the ramdisk. It is stored in the boot image and gets expanded to RAM at every boot, so any changes in /sbin will be destroyed on next boot.
all I have to do then is find where this ramdisk and update it ? ...
I'll try and let you know
Thanks again !
mbaroukh said:
all I have to do then is find where this ramdisk and update it ? ...
I'll try and let you know
Thanks again !
Click to expand...
Click to collapse
The ramdisk is a cpio archive gzipped to save space, then concatenated with a kernel into a single file. A short header on the whole thing tells where to split the two, and the kernel command lines and some other housekeeping tasks. Together that all makes up the boot.img partition (at least this is how it is on most androids I've played with). When the bootloader launches, it loads the header that tells where the kernel is in the file. It then loads the kernel into RAM. It then passes control to the kernel. The kernel knows how to gunzip the cpio archive and how to create a ramdisk partition of the required size. It then un-archives it into the newly created ramdisk, then passes control to `init' to do the rest of the boot process.
You can't just modify the ramdisk on the device. You have to extract the whole boot.img from flash, then separate its two parts (ramdisk and kernel) then gunzip and un-archive the cpio filesystem somewhere (preferably a *nix system that understands unix permissions, simlinks, etc), then modify whatever it is you want, then archive the contents again to a cpio archive, gzip it up, then recombine it with the kernel and the appropriate header for the whole thing, then re-flash it to the NAND partition on your device where the boot.img normally resides.
Thanks !
This is my next week-end task to try all this.
I'll let you know if I succeed or not.

[GUIDE] How to build CM10.2 for the HTC One with OS X 10.8.X

This is a guide to build CyanogenMOD 10.2 (Android 4.3) for the HTC One. This guide is for OS X Mountain Lion (10.8.X).
[size=+1]Pre Requirements:[/size]
1) go to App Store on your OS X and Download Xcode 4. Once that is installed, open Xcode and go to preferences. There you find a tab “DOWNLOADS”, open it and there you can find “Command line tools” and next to it click INSTALL. It will take a few minutes to download and install
2) Make sure you have the android-sdk downloaded and setup adb and fastboot, so they work. It is recommended to place the android-sdk to /usr/local/
[size=+1]Initializing the build environment[/size]
First we need to set up our OS X to be able to build Android. This needs some extra things compared to for example, building in Linux, but the main stuff is pretty much the same. So let’s get started then, shall we?
Open up Terminal and type
Code:
java
If you don’t have java installed you will get a prompt to install it.
Next we will install homebrew (you can also use macports if you like)
Code:
ruby <(curl -fsSk https://raw.github.com/mxcl/homebrew/go)
Now make sure android-sdk and homebrew are in $PATH
Code:
touch ~/.bash_profile && echo "PATH=/usr/local/bin:/usr/local/sbin:$PATH:/usr/local/android-sdk/tools:/usr/local/android-sdk/platform-tools" >> ~/.bash_profile
I also recommend to add this edit to the .bash_profile file:
Code:
nano –w ~/.bash_profile
Code:
export BUILD_MAC_SDK_EXPERIMENTAL=1
Now run this and see if you need to update anything.
Code:
brew doctor
If you do (and you probably will once a day) type:
Code:
brew update
Now we need to get our dev packages
Code:
brew install git coreutils findutils gnu-sed gnupg pngcrush repo
Once that is done, run
Code:
brew outdated
if it shows anything, run
Code:
brew upgrade
Now run this the correct a few symlinks [Not sure if these are needed anymore]:
Code:
ln -s /usr/local/bin/gfind /usr/local/bin/find && ln -s /usr/local/bin/gsed /usr/local/bin/sed
Now to create our case sensitive image for our CM work [NOTE: the 60g can be changed to anything. It only takes up what it needs but I used 60GB]:
Code:
hdiutil create -type SPARSE -fs "Case-sensitive Journaled HFS+" -size 60g -volname "android" -attach ~/Desktop/Android
Now to create our working directory
Code:
cd /Volumes/Android && mkdir cm10.2 && cd cm10.2
[size=+1]Getting the source[/size]
Now to initialize the git and to download it
Code:
repo init -u git://github.com/CyanogenMod/android.git -b cm-10.2
Download the sources:
Code:
repo sync
Wait until it is finished. It will take a long time, depending on your internet connection.
[size=+1]Obtain the device build files and proprietary files:[/size]
To do this we will use CyanogenMods "tool" called roomservice. Roomservice is replacing the old local_manifest.xml file. Just run the code below to create the file directly into the folder.
Code:
nano -w /Volumes/android/cm10.2/.repo/local_manifests/roomservice.xml
Paste the following lines into the file:
Code:
<manifest>
<project name="TheMuppets/proprietary_vendor_htc.git" path="vendor/htc" remote="github" revision="cm-10.2"/>
</manifest>
It seems that nowadays you only need to have the TheMuppets repo there, the roomservice process takes care of the rest and downloads the needed mako bits automatically. And actually it doesn't matter what you name the xml file under the local_manifests directory. The process loads every xml file from there in a alphabetical order. If you still have that local_manifest.xml file in your .repo directory, i suggest you remove that, because at that case that file will be read first and after that all the other from the local_manifests folder
Save the file. And rerun the code:
Code:
repo sync
Download the necessary pre-builts:
Code:
/Volumes/android/cm10.2/vendor/cm/get-prebuilts
That is all. The sources are now ready.
[size=+1]Building CyanogenMOD[/size]
If you build now, you're probably gonna get kernel build errors regarding the missing elf.h header (this error might be device specific). Fortunately, we already have this file downloaded, so we only need to copy it to /usr/local/include:
Code:
cp /Volumes/android/cm10.2/external/elfutils/libelf/elf.h /usr/local/include
FINALLY, we are ready to build:
Code:
cd /Volumes/android/cm10.2 && source build/envsetup.sh && brunch m7ul
The upper command will start the build for the international version for the HTC One (m7ul). Just change the m7ul part to the right codename (check it from f.ex www.get.cm webpage).
Then we just let the Mac do the rest. Remember that it will take a while to do the build, and meantime you Macs fans will scream for mercy while CM punishes your system ☺
After the build is finished successfully you can find your newly created flashable zip by typing:
Code:
cd $out
Look for .zip file with a tag UNOFFICIAL
Happy building!
donk
I just might give this a try. Thanks for the tutorial!
Sent from my One using Tapatalk 4
inffy said:
Hey there!
Only Thing that comes to mind is that you forgot to get the prebuilts. Or you flashed incompatible kernel
Click to expand...
Click to collapse
Not that I'm aware of, but I must've messed something up. I nuked it all and started over.
It works fine now (and more importantly I got myself a new "theme aware" aapt that doesn't think that drawable-xxhdpi is an invalid folder name )
Thanks again for a nice guide.
i can add packages of apk github
help
thanks
packhex said:
i can add packages of apk github
help
thanks
Click to expand...
Click to collapse
What do you mean, sry
Strange error
I get this error when I try to save the manifests xml file.
[ Error writing /Volumes/android/cm10.2/.repo/local_manifests/roomservice.xml: ]
Please help me figure this out...
Okay, I figured I hade the wrong directory..
now when I try to brunch, I get this error:
Don't have a product spec for: 'cm_m7ul'
Do you have the right repo manifest?
Please help!

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

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!

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