[Atrix 4G Android Development] sendust7:
New! Dual Boot Flashable Zip CM10 epinter (emmc) and CM7.2 RC3 (SD) ...

At least two variants of JellyBean CM10 for Atrix are now available courtesy of xda members epinter and jokersax11. So I created a Dual Boot Flashable Zip (DBFZ) with CM10 (epinter) on emmc and CM7.2 RC3 on SD card. This is consistent with the philosophy of hosting an alpha ROM on emmc and a stable ROM on SD, thus making it easier to manage dual boot when flashing alphas.

Dual-Boot-CM10-epinter-0727-CM7.2-RC3-signed.zip: http://www.mediafire.com/?grp4adjqwuhica1

I noticed that the CM10 path to SD FAT32 is now “/storage/sdcard0”. So I updated the boot switcher: ./Boot/boot-rom.sh to automatically follow this path if it cannot locate ./Boot on the /mnt path.

I also found a bug in my previous DBFZs which this version fixes: In CM7 /system/bin/backuptool.sh, redirect the “mount /system” command to SD: “mount /dev/block/mmcblk1p2 /system”

That's it...

Instructions:

1. Boot to CWM and if necessary, partition your SD (you can use SmartPart, which is described further below):

2. Are you coming off a previous dual boot with a non-CM7 ROM on SD? You can ...

wipe SD /cache: http://www.mediafire.com/?mc881zjhl9oqr0q

wipe SD /data: http://www.mediafire.com/?4k4fey6gxe1nbn0

Both wipers assume that SD is correctly partitioned to host ROM.

3. Flash DBFZ.

4. Boot to CM10 and configure SD card ./Boot/boot-rom.sh in Script Manager to boot CM7 (Argument = 2).

Note: If for some reason the Boot directory did not make it over, you can manually extract it to /storage/sdcard0 (CM10 path).

5. Boot to CM7 and configure SD card ./Boot/boot-rom.sh in Script Manager to boot CM10 (Argument = 1).

6. Boot to CWM and flash CM10 gapps and gapps-for-CM7-20120316-sdcard: http://www.mediafire.com/?1c2br6sw6330lwn

You should be able to flash another CM10 alpha right over this one. And if the CM10 boot.img differs from current one, you can update dual boot configuration by copying boot.img to ./Boot/ROM1.

Cheers.

++++++++++++++++++++++++++++++++++++++++++++

“SmartPart” Android batch script intelligently partitions your Atrix SD card to host a second ROM in a dual boot configuration

SmartPart v1.1 accommodates larger SD card-based ROMs, simplifies tweaking and slightly refines the decision logic for repartitioning.

Dry Run (allows you to see first-hand what to expect without making any changes, since all code that modifies SD card is commented out)

http://www.mediafire.com/?81uikn7ih8brcnw

Full Up

http://www.mediafire.com/?vz2q6usm2f84j8q

SmartPart Features

Eliminates the need to swap SD card between phone and computer

Takes the guesswork out of setting partition boundaries by automatically computing them while taking measures to protect your SD card's existing FAT32 partition and all data stored on it. My (pre-shrunk) FAT32 partition actually grew after running this script, lol.

Provides a “walk-through” feel as it computes and displays useful info about your SD card and internal memory --- all in “real time” on your monitor. And the intermediate results files are all stored in the CWM /tmp directory alongside recovery.log.

Option to backup your SD card's FAT32 partition before proceeding

Several options to exit midstream before modifying SD card

Uses all stock ClockWorkMod Recovery shell commands

Can be run from any ADB-enabled machine, Windows or Linux

Preliminaries

ADB-enabled computer (“adb” tool resides in the Android SDK “platform tools” directory)

CWM Recovery 5.0.2.0

Class 4 (or higher) SD card with leading FAT32 partition. Class 2 MAY work, not sure.

Fully charged battery

Instructions

1. Download "part-sdc.sh" from link at top and move to directory where "adb" tool resides

2. Boot to CWM

3. Connect phone to computer

4. At ADB command terminal, enter:

adb devices (ensure device is listed)
adb push part-sdc.sh /tmp
adb shell (to access phone's root filesystem)
sh /tmp/part-sdc.sh (run SmartPart)

5. During execution, follow all prompts, read the displayed info and wait for SmartPart to process between interrupts. See "Timing Benchmarks" below to get a feel for how long things take.

6. Done!

7. Reboot to CWM and (if necessary) wipe /cache and /data for primary ROM and flash dual boot – or maybe clone the /system partition of a working ROM to SD card.

SmartPart Algorithm

1. Analyze memory and check for three ext3[4] partitions of adequate size behind the FAT32 partition. If they exist, exit; else continue with memory analysis.

2. Check for SD card device name: "mmcblk1"

3. Check if SD card has enough free space to hold second ROM. If not, exit.

4. Provide option to safety-backup SD card FAT32 to /emmc with a timestamped backup directory. Figure on 2+ minutes per GB using Class 6 or lower SD card.

Note: I have run SmartPart several times on my Class 6 SD without backing up and in each case, all of my data under /sdcard was preserved.

5. Option to backup SD card FAT32 to /emmc, check if /emmc has enough free space to hold this backup. If not, exit; else proceed with backup at user's request.

6. Remove any pre-existing SD card partitions beyond FAT32. If coming off a previous dual boot, this will wipe the SD card-based ROM /system, /cache and /data.

7. Proposed SD card partition design is presented for review.

8. Option to repartition SD card by resizing FAT32 and creating three new “ext” partitions for ROM /system, /cache and /data respectively.

9. Upgrade ext2 to ext3 using CWM “tune2fs” filesystem tuner.

10. Final review: Mount SD card FAT32 and ROM filesystems to show used and available space

11. Unmount filesystems and exit

Note 1: Partition sizes may not be adequately robust for all ROMs. May need to increase size of one or more partitions. But the script format allows for easy tweaking.

Note 2: I tried rolling an earlier version of SmartPart into a CWM-flashable zip, but got errors at runtime. I think it is because when CWM flashes zip files, the /sdcard filesystem is mounted and stays mounted during the entire flashing process --- and partitioning tools cannot modify a device while one or more of its filesystems are mounted.

Timing Benchmarks

Platform:

SanDisk 16GB Class 6 micro-SD

Motorola Atrix 4g running ClockWorkMod Recovery version 5.0.2.0

Running part-sdc.sh with single FAT32 partition

Start: 1:13:15 Finish: 1:19:35 (6.3 minutes)

Backup 4000MB from /sdcard (FAT32) to /emmc using CWM busybox"cp" copy command

Start: 2:14:06 Finish: 2:23:09 (9 minutes, or 2.25 minutes per GB)

Same backup with CM7 running on SD card and LCD mostly OFF

Start: 5:23:30 Finish: 5:33:28 (10 minutes, or 2.5 minutes per GB)

++++++++++++++++++++++++++++++++++++++++++++++++

Dual Boot Information Here!

PLEASE read Dual Boot Instructions first! See below.

Dual Boot Flashable Zip v1.4

Ziplink: http://www.mediafire.com/?58pxlm9qbj5e1q2

Checksum: http://www.mediafire.com/view/?rg3bozbckzq4baq

This is my first attempt at integrating dual boot with an AROMA-based installer. It worked great on my phone after flashing my wiper zip (wipe /cache and /data on both sides).

Make sure to have a solid Nandroid backup. If you previously had dual boot and want to backup your second ROM, I can provide some direction on how to do it. (CWM Recovery will not recognize the second ROM.)

Then, CWM-flash wiper zip: http://www.mediafire.com/?yguun5clck17pdx to fully wipe /data and /cache on emmc and sdcard.

Then flash dual boot zip and select all of the AROMA defaults if you want to make sure this works before customizing.

Android should boot to the Nvidia Tegra II splash screen and hang there til it's finished loading files and building cache. Longer boot times are typical after full wipe. Then look for the familiar Welcome screen.

Since the primary goal here is to get dual boot working, you can skip Google setup for, tapping “Next” to all the prompts and then “Finish”. Then configure Script Manager using the Dual Boot Flashable Zip instructions below.

In the AOKP/CM7 zip file updater-script, I pushed the kernel you selected during the AROMA install to: /sdcard/Boot/AOKP/boot.img. So theoretically, if you boot AOKP from CM7, Android should boot that same kernel. I personally haven't had much success with overclocked kernels; my Atrix usually goes into boot loop.

Now if you want to customize from here, it's better to re-flash the dual boot version of AOKP and customize from there instead of flashing the original AOKP installer zip. That's because AOKP doesn't include Script Manager which is needed to quickly boot to the other ROM.

I did a simple test by choosing Droid splash instead of Tegra II and black keyboard instead of AOKP kb. Everything seems to work fine except for the usual CM9 hiccups with rotation, camera, etc.

CM9 beta 0.6.9.1 and CM7 RC3...

Dual Boot Flashable Zip v1.3

Ziplink: http://www.mediafire.com/?b7g7i78kzr08hcd

Checksum:http://www.mediafire.com/view/?4yue8mds4sd7zxc

Features:

Joker Beta CM9 0.6.9.1 (emmc) and CM7.2.0 RC3 (sdcard)

Zip updater now automatically backs up the boot configuration directory: /sdcard/Boot (if it exists) and generates a new /sdcard/Boot.

Script Manager free (credits to devwom https://sites.google.com/site/devwom/script-manager ) is now pre-installed in both /system partitions (emmc and sdcard).

Installation/configuration instructions are now simplified as a result of these enhancements.

Dual Boot Instructions:

1.a. Create ext4 partitions on sdcard as described here and/or in my original Dual Boot Atrix thread. I prefer to use GParted with micro-SD card connected directly to computer via card adapter. This can be done on a Windows or Linux machine using GParted LIve CD: http://sourceforge.net/projects/gparted/files/gparted-live-stable/ , Here are two videos showing how to do this. The second one (better display quality but no sound) was done on Ubuntu, but the method is exactly the same.

http://www.youtube.com/watch?v=2fQIQIKeIbI

http://www.mediafire.com/?ys8b07b0vpaivg5 (opens with VLC Media Player)

1.b. Remove SD card from computer and reinsert into phone.

2. Download dual boot zip to /sdcard/Download (or wherever you keep your ROMs).

3. Flash dual boot zip via CWM 5.0.2.0. If all goes well, CM9 should be on emmc, CM7 on sdcard and boot files in new directory: /sdcard/Boot

4. Reboot. CM9 should come up, though the first boot takes longer as CM9 is building cache.

5. On CM9, go to Apps, tap SManager (SM) and browse as root (no need to install widgets). With SM running, tap Menu > More > Advanced Options > Config and set home directory to /sdcard/Boot (use the select directory button at bottom). Exit and restart SM, look for /sdcard/Boot/boot-rom.sh and tap on it. Set Arg = 2, tap "Su" then "Save" then "Run" to reboot to CM7 from CM9. The first boot takes longer as CM7 is building cache.

6. Reboot to CM7 and configure SM to run /sdcard/Boot/boot-rom.sh exactly the same way you did for CM9, except this time set Arg = 1 to reboot to CM9 from CM7.

If you want a jet clean install (e.g. after previously dual booting) here is a single CWM-flashable zip that completely (and dangerously;)) wipes /cache and /data (ALL user apps and related data) for both ROMs (emmc and sdcard). Link: http://www.mediafire.com/?yguun5clck17pdx . I am presently working on a companion backup/restore zip.

Note: Dual Boot Flashable Zip version 1.2 and below are now deprecated.

Video Tutorial Sneak Preview! http://www.mediafire.com/?ys8b07b0vpaivg5

This video-only clip shows how to partition your micro-SD card so it can host your second ROM. You can open the video using VLC media player (free). In this video, I have my 16 GB micro-SD card connected to my computer via card adapter, and am using GParted on Ubuntu 11.10 to shrink the existing vfat partition and create the required ext4 partitions (/system, /cache and /data) for my second ROM. Note: The sizes of these new partitions are approximately the same as the existing emmc partitions. You can also boot your Windows/Linux computer with a GParted Live CD and perform these operations. I chose to run GParted on Ubuntu so I could capture this high res video with Desktop Recorder.

Bonus! CM7 GApps flashable zip ported to sdcard: http://www.mediafire.com/?dv22qnfqzj5d3la Since this version is older than Google Play, it will initially come up as Android “Market”. And you'll probably get “Problem loading widget” at top of screen. I think it's the Google search bar trying to load. I just delete the search bar as it consumes too much real estate anyway. Let Android Market update to Google Play (takes a little while), reboot to CM7 on sdcard and enjoy.

Useful info here: http://xdaforums.com/showthread.php?t=1642185 and http://xdaforums.com/showthread.php?t=1645344

SD card partitions should look something like this after the install:http://www.mediafire.com/i/?qseve9gppjt2bxe

When you reinsert your SD card to phone, Android should recognize the partitions as:

/dev/block/mmcblk1p2 (system)

/dev/block/mmcblk1p3 (cache)

/dev/block/mmcblk1p4 (data)

Troubleshooting: Copy /sdcard/Boot/CM7/boot.img to your computer. Then with phone connected to computer with fastboot tool (e.g. under Android SDK Platform Tools) enter:

fastboot devices (make sure phone is recognized)

fastboot flash boot /path/to/boot.img

fastboot reboot

Helpful link: http://www.freeyourandroid.com/guide/fastboot-guide

If CM7 does not boot, most likely one or more of your SD card ext4 partitions does not exist or is corrupted.

Please Note: The ramdisk directory embedded in /sdcard/Boot/CM7/boot.img is custom in that the embedded script file: init.olympus.rc is modified to mount /system, /cache and /data on sdcard instead of on emmc (see code below).

on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
#mount ext4 /dev/block/mmcblk0p12 /system noatime nodiratime wait ro barrier=1
#mount ext4 /dev/block/mmcblk0p16 /data nosuid nodev noatime nodiratime wait barrier=1 noauto_da_alloc
#mount ext4 /dev/block/mmcblk0p15 /cache nosuid nodev noatime nodiratime wait barrier=1 noauto_da_alloc
mount ext4 /dev/block/mmcblk1p2 /system noatime nodiratime wait ro barrier=1
mount ext4 /dev/block/mmcblk1p4 /data nosuid nodev noatime nodiratime wait barrier=1 noauto_da_alloc
mount ext4 /dev/block/mmcblk1p3 /cache nosuid nodev noatime nodiratime wait barrier=1 noauto_da_alloc

SO... if you want to swap /sdcard/Boot/CM7/boot.img for another image and keep CM7 running on your sdcard, you must first: 1) unpack the new image to kernel file and ramdisk directory, 2) modify init.olympus.rc under ramdisk to mount /system, /cache and /data on sdcard instead of on emmc as described in the code, and 3) repack boot image from kernel and modified ramdisk. Along this line, I have developed simplified, more intuitive Perl scripts to unpack and repack boot image files based on: http://android-dls.com/wiki/index.php?title=HOWTO:_Unpack,_Edit,_and_Re-Pack_Boot_Images

I haven't yet posted these new scripts as they are still under test, but hopefully they will make it a little easier to unpack/modify/repack boot images.

Please Note: I've received several valid requests for customization, and I seek to respond to each while continuing my research. However please understand that this work is highly experimental. One BIG challenge is the lack of a recovery tool that will recognize the ext4 partitions for /system, /cache and /data on sdcard. So for example if you want to customize your secondary (sdcard) build, you won't be able to do it via standard zip flash. For now, customizations must be done manually e.g. by modifying/re-signing the customization zips or by pushing a nandroid backup of your pre-customized ROM to the respective ext4 partitions on sdcard. I'm looking at ways to automate certain methods. I've also considered developing a "Sendust Recovery" tool, but that would be a huge undertaking:)

Idea: A flashable zip that clones primary ROM and data to sdcard. Concept offered by XDA member Always_Jonezen (thanks!)

A future goal of this project (and a primary reason for building this zip) is to redirect user apps to sdcard per Joker's suggestion, thus allowing each ROM to access a common set of apps . For CM7, the /data partition is already on /sdcard as /dev/block/mmcblk1p4. I would still need to modify the CM9 paths.

Standard disclaimers apply. In short, I am not responsible for any harm you or your phone may incur by using any or all of this material.

Many thanks to epinter, jokersax11, leonardoaraujo, and the CM/Photon/Atrix/Android dev teams for their excellent ROMs. And of course, to Koush.