Welcome to XDA

Search to go directly to your device's forum

Register an account

Unlock full posting privileges

Ask a question

No registration required
Post Reply

[HOWTO] Dual-Boot P31xx

OP Nicene Nerd

2nd September 2012, 04:53 PM   |  #1  
Nicene Nerd's Avatar
OP Senior Member
Flag Chattanooga
Thanks Meter: 166
 
232 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Dual-booting has always intrigued me. I dual-boot between Windows and Linux on one of my computers, dual-boot between stock firmware and RockBox on my Sansa Fuze v2, and I decided to find out how to dual-boot my Galaxy Tab 2 7.0". It took a couple days of work, but I have found one way to do so using the external SD card.
In the future, if I can work it out, I will provide a method for dual-booting using only internal storage. Update: I have successfully tested an internal dualboot setup. I will post details later.
Warning: While I am not aware of any specific way this could brick your device, stuff happens, so don't blame me. I've tested this and found no problems, but you may not be the same.
To use this method, you need a microSD card at least 8GB in size. If you use 8GB, though, you will have pretty limited space for storage, so a card 16GB or greater is advised.
Preparing SD Card
  1. Repartition your microSD card using whatever program suits you. You need to shrink the first storage partition to make room for the new system partitions. The new partitions should take at least 5GB, so be sure to leave at least 5.25GB. You can always resize later if you need to.
  2. After shrinking your storage partition, create four ext4 partitions in this order: system (min 800MB, recommended 1.25GB), cache (min 500MB, recommended 700MB), data (min 3GB, recommended 5GB), and EFS (min 21MB, recommended 32MB).
  3. Verify your partitions on your tablet by inserting the SD card, booting into CWM, and running "parted /dev/mmcblk1" (no quotes) over ADB shell.
Flashing External ROM
  1. Now you just need a ROM to flash. Most ROMs are not packaged to run from external SD card. You MUST either use a provided ROM or edit one yourself. I provide here a repackaged version of the 8/28 CM10 nightly which can flash to and run from your SD card. If you want to edit a ROM yourself, see the bottom of this post.
  2. Boot into CWM and backup. You will need your backed up boot image if anything goes wrong.
  3. Now flash your ROM. It will install to the external SD card on the appropriate partitions if you did everything right. Reboot: you should be in your new ROM.
  4. You'll probably want a Google Apps package. See below for packages for external dualboot.
Using Your Dual-Boot Setup
  • Your internal and external ROMs do not share internal storage, due to the odd nature of the SD card fuse tool.Your external ROM has an "internal SD card" of its own. You may find a way to mount the internal /data/media to the external ROM's /sdcard. My new ROM conversion script will add attempt to mount the internal ROM's storage to /storage/intSdCard
  • The ROMs I provide here include a script in /system/bin called "bootinternal." Run this from a terminal emulator or adb to switch from the external ROM back to the internal one. I have attached a script called "bootexternal" to this post. Use it on your internal ROM to switch to the external one (remember to set the executable permission).
  • In order for the boot switching scripts to work, you must do some preparation. On your external ROM, place the internal ROM's boot.img in /sdcard/Boot/internal.img. For your internal ROM, place your external ROM's boot.img in /sdcard/Boot/external.img.
  • If you ever need/watch to switch ROMs manually, run the following commands in a terminal emulator or over ADB, replacing "boot.img" with the boot image of the ROM you are switching to:
    Code:
    cat boot.img > /dev/block/mmcblk0p5
    reboot
    Alternatively, you could switch boot images using Mobile Odin.
  • Update: I would skip using my prepackaged ROMs now, because I have uploaded a converter script that will actually do a better job. These will configure the "bootinternal" and "bootexternal" scripts automatically.
  • If you ever need to wipe your data, cache, or dalvik cache, see the next post for CWM zips.
Downloads
Roms for External SD Card:
CyanogenMod 10 Nightly (8/28/2012)
AOKP P3113 Stable
Note that these are probably unnecessary now, because I provide a script to convert ROMs automatically on Linux.
Google Apps Packages for External SD Card:
Gapps for Jelly Bean - Use for CM10, AOKP, etc
Gapps for Ice Cream Sandwich - Use for stock, RomsWell, etc
If I ever have time, I plan to upload SD card images which you can use to partition your external SD card automatically.
---
Repacking a ROM for Dual-boot from SD Card
Note: You no longer need to do this manually. I have uploaded a script which automates the conversion process. See the next post for download.
  1. First, you need to extract and unpack the boot image. There are tools and scripts available for this, so find one.
  2. Once the boot image is unpacked, you need to edit init.espresso.rc on the ramdisk. Find where the partitions are mounted and change the code to look like this (yours may look slightly different depending on the ROM, but just be sure to replace the default partition mounts with those of your SD card partitions):
    Code:
        #mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/FACTORYFS /system wait rw   
        mount ext4 /dev/block/mmcblk1p2 /system wait rw
        #mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/FACTORYFS /system ro remount
        mount ext4 /dev/block/mmcblk1p2 /system ro remount
        #mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/DATAFS /data wait noatime nosuid nodev crypt discard,noauto_da_alloc
        mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/DATAFS /data2 wait noatime nosuid nodev crypt discard,noauto_da_alloc
        mount ext4 /dev/block/mmcblk1p4 /data wait noatime nosuid nodev crypt discard,noauto_da_alloc
        #mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/CACHE /cache wait noatime nosuid nodev nomblk_io_submit,errors=panic
        mount ext4 /dev/block/mmcblk1p3 /cache wait noatime nosuid nodev nomblk_io_submit,errors=panic
        #mount ext4 /dev/block/platform/omap/omap_hsmmc.1/by-name/EFS /efs wait rw
        mount ext4 /dev/block/mmcblk1p5 /efs wait rw
  3. Repack the boot image and stick it back into the ROM. Then edit the updater-script, and change all references to the internal system partition (/dev/block/mmcblk0p9) to the external system partition (e.g. /dev/block/mmcblk1p2). If any other partitions are referenced, change them as well.
  4. Optional: insert the "bootinternal" script in /system/bin and the a script to mount the internal storage in /system/etc/init.d.
  5. Your ROM is ready to go. Flash and be happy!

Thanks to Johnsel for helping me edit the boot image and pointing me to sendust7's work on the Atrix, who I also thank for his precedent.
Attached Files
File Type: txt 02intsdcard.sh.txt - [Click for QR Code] (122 Bytes, 429 views)
File Type: txt bootexternal.sh.txt - [Click for QR Code] (81 Bytes, 346 views)
File Type: txt bootinternal.sh.txt - [Click for QR Code] (81 Bytes, 260 views)
Last edited by Nicene Nerd; 5th September 2012 at 03:45 PM.
The Following 37 Users Say Thank You to Nicene Nerd For This Useful Post: [ View ]
2nd September 2012, 04:54 PM   |  #2  
Nicene Nerd's Avatar
OP Senior Member
Flag Chattanooga
Thanks Meter: 166
 
232 posts
Join Date:Joined: Mar 2012
Donate to Me
More
CWM Zips for Wiping External Partitions
If you ever need to wipe /data, /cache, or dalvik on your external dual-boot partitions, you can use these CWM zips to do so.

Update: Here is a script to automate the conversion of a ROM from standard to external dualboot.
Attached Files
File Type: zip wipe-cache-dualboot.zip - [Click for QR Code] (152.3 KB, 330 views)
File Type: zip wipe-dalvik-dualboot.zip - [Click for QR Code] (152.4 KB, 303 views)
File Type: zip wipe-data-dualboot.zip - [Click for QR Code] (153.4 KB, 305 views)
File Type: zip dualboot-rom-convert.zip - [Click for QR Code] (18.8 KB, 418 views)
Last edited by Nicene Nerd; 4th September 2012 at 07:54 PM.
The Following 12 Users Say Thank You to Nicene Nerd For This Useful Post: [ View ]
2nd September 2012, 06:45 PM   |  #3  
baliriot's Avatar
Senior Member
Flag Shah Alam
Thanks Meter: 268
 
744 posts
Join Date:Joined: Nov 2010
More
interesting... gonna try this later...
2nd September 2012, 08:39 PM   |  #4  
scottx .'s Avatar
Senior Member
Flag San Antonio, Texas
Thanks Meter: 801
 
2,228 posts
Join Date:Joined: Jun 2011
More
Nice guide! Dual boot with stock and cm9/10/AOKP would be ideal.
3rd September 2012, 09:16 AM   |  #5  
F3AR420's Avatar
Senior Member
Flag in a house
Thanks Meter: 63
 
323 posts
Join Date:Joined: Oct 2011
More
Confirmed?

Sent from my GT-P3113 using Tapatalk 2
3rd September 2012, 11:50 AM   |  #6  
IFLATLINEI's Avatar
Senior Member
Thanks Meter: 44
 
215 posts
Join Date:Joined: Dec 2010
More
Quote:
Originally Posted by scottx .

Nice guide! Dual boot with stock and cm9/10/AOKP would be ideal.

Agreed! Is it possible to dual boot stock and AOKP?
3rd September 2012, 06:22 PM   |  #7  
Nicene Nerd's Avatar
OP Senior Member
Flag Chattanooga
Thanks Meter: 166
 
232 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Quote:
Originally Posted by IFLATLINEI

Agreed! Is it possible to dual boot stock and AOKP?

Absolutely. If you're running stock, just follow the instructions to partition your SD card, then flash the provided AOKP package and (I assume you would) the gapps package. You should boot right into to your external AOKP installation. Then just copy your stock boot image to /sdcard/Boot/internal.img and run "bootinternal" from a Terminal Emulator or adb shell to return to stock.
The Following User Says Thank You to Nicene Nerd For This Useful Post: [ View ]
4th September 2012, 12:10 AM   |  #8  
silentvisitor's Avatar
Senior Member
Thanks Meter: 856
 
1,830 posts
Join Date:Joined: Mar 2012
BRILLIANT !!!

A few suggestions:
Possible to have a GUI to switch ROM or even better to have it at boot (through kernel).
Script to Automate the process of converting any(P31xx) ROM to dual-boot. It will take away pressure off you.

Thanks !
4th September 2012, 12:51 AM   |  #9  
Account currently disabled
Thanks Meter: 269
 
1,586 posts
Join Date:Joined: Oct 2011
thanks for the tutorial.
4th September 2012, 02:23 PM   |  #10  
Nicene Nerd's Avatar
OP Senior Member
Flag Chattanooga
Thanks Meter: 166
 
232 posts
Join Date:Joined: Mar 2012
Donate to Me
More
Quote:
Originally Posted by silentvisitor

BRILLIANT !!!

A few suggestions:
Possible to have a GUI to switch ROM or even better to have it at boot (through kernel).
Script to Automate the process of converting any(P31xx) ROM to dual-boot. It will take away pressure off you.

Thanks !

The GUI may or may not happen, since I, while familiar with partitions and scripting, don't know much about Java or Android development. I'll look into it, though. Having it run at boot through the kernel is beyond my skills. The closest I could do would be an init.d script.
As for a script to automate the conversion process, that seems doable. It only involves two files (init.espresso.rc in the boot image and the updater-script), so I could see that happening. I'll try to do something with that.

The Following 2 Users Say Thank You to Nicene Nerd For This Useful Post: [ View ]
Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes