[MOD] one_sv-swaper: Swap "internal" sd (4GB fat), /data (1GB ext4) and external SD - HTC One SV

[MOD] one_sv-swaper: Swap "internal" sd (4GB fat), /data (1GB ext4) and external SD
Hello there.
I'm using my c525u for over a year and very upset with the size of /data partition, From the other side, it has "internal sd-card" I'm not using at all (well, some apps use it for it's data, but not all 4GB).
So one day I decided to swap them. Store data on 4GB partition and int_sd on 1GB one. Here is small instruction, how to do this.
one_sv_swapper
Goal: swap /data, /sdcard and /sdcard/ext_sd in different ways (see below). The main result is to allow one to "enlarge" /data partition.
How: modify boot (aka kernel) and /system to change mount points. Also modify recovery to force it to backup/restore with new partitioning scheme.
Requirements:
K2_UL, K2_U or K2_CL smartphone. (K2_PL_CPL should be supported too, but nobody has tested it yet.)
ROM: Stock JB based
Recovery: TWRP (Was tested with TWRP_2.7.1.1_K2_UL.img and openrecovery redo 2.8.5.0)
S-Off/S-On: S-Off is needed. Will not work with S-On.
Working adb on PC.
Do full backup of your phone before you begin (including android_secure)!
Also save any valuable content from your "internal" sd-card, because it will be formated.
Install instructions.
1. Boot into recovery!
2. Download archive from the link below and extract files to some directory on your PC.
3. Open console in the directory with the files. (Start/Run/cmd.exe or any other way)
4. Write the following 3 commands in the console (Do not loose " sign.)
Code:
adb push swapper /tmp
adb push abootimg /tmp
adb shell "cd /tmp&&chmod 755 *&&./swapper READONLY"
If scripts finishes successfully you will see Everything is done. message.
In case of troubles dump here script's output to get support.
After "remapping" your flash it is necessary to reboot your smartphone. Then you could start with your wiped system or boot into recovery and restore your data from the backup (but only /data and .android_secure)
Take a note: this mod modifies recovery partition, so do not reflash recovery after installing this mod, or you will not be able to use backup/restore/wipe functions.
Mod's modes =)
There is "READONLY" parameter written in the end of the last command. This is partitioning mode. You should write there any of the following variants:
READONLY
Do not modify anything on the phone, just unpack images and analyze them.
STOCK
/data - 1GB flash
/sdcard - 4GB flash
/sdcard/ext_sd - external SD
I_E_MOD
/data - 1GB flash
/sdcard - external SD
/sdcard/ext_sd - 4GB flash
D_I_MOD
/data - 4GB flash
/sdcard - 1GB flash
/sdcard/ext_sd - external SD
D_I_E_MOD
/data - 4GB flash
/sdcard - external SD
/sdcard/ext_sd - 1GB flash
Uninstall instruction
To remove this mod just run it again with parameter STOCK (see above).
Or follow the full restore instruction below.
Any of this methods means data loss, so do not forget backup data, android_secure and internal SD.
How to restore your phone in case of troubles:
1. Flash clean recovery from PC (with "fastboot flash recovery ...")
1'. Boot into recovery.
2. Restore all data from backup
3. Reformat int_sd as FAT from recovery "Format" menu
FAQ
Q: Could I install this mod on the phone with internal and external sd swapped.
A: Yes, this is one of supported state (called I_E_MOD). swapper should handle this perfectly.
Q: After installing this mod, I see "Unknown" in Settings/Storage/AppStorage size.
A: This is known issue in I_E_MOD and D_I_E_MOD modes. It doesn't affect any functionality.
Q: After reboot says Type Password to Decrypt Storage... what can i do?
A: This means that swapper failed to modify your boot/system correctly. You could restore your firmware from backup (see above). If you still want to do the modification, contact me with detailed info about your phone, we could try to debug the problem.

Download here
Donate here
Changelog:
v 0.8 Support flags in recovery.fstab of k2_cl openrecovery TWRP.
v 0.7 Link abootimg statically to fix possible issues with incompatible recovery builds.
v 0.6 Fix error with openrecovery-twrp-2.7.1.0-k2_ul.img (And possibly 2.8.4.0)
v 0.5 Fix fatal error from 0.4. Readonly mode by default.
v 0.4 Fix k2_u support, add k2_cl support.
v 0.3 Fix some diagnostics, add footer.
v 0.2 Support for k2_u
v 0.1 Initial version.
Click to expand...
Click to collapse

App Storage of 6,8GB
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Phone Storage

There would be an easier way ? or otherwise make 3gb data and 2 internal sd ? anyway, congratulations : D and sorry for my bad english xD

Hello ,
Thanks for your post.
If there will be no errors/problems reported, I'll write more newbi-flendry instruction and upload images/scripts.
Click to expand...
Click to collapse
That would be Wonderful !!!!
Please can you confirm which K2 model you use ? (K2UL or something?)
Alos i understand you have a TWRP boot :
it means : S-OFF & Root ?
The more detailed it is, the best it is !
Thanks, and Congrats !

Near710 said:
There would be an easier way ?
Click to expand...
Click to collapse
Definitely yes.
or otherwise make 3gb data and 2 internal sd ?
Click to expand...
Click to collapse
No.

Ivory_75 said:
Hello ,
Thanks for your post.
That would be Wonderful !!!!
Please can you confirm which K2 model you use ? (K2UL or something?)
Alos i understand you have a TWRP boot :
it means : S-OFF & Root ?
The more detailed it is, the best it is !
Thanks, and Congrats !
Click to expand...
Click to collapse
The main idea (posted above) is proof of concept. It could be implemented with any rom/firmware/model (even not only K2). All you need is unblocked bootloader and you do not need S-Off.
But right now I'm testing fully automatic method, it will be released soon.
Successfully tested on K2_UL S-Off TWRP_2.7.1.1 Stock JB rom.
K2_U support work is in progress, there are minor issues.
S-Off is not needed, I think, but may be wrong.
Root is not needed.
TWRP 2.7.1.1 is the only supported recovery, I did not tested any other.
Script supports only JB stock based roms, but other roms could be added in the future.

Ok, several phones (K2_UL and K2_U) were successfully converted using new automatic method.
You could try it right now from here [1].
Instruction is in Russian for now (you can try google translate), I will put English one in 1st post later today.
[1] http://4pda.ru/forum/index.php?showtopic=439253&st=7020#entry37175308

Tadaaam! Post is updated with new end-user friendly instruction.

After reboot says Type Password to Decrypt Storage... what can i do?

Near710 said:
After reboot says Type Password to Decrypt Storage... what can i do?
Click to expand...
Click to collapse
Sad to hear this.
Please write here your configuration (model, rom, recovery, s-on/off) and output of swapper READONLY command. This will allow me to find problem in swapper script.
Then just restore your phone from backup as described in top message.

K2U Stock Rom
TWRP 2.6.3.2
S OFF
C:\Users\Mario\Android SDK\adt-bundle-windows-x86_64-20140624\sdk\platform-tools
>adb push swapper /tmp
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
2207 KB/s (9043 bytes in 0.004s)
C:\Users\Mario\Android SDK\adt-bundle-windows-x86_64-20140624\sdk\platform-tools
>adb push abootimg /tmp
3164 KB/s (25924 bytes in 0.008s)
C:\Users\Mario\Android SDK\adt-bundle-windows-x86_64-20140624\sdk\platform-tools
>adb shell "cd /tmp&&chmod 755 *&&./swapper READONLY"
HTC One SV partition swapper by Alexander GQ Gerasiov.
Version: 0.5, target state: READONLY.
Emmc partitions: recovery=21 boot=20 userdata=35 fat=36
Extracting boot...
/dev/block/mmcblk0p20: no Android Magic Value
/dev/block/mmcblk0p20: not a valid Android Boot Image.
Possible stock signed boot, stripping signature...
65535+0 records in
65535+0 records out
16776960 bytes (16.0MB) copied, 1.005127 seconds, 15.9MB/s
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
Extracting boot:initrd...
1939 blocks
Extracting recovery...
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
Extracting recovery:initrd...
22532 blocks
Checking current state...
States: boot: STOCK, recovery: STOCK, system: STOCK
Readonly mode called, exiting successfully.
C:\Users\Mario\Android SDK\adt-bundle-windows-x86_64-20140624\sdk\platform-tools
>
Click to expand...
Click to collapse
Try to restore but nothing..
Solved by flashing RUU

That looks very strange, because the dump you posted shows, that you have stock unmodified partitions and even signed boot.

any chance this would work on k2_cl(boost)?

BHoller said:
any chance this would work on k2_cl(boost)?
Click to expand...
Click to collapse
There is support in the code of swapper, but nobody has tested this.
Sent from my HTC One SV

Hello
I'm trying to do the swapp. On Readonly, i have the following message :
../abootimg: not found
what's wrong ?
abooting appears in the /tmp folder with TWRP....
d:\tel2015\Fastboot>adb push swapper /tmp
8 KB/s (9043 bytes in 1.000s)
d:\tel2015\Fastboot>adb push abootimg /tmp
811 KB/s (25924 bytes in 0.031s)
d:\tel2015\Fastboot>adb shell "cd /tmp&&chmod 755 *&&./swapper READONLY"
HTC One SV partition swapper by Alexander GQ Gerasiov.
Version: 0.5, target state: READONLY.
Emmc partitions: recovery=21 boot=20 userdata=35 fat=36
Extracting boot...
./swapper: line 226: ../abootimg: not found
Possible stock signed boot, stripping signature...
65535+0 records in
65535+0 records out
16776960 bytes (16.0MB) copied, 0.929650 seconds, 17.2MB/s
./swapper: line 226: ../abootimg: not found
Click to expand...
Click to collapse
My phone
TWRP 2.7.1.0 (same error with 2.8.0.1 version), phone K2_UL unlock, root, s-off (S-off is complicated and required root. and it is too risky to try it with S-On )
Thanks for your help;

-=GQ=- said:
There is support in the code of swapper, but nobody has tested this.
Sent from my HTC One SV
Click to expand...
Click to collapse
my concern is that the boost variant is most likely formatted differently and this could actually brick my phone indefinitely.. i can recover from a soft brick no problem and i have my backup files but i have never tried to format the internal drive.. ive swapped them with the fstab trick in the past but i found extending the apps to the external to work better.. your method, if im not mistaken, would allow me to use the current 4.45gb "media" partition as the "data" partition and use the 1.22gb "data" partition as "media".. this would allow me to install more apps to the phone without running out of space.. this method doesnt effect the system rom partition at all though? as long as it doesnt modify any of the system rom i should be able to recover if your swapper doesnt work with my variant

BHoller said:
my concern is that the boost variant is most likely formatted differently and this could actually brick my phone indefinitely..
Click to expand...
Click to collapse
I use info from /proc/emmc about partitions and modify only recovery, system, boot, data and fat.
As I do no modification to hboot, maximum problem you could get is the phone in fastboot mode. That's my view.
But of course there is no warranty.

same problem like Ivory_75
Hello,
i have exactly same problem like Ivory_75. Please, how to fix it. thanks

Ok,
It doesn't work.
Stupid question : running adb command is from system or from TWRP recovery ?
from system, it says /tmp is readonly.
From recovery, it says (after pushing both files):
Possible stock signed boot, stripping signature...
65535+0 records in
65535+0 records out
16776960 bytes (16.0MB) copied, 0.934992 seconds, 17.1MB/s
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
Extracting boot:initrd...
1937 blocks
Extracting recovery...
writing boot image config in bootimg.cfg
extracting kernel in zImage
extracting ramdisk in initrd.img
Extracting recovery:initrd...
12444 blocks
Checking current state...
States: boot: STOCK, recovery: UNKNOWN, system: STOCK
Fatal error: Current state is unknown, nothing changed, aborting.
My guess is TWRP 2.7.1.1 is mandatory, but i can't find it in http://techerrata.com/browse/twrp2/k2_ul
Thanks for your help

Related

The Ultimate Guide to put Hero Builds and other Builds to your G1/Magic Android

The Ultimate Guide to put Hero Builds and other Builds to your G1/Magic Android Phones by hellogadgetman from Greece
or download from here for best structure and more
http://rapidshare.com/files/2522727..._Builds_and_other_Builds_to_your_G1_best.docx
for ROOTED Phones
I have no responsibility for mistakes and problems through this guide
1) Find your SPL and Radio Versions
• Radio
o Next you will want to confirm your Radio Baseband.
To Confirm this Press Menu - Settings - About Phone - Scroll down till you see Baseband version.
Compare the Baseband value to the value below to see if you are using the correct radio for your build or if you need to update.
o You will need 2.22.19.26I
• Currently there are three SPLs available. The G1 variant is the SPL that is installed in stock T-Mobile G1 phones. The Engineering variant is found in the Android Dev Phone 1. Finally, the HardSPL is a modification of the Engineering variant by cmonex, with additional hacker-friendly functionality.
• HardSPL
• VER: HSPL10.95.3000
• HardSPL is a modification of the Engineering SPL by cmonex. In addition to the functionality of the Engineering SPL, HardSPL also allows NBH files to be used without matching the CID (carrier ID) check.
• Engineering SPL
• VER: HBOOT-0.95.3000
• The Engineering SPL is a custom SPL installed in devices intended for Android development. It has existed since before the launch of the G1 and is now available to the general public as preinstalled on the Android Dev Phone 1.
• G1 Original SPL
• VER: HBOOT-0.95.0000
• This is the original SPL which is installed in a stock G1. It is easily distinguished by the "trademark" red-green-blue bootloader screen which appears in many HTC phones. This SPL does not support the fastboot protocol and thus will not allow the user to flash nand backup images.
2) Update the Radio to the Latest
• Download the Radio zip.
• http://android-roms.googlecode.com/files/ota-radio-2_22_19_26I.zip
• Rename it to "update.zip".
• Copy it to the root of your phone's SD card.
• Turn your phone off.
• Start up in recovery mode by holding Home and pressing Power.
• Press ALT+S to apply the update.
• Once the update is applied press Home+Back to reboot the phone. The Phone will start to boot up and then continue applying the update. Once this is completed the Recovery menu will ask you for the second time to reboot the phone via Home + Back
3) Update the SPL to the Latest
IF YOU HAVE ONE SD CARD:
• Upload new SPL on your microSD and rename to "update.zip"
• Reboot your phone into recovery mode. I ASSUME YOU MEAN HOLDING POWER AND HOME BUTTONS>>>RIGHT?
• THIS IS IMPORTANT (perform a nandroid backup, of course) APPLY THE UPDATE USING ALT-S..., and once complete DON'T DO ANYTHING.. read step 4.
• WITHOUT PRESSING ANY BUTTONS remove your microSD card from your phone, and plug it into your microSD card adapter/SD card reader
• Remove/rename the SPL update (to something other than "update.zip") and upload the update file of the build you are currently using onto your microSD card. Put your microSD card back in your phone AGAIN WITHOUT PUSHING ANY BUTTONS I KNOW THIS IS STUPID, BUT WE RENAME THE BUILD TO UPDATE.ZIP AS WELL
• Press Alt + x to go to the console. If your phone does not reboot automatically, press enter, type "reboot recovery", then press enter again.
• If you boot up in recovery, you have done everything correctly. Now APPLY THE UPDATE USING ALT-S, reboot, and you're done
4) Performing a NANDROID Backup
At this point you should backup your phone via NANDROID
1 Turn your phone off.
2 Hold Home, press Power button to boot into Recovery Mode
3 Press ALT+B to start the backup.
4 Once the backup has completed press Home + Back
Next your phone will reboot and load the OS, at this point you should copy the files your just backed up to your PC incase you need to recover your phone
1 Mount your SDCard to your PC
2 On your SDCard change to the nandroid/HT840GZ30985
3 Inside this folder you will see another folder the first 8 digits of this folder name is the date it was created in the YYYYMMDD format and the last four are the time.
4 Copy this entire folder to your PC and save it. As you make more backups to your phone repeat this process.
5) Format your sd card to Fat32 and Ext2/Ext3 Partitions
• Install the sdsplit executable to your phone. To so this, open the 'terminal' application / ADB Shell and type the following commands at the prompts:$ su
# cd /data
# wget http://64.105.21.209/bin/lib/droid/sdsplit
# chmod 555 sdsplit
# exit
• Decide the size of your FAT partition:
You should use one of two approaches to decide the size of your FAT partition. The first one involves simply directly deciding this size (i.e. I want a 5G FAT partition). In this case, the EXT2 partition will be the remainder of the card.
size_of_fat_partition = size
The second method is based upon the fact that you want to decide the size of the EXT2 partition and would like the FAT partition to be the remainder of the card. In this case, the size of the FAT partition will be based on the size of your sdcard and the size of the EXT2 partition that you want. Use this formula to calculate it:
size_of_sdcard - size_of_ext2_partition = size
So, if you have an 8GB sdcard and want 1GB of space for apps on your EXT2 partition, use 7000M for the FAT size.
No matter which method you use, you will need to specify either bytes (no parameter), kilobytes (K) or megabytes (M) . So, for a 5G partition would use a 5000M size parameter.
Note: The size parameter is currently case sensitive, use 7500M, not 7500m!
• Backup your SDCard onto your PC
Note: To figure out how much data (in K) you have on you FAT partition, you can type the following in your terminal / ADB Shell (the sdcard can not be mounted for this cmd to work):
$ du -s /sdcard
Note: to find out how much free space is left on your /data partition type (see available)
$ df /data
• Run sdsplit. Use the size from step 3 below (do not forget the "M" in size if you are specifying megabytes): (Note: you will need an internet connection on your phone for this step)
Note: If you are using the JF1.5 update, you should put a -nc at the end of the commands below since system configuration is not needed!
Non JF1.5 Build:
$ su
# /data/sdsplit -nd -fs size
# exit
JF1.5 Build:
$ su
# /data/sdsplit -nd -fs size -nc
# exit
Please, remember to record the output of this stage if you run into a problem. There will be a permanent record of it in, /data/sdsplit.log.
• Reboot your phone, via terminal:
reboot
• Restore your data from your PC to your Fat partition of your SDCard.
• You're done! You should have two partitions now on your sdcard. The FAT one mounted at /sdcard and the EXT2 one mounted at /system/sd.
6) Put the Cyanogen Recovery image 1.2
http://n0rp.chemlab.org/android/cm-recovery-1.2.img
To install raw image: copy it to your sdcard and run from a terminal:
flash_image recovery /sdcard/cm-recovery-1.2.img
It is suggested to fully shutdown the device and power it back up.
Check Recovery IMG by rebooting phone and pressing Home + Power to see the new Recovery IMG
If you have problems with a "no space on device" error, try using fastboot and erasing first:
fastboot erase recovery
fastboot flash recovery cm-recovery-1.3.1.img
7) Upload JACHero 2.2.3 or any other to sd card and rename them as update.zip
8)Last steps to finalize
• wipe
• run apps2sd from recovery image menu
• then run fix filesystems
• then run update.zip
• then run apps2sd from recovery image menu again
• then reboot
• when phone reboots, give it about a minute after the screen comes on and chose deny on swapper in SU permissions pop up.
• then go thru the setup for gmail and android..
• after you get logged in to everything, do your settings for backlight and whatever else,
• then go to programs and do the swapper settings -
• SWAPPER SETTING:
/system/sd/swapfile.swp
Change swapper size
i did 20mb / 32mb ( i think thats right )
• then reboot ( after Gmail has finished syncing your contacts )
• when it comes back up choose always allow on swapper ( in su permission popup )
• then do you market and flickr( disable wifi for a sec ) to accept the terms..
• then give it a few seconds, and in about 1 min the phone will be running faster like cupcake
Many thanks to JACHero,Cyanogen,Robpet2,Jesus Freke,Jon Pezz, xmoo, Haykuro, Stericson, dapro, The Dude, Darkrift, and many others!
very nice guide thank you...also very nice guide structure
gonna try this and see if i can really get this to run as fast as cupcake
Just a side note;
Http://twistedumbrella.googlepages.com/index.htm
The guide there has all the resources loaded to the site already and no longer requires you to have to use fastboot because the recovery there has restore built in.
pretty good guide...but this has nothing to do with porting builds -- only installing builds that have already been "ported"
porting (in the context you used it) means to change a build to work on another system / device:
http://en.wikipedia.org/wiki/Porting
also...Recovery 1.3.1 is the latest and greatest
cheers
alapapa said:
pretty good guide...but this has nothing to do with porting builds -- only installing builds that have already been "ported"
porting (in the context you used it) means to change a build to work on another system / device:
http://en.wikipedia.org/wiki/Porting
also...Recovery 1.3.1 is the latest and greatest
cheers
Click to expand...
Click to collapse
I know but 1.2 Cyanogen has Apps to sd and fix filesystems
alapapa said:
pretty good guide...but this has nothing to do with porting builds -- only installing builds that have already been "ported"
porting (in the context you used it) means to change a build to work on another system / device:
http://en.wikipedia.org/wiki/Porting
Click to expand...
Click to collapse
Yes, the title of this post is rather misleading. I was expecting a guide to porting. This is a well organized collection of instructions to prepare your phone for most modern builds, and will surely be useful to some, but the title should really be changed to better reflect the content of the post.
hellogadgetman said:
I know but 1.2 Cyanogen has Apps to sd and fix filesystems
Click to expand...
Click to collapse
1.3.1 does too, but much like fix_permissions its executed through concole instead of menu
If someone made the guide please post his thoughts
Thanks
Anyone or better None
thanx for your instructions!
and, is the Cyanogen Recovery Image the necessary part for flashing Hero roms on G1?
thanx again.
thanx for your instructions!
and, is the Cyanogen Recovery Image the necessary part for flashing Hero roms on G1?
thanx again.
Very good, indeed.
EDIT:
What happens if you miss a step, but still able to flash the latest 2.3.5 hero rom? (Following these steps reduces the lag?)
That's what exactly what I did:
1. I already had the latest radio update (so I didn't bother downloading again)
2. I installed latest SPL, renamed it to "update" in my sd card, turn off phone, turn-on phone (HOME+END button), hit ALT+S.
(I don't have a SD card reader yet.....but I have another phone (T-Mobile Wing), I removed SD card from G1, put it in T-Mobile Wing, opened folder where SD card is, and deleted "update" (SPL file), rename the 2.3.5 HERO rom to "update", took SD card out of T-Mobile Wing, put it in my G1)
3. Turn on G1 (HOME + END), wipe (ALT+W), then flash (ALT+S)
(Waited until it installed new hero ROM, it was installed, then I went to swapper application and changed settings to " /system/sd/swap.swp "
That's it.
I already had partition my SD card before doing this update. I dont know if it's necessary to do it again.
My G1 is working, and I have 72MB free space in internal phone storage (so far).
My question is:
Do I need to follow these steps to make the rom work better? To allow my apps go to my SD card (like it was before).?
By the way, I installed the OVERCLOCKWIDGET app from market and it won't open. (Launch Error, "Overclockwidget (need root) could not be launched")
Any inputs would be greatly appreciated.
Then I wipe, flash new ROM.
ss1271 said:
thanx for your instructions!
and, is the Cyanogen Recovery Image the necessary part for flashing Hero roms on G1?
thanx again.
Click to expand...
Click to collapse
Yes if you want to be a fast Hero ROM
jay22are said:
very nice guide thank you...also very nice guide structure
gonna try this and see if i can really get this to run as fast as cupcake
Click to expand...
Click to collapse
if it is let me lnow to make the change to hero
FAILURE to install
I followed your guide exactly but when I was flashing the hero update an error came back
"E: Cant't chown/mod /system/xbin
(no such file or directory)
E:Failure at line 14:
set_perm_recursive 0 2000 0755 06755 SYSTEM.xbin
Installation aborted."
Any suggestions???
NVM. Problem fixed. had to download the following spl
https://www.digital-bit.ch/g1devel/6.0-spl-signed.zip
Alt+M (apps2sd option) isn't showing up in v1.3.1
Anyone have any idea why Alt+M (apps2sd option) isn't showing up in Cyanogen's Recovery Image when all the other options that were updated in 1.3.1 are?
twistedumbrella said:
1.3.1 does too, but much like fix_permissions its executed through concole instead of menu
Click to expand...
Click to collapse
Thats the reason I put in my guide the 1.2 Cyanogen recovery
DirectMatrix said:
Anyone have any idea why Alt+M (apps2sd option) isn't showing up in Cyanogen's Recovery Image when all the other options that were updated in 1.3.1 are?
Click to expand...
Click to collapse
app2sd is automatic in version 1.3.1, but that's for new apps installation.
All the hero roms (at least that i know) require not the recommended "HardSPL" but Haykuro's updated SPL
This guide is very misleading esp since you bascially c/p from the other posts.
Dont take it personally, but it really needs to be cleaned up
B-man007 said:
All the hero roms (at least that i know) require not the recommended "HardSPL" but Haykuro's updated SPL
This guide is very misleading esp since you bascially c/p from the other posts.
Dont take it personally, but it really needs to be cleaned up
Click to expand...
Click to collapse
But this is the point of somebody who has to read over 500 posts to understand to have all the things straight away.
I have used it and it is fine and some others also ...(over 100 downloads of the document)
Thanks

[Reference] Stock G1 to Newest CM (5.0.7 Stable)

This is a guide that I created for a friend of mine. Since originally putting it together I have found myself going back to it often as a quick reference guide on how to perform certain procedures. I figured that I may as well share it for others that might find it useful. I will do my best to keep it as up to date as possible.
Gain Root
Koush put together an excellent guide for this here:
http://forum.xda-developers.com/showthread.php?t=442480
Click to expand...
Click to collapse
Recovery
Rom Manager to install either clockwork recovery or amon ra recovery
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Rom Manager
Click to expand...
Click to collapse
Backup
In either recovery you can do a nandroid backup. Do a full backup in case anything goes wrong you can restore phone to its previous state. If you have apps2sd running you will want to select the option that does ext backup as well. Basically its best that every time you have your system working the way you like it to do a nandroid backup so you always have the most recent restore point for your phone.
Alternately, if you simply want to backup applications or system settings individually download MyBackup or Titanium backup You can opt to save application data so that all of your application settings and such are saved as well.
MyBackup
Titanium Backup
Click to expand...
Click to collapse
Flash Radio Update
**NOTE** It has been brought to my attention that it can be unsafe to flash Radio or SPL via recovery (result in brick). Fastboot is much safer. I completed this via recover without any issues. However, I am not responsible if something happens. I will be adding instructions for fastboot shortly. Haven't touched it since I first got my phone way back so need to relearn the procedures. Info HERE**
http://forum.xda-developers.com/showthread.php?t=640535
Download - http://www.mediafire.com/?zgnzmex2mrj
Copy to SD card
In recovery apply zip
Click to expand...
Click to collapse
Flash Danger SPL
**NOTE** It has been brought to my attention that it can be unsafe to flash Radio or SPL via recovery (result in brick). Fastboot is much safer. I completed this via recover without any issues. However, I am not responsible if something happens. I will be adding instructions for fastboot shortly. Haven't touched it since I first got my phone way back so need to relearn the procedures. Info HERE**
http://wiki.cyanogenmod.com/index.php/DangerSPL
Download - http://sapphire-port-dream.googlecode.com/files/spl-signed.zip
Copy to SD card
In recovery apply zip
Click to expand...
Click to collapse
Partition SD
In recovery partition SD
~500 ext
64 swap (only do swap if you intent to use it; read info on swap below before you decide)
*These are my settings. You can adjust as you wish
Click to expand...
Click to collapse
Flash Newest CyanogenMod Rom (5.0.7 Stable)
http://forum.cyanogenmod.com/index....magic-mean-lean-pastry-machine-v507-05252010/
Download - http://www.kanged.net/mirror/download.php?file=update-cm-5.0.7-DS-signed.zip
Download - http://kanged.net/mirror/download.php?file=gapps-ds-ERE36B-signed.zip
Copy all to SD card
If first time installing CM 5.0.7 do a wipe in recovery
In recovery apply update zip
In recovery apply gapps zip (not necessary if already running previous version of 5.0.7)
*Note
Go into settings
Application settings
enable unknown sources and aps2sd
Click to expand...
Click to collapse
Optional Addons Must be completed after every rom flash to retain effects.
Enable Swap
**Note** Each location on a flash memory card can only be written to so many times before it stops working correctly. Since swap will cause the swap partition to be written to frequently, there is a potential issue of wearing out part of a flash memory card. If a card wears out while using swap, your system will malfunction and crash.
Wear leveling is a mechanism that distributes write wear uniformly over the entire memory card by dynamically remapping logical memory blocks to different physical memory blocks over time. This largely alleviates the issue of card wear when using applications such as swap that tend to write to the same memory blocks over and over.
Anecdotal reports on the 'net indicate that most Class 6 microSDHC include hardware wear leveling, while Class 4 and lower cards typically don't. A-Data and Transcend Class 6 cards were specifically cited as having hardware wear leveling. Many people have used these cards for swap without issue. In the end it is your decision on whether you want to take the risk of running swap. Many respected developers here recommend you not use it.
http://forum.cyanogenmod.com/index....swap-partition/page__view__findpost__p__30130
Download - http://dl.dropbox.com/u/5702285/G1/86swapon.txt
Edit 86swapon.txt (default at 30 swappiness)
Copy to SD card
In terminal:
su
mount -o rw,remount /system
cp /sdcard/download/86swapon.txt /system/etc/init.d/86swapon
chown 0:2000 /system/etc/init.d/86swapon
chmod 755 /system/etc/init.d/86swapon
sync
reboot
*Verify by typing "free" in terminal (swap will show values instead of "0")
To disable swap do the following:
su
mount -o remount,rw /system
rm /system/etc/init.d/86swapon
sync
reboot
Click to expand...
Click to collapse
Enable JitFix
http://forum.cyanogenmod.com/index.php?/topic/2910-jit-installeruninstaller-script-507t3-updated/
Download - http://dl.dropbox.com/u/5702285/G1/JIT-Install.zip
Extract JITFIX folder to SDCard
In terminal:
su
sh /sdcard/JITFIX/install
after installation is complete you will be asked if you want to install the fix as well
just type Y and hit enter
the next line will ask where your dalvik-cache is located
Type S for SD card
*verify by typing "dalvikvm -h" in terminal (last line will contain "WITH_JIT")
Click to expand...
Click to collapse
Enable OverClock
http://forum.xda-developers.com/showthread.php?t=679033
Download - http://fromhindsight.com/crap/overclock_update.zip
In recovery apply zip
Download SetCPU
Open and set auto detect.
Set max to no higher than 652800
Min works good at 480000
*These are general settings. You can find a more in-depth conversation about what good settings are at the link above.
SetCPU
Market link above for donate. Free for XDA members here
Click to expand...
Click to collapse
Facebook Account Sync
http://forum.xda-developers.com/showthread.php?t=679572
Facebook from market breaks sync for Market users. Firerat has posted a great patch file for fixing this issue.
Download - http://forum.xda-developers.com/attachment.php?attachmentid=325544&d=1273702838
Copy to SDCard
In terminal:
su
sh /sdcard/fr-patch132.txt fb
Go into Facebook app and edit settings for sync
Click to expand...
Click to collapse
Thanks for this guide!
What's this for?
echo 255 >/sys/class/leds/blue/brightness;
yokonunz said:
What's this for?
echo 255 >/sys/class/leds/blue/brightness;
Click to expand...
Click to collapse
Led will turn blue after settings swap on startup. (Will be reset later in the startup process)
Enable Facebook Sync
To enable Facebook sync use firerats script: http://forum.xda-developers.com/showthread.php?t=679572
su
sh /sdcard/fr-patch132.txt fb
Click to expand...
Click to collapse
fonzie123 said:
Led will turn blue after settings swap on startup. (Will be reset later in the startup process)
Click to expand...
Click to collapse
As Fonzie stated, it makes your led turn blue during startup. This lets you know that the script file is being run. You can safely remove that section if you do not need to notification. I just like having it there.
fonzie123 said:
To enable Facebook sync use firerats script: http://forum.xda-developers.com/showthread.php?t=679572
Click to expand...
Click to collapse
Thanks for that. I'll add it to the guide.
Should be on Cyanogenmod wiki where it belongs
xaueious said:
Should be on Cyanogenmod wiki where it belongs
Click to expand...
Click to collapse
I can throw it on there as well, but I think it belongs here as much as it does there. xda-dev forums are here to help all, and have a much larger user base. A large number of g1 users here use cyanogen. And besides a lot of this can be used for other roms as well. It's simply a quick reference guide to help people out.
To be safe, if you already have the newest radio 2.22.23.02, I say DOWNGRADE to 26i. That way when you're flashing the Danger SPL you decrease your chance of getting a brick.
I know thins because I accidentally bricked my friends G1 because he had the newest radio(2.22.23.02) when I flashed Danger over it..
I wouldn't know how to write out the steps so if you kindly would.
And if you already have 26i whoopy dooo for you less work.
AustinAce said:
To be safe, if you already have the newest radio 2.22.23.02, I say DOWNGRADE to 26i. That way when you're flashing the Danger SPL you decrease your chance of getting a brick.
I know thins because I accidentally bricked my friends G1 because he had the newest radio(2.22.23.02) when I flashed Danger over it..
I wouldn't know how to write out the steps so if you kindly would.
And if you already have 26i whoopy dooo for you less work.
Click to expand...
Click to collapse
That advice is false.
What does prevent accidents when flashing radio is flashing in fastboot
xaueious said:
That advice is false.
What does prevent accidents when flashing radio is flashing in fastboot
Click to expand...
Click to collapse
I'm talking about the SPL. When I flashed Danger over 2.22.23.02 I bricked my friends phone.
What xaueious means is that flashing a radio or SPL through recovery has been proven dangerous. We don't fully understand why, but we do know that you run close to 0 risk if you flash through fastboot instead. Danger has been shown running on old 1.x radio's before, only if they are flashed through fastboot.
mejorguille said:
What xaueious means is that flashing a radio or SPL through recovery has been proven dangerous. We don't fully understand why, but we do know that you run close to 0 risk if you flash through fastboot instead. Danger has been shown running on old 1.x radio's before, only if they are flashed through fastboot.
Click to expand...
Click to collapse
Oh hahaha alright I get it thanks for clearing that up for me.
Sorry! Process System is not responding
i don't know what i have done to the phone. since i flash cm5-t5, i get warning "Sorry! Process System is not responding" everytime I reboot the photo and then unlock it. I did try to wipe and flash back to cm5-t4, i still get the same warning.
xaueious said:
That advice is false.
What does prevent accidents when flashing radio is flashing in fastboot
Click to expand...
Click to collapse
Thanks for the info Xaueious. I looked more into this and found the following:
http://wiki.xda-developers.com/index.php?pagename=HTC_Dream_Bootloader
I will be updating my reference guide here shortly to reflect this information.
Great guide i just placed it in the bible
Royalknight6190 said:
Great guide i just placed it in the bible
Click to expand...
Click to collapse
Thanks Royalknight. I figured some people could get some use out of it. And it helps me update my procedures as people kindly let me know of better ways to do things.
sagementor said:
i don't know what i have done to the phone. since i flash cm5-t5, i get warning "Sorry! Process System is not responding" everytime I reboot the photo and then unlock it. I did try to wipe and flash back to cm5-t4, i still get the same warning.
Click to expand...
Click to collapse
So you had test 4 running good, and flashed test 5 over it correct? No other changes? Upon booting up when you attempt to unlock you get the above error message?
i don't remember. i can eliminate the problem by swipping the ext partition. however after i add back some apps, the problem appears again.

[MOD][RECOVERY] Custom MTD Partitions (resize Data,System and Cache ) [ 2010-10-29 ]

Custom MTD Partitions
This is an implimentaion of lbcoder's Custom partition layouts
be sure to checkout that thread for the full history
What does it do?
Well, basically Custom MTD Partitions resizes your MTD partitions
for instance this is a CM6.1RC1, ( heavily customised )
Code:
Filesystem Size Used Available Use% Mounted on
/dev/block/mtdblock3 73.0M 72.8M 236.0K 100% /system
/dev/block/mtdblock5 134.8M 107.2M 27.6M 80% /data
/dev/block/loop0 896.0K 896.0K 0 100% /system/lib/modules
/dev/block/loop1 4.0M 4.0M 0 100% /system/xbin
/dev/block/mmcblk0p2 457.4M 201.8M 231.1M 47% /sd-ext
/dev/block/mmcblk0p2 457.4M 201.8M 231.1M 47% /cache
/dev/block/mtdblock4 2.0M 776.0K 1.2M 38% /dev/cache
most of my Apps are on sd-ext, dalvik-cache is on data
/dev/cache is where the real cache partition is mounted, /cache is actually a bind mount from /sd-ext/cache
Applicable to..
Probably any device that uses the same kind of nand as the G1 MT3G ( msm_nand )
The intial scripts are geared towards G1 / MT3G. however I have 'rewritten' much of the script for v1.5 , it now reads the partition table in dmesg, so it _should_ be universal **
v1.5.3 confirmed to work on heroc
v1.5.6 confirmed to work on bravo + bravoc ( with S-OFF )
unsure if it will work with your device? checkout the source on github ( or ask your favourite dev to take a look )
The 'Tech' in Breif
This method is beautifully simple...
When booting we give the kernel the mtd partition table we want to use..
Thats it
In practice we need to do this when booting to recovery, and booting the rom.
below are files to make this as simple flashing a rom.
Credits :-
Lbcoder - for coming up with the idea
Skraw ( CM forums ) - for getting lbcoder interested
Koush - for AnyKernel
Cyanogen & Co - for giving us all such great ROMs to play with
Amon_RA and Koush - for giving us something to patch
Techjosh - for fixing the patchers for use with Rogers (EBi1)
Mblaster - for pointing out my nasty habit of using -r zip flag at the end of command ( breaks compatibility with older zip versions, fixed in AutoPatcher v1.5 )
Safety First
This method is safe, however it is not without risk
Two things could potentially go wrong
Recovery flash corrupt
This is extremely unlikely, and tbh could happen anytime you flash recovery
If in the very unlikely event that you find you can't reboot to recovery you have three options
re-flash recovery via fastboot ( the preferred option )
re-flash recovery via ROM ( not a great option with cm5.0.x/cm6 )
Do the whole root thing all over again ( no one wants to do that )
system, cache , data partition unmountable - corrupt
Under the right ( or wrong ) circumstances it is possible to get 'junk' files stuck in system ( or cache,data ), and in such away that recovery can not delete them, more serious corruption can render the partitions unmountable.
It is actually quite straight forward to fix this, but it does require fastboot
Code:
fastboot erase system -w
Clockwork Recovery 2.0.2.0 and later has erase_image binary, if you can adb shell in then
Code:
for i in system cache userdata;do erase_image $i;done
and reboot
I would advise you seek out how to 'fastboot', which tbh is a good thing to have regardless of using this 'hack' as it can get you out of so much trouble
*NB* don't use a patched recovery to flash SPL or RADIO ( you should avoid using recovery to flash these anyway, feel free to ask for current advice on spl / radio flashing )
Prevention is better than cure
I have only managed to corrupt partitions when switching partition layouts while having files on cache or data, for example going from System 67.5 Cache 67.5 to System 90 cache 5 with
cache approx 80% 'used'...
I have not been able to repeat this if I wipe Cache before rebooting,
therefore I advise that you wipe both cache and data * after patching recovery ( and rebooting )
* along with system if you are using clockwork
OK, now lets patch recovery and a ROM
Install Instuctions
It really is quite simple
download FR-recovery-v1.5.6-CustomMTD_S.zip and FR-boot-v1.5.6-CustomMTD_S.zip
create mtdpartmap.txt and put on /sdcard/ see configuration *
reboot to recovery
nandbackup
wipe cache + data
flash FR-recovery-v1.5.6-CustomMTD_S.zip
reboot to recovery ( reboot and hold Home )
Either : -
Nandrestore
Flash ROM + extras
flash FR-boot-v1.5.6-CustomMTD_S.zip
reboot
* configuration
The script in the recovery patcher checks for /sdcard/mtdpartmap.txt and reads that to override the default sizes.
e.g. for system 90mb and cache 2mb
NB make sure you mount sdcard first, else you won't write to sdcard/mtdpartmap.txt !
Code:
echo "mtd 90 2" > /sdcard/mtdpartmap.txt
data would be 117.8mb ( 116.7 useable )
e.g. for system 55mb and cache 2mb ( Purhaps a nice 'sugar free' Donut )
Code:
echo "mtd 55 2" > /sdcard/mtdpartmap.txt
data would be 152.8mb ( 151.7 useable )
NB, above data sizes are for G1s, MT3Gs should add ~78mb
All In One Patch runner ( New to v1.5.3 )
new option to run the All In One Patch script ( versions 1.3.6 and higher )
the format is
Code:
aio <option1> <option2> <option3>...
e.g.
Code:
aio swap remount shabang lwp
By default it will install the sd-ext mount ( option sdext )
so a line just reading aio will be fine
Note: the patch must be on the root of the sdcard, and its file name must start with "fr-patch" and end with ".txt"
if you have several versions the newest ( as per files datetime stamp ) will be used
Faking your SPL
If your using an SPL that is not officially supported by your ROM and that ROM checks your SPL you can 'patch' to fake it.
Code:
echo "spl 1.33.2005" >> /sdcard/mtdpartmap.txt
note that we are using ">>" here, this is to append to the file ( ">" would overwrite it )
you can by all means use any text editor you like, the script will automatically convert to unix format
NOTE : you are dodging the checks the ROM dev put in place, do not complain to them if this doesn't workout for you
in post 2 I have some 'CM6' Kernels I compiled for (1)0.95.xxxx SPLs
but I will only likely do these for RCs and Finals ( and there maybe a delay ).
In that post I point you towards the 'SafeSPL' ( 1.33.2003 ) this SPL is compatible with the current CM6 kernels ( so no need to wait for me or someone else to compile with bluetooth as modules ), but 1.33.2003 is not 'officially' supported ( its stock at 67.5mb system ) so you need to Fake your SPL ( say 1.33.2005 ) and resize to 90mb system ( or whatever you feel is optimum )
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
Downloads
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
http://tinyurl.com/customMTD
aab0fadf658ed275954aea8d0aed9c8f FR-AutoMTD_partitionPatcher_v1.5.6.tar.bz2
8857194cdbe34a52d173def4441ad2ae FR-AutoMTD_partitionPatcher_v1.5.6.zip
1f84a5ec50684a7830a93a8d455bc159 FR-boot-rpp-v1.5.6-CustomMTD_S.zip
bca0360f91aed0acf6e2dc82dfe01b56 FR-boot-v1.5.6-CustomMTD_S.zip
94b4238c2668cbe7cd52fb8ad5a2ee12 FR-recovery-v1.5.6-CustomMTD_S.zip
5404f1a41dbc60105d59c7fa0c335a70 FR-remove-v1.5.6-CustomMTD_S.zip
NB New Config option !!! to automatically run fr-patch136+
e.g.
Code:
mtd 90 2
spl 1.33.2005
aio swap remount shabang lwp a2sd
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
ROM Zip Patcher for Devs
To make life even simpler for end users it is possible to integrate the 'patch' within a ROM
AutoMTD_partitionPatcher_v1.5.6.zip
currently Linux only,
within the zip is a tarball, untar that.
get that directory into your PATH, ( or just cd into it )
and then execute
Code:
PatchUpdateScript.sh <zip file to patch>
it will then
create a temp directory ( in your current directory )
copy your zip to it
extract required files
patch update(r)-script
zip and sign.
It simply saves the user from flashing the boot patch after flashing your ROM
The Future....
lbcoder has already suggested ways in which we can implement this 'on the fly'
so for instance it would be possible for a ROM , to instruct recovery what MTD partition layout is required, reload mtd kernel modules, and then flash ROM + boot.img
for those with huge partitions
Hey, you could go all silly and dual boot between ROMs ..
Anyway, enjoy and feel free to modify/improve on these
Changelog
v1-5-6 : 2010-10-28
Calculate userdata size, greatly improves compatibility
Added a version to patch a boot.img ( boot-rpp ) with run-parts
didn't want to , but some are using roms which don't have run-parts, so the 06BindCache script wasn't running
Added a remove version ( remove )
flashing this will return the recovery to SPL's layout
I may well integrate that better, so you don't need a separate zip
AutoMTD_partitionPatcher can convert a recovery.img to a AutoMTD flashable zip
PatchUpdateScript.sh <full path to>/recovery.img
boot patcher is much cleaner, it just uses the cmdline of the running recovery
removed the default 90 2 sizing, you *must* set your own size in mtdpartmap.txt
v1-5-4/5
added stuff
removed stuff
moved stuff
see v1-5-6
v1-5-3 : 2010-08-13
This should be last version we need
greater compatibility with none dreams/sapphires
option to launch All in One Patcher
v1-5-2 : 2010-08-0
Bug fixes
recovery was getting written to boot ( flash_image <partition> is now a variable )
typo in env variable was causing cache and data calculations to fail
AutoMTD now prints version number ( when flashing patched Zip )
tided up system "0x" 'fudge' ( to be compatible with trout/sapphire fall back )
removes temp files from memory when done
v1-5-1 : 2010-08-06
Bug fixes, had an extra '0x' on the system start + functions had wrong env var for the location of dmesg derived partition map
v1-5 : 2010-08-06
Version numbers brought into sync
Zipe Filename - 'reordered' ( easier to see version numbers in CWR )
AutoMTD Patcher - changes as per boot Patcher + zip recursion fix ( my bad habit, thanks go to mblaster for pointing this out )
Boot Patcher - cleaned up cache bind mount
Now supports leagcy /system/sd mount point
[*]supports ROM Manager ( real cache partition mounted on /dev/cache, recovery dir symlinked from 'fake' to 'real' cache )
Recovery Patcher - can 'fake' your SPL ( see configuration )
Recovery Patcher - creates more noise ( advise wipe and reboot )
Single Patcher script ( so I don't have make the same changes to three different files that essentially do the same job )
No longer 'Hardcoded' to 32[a/b] Partition Layout ( figures out SPL layout via dmesg ) **
uses original boot/recovery img's base configuration ( i.e. EBi0 and EBi1 compatible )
=< v1.4
Recovery Patcher v1.3, added SPL faker
Boot Patcher v1.2, fixed oversite where boot.img was not 'dumped'
Recovery Patcher v1.1 initial
Boot Patcher v1.1 ( was a fail, it didn't patch boot.img on CM roms as the tmp boot.img was deleted, my fault for just using the AutoMTD Patcher's script ( which runs before the tmp boot.img is deleted )
Boot Patcher v1 initial
Todo
- 2010-08-13 redundent ( launching AIO script ) - I might add some stuff to cm5/6's backup routine via the Auto patcher, things like the "All in One" installed scripts: 05mountsd and remount
windows compatible AutoMTD script ( meh, I hate batch scripts )
- 2010-08-13 DONE - thinking of adding a config option to launch the "all in one" script, but have to make that recovery compatible first
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
Downloads
.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:._.:*~*:.
mediafire downloads
http://tinyurl.com/customMTD
aab0fadf658ed275954aea8d0aed9c8f FR-AutoMTD_partitionPatcher_v1.5.6.tar.bz2
8857194cdbe34a52d173def4441ad2ae FR-AutoMTD_partitionPatcher_v1.5.6.zip
1f84a5ec50684a7830a93a8d455bc159 FR-boot-rpp-v1.5.6-CustomMTD_S.zip
bca0360f91aed0acf6e2dc82dfe01b56 FR-boot-v1.5.6-CustomMTD_S.zip
94b4238c2668cbe7cd52fb8ad5a2ee12 FR-recovery-v1.5.6-CustomMTD_S.zip
5404f1a41dbc60105d59c7fa0c335a70 FR-remove-v1.5.6-CustomMTD_S.zip
The attached files are OLD
Custom MTD FAQ
FAQ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q my SPL starts with 0 or 10, and I want to try CM5.0.8 or/and CM6. DO I need to do anything extra?[/b]
A yeap, it seems the newer kernels are just a bit too big for x0.95.x00x SPLs, you can get round it with the below kernels. And to flash CM6 you need to 'fake' your SPL ( see configuration in OP ) or edit the updater-script. faking is easier.
However, I would recommend the 1.33.2003 SPL ( you still need to fake your SPL, but you won't need the 'special' kernels )
guide for flashing 1.33.2003 SPL by Ezterry
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
2010-07-11
I have compiled a kernel, which I hope is NoneDanger compatible
the source is simply CyanogenMod's github, I have taken the config from cm6rc1, and simply changed the bluetooth to modules
this approach has worked in the past
It is pre-patched with AutoMTD, so just flash cm6rc1, then flash this
FR-CM6RC1-bootimg4NoneD-AutoMTD.zip(MD5: 386D9A05A3C0FFC08E5B3F844D437AA7)
mirrors
http://rapidshare.com/files/406402016/FR-CM6RC1-bootimg4NoneD-AutoMTD.zip
http://www.mediafire.com/?152jnqwyme3
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
2010-07-27
NoneDanger compatible Kernel for RC2
FR-CM6RC2-bootimg4NoneD-AutoMTD.zip (MD5: 7858a8a8d126919318d1718c6e5167ec )
http://www.mediafire.com/file/ttxfcocsti3mma3/FR-CM6RC2-bootimg4NoneD-AutoMTD.zip
I'll have to dig out the src
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
2010-08-15
NoneDanger compatible Kernel for RC3
2010-08-17 ( Sorry, old one had a status6 bug )
New one here
87F160F08FCD2233DDD40FBFC50D3711 FR-CM6RC3-bootimg4NoneD-AutoMTD.zip
src = http://github.com/CyanogenMod/cm-kernel/tree/48c57f11abaaf3de6c81f6f5c44cfe2637251184
no modifications its straight cm ( besides the config, which you can get from the compiled kernel or zcat /proc/config.gz )
#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#*#
*NB* don't use a patched recovery to flash SPL or RADIO ( you should avoid using recovery to flash these anyway, feel free to ask for current advice on spl / radio flashing )
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q do I need to flash both of the files each time I install a new rom?
A No, you only need to flash the recovery patcher once, unless you want to resize or you install a new recovery.
the boot patcher *must* be flashed after you have installed a new ROM or Kernel update
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q my cache looks odd in df, I see two and its the same size as data or sd-ext, is something wrong?
A everything is fine, since we shrunk cache its no good for things like the Market, so a script is installed to 'bind mount' cache with /sd-ext/cache or data if sd-ext is not mounted.
it actually turns out that /cache is not actually used in CM6, so I might adapt the script a little in a future release.
EDIT: as of version 1.5 the cache bind mount script mount 'real cache' separately, which should reduce confusion
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Q When I tell ROM Manger to do something in recovery, it just reboots to recovery and does nothing. it used to do the action but not since I installed CustomMTD
A yeah, nearly forgot about that, I was going to fix it last week, basically ROM Manger writes commands to /cache, but its writing it to our bind mount so.. when recovery boots it doesn't see the commands.
In all honesty that one hasn't been pointed out to me yet, but yeah I can fix it..
EDIT: as of version 1.5 the cache bind mount is compatible with ROM Manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The Scripts
'source' is now available on github
http://github.com/Firerat/CustomMTD
errm, tbh I'm not all that clued up on it yet
looks very promising
So, will i need to change the values everytime i flash a different rom? or can i just set them to a large size and everything will work?
asb123 said:
looks very promising
So, will i need to change the values everytime i flash a different rom? or can i just set them to a large size and everything will work?
Click to expand...
Click to collapse
most roms have a target of 90mb system ( DangerSPL )
so 90 2 config will basically give you an extra 28mb on data than you would have with stock DangerSPL MTD map
so yeah
90 2 is a good all rounder
Firerat said:
most roms have a target of 90mb system ( DangerSPL )
so 90 2 config will basically give you an extra 28mb on data than you would have with stock DangerSPL MTD map
so yeah
90 2 is a good all rounder
Click to expand...
Click to collapse
is it okay if I make system 70mb?
The rom im using is only using 66 out of 90, i want more space for data instead. I remember you said something about it being a miltiple of 128K.
With this, could Devs stop skimping on stuff like wallpapers and ringtones or additional apps, and surpass the 90MB danger spl mark? It would seem so. Also, I do not make roms so I do not know how it works but if there is compression or lower quality stuff they would now be able to use up as much space as wanted correct?
Ace42 said:
is it okay if I make system 70mb?
The rom im using is only using 66 out of 90, i want more space for data instead.
Click to expand...
Click to collapse
yeap, should be fine
personally I would be tempted to use clockwork, since you can erase system ( part of partition options )
.img files can be found here
http://www.koushikdutta.com/2010/02/clockwork-recovery-image.html
I don't recommend flashing via ROM Manager with CM5 or CM6
fastboot it over, or flash via recovery
I may be a little over cautious recommending a full wipe, but I have never had problems when system, cache and data are clean.
if you are 'growing' system make sure cache and data are clean
if your 'shrinking' make sure system is clean ( so 'hangovers don't mess up /cache or data )
asb123 said:
With this, could Devs stop skimping on stuff like wallpapers and ringtones or additional apps, and surpass the 90MB danger spl mark? It would seem so. Also, I do not make roms so I do not know how it works but if there is compression or lower quality stuff they would now be able to use up as much space as wanted correct?
Click to expand...
Click to collapse
yes, you can 'grow' or 'shrink' at will
just hope it doesn't get used to be lazy and not trim bloat
Hi firerat,
you mentioned once before something about market data on the cahe... or something so downloads would be ok if a certain partition was big enough?....something like that... I am having a prob that might be related since it started when I tried to change from default to system 80 5 for data. now I cant sign in to google and after flashing gaaps there is no market? everything else in the gaaps zip is there...? It could be google i know but i remembered you saying that somewhere.
TheNewGuy said:
Hi firerat,
you mentioned once before something about market data on the cahe... or something so downloads would be ok if a certain partition was big enough?....something like that... I am having a prob that might be related since it started when I tried to change from default to system 80 5 for data. now I cant sign in to google and after flashing gaaps there is no market? everything else in the gaaps zip is there...? It could be google i know but i remembered you saying that somewhere.
Click to expand...
Click to collapse
I very much doubt it is related in anyway
/cache is where the market downloads apks to prior to install
it should be bind mounted to /sd-ext/cache or /data/cache if sd-ext is not mounted
your missing Market is related to something else
Firerat said:
I very much doubt it is related in anyway
/cache is where the market downloads apks to prior to install
it should be bind mounted to /sd-ext/cache or /data/cache if sd-ext is not mounted
your missing Market is related to something else
Click to expand...
Click to collapse
On my sdcard, why were my market Dls going to /Sdcard/Download folder?
I never seen them go there before, I'm used to seeing them in /cache.
Ace42 said:
On my sdcard, why were my market Dls going to /Sdcard/Download folder?
I never seen them go there before, I'm used to seeing them in /cache.
Click to expand...
Click to collapse
Because he bind mounted it.
Ace42 said:
On my sdcard, why were my market Dls going to /Sdcard/Download folder?
I never seen them go there before, I'm used to seeing them in /cache.
Click to expand...
Click to collapse
JAguirre1231 said:
Because he bind mounted it.
Click to expand...
Click to collapse
sorry for confusion
When I download stuff with dolphin HD it goes to /sdcard/download
maybe its different with stock browser
the cache bind mount is
added a few extra comments to make it easier to follow
/system/etc/init.d/06BindCache
Code:
#!/system/bin/sh
# check we don't already have a bind mount
# ( so if ran manually multiple times we don't end up with strange things happening )
if [ "`awk '/\/cache/' /proc/mounts |sed -n '$='`" -gt "1" ];
then
echo "cache already bind mounted"
echo `awk '/\/cache/' /proc/mounts`
exit
fi
# check if /sd-ext mounted, if yes then bind to /sd-ext/cache, if not /data/cache
if [ "`grep -q sd-ext /proc/mounts;echo $?`" = "0" ];
then
CacheDir=/sd-ext/cache
else
CacheDir=/data/cache
fi
# check we have something to bind mount, and create if not
if [ ! -d $CacheDir ];
then
install -m 771 -o 1000 -g 2001 -d $CacheDir
fi
mount -o bind $CacheDir /cache
# check dalvik-cache exists ( this is really for magics )
# so they don't end up in bootloop because dex files can not be created
if [ ! -d $CacheDir/dalvik-cache ];
then
install -m 771 -o 1000 -g 1000 -d $CacheDir/dalvik-cache
fi
actually, errm yeah it is d/l to /sdcard/downloads
not my doing
I guess cache really is pointless on froyo
hey firerat great job bro! again ive been really busy and i still didnt get to try this or the earlier betas you made...hell i havent even tried a froyo rom yet. ima try this right now and let you know how it goes!
speedysilwady said:
hey firerat great job bro! again ive been really busy and i still didnt get to try this or the earlier betas you made...hell i havent even tried a froyo rom yet. ima try this right now and let you know how it goes!
Click to expand...
Click to collapse
Froyo has been nice so far
but you may run into issues
for one the updater-script is actively 'kicking' NoneDanger
you can just remove the getprop checks
I have had problems booting cm5.0.8's kernel, I did get round it by compiling a new one from cm github,
I
'm not sure is cm6's kernel has the same issue
it does seem SPL related, I flashed Danger and it was fine, I plan to go back to NoneDanger and confirm it still doesn't work.
but figured that while I was on Danger I might as well put this (Custom MTD) through its paces with a DangerSPL
Firerat said:
Froyo has been nice so far
but you may run into issues
for one the updater-script is actively 'kicking' NoneDanger
you can just remove the getprop checks
I have had problems booting cm5.0.8's kernel, I did get round it by compiling a new one from cm github,
I
'm not sure is cm6's kernel has the same issue
it does seem SPL related, I flashed Danger and it was fine, I plan to go back to NoneDanger and confirm it still doesn't work.
but figured that while I was on Danger I might as well put this (Custom MTD) through its paces with a DangerSPL
Click to expand...
Click to collapse
lol yeah i was just gonna say the get prop error occured lemme remove those asserts resign and see what happens
hmm oddly everything flashed fine on the latest nightly build but when it gets past the g1 screen it keeps rebooting to recovery? ima rewipe and try again and see if i can get a logcat if it happens again
edit: no dice when i run logcat =/
-exec '/system/bin/sh/' failed: permission denied (13) -"
double edit: i get the same error for any rom i try to flash when i look at the logcat. the only difference is cm's latest nightly build rebooted on the g1, super e freezes at the g1 screen...ima try to modify the .txt to go back to the stock layout so i can nandroid my cachehacked cm5.08 back if not...idk what to do..
speedysilwady said:
hmm oddly everything flashed fine on the latest nightly build but when it gets past the g1 screen it keeps rebooting to recovery? ima rewipe and try again and see if i can get a logcat if it happens again
edit: no dice when i run logcat =/
-exec '/system/bin/sh/' failed: permission denied (13) -"
Click to expand...
Click to collapse
Odd, but at leasat the kernel is booting, I wasn't getting anywhere with cm5.0.8
It could be a general error
Which build are you using
I'm on a nightly, but I know Defcon works
If its still not working, try the older v1 version of boot patcher in lbcoders thread
I did change boot v1.1 to the script I use in the automtd one
I'm on the nightly 0704 (944 I think ) btw
Firerat said:
Odd, but at leasat the kernel is booting, I wasn't getting anywhere with cm5.0.8
It could be a general error
Which build are you using
I'm on a nightly, but I know Defcon works
If its still not working, try the older v1 version of boot patcher in lbcoders thread
I did change boot v1.1 to the script I use in the automtd one
I'm on the nightly 0704 (944 I think ) btw
Click to expand...
Click to collapse
noo this wasnt cm5.08 this was the latest nightly, same one youre 0704 on.
it got to the g1 screen and right when its abt to hit the boot animation it reboots.
i tried super e but it froze on the g1 screen
trying to get back to 67 67 for cache and system so i can nandroid but its weird that the logcat wont show no matter what rom i use.

[DEV][LINUX/OSX] IMG Patch Tools | sdat2img for OTA zips

{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
most part of Introduction from taken sdat2img thread
if you want extract non OTA zip i suggest to use sdat2img tool
FOR AB OTA ZIPS USE THIS SCRIPT AND PAYLOAD EXTRACTOR​
in this tools i made block_image_update() function from android recovery to a binary to run on PC and patch system.img with DAT files on OTA package to update system.img by OTA
also we have apply_patch() function for patching boot.img and other files like firmwares
Introduction
You probably know already that starting from Android 5.x (Lollipop) compiled roms (aosp,cm,stock) are not compressed anymore the way they used to be on previous android versions. On previous versions all content inside /system folder that has to be extracted within our device was either uncompressed (simple /system folder inside our flashable zip) or compressed in a system.img file, which it is a ext4 compressed file; both of these, anyway, were readable and we could see all system files (app,framework, etc).
The problem comes in >=5.0 versions, this method is not used anymore. Why? Because roms started to be always larger, so it is necessary to compress them even more.
What does new Android zips (full roms, but also OTAs) contain?
New Android flashable zips are made this way:
boot.img (kernel)
file_contexts (selinux related)
META-INF (folder containing scripts)
system.new.dat (compressed /system partition)
system.patch.dat (for OTAs)
system.transfer.list (see explanation below)
and other patch files (.p only on OTA zip)​
What does updater-script contains then?
The updater-script uses a brand new function: block_image_update(), this method basically decompresses necessary files inside the device. Let's study it.
From google git source code, if we go inside the new file /bootable/recovery/updater/blockimg.c, we find at the end of it the registration of the function block_image_update() as the method BlockImageUpdateFn() which starts at line 254. Here finally we find all information we need to know about the decompression of the .dat file(s). First file we analyze is system.transfer.list which Google tells us:
The transfer list is a text file containing commands to transfer data from one place to another on the target partition.
Click to expand...
Click to collapse
But what each line means?:
First line is the version number of the transfer list; 1 for android 5.0.x, 2 for android 5.1.x, 3 for android 6.0.x, 4 for android 7.x
Second line is the total number of blocks being written
Third line is how many stash entries are needed simultaneously (only on versions >= 2)
Fourth line is the maximum number of blocks that will be stashed simultaneously (only on versions >= 2)
Fifth line and subsequent lines are all individual transfer commands.
Click to expand...
Click to collapse
all transfer commands is :
bsdiff
*erase
free
imgdiff
move
*new
stash
*zero
BlockImageUpdate is reading system.transfer.list and executing all commands
But BlockImageVerify doesn’t execute * commands, which not to make changes on system.img just verifying update can happen
original sdat2img tool only support "new" command
Ok, but how to Patch the system.img with OTA files?
All instructions are below. binaries are involved. Please read carefully step by step.
You can use/modify these files and/or include them in your work as long as proper credits and a link to this thread are given.
If you have questions or problems
write here
Thanks
- @xpirt , for original sdat2img tool and useful thread
XDA:DevDB Information
IMG Patch Tools, sdat2img for OTA zips, Tool/Utility for all devices (see above for details)
Contributors
erfanoabdi
Source Code: https://github.com/erfanoabdi/imgpatchtools
Version Information
Status: Testing
Created 2017-07-21
Last Updated 2020-01-23
Usage
Code:
./BlockImageUpdate <system.img> <system.transfer.list> <system.new.dat> <system.patch.dat>
args:
<system.img> = block device (or file) to modify in-place
<system.transfer.list> = transfer list (blob) from OTA/rom zip
<system.new.dat> = new data stream from OTA/rom zip
<system.patch.dat> = patch stream from OTA/rom zip
Code:
./ApplyPatch <file> <target> <tgt_sha1> <size> <init_sha1(1)> <patch(1)> [init_sha1(2)] [patch(2)]...
args:
<file> = source file from rom zip
<target> = target file (use "-" to patch source file)
<tgt_sha1> = target SHA1 Sum after patching
<size> = file size
<init_sha1> = file SHA1 sum
<patch> = patch file (.p) from OTA zip
Code:
usage: ./scriptpatcher.sh <updater-script>
args:
<updater-script> = updater-script from OTA zip to patch recovery commands
Example
for example from updater-script of OTA we have:
Code:
block_image_update("/dev/block/bootdevice/by-name/system", package_extract_file("system.transfer.list"), "system.new.dat", "system.patch.dat")
apply_patch("EMMC:/dev/block/bootdevice/by-name/boot:33554432:f32a854298814c18b12d56412f6e3a31afc95e42:33554432:0041a4df844d4b14c0085921d84572f48cc79ff4",
"-", 0041a4df844d4b14c0085921d84572f48cc79ff4, 33554432,
f32a854298814c18b12d56412f6e3a31afc95e42,
package_extract_file("patch/boot.img.p"))
after getting system.img and boot.img from firmware This is equals of previous functions on PC with this tools:
Code:
~$ ./BlockImageUpdate system.img system.transfer.list system.new.dat system.patch.dat
~$ ./ApplyPatch boot.img - 0041a4df844d4b14c0085921d84572f48cc79ff4 33554432 f32a854298814c18b12d56412f6e3a31afc95e42
scriptpatcher.sh will generate all commands automatically from updater script so run it like:
Code:
~$ ./scriptpatcher.sh META-INF/com/google/android/updater-script > fullpatch.sh
check fullpatch.sh your self, you need to provide all images and files in correct name and patch as mentioned in mount and other commands of fullpatch.sh
Building Requirements
For Building this tool you need :
zlib
libbz2
openssl
It currently supports Linux x86/x64 & MacOS, Not tested on Windows.
Compile and Build command:
Code:
make
Youtube
Download links:
GitHub Release
Changelog:
GitHub Commits
Known Bugs/Issues:
Plz test and report
Nice work
Very nice
Sent from my LG-LS997 using Tapatalk
Wow, I tried to apply OTAs manually myself, but never got it to work. Getting the propper tools from you is awesome!
One tiny question though: Does applying/verifying a system update to system.img require a lot of temporary space or memory?
I am running Ubuntu x64 in a VM (VirtualBox) on Windows 10. Verifying a system update doesn't really do much, except keeping the CPU busy.
This is the output of "./BlockImageVerify system.img system.transfer.list system.new.dat system.patch.dat":
Code:
performing verification
creating cache dir cache
cache dir: cache
blockimg version is 3
maximum stash entries 236
creating stash cache/537ed49fb5f6c32dc3d205d78b6084fe54f70cd3/
The cache folder remains empty, there is no harddisk activity and only the CPU is working at 100 %. I interrupted BlockImageVerify after 30 minutes.
daniel_m said:
Wow, I tried to apply OTAs manually myself, but never got it to work. Getting the propper tools from you is awesome!
One tiny question though: Does applying/verifying a system update to system.img require a lot of temporary space or memory?
I am running Ubuntu x64 in a VM (VirtualBox) on Windows 10. Verifying a system update doesn't really do much, except keeping the CPU busy.
This is the output of "./BlockImageVerify system.img system.transfer.list system.new.dat system.patch.dat":
The cache folder remains empty, there is no harddisk activity and only the CPU is working at 100 %. I interrupted BlockImageVerify after 30 minutes.
Click to expand...
Click to collapse
Ah actually yes you need free space on RAM as much as both patch.dat and new.dat sizes
It's on my todo list to fix it, https://github.com/erfanoabdi/imgpatchtools/blob/master/blockimg/blockimg.cpp#L383
How to extract the file system.new.dat
evangelico793 said:
How to extract the file system.new.dat
Click to expand...
Click to collapse
You can find it in OTA zip
Motorola? See this : motorola.erfanabdi.ir
erfanoabdi said:
You can find it in OTA zip
Motorola? See this : motorola.erfanabdi.ir
Click to expand...
Click to collapse
No longer look at the picture
erfanoabdi said:
You can find it in OTA zip
Motorola? See this : motorola.erfanabdi.ir
Click to expand...
Click to collapse
Something Looks Wrong ReCheck inputs Or No Update Available
for moto g4 play 6.0.1
evangelico793 said:
No longer look at the picture
Click to expand...
Click to collapse
Please send picture again
404 not found
evangelico793 said:
Something Looks Wrong ReCheck inputs Or No Update Available
for moto g4 play 6.0.1
Click to expand...
Click to collapse
You are doing something wrong see thread for help and examples
@erfanoabdi
Thank you a ton for these tools!
They work like a charm :good:
I knew there must be a way to do this, but it's definitely above my paygrade.
@erfanoabdi
I've been trying scriptpatcher.sh on various updater-scripts and have noticed some bugs.
If you're interested in looking at the files, let me know and I'll post them.
Q9Nap said:
@erfanoabdi
I've been trying scriptpatcher.sh on various updater-scripts and have noticed some bugs.
If you're interested in looking at the files, let me know and I'll post them.
Click to expand...
Click to collapse
Yeah, there's lots of bugs in that script
I appreciate any kind of help
So far i know :
Only supporting /dev/block/boot.../by-name partitions
Can't mount ext4 in macOS
I disabled verify, but we can verify images
And i haven't tested it so much
If it gets more complicated Maybe we have to rewrite it on python.
erfanoabdi said:
Yeah, there's lots of bugs in that script
I appreciate any kind of help
So far i know :
Only supporting /dev/block/boot.../by-name partitions
Can't mount ext4 in macOS
I disabled verify, but we can verify images
And i haven't tested it so much
If it gets more complicated Maybe we have to rewrite it on python.
Click to expand...
Click to collapse
*removed*
@erfanoabdi
I noticed that there was an update to the source today to enable the bonus file argument.
I tried to create a recovery.img with a boot.img, recovery-from-boot.p, and recovery-resource.dat.
I tried patching to create a new recovery image and also tried patching the boot image in place.
It always returns "Unknown patch file format".
I am able to use these files to create recovery with the on-device applypatch binary, so not sure why it's throwing the "unknown patch file format" error.
Q9Nap said:
@erfanoabdi
I noticed that there was an update to the source today to enable the bonus file argument.
I tried to create a recovery.img with a boot.img, recovery-from-boot.p, and recovery-resource.dat.
I tried patching to create a new recovery image:
#Output:
creating cache dir cache
cache dir: cache
patch boot.img:
failed to stat "recovery.img": No such file or directory
Unknown patch file format
Done with error code : 1
and also tried patching the boot image in place:
#Output:
creating cache dir cache
cache dir: cache
patch boot.img:
Unknown patch file format
Done with error code : 1
I am able to use these files to create recovery with the on-device applypatch binary, so not sure why it's throwing the "unknown patch file format" error.
Any ideas? Is my syntax incorrect?
Click to expand...
Click to collapse
That was chainfire commit changes how can i say "no" to his PR
I didn't had time to check it
I'll check it out when I could
Q9Nap said:
@erfanoabdi
I noticed that there was an update to the source today to enable the bonus file argument.
I tried to create a recovery.img with a boot.img, recovery-from-boot.p, and recovery-resource.dat.
I tried patching to create a new recovery image:
#Output:
creating cache dir cache
cache dir: cache
patch boot.img:
failed to stat "recovery.img": No such file or directory
Unknown patch file format
Done with error code : 1
and also tried patching the boot image in place:
#Output:
creating cache dir cache
cache dir: cache
patch boot.img:
Unknown patch file format
Done with error code : 1
I am able to use these files to create recovery with the on-device applypatch binary, so not sure why it's throwing the "unknown patch file format" error.
Any ideas? Is my syntax incorrect?
Click to expand...
Click to collapse
I've tested recovery-from-boot by chainfire and i can confirm its working
Also i fixed no such file error
Try to compile new source
*edit*
Fixed!

[PX5][Android 10] Patched recovery

This is the Android 10 recovery image by HCT (version 10.3.1) patched to skip signature checking on .zip files
Tested on MTCE_LM (Eunavi). Use at your own risk
It can be flashed from a root shell (either adb or via terminal emulator) by performing the following steps
1. upload recovery via adb
Code:
adb push hct_recovery_patched.img /sdcard/
2. flash recovery
Code:
# backup current recovery
dd if=/dev/block/by-name/recovery of=/sdcard/recovery_backup.img
# write new recovery
dd if=/sdcard/hct_recovery_patched.img of=/dev/block/by-name/recovery
NOTE: If you do not disable the "flash_recovery" service in /init.rc, AND you have a stock kernel, recovery will be restored to the original version after rebooting.
There are 3 ways to avoid this:
- Flash magisk (or a modified kernel) while in recovery. The patch will then fail to apply and recovery won't be overwritten
- Disable "flash_recovery" by doing "adb remount" and editing /init.rc (comment out the following)
Code:
service flash_recovery /system/bin/install-recovery.sh
class main
oneshot
- Neuter the service by either:
- removing /system/bin/install-recovery.sh​- replacing /system/bin/install-recovery.sh with a dummy script​- removing /system/recovery-from-boot.p​
Woo-hoo, after hundreds of rubbish posts in the MTCD forums, we have a real development post!
Great work and thanks for sharing this, these forums need more like you.
Thanks for the kind comment!
I have to admit that it was frustrating to see the lack of information sharing on this forum, and the pervasive pay-per-use model.
I spent a lot of time just getting Android 10 installed (starting from Android 9), and i had to bring the head unit to my desk as working in the car was rather hard and all i achieved was a brick.
I unfortunately had to bring it back in the car now (can't sit on my desk forever) but, now that i figured out how to make bootable recoveries, i was wondering how hard it could be to have TWRP or at least a hassle-free recovery to install Android 10 from Android 9.
As a first step, this recovery makes it possible to install Magisk or other zip files without doing it manually within adb.
Cheers!
Your work is really good!
Thanks a lot for it.
Now you can also modify ROM's without signatur errors when installing.
Wouldn't it be good if we had an app like the ModInstaller ?
So a one click installation of the recovery without shell or adb.
I have now built an app.
And now need help.
Namely, in the app is the recovery and the script.
Unfortunately, the flash process is not started.
It always comes only the first message from the script.
The app is open source and the script and the recovery are in res/raw.
In the attach you will find the finished app and pictures.
If someone has a solution, he can write me or make a pull request on Github.
Source code:
GitHub - jamal2362/RK33XX-Custom-Recovery-Installer: Application for flashing custom recovery on Rockchip Android Head-Units.
Application for flashing custom recovery on Rockchip Android Head-Units. - GitHub - jamal2362/RK33XX-Custom-Recovery-Installer: Application for flashing custom recovery on Rockchip Android Head-Units.
github.com
The script:
RK33XX-Custom-Recovery-Installer/script at master · jamal2362/RK33XX-Custom-Recovery-Installer
Application for flashing custom recovery on Rockchip Android Head-Units. - RK33XX-Custom-Recovery-Installer/script at master · jamal2362/RK33XX-Custom-Recovery-Installer
github.com
First of all, congrats for the work!
DISCLAIMER:
I don't own ModInstaller, i have never bought a copy of it and i don't intend to do so.
Analysis is purely done from Youtube videos, open source code analysis and existing and openly available binary images.
I was working to figure out how to make a FLOSS alternative to ModInstaller.
The issues i found in all my attempts are the following:
- A6 recovery is the only one that can boot from SD Card (which can then be used to flash A9 -> A10 with the 2SD trick)
- (it took me a long time to pull these information together and unbrick my unit)​- The A6 recovery is unable to directly flash A10 RKAF/RKFW images (sdupdate.img) due to the code being too old
- a failure will be observed while writing super.img. This happens because the device needs to be repartitioned, and the A6 recovery is not doing it correctly​- A9 recovery is buggy. Booting it with no system installed will result in a black screen.
- it will only boot succesfully after being written by the A6 flash tool, which writes the "misc" partition with the recovery commands to run (the "hint" i get from this is that the misc partition is important)​- A10 recovery can't be loaded by the A6 recovery. I always got a black screen after flash. Is it a flash issue? is it an issue with the recovery itself? hard to know
Theory: maybe the recovery could be written over the kernel partition? ("boot")
This way, the recovery will always run after being flashed instead of requiring an explicit "enter recovery" trigger (buttons, misc partition, etc.)
Besides these experiments, in parallel, i did some bug fixing to this repository: https://github.com/liftoff-sr/rockchip-tool/commits/master (i'm "smx-smx")
That allows me to unpack nad repack "sdupdate.img" , "reduced recovery images" and "full IMG files".
With those tools. i tried to swap "recovery.img" in the A6 image, but i always got the black screen upon booting from SD.
Either A9/A10 breaks sdboot or the bootloader crashes before it gets there.
Since this also happens when being flashed, this could either be a bug in the flashing program or a bug in the boot stack (which fails to run recovery perhaps due to a dirty state of the internal flash). It's hard to know for sure without having a UART connection with the board.
BUT, we have an alternative, in the form of the recovery built-in ISP flash tool.
This is the code that reads "sdupdate.img" from the SD Card and flashes it
After reading the recovery source code, i realised that this code can only be triggered correctly when booting from the SD card.
It detects this state by reading /proc/cmdline and probing for specific values (https://github.com/rockchip-android...6f72b7d3123dab27135ac41d55029/sdboot.cpp#L206)
This means the bootloader can (and will) pass those arguments under specific conditions (https://github.com/rockchip-linux/u...c873f178c/arch/arm/mach-rockchip/board.c#L358)
If you check here https://github.com/rockchip-linux/u...3f178c/arch/arm/mach-rockchip/boot_mode.c#L47 you can see the magic word that needs to be written to the "misc" partition in order to trigger that code.
Note that, besides the well known "sdboot", "usbboot" is also possible.
I'm not sure if the ROM can physically boot from USB, but the bootloader and recovery do support (according to code) passing the flag to enable flashing from USB.
So, recapping, there are these ways we can try:
a - try to overwrite "boot" with "recovery" (but it might not work due to the partitioning layout, e.g. jumping from A6 -> A10)
- note: uboot might also need to be written when doing this.
b - making a modified "sdupdate.img" that flashes recovery on top of boot, and all the other core partitions like "misc", "uboot", "trust", "vbmeta"
c - writing "misc" from android in order to triggers the "rkfwupdate" mode
d - taking a dump of the first portion of the flash in various states (A6, A8, A9, A10), and having a "dd" that writes it back to the beginning of the flash (i suspect this is how ModInstaller does it)
Considering cases "b" and "c" depend on a recovery that can write them correctly (and the A6 one is buggy), this leaves us with "a" and "d"
Considering that ModInstaller does it in one shot, and doesn't seem to matter about the partitioning layout, i believe "d" might be the most viable option...
Using the "rockchip-tool" repository i linked from github, the partition table can be dumped from any .img file
You can observe "Image/parameter.txt" from the extracted firmware
This is the partition table from A6's recovery:
[email protected](uboot)
[email protected](trust)
[email protected](misc)
[email protected](resource)
[email protected](kernel)
[email protected](dtb)
[email protected](dtbo)
[email protected](vbmeta)
[email protected](boot)
[email protected](recovery)
[email protected](backup)
[email protected](security)
[email protected](cache)
[email protected](system)
[email protected](metadata)
[email protected](vendor)
[email protected](oem)
[email protected](frp)
[email protected](userdata)
And this is the partition table from A9's recovery
[email protected](uboot)
[email protected](trust)
[email protected](misc)
[email protected](resource)
[email protected](kernel)
[email protected](dtb)
[email protected](dtbo)
[email protected](vbmeta)
[email protected](boot)
[email protected](recovery)
[email protected](backup)
[email protected](security)
[email protected](cache)
[email protected](system)
[email protected](metadata)
[email protected](vendor)
[email protected](oem)
[email protected](frp)
[email protected](userdata)
Notice how uboot, trust, misc, resource, kernel, dtb, and others live in the same space. (2000, 4000, 6000, 8000, 10000, ...)
What we could do is create a raw blob that spans that address range, and "dd" it directly to /dev/mmcblk0 at the right offset.
So i would focus on converting recovery images to raw blobs, with recovery-as-kernel so it boots straight away on the first try.
Bump a real thread.
Is it possible to convert it to a file installed by SDDiskTool?
marchnz said:
Bump a real thread.
Click to expand...
Click to collapse
I created a flashing tool to flash recovery within Android, using Rockchip's own code: https://forum.xda-developers.com/t/...chip-firmware-flash-tool-for-android.4458299/
blala said:
I created a flashing tool to flash recovery within Android, using Rockchip's own code: https://forum.xda-developers.com/t/...chip-firmware-flash-tool-for-android.4458299/
Click to expand...
Click to collapse
This file hct_recovery.patched.img does not appear to be installed via rkupdate
sadaghiani said:
Is it possible to convert it to a file installed by SDDiskTool?
Click to expand...
Click to collapse
It needs to be converted, yes
I'll take a look this afternoon
blala said:
It needs to be converted, yes
I'll take a look this afternoon
Click to expand...
Click to collapse
Is it possible to create a boot image that includes moded recovery & magisk and moded kernel ?
If by image you mean firmware image then yes, it can be done with https://github.com/liftoff-sr/rockchip-tool
But what i would recommend is the modded recovery only, with the magisk .zip to use in Recovery
Otherwise you risk flashing a kernel that doesn't match with kernel modules or is otherwise not fully compatible with the installed system
blala said:
If by image you mean firmware image then yes, it can be done with https://github.com/liftoff-sr/rockchip-tool
But what i would recommend is the modded recovery only, with the magisk .zip to use in Recovery
Otherwise you risk flashing a kernel that doesn't match with kernel modules or is otherwise not fully compatible with the installed system
Click to expand...
Click to collapse
boot.img file included recovery+magisk+kernel
Flashing a boot.img (Kernel, for example) in an Android mobile phone via adb shell
Flashing a boot.img (Kernel, for example) in an Android mobile phone via adb shell - script.sh
gist.github.com
MTCD has separate boot and recovery partitions.
Perhaps you can adapt both recovery/kernel to be in the same image but the bootloader won't know about that (and will always boot from "recovery" partition)

Categories

Resources