[HOWTO] Creating custom SBF firmware

Simplestas

Senior Member
Sep 2, 2010
143
112
0
With Epsylon3 brilliant work, a new idea of flashing custom firmwares came to surface, allowing custom /system partition to be flashed directly from RSD Lite! This way you don't need to flash fixed SBFs and waste time with rooting and recovery install in case of system screw-up.

What you need:
1) MotoAndroidDepacker. With it, unpack sbf of the firmware you use as base.
2) Leave CG35(boot) and CG61(devtree) partition files, delete other smgs. Other files are not that important. You can delete all partition files if you're making backup for yourself...
3) Replace CG39(system) with your system dump:
adb shell:
su
dd if=/dev/block/system of=/sdcard/CG39.smg
copy CG39.smg from sd card to your firmware folder.
4) Compile sbf with MotoAndroidDepacker.
5) Flash your sbf in case of failure.

MAJOR CAVEAT: This sbf will work ONLY on devices with have same full SBF version applied last as your device. I.e. if you have flashed 3.4.2-107 and then upgraded it with nandroid to 3.4.2-177, the sbf you created from your system dump will work only for devices which flashed still 3.4.2-107 sbf last. To install such (custom) sbf, one would need to flash full 3.4.2-107 sbf first.

Technical: this is possible because of bug/feature in flashing process: system signature partiton is not checked if phone signature is already present. Phone signature is generated when flashing full genuine sbf and is verified aganist copy in sp partition and obviously differs for each firmware. It is stored at the end of the system partition.
 
Last edited:

Simplestas

Senior Member
Sep 2, 2010
143
112
0
You can make a backup for yourself and flash it again all you want until you flash another full motorola sbf. Don't forget to make data backups as well, this method can't replace nandroid / titanium!
 

chaihg

Senior Member
Nov 15, 2010
497
53
0
Oh great all of us asked this question when this section began in xda. So essentially we can make an sbf out of our phones and keep it and not worry about any nandroid backups.
This is a great discovery, thanks a ton.

Cheers
 

Epsylon3

Senior Member
Jan 25, 2008
1,177
4,310
0
Geneva
tanguy.forumdoandroid.com
i think you can create a Full SBF with all original partitions and your "signed" CG39

I think it is not a bug... the thing is : i'm not sure sbf can work on other devices ... but anyway... it can be really usefull to recover device or to create a full backup with the good kernel made for the /system and /devtree

mbr and ebr are needed too, if the partition table has changes, you will have problems..
 
Last edited:
  • Like
Reactions: srk_srinivas

sunoldman

Senior Member
Jan 20, 2011
144
34
0
So the question is whether the signature is related to the specific part of every device, or it is universal as official sbf. Need to be verified .
 

AgentSmith

Senior Member
Feb 22, 2006
764
174
0
Great news! But why are Android systems so complicated when it comes to flashing and banking up? I mean, with computers it's easy. You make an image of the system partition and you're done. Restoring is as simple as writing the backup back to the partition. So, why is it so hard to just make an entire nand backup that we can simply write back to go to a working state after failure?

Sent from my MB525 using Tapatalk
 

sunoldman

Senior Member
Jan 20, 2011
144
34
0
I made a custom sbf with nightly build in it . Then wipe and flash it, stuck at M logo. Bootmenu works, but it seems that it can't mount some partition , it's the same symptom when wipe in stock recovery in cm7.
Does it really need to flash a full sbf before the custom sbf ?
 

ephumuris

Senior Member
Dec 7, 2008
3,678
633
0
33
Hull
So if i wanted to do this i split my sbf, delete everything only leaving,

CG35.SMG
CG61.SMG
firmware.hmg

Then system dump and add that CG39.smg in and build and flash?

Have i missed anything? :)
 

Simplestas

Senior Member
Sep 2, 2010
143
112
0
Well you forgot RAMDLD... One CG39 is enough if you'll flash this SBF over ver 4 froyo (not Chinese or Korean) but i recommended CG35 and CG61 to make such sbf enough to flash over system downgraded with fixed sbf + nandroid.
 

ephumuris

Senior Member
Dec 7, 2008
3,678
633
0
33
Hull
Well i made an sbf version of miui and it works :D

Wonder if it works on other peoples Defy? :)

Tested by formatting system and then applying sbf. Booted back into MIUI like a dream :D

EDIT:

Shame the SBF comes out at 300+mb :( May take a while to upload these things lol.
 
Last edited: