[RAZR HD Original Android Development] skeevydude:
Please don't quote this post.

Nobody likes an OPs Wall of Text in the middle of page 3.

One of the best things about Android is the ability to make roms, whether it be from source or stock. A lot of guides go into details about how to get your Linux system set up and running, this one won't. I expect that you already have a running Linux system and have followed one of the many guides around to have all the required software installed.

If you don't have Linux installed, preferably Debian or Debian based (I use Debian Testing) and set up for compiling an Android rom, stop reading this, install Linux, and follow one of the Android guides below Everything in this guide requires Linux, I might add in some Windows tools in the future. Ask for Linux install help in what ever disto you choose's forums, not here.

This is Google's guide for compiling Android

This is a guide I found here on XDA.

Required Tools

Attached is a zip containing a lot of tools that I use, and sadly, I've acquired them at different times over the years and I don't remember where I got them all at, so giving proper credit isn't possible. If you developed a tool I used here, please know that you have my thanks and gratitude, and if you let me know, I'll remove it or add proper credit.

Some of the included tools I won't even discuss because they're not relevant to this platfore (like sbf_flash...Linux tool for flashing old school moto firmware to the Bravo, Defy, and other omap3 based moto phones), but they're included because I've added all the things I have installed in my local Android $PATH. They are only 1.9mb extracted, so it's not like they take up a lot of space...anyways...

Just extract all the tools into $HOME/bin, or any other preferred location in your $PATH

Ensure they have the proper permissions; run "chmod 755 +x $HOME/bin/*", change $HOME/bin to where ever you installed the tools at

log out

log back in

and you're done with the tool installation part (there's also a source /blah/blah command that can be used, but log out and log in is universal). I keep all my sources and tools on their own hard drive, located on /android, so nothing is lost if I ever change Linux distros -- All I have to do is add /android/bin to my $PATH and I'm good to go (once I've copy/pasted the commands in one of the above guides :p)

Some Linux terms/commands

$HOME -- The current users home directory. I'm logged in as skeevy420, so my $HOME is /home/skeevy420, $HOME/bin is /home/skeevy420/bin

$PATH -- all the directoies your system will look for executable files....Google it or check Arch Linux's guides, they're great

su -- you should really know this one....shame on you if you don't

sudo -i -- similar to sudo, only it opens an interactive sudo shell where every command is done as sudo

Converting a Fastboot into a flashable zip

This is pretty straight forward and only requires dumpperms.pl and simg2img.py (in the zip you should have already installed)

To make things easier all the terminal commands are colored blue

First Step -- Converting system.img into a mountable format

Download and Extract a fastboot zip file

Open a terminal in the folder you extracted the zip to

run "simg2img.py ./system.img ./system.img.raw" (it's system.img.ext4, not system.img, if you're converting an ICS fastboot image)

Second Step -- Mount the converted image

Obtain a root shell, use "sudo -i" or "su" depending on how your system handles regular users accessing superuser privileges ***$PATH HINT***

Every single command in every step done after this will be as su/sudo -i

cd back to the folder with the converted image, if necessary

mkdir -p /mnt/tmp/zip/system

mount -o loop system.img.raw /mnt/tmp/zip/system

Thrid Step -- Get file permissions

dumpperms.pl /mnt/tmp/zip/system > /mnt/tmp/perms

Fourth Step -- Add in META-INF (this is from Gummy Rom June 02, 2014)

Download the attached META-INF.zip

unzip META-INF.zip -d /mnt/tmp/zip

Fifth Step -- Modify Updater Script

Open /mnt/tmp/perms with a text editor

Select everything and copy it

Open /mnt/tmp/zip/META-INF/com/google/android/updater-script with a text editor

Select the marked line, highlighted blue in the template below

Paste in the permissions

Save it as /mnt/tmp/zip/META-INF/com/google/android/updater-script

Sixth Step -- Add in kernel/boot.img

cd into extracted fastboot folder if necessary

cp boot.img /mnt/tmp/zip

Seventh Step -- Pack it all up

zip -r /mnt/tmp/zip/rom.zip /mnt/tmp/zip

Eight Step -- Flash it

You should really know how to get a rom on your phone at this point in the game....

If you don't, we're all gonna laugh at you.

Updater Script Template

assert(getprop("ro.product.device") == "moto_msm8960" || getprop("ro.build.product") == "moto_msm8960" ||
getprop("ro.product.device") == "xt901" || getprop("ro.build.product") == "xt901" ||
getprop("ro.product.device") == "solstice" || getprop("ro.build.product") == "solstice" ||
getprop("ro.product.device") == "xt905" || getprop("ro.build.product") == "xt905" ||
getprop("ro.product.device") == "smq_u" || getprop("ro.build.product") == "smq_u" ||
getprop("ro.product.device") == "scorpion_mini_u" || getprop("ro.build.product") == "scorpion_mini_u" ||
getprop("ro.product.device") == "xt907" || getprop("ro.build.product") == "xt907" ||
getprop("ro.product.device") == "scorpion_mini" || getprop("ro.build.product") == "scorpion_mini" ||
getprop("ro.product.device") == "xt925" || getprop("ro.build.product") == "xt925" ||
getprop("ro.product.device") == "vanquish_u" || getprop("ro.build.product") == "vanquish_u" ||
getprop("ro.product.device") == "xt926" || getprop("ro.build.product") == "xt926" ||
getprop("ro.product.device") == "vanquish" || getprop("ro.build.product") == "vanquish" ||
getprop("ro.product.device") == "mb886" || getprop("ro.build.product") == "mb886" ||
getprop("ro.product.device") == "qinara" || getprop("ro.build.product") == "qinara" ||
getprop("ro.product.device") == "xt897" || getprop("ro.build.product") == "xt897" ||
getprop("ro.product.device") == "asanti" || getprop("ro.build.product") == "asanti" ||
getprop("ro.product.device") == "xt897c" || getprop("ro.build.product") == "xt897c" ||
getprop("ro.product.device") == "asanti_c" || getprop("ro.build.product") == "asanti_c" || abort("This package is for \"moto_msm8960,xt901,solstice,xt905,smq_u,scorpion_mini_u,xt907,scorpion_mini,xt925,vanquish_u,xt926,vanquish,mb886,qinara,xt897,asanti,xt897c,asanti_c\" devices; this is a \"" + getprop("ro.product.device") + "\"."););
show_progress(0.500000, 0);
format("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "0", "/system");
mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
show_progress(0.500000, 40);
ui_print("{x}...Installing System...");
ui_print("");
package_extract_dir("system", "/system");
ui_print("{x}...Creating Symlinks...");
ui_print("");
ui_print("{x}...Setting Permissions...");
ui_print("");
[B][COLOR="MediumTurquoise"]HIGHLIGHT THIS LINE AND PASTE YOUR PERMISSIONS HERE[/COLOR][/B]
show_progress(0.200000, 0);
show_progress(0.200000, 10);
ui_print("{x}...Flashing Kernel...");
ui_print("");
package_extract_file("boot.img", "/dev/block/platform/msm_sdcc.1/by-name/boot");
show_progress(0.100000, 0);
ui_print("{x}...Installation Complete!");
ui_print("");

Amended Hints

***$PATH HINT*** Make sure root/sudo has access to the primary users $HOME/bin or where every you installed the tools to, It's that or you'll have to figure out your own workarounds and do a lot of jumping between user and su.

THIS IS A WIP, I'LL BE ADDING MORE THINGS IN THE FUTURE. I'M HUNGRY AND I WANT A BREAK FROM TYPING