Can I flash an .img pulled from the device? - General Questions and Answers

I have a Google Pixel 5.
Pixel stock roms don't have a modem.img in the rom.zip.
Instead, there's a radio.img that can't be mounted to see file contents.
I managed to pull the modem.img from by device by doing:
1. #ls -la /dev/block/bootdevice/by-name
to find which partition the modem.img is flashed in
2. #dd if=dev/block/(modem_a#) of=/sdcard/modem_a.img
#dd if=dev/block/(modem_b#) of=/sdcard/modem_b.img
to extract the modem images which can now be mounted and edited.
After editing the mbn files inside, is it safe to just "fastboot flash modem" the device?

Related

Fixed SBF?

i understand that to create a fixed SBF i need to remove CG31 and CG39 and repack. the question is, how can i get a nandroid of the system SBF without flashing the full SBF?
so is there a way of converting the CG39 into a nandroid img? or is there any other way to do it?
i know there are nandroid backups of different SBFs but i have localised SBF that i want to use and i dont want to lose downgrade-ability. what to do?
You can get the CG39.smg file and copy it to a linux box.
Then you create a folder inside the /mnt folder
Code:
mkdir /mnt/GC39
.
Then you can mount the CG39.smg as a loopback device:
Code:
mount -o loop /location/to/your/cgfile/CG39.smg /mnt/CG39/
Then you can go into /mnt/CG39 folder and copy the contents to anywhere.
After you'll need to repack it on a system.img file in order to make a nandroid restore.
i will try that, thanks!
i've done the above, and used "cat" command to create the .img file, strangely the smg file and the cat output .img are exactly the same size in bytes.
is it safe to nandroid restore the .img file?
can anyone tell?
im going to see if using dd command makes a difference.
Edit:
using dd command i got also the same size in bytes as the original smg file. this either means that i wont be able to downgrade or CG39 file doesnt include anything to block downgrading.
nolimitzz said:
i've done the above, and used "cat" command to create the .img file, strangely the smg file and the cat output .img are exactly the same size in bytes.
dd command i got also the same size
Click to expand...
Click to collapse
seriously? how could you expect otherwise?
you practically did the most complicate way of copying a file.
would you expect the file to change by doing that?
you need to do use makeyaffs2image

Help - unbrick using fastboot and files from update.zip?

I have bricked my kyobo ereader (gingerbread 2.3.5) but still have fastboot and limited adb (no shell commands since there is no valid system) access on the device.
I have various update.zips for the device but unfortunately these are installable only on a working system (via settings->privacy->updates) and I know of no way of installing the update.zip since there does not appear to be any custom recovery for this ebook reader and booting into recovery does not install the update.zip on the sdcard.
The update.zip for the Kyobo ereader contains boot.img, recovery.img and a system folder containing files and directories for the system partition (an example of an official update.zip is available from m.kyobobook.co.kr/mirasol/update.zip )
I have extracted the system folder on a ubuntu system and need to prepare a system.img file which may be flashed using fastboot. I have also changed owner of the extracted files to root:root and chmod 777 on all the executables in the extracted system folders. A complication is that I only have the windows qualcomm hsusb drivers for fastboot or adb to connect to a pc, so I must use a windows 7 notebook to flash the device (possibly precluding pushing the system folder files to the device since they don't have permission and owner settings in windows)
I have tried various tools to make a system.img including the native linux mkcramfs and tools suggested by various google searches such as mkfs.yaffs2.x86 and make_ext4fs. All these tools could prepare a system.img but unfortunately they have different sizes and I am not sure which img is the correct one. I have tried to flash the various system.img using both fastboot flash system system.img and also by adding the system.img to the update.zip (together with placeholders for the required android-info.txt but in all cases they do not any files onto the sytem partition (although fastboot does send the system.img successfully to the device and writes the 120~180MB img files in about 50-70seconds. I have tried using both the official boot.img and the rooted boot.img. I noticed that the device reboots twice after such flashing which may be because there is some protection from the official recovery.img which checks the system partition an erases it if it does not match.
My first 2 questions are general and the third is specific to my situation:
1. What is the correct tool to generate an android system.img file from the extracted update.zip's system folder on a linux system?
2. Any suggestions on how to flash an update.zip using fastboot or adb?
3. Are there any generic recovery.img which I could try to flash over the official recovery partition on the kyobo mirasol ereader?
Any suggestions anyone?

[GUIDE][FOR ADVANCED USERS] [Edit original LG Firmwares] root su760 ICS

Hi guys,
this is a big tutorial for advanced users on how to edit LG Firmwares.
This could be usefull to change recovery included, root the bin or give a try to
change bootloader to make su760 ics on p920 work.
First download a bin or a kdz file:
http://lg-phone-firmware.com/
Then download the attached zip file and unpack it somewhere on your
windows pc.
Put the downloaded firmware in the same directory.
If you have chosen a kdz file you have to unpack it with LGExtract.
Ope up cmd and go with cd to the directory where all the files are.
Then type:
Code:
LGExtract -kdz *nameofthekdzfile*.kdz
upack the new .cab file with winrar or something like that, then run
LGExtract -wdb ***.wdb ***.dll
Click to expand...
Click to collapse
replace *** with the name of the files that you have unpacked
Now you should have a Folder caled BIN.
Use cd to enter that folder.
Run in cmd:
Code:
copy /b "LG****_AP[*].bin" "LG****_AP.bin"
Replace **** with p920 or su760 related to wich firmware you have downloaded.
Now use explorer to move the LG****_AP.bin in the folder where all the .exe files are.
Extracting the bin
Run in cmd
Code:
extract.exe ***_AP.bin
At first you will see all the partitions in the bin and their offsets,
then the tool will extract them to .img files, stay tuned this will take some time.
Root the system partition
You can skip this if you just want to replace a partition.
Rename the extracted sstem partition from something like "7 - system.img" to "system.img"
Download this:
http://downloads.noshufou.netdna-cdn.com/superuser/Superuser-3.1.3-arm-signed.zip
and put it together with the system.img into a linux distro.
In linux unpack the zip and copy the superuser.apk and the su file
in the same directory with the img
go with the terminal in the folder with the system.img
and run:
Code:
sudo mkdir temp
sudo mount -o loop system.img temp
sudo cp superuser.apk temp/app
sudo cp su temp/bin
cd temp/app
sudo chmod 0644 superuser.apk
cd ..
cd bin
sudo chmod 6755 su
sudo umount temp
Copy the image back to windows.
Replace a Partition
Install winhex or an other hex editor.
Open the downloaded or extracted bin.
Go to offset that extract.exe showed you,
and select everything to the end of the partition and delete it.
The end of the partition is the offset + size of extract.exe showed you.
For example:
If the offset of the system partition is 00DA0000
and the size of is 2BC00000 the end of the partition is DA0000 + 2BC00000 = 2C9A0000
now open up the image you want to replace i with in hex editor,
select everything go back to the offset of the partition in winhex and paste it there,
just save it and you have your new own bin file ready to flash with LGFlashTool.
Hope this helps you, please post if you didn't understand anything, I forgot something or something is wrong.
Credits
LGExtract:
http://forum.xda-developers.com/showthread.php?t=1566532
BIN Extracting Tool:
http://forum.xda-developers.com/showpost.php?p=31476664&postcount=17
Rooting img file:
http://forum.xda-developers.com/showthread.php?t=1517457
Please sent pm if I forget somebody
Changelog
--reserved--
↑
Sent from my LG-P925 using xda app-developers app
Hi berni, i managed to insert your bootloaders into an ics bin but it didnt boot good news though the bootloaders seemed to have flashed fine. Now just finding a way back into android.
berni987654321 said:
Hi guys,
this is a big tutorial for advanced users on how to edit LG Firmwares.
This could be usefull to change recovery included, root the bin or give a try to
change bootloader to make su760 ics on p920 work.
First download a bin or a kdz file:
http://lg-phone-firmware.com/
Then download the attached zip file and unpack it somewhere on your
windows pc.
Put the downloaded firmware in the same directory.
If you have chosen a kdz file you have to unpack it with LGExtract.
Ope up cmd and go with cd to the directory where all the files are.
Then type:
Code:
LGExtract -kdz *nameofthekdzfile*.kdz
upack the new .cab file with winrar or something like that, then run
replace *** with the name of the files that you have unpacked
Now you should have a Folder caled BIN.
Use cd to enter that folder.
Run in cmd:
Code:
copy /b "LG****_AP[*].bin" "LG****_AP.bin"
Replace **** with p920 or su760 related to wich firmware you have downloaded.
Now use explorer to move the LG****_AP.bin in the folder where all the .exe files are.
Extracting the bin
Run in cmd
Code:
extract.exe ***_AP.bin
At first you will see all the partitions in the bin and their offsets,
then the tool will extract them to .img files, stay tuned this will take some time.
Root the system partition
You can skip this if you just want to replace a partition.
Rename the extracted sstem partition from something like "7 - system.img" to "system.img"
Download this:
http://downloads.noshufou.netdna-cdn.com/superuser/Superuser-3.1.3-arm-signed.zip
and put it together with the system.img into a linux distro.
In linux unpack the zip and copy the superuser.apk and the su file
in the same directory with the img
go with the terminal in the folder with the system.img
and run:
Code:
sudo mkdir temp
sudo mount -o loop system.img temp
sudo cp superuser.apk temp/app
sudo cp su temp/bin
cd temp/app
sudo chmod 0644 superuser.apk
cd ..
cd bin
sudo chmod 6755 su
sudo umount temp
Copy the image back to windows.
Replace a Partition
Install winhex or an other hex editor.
Open the downloaded or extracted bin.
Go to offset that extract.exe showed you,
and select everything to the end of the partition and delete it.
The end of the partition is the offset + size of extract.exe showed you.
For example:
If the offset of the system partition is 00DA0000
and the size of is 2BC00000 the end of the partition is DA0000 + 2BC00000 = 2C9A0000
now open up the image you want to replace i with in hex editor,
select everything go back to the offset of the partition in winhex and paste it there,
just save it and you have your new own bin file ready to flash with LGFlashTool.
Hope this helps you, please post if you didn't understand anything, I forgot something or something is wrong.
Click to expand...
Click to collapse
Unable to extract bin of P725. it says "MAGIC HEADER NOT FOUND: any suggestions ?
Eklovya said:
Unable to extract bin of P725. it says "MAGIC HEADER NOT FOUND: any suggestions ?
Click to expand...
Click to collapse
The bin got corrupted or they aren't supported there is also a tool made by wkpart it doesn't support the p920 but maybe you re phone
Sent from my LG-P920 using xda app-developers app
berni987654321 said:
The bin got corrupted or they aren't supported there is also a tool made by wkpart it doesn't support the p920 but maybe you re phone
Sent from my LG-P920 using xda app-developers app
Click to expand...
Click to collapse
The bin are correct i used them to recover my phone.
Can you provide me the link towards wpark tool?
Sent from my LG-P725 using xda premium
berni987654321 said:
Hi guys,
this is a big tutorial for advanced users on how to edit LG Firmwares.
This could be usefull to change recovery included, root the bin or give a try to
change bootloader to make su760 ics on p920 work.
First download a bin or a kdz file:
http://lg-phone-firmware.com/
Then download the attached zip file and unpack it somewhere on your
windows pc.
Put the downloaded firmware in the same directory.
If you have chosen a kdz file you have to unpack it with LGExtract.
Ope up cmd and go with cd to the directory where all the files are.
Then type:
Code:
LGExtract -kdz *nameofthekdzfile*.kdz
upack the new .cab file with winrar or something like that, then run
replace *** with the name of the files that you have unpacked
Now you should have a Folder caled BIN.
Use cd to enter that folder.
Run in cmd:
Code:
copy /b "LG****_AP[*].bin" "LG****_AP.bin"
Replace **** with p920 or su760 related to wich firmware you have downloaded.
Now use explorer to move the LG****_AP.bin in the folder where all the .exe files are.
Extracting the bin
Run in cmd
Code:
extract.exe ***_AP.bin
At first you will see all the partitions in the bin and their offsets,
then the tool will extract them to .img files, stay tuned this will take some time.
Root the system partition
You can skip this if you just want to replace a partition.
Rename the extracted sstem partition from something like "7 - system.img" to "system.img"
Download this:
http://downloads.noshufou.netdna-cdn.com/superuser/Superuser-3.1.3-arm-signed.zip
and put it together with the system.img into a linux distro.
In linux unpack the zip and copy the superuser.apk and the su file
in the same directory with the img
go with the terminal in the folder with the system.img
and run:
Code:
sudo mkdir temp
sudo mount -o loop system.img temp
sudo cp superuser.apk temp/app
sudo cp su temp/bin
cd temp/app
sudo chmod 0644 superuser.apk
cd ..
cd bin
sudo chmod 6755 su
sudo umount temp
Copy the image back to windows.
Replace a Partition
Install winhex or an other hex editor.
Open the downloaded or extracted bin.
Go to offset that extract.exe showed you,
and select everything to the end of the partition and delete it.
The end of the partition is the offset + size of extract.exe showed you.
For example:
If the offset of the system partition is 00DA0000
and the size of is 2BC00000 the end of the partition is DA0000 + 2BC00000 = 2C9A0000
now open up the image you want to replace i with in hex editor,
select everything go back to the offset of the partition in winhex and paste it there,
just save it and you have your new own bin file ready to flash with LGFlashTool.
Hope this helps you, please post if you didn't understand anything, I forgot something or something is wrong.
Click to expand...
Click to collapse
how can I extract the other partitions?
need modify the exe file? with that program? VS2012?
sorry for my english .. I'm Italian.
fabersantucci said:
how can I extract the other partitions?
need modify the exe file? with that program? VS2012?
sorry for my english .. I'm Italian.
Click to expand...
Click to collapse
Extract .exeextracts all the partitions
Sent from my LG-P920 using xda app-developers app
Thank you very much for this guide. I hope somebody makes a working recovery without wkparks u-boot
Sent From My LG Optimus 3D SU760
berni987654321 said:
Extract .exeextracts all the partitions
Sent from my LG-P920 using xda app-developers app
Click to expand...
Click to collapse
not work ... You can make an example?
Put for example v21e bin and the extract tool in one folder and run extrct .exe name of bin file
Sent from my LG-P920 using xda app-developers app
Hey, great guide! I'm trying this on an LG Motion and the LGExtract worked great. Unfortunately, I'm getting an error with extract.exe "Failed to match header."
Could you please provide a link to the wpark tool?
Lg su760 ics
hi,
my mobile sets info are:
Model LG SU760(korean T)
Android ver 4.0.4
baseband XMM6260
karnel 3.0.21
build number ICS
Software ver LGSU760-V30b-OCT-18-2012
Problems:
1. how i uninstall korean skt and T applications??
2. My data speed on gprs is slow, highest is 12kbps. wifi speed is ok. why the gprs is slow??
Is there i need to root or change baseband? i live in bangladesh.
thanks.
I do not understand this problem
I hope you give me detailed instructions. Thank you very much!!!
"Replace a Partition
Install winhex or an other hex editor.
Open the downloaded or extracted bin.
Go to offset that extract.exe showed you,
and select everything to the end of the partition and delete it.
The end of the partition is the offset + size of extract.exe showed you.
For example:
If the offset of the system partition is 00DA0000
and the size of is 2BC00000 the end of the partition is DA0000 + 2BC00000 = 2C9A0000
now open up the image you want to replace i with in hex editor,
select everything go back to the offset of the partition in winhex and paste it there,
just save it and you have your new own bin file ready to flash with LGFlashTool."

Universal Android Flasher

From now on, Android rom can be easy to pack. You don't need to worry about the permissions of the files or the symlinks anymore.
What does this package do:
1. Automatically find and recognize the img with patterned name in the same folder of this package.
2. Automatically wipe and flash the system partition when system.img is found.
3. Automatically flash the addon pack without wiping the system partition when addon.*.img is found.
4. Automatically backup efs and efs_gsm partition, on Samsung Duo sim card phones.
5. Be able to flash the unmountable partitions like boot, recovery, modem, etc.
How to pack:
1. Make you rom on on the Phone or Linux. On the Phone? Yes, you can test your patches on your phone.
2. No matter on the Phone or on Linux, cd /system/ or cd <your system folder>, check the permissions and symlinks. Usually I don't check cause I modify directly on a system I dumped from my phone. Yes a dump of system partition is a good idea.
3. You have two optitions: 1. Use the modified dumped system partition dump as system.img. This usually generate a big img to flash, but will flash faster. 2. If you use extracted folder or want to use small files, cd to the system folder in shell and make the folder to a tarball with the command: 'tar --lzma -cf <your tar file> * .[!.]*'. Why use * .[!.]*? This will put the .* files and folders in the tarball.
4. Then rename the dumped image or the tarball to system.img and put it in the same folder of the FLASHER.
5. Want to make an addon? Just make the name like addon.<your name>.img. Don't for get the permissions and ownership of the files and folders.
Future plan:
1. Make a packer/dumper for the system partition.
Github:
https://github.com/maxfu/universal_android_flasher
I will edit this post and post some pictures later.

Can I flash with fastboot image created with adb pull?

I created image of, for example, /data partition with
Code:
adb pull /dev/block/mmcblk0pXXX data.img
Can I use
Code:
fastboot flash data data.img
fastboot reboot
to restore it back? Or fastboot require specific, not just raw binary, image file format? If so, is it possible to convert my data.img to that specific format?

Categories

Resources