[Atrix 4G Android Development] sendust7:
Quickly and conveniently leverage the strengths of mainstream ROMs and kernels using my new simplified and standalone dual boot tools!

Here I assume that your rooted Atrix with unlocked boot loader already hosts a ROM on EMMC. Even if you're not dual booting, I think you will find some or all of these tools helpful!

Steps

1. Boot to Recovery
2. Flash SmartPart FZ (partition SD card right on your phone!)
3. Flash Copy-ROM (copy ROM --- all except boot image --- from EMMC to SD card)
4. Flash Atrix Boot Emporium V3.0 (boot ROM on SD card to verify success)
5. Flash another ROM of your choice to EMMC and reboot (optional)

Links

SmartPart-V1.0-signed.zip: http://www.mediafire.com/?wm96y92g3lla3ot

Copy-ROM-V1.0-signed.zip: http://www.mediafire.com/?i068xs1ktdkd183

Atrix-Boot-Emporium-V3.0-signed.zip: http://www.mediafire.com/?zsf4is8fbzs7sf9

All zips tested working on my AT&T Atrix + Samsung 32GB Class 10 SD using ClockworkMod Recovery 5.0.2.0.

If everything goes well, you will have demonstrated "standalone" dual boot capability on your Atrix beauty without a computer! In fact, "unlisted" ROMs may be supported. For example I downloaded upndwn4par's CSROM V7.0 (26 Jan 2013), ported it to SD and then successfully booted it with faux's 1.0 GHz GB boot image featured in Emporium.

Walk-Through

Step 1: I prefer ClockworkMod Recovery 5.0.2.0 as it appears to be the most compatible recovery for Atrix.

Step 2: SmartPart FZ shrinks your (external) SD card's FAT32 partition by 4GB and adds three new “ext” partitions: /system, /cache and /data of ample size to host virtually any Android ROM. SmartPart FZ takes about 30-45 seconds to partition a Class 10 card.

Important! You MUST flash SmartPart FZ from internal memory (“choose zip from internal sdcard”) because if you flash it from external memory, your SD card gets mounted and you can't partition a mounted filesystem. Also it is a good idea to flash SmartPart FZ immediately after booting to CWM; else your SD card could get mounted accidentally.

Not sure you want dual boot? Just select the “Restore” option and Smart Part FZ restores your SD to its original state by removing any existing ext partitions (up to three consecutive partitions) and growing your FAT32 partition back to its original size. This takes about 10-15 seconds on a Class 10.

Note: SmartPart FZ is fundamentally the same as its shell script predecessor ( http://xdaforums.com/showthread.php?t=1651356 ) --- except that FZ runs unattended and does not backup anything.

Step 3: Copy-ROM, with the “EMMC to SD Card” option selected, copies all files on /system, /cache and /data files to the equivalent SD card ext partitions created in Step 2. Your EMMC ROM becomes a “live backup” on SD that you can boot to, thus freeing up EMMC to host another ROM of your choice.

One advantage of copying a ROM to SD is that you can first configure it the way you wish (GApps etc.), and then copy it over instead of having to flash individual customized zip files to SD. Then you're ready to flash a different ROM to EMMC, or blast off with a fully redundant system.

Copy-ROM uses the “cp -a” command, which I have found to be several times faster than cloning partitions. How much faster depends partly on disk usage since cloning copies everything, including empty space. Example: Port CM10 Liquid Smooth with ~100 total apps to a Class 10 SD. Clone ROM takes 15 minutes. Copy-ROM takes less than 2 minutes.

Another advantage of copying files over cloning partitions is that you don't have to worry about partition size mismatch. And I would not want to modify EMMC partitions --- too scary for me.

Step 4: Use Emporium V3.0 to boot a supported ROM whether it is hosted on EMMC or SD. Emporium contains boot images and corresponding /system/lib/modules for:

ICS MROM
ICSROM
CM10 epinter (Stock and OC1300)
CM10 Th3Bill (AOKP, Liquid Smooth and MIUI)
CM7 MROM (HV and SV)
CM7 Neutrino (EE, GT and GT+)
GB MROM (HV and SV)
GB NottachTrix (ATT and faux 1.00, 1.30 and 1.45)

Emporium V3.0 is less than 120 MB compressed and 10-15% more uncompressed. Each file named “boot.img” was lifted from its respective ROM zip. Each file named “boot-sd.img” exactly matches its big brother boot.img, except that ramdisk was modified to redirect ROM filesystem mounts from EMMC to SD:

/system: mmcblk0p12 to mmcblk1p2
/cache: mmcblk0p15 to mmcblk1p3
/data: mmcblk0p16 to mmcblk1p4

except

for CM10 boot images. Please read CM10 Notes below.

Emporium Options

One of the dilemmas associated with dual booting is how to clear /cache and or /data. Of course CWM can do this, but only for ROMs hosted on EMMC: It does not recognize ROMs hosted on SD. And CWM is a little cumbersome to use since the clearing options are not all on one page. Emporium addresses these issues by displaying a single page with options to:

Clear /cache and /data/dalvik-cache
Clear /data (BE CAREFUL)

on EMMC or SD depending on the option selected on the first page. Now you can conveniently boot to a jet clean ROM whether it is hosted on EMMC or SD. Of course if you just copied a healthy ROM to SD, it is probably not necessary to clear.

I will explain the third option: Extract Boot Files to /sdcard/Boot later.

All three options are null by default.

Step 5: Nothing new here if you've ever flashed a ROM.

Now if for some reason you want to reverse the process and copy a ROM from SD Card to EMMC, just flash Copy-ROM and this time select the “SD to EMMC” option. Then flash Emporium or fastboot your EMMC ROM with the boot image of your choice. You may want to Nandroid-backup or Titanium Backup before doing a reverse copy.

Of course there are faster ways to switch between ROMs. But the tools presented here give your Atrix a simplified, standalone dual boot capability using all flashable zips.

Once you're comfortable using these flashable zip tools, you can then move onto “live” boot switching using all soft keys. To that end, I rolled up all of Emporium's boot images and my simplified boot switcher “boot-rom.sh” to a single directory named “Boot” which also includes the user-configurable subdirectories ROM1 and ROM2. Just select Emporium's option: Extract Boot Files. This extracts Emporium's Boot directory and its contents to the top directory of your SD card. After that you can copy your ROM boot images to Boot/ROM1 and Boot/ROM2 using Root Explorer or other suitable app. Copy boot.img to {path-to-SD}/Boot/ROM1 and boot-sd.img to {path-to-SD}/Boot/ROM2.

Now you can switch “live” between ROMs or boot to recovery using the appropriate command string:

sh boot-rom.sh (reboot to current ROM)
sh boot-rom.sh 1 (boot to ROM1)
sh boot-rom.sh 2 (boot to ROM2)
sh boot-rom.sh 3 (boot to Recovery)

Here is Emporium's boot-rom.sh:

#!/system/bin/sh

echo Motorola Atrix Dual Boot ROM1 emmc or ROM2 SD card
echo sendust7 @ xda developers
echo
echo Usage: sh boot-rom.sh N
echo where N = blank \(reboot to current ROM\)
echo 1 \(reboot to ROM1\)
echo 2 \(reboot to ROM2\)
echo 3 \(reboot to recovery\)

echo
echo "Home directory: $HOME"
echo

if [ $# -eq 0 ]; then
echo Rebooting to current ROM. Please wait...
sleep 3
reboot
elif [ $1 -eq 1 ]; then
if [ -f $HOME/ROM1/boot.img ]; then
cat $HOME/ROM1/boot.img > /dev/block/mmcblk0p11
echo Rebooting to ROM1. Please wait...
sleep 3
reboot
else
echo "boot.img not found. Check home directory."
exit 1
fi
elif [ $1 -eq 2 ]; then
if [ -f $HOME/ROM2/boot-sd.img ]; then
cat $HOME/ROM2/boot-sd.img > /dev/block/mmcblk0p11
echo Rebooting to ROM2. Please wait...
sleep 3
reboot
else
echo "boot-sd.img not found. Check home directory."
exit 1
fi
elif [ $1 -eq 3 ]; then
echo Rebooting to recovery. Please wait...
sleep 3
reboot recovery
else
echo "Invalid option. See Usage."
exit 1
fi

return 0

Note that boot-rom.sh is more robust than previous versions. The improved logic displays the $HOME directory and also displays an error message if it can't find ROM1/boot.img or ROM2/boot-sd.img under $HOME. If you are using Script Manager to launch boot-rom.sh, go to Settings>More>Advanced>Configuration, set Home directory to {path-to-Boot} (for example, “/storage/sdcard1/Boot” for CM10), press field at bottom to select Home directory, then select “Export $HOME” and “Browse as root”. So when you launch boot-rom.sh from Script Manager, the $HOME directory should be: {path-to-SD-card}/Boot. If not, you get an error message if you enter an argument of 1 or 2 in the command string.

Be sure to launch boot-rom.sh as root.

CM10 Notes

If you unpack any of Emporium's CM10 files named “boot-sd.img”, note that I made two small changes in ramdisk in addition to rerouting filesystem mounts:

The “init” executable was replaced with the MROM ICS init

init.olympus.rc was modified to grant elevated privileges in mkdir /storage/sdcard{0,1} per the MROM ICS init.olympus.rc

I found these two additional steps necessary to successfully boot CM10 from SD and to make apps run properly. That said, these “boot-sd.img” files should be viewed as experimental, as your mileage may differ. But no kernels were modified.

I think that porting CM10 to SD has some merit as the /system partition is easily up-sized to hold apps moved from the /data partition. Why would I make this obscure statement? Well it turns out that CM10 apps running under /system appear to have more privileges than those running under /data. I demonstrated this behavior on at least two different CM10 builds hosted on both EMMC and SD using “aLogcat” a GUI-based system logcat generator. When I launched aLogcat under /data/app, it would not display logcat to screen nor save results to a file. Then I moved it to /system/app and the problems disappeared.

Enjoy.

Troubleshooting

No wifi? Try re-flashing with Emporium since it refreshes /system/lib/modules.

Soft-brick? You may have attempted to boot a non-existent, corrupt or incompatible ROM.

Unusually fast completion of zip flash? An error has probably occurred, and you may need adb and recovery log to debug.

Disclaimer: Standard disclaimers apply.

Credits: Embedded in the zip files.

Photos and Screenshots

SmartPart FZ Before and After (in adb shell):

Emporium V3.0 Directory Structure

More on the way!