[Android General] jostrus:
Pre-Rooted system image for US and non-US variants ME302C-V5.0.21

I got tired of waiting for a US "fake update" root zip so I created my own partition image pre-rooted. If you want to make your own skip down a little bit.

Using this method you do not need to go back to stock, switch from WW to US first, or any such nonsense. If you have gone the route of flashing the US model with the WW update rom you can flash this directly over it, and it goes back to the proper US rom. If coming from something other than US it might be worthwhile to erase cache.

Non US roms:

You can use these instructions to create an image of the WW and TW, and other roms by using the regex macro at Post 536 to convert the updater-script file from the OTA zip. Then use that instead of the update_system_5021.sh referenced in this post. You can use that with my newly created automated script from View attachment make_US_image_5021.zip, but replace the included script. You need to edit the make_US_image.sh to reflect your OTA zip file, permissions script, and desired output image file.

If you wish to download a pre-created US v5.0.21 image for flashing via fastboot here are some links. They are all the same file which is around 800mb.

US_ME302C-V5.0.21-JB_4.3-system.gz Dropbox

US_ME302C-V5.0.21-JB_4.3-system.gz Google Drive

US_ME302C-V5.0.21-JB_4.3-system.gz Onedrive

US_ME302C-V5.0.21-JB_4.3-system.gz Mega.co.nz

US_ME302C-V5.0.21-JB_4.3-system.gz MediaFire

I have included an MD5 hash View attachment US_ME302C-V5.0.21-JB_4.3-system.gz.md5.txt attachment. Renamed to .txt so the forum server would allow it. If you don't wish to download the attachment for some reason here is the MD5

d18efcb9497acedb9770687217ea2dca *US_ME302C-V5.0.21-JB_4.3-system.gz

Once you download the gzip file jump to step 4 for flashboot syntax. Remember to adjust the filename as the sample in the tutorial is not the same as the default for the download links. Also check Step 5 for kernel update instructions.

If you wish to generate it yourself there are 2 options.

First is get the View attachment make_US_image_5021.zip, extract and run the included script inside.

The other still requires 2 of the scripts in the zip or found attached to this post, then follow the old instructions below. I try to be as thorough as possible so this gets long.

This is not for someone with very little or no Linux knowledge. If you fit that description use the pre-made image from a link above.

I have included 2 *nix shell scripts to set all the permissions in the system image file. The basic update script for the system files *might* work on the non US variants of the update OTA's but they are untested. All I did was rewrite the set permission and symlink commands in the updater-script from the OTA zip to Linux commands. More details about that here Post 536. If you want to generate a non US version rom image I recommend using the instructions above for non US roms.

What you need:

Download the OTA zip from Asus website. Asus Download Page

Download one of the previous "fake update" root zips (I attached the 5.0.19 View attachment fakeroot.zip). We just need the system folder from it with the actual root files.

Download View attachment make_US_image_5021.zip. If you do not want an automated creation follow the old instructions further down.

A Linux install of some sort to do this. Virtual Machine, Linux live cd, regular install, etc. (I used Ubuntu 12.04.3LTS)

A Linux kernel with loop file support. (most modern distros have this)

Unzip (Info-Zip compatible) utility. Or something else that has same syntax linked as "unzip". (do any distros not have this?)

Gzip (do any distros not have this?)

Note: You need about 3.5GB of free space in the directory where you run the script from. If you use the manual method further down you'll need about 5gb.

Place the US_ME302C-V5.0.21-0-ota-user.zip in the same directory as make_US_image_5021.zip. Then you can just run

unzip make_US_image_5021.zip
sudo bash make_US_image.sh

If you're using a Linux distro without sudo make sure you run the bash script as root.

It will do everything for you. It has some, but very little error checking. It does the same as the old manual steps further below with the exception of using the current directory for the image file, command execution in a slightly different order, and unzipping directly to the mounted image instead of a local folder first. This saves a little bit of interim space and time.

When it is finished it will have created a file US_ME302C-V5.0.21.ext4.img.gz you can then continue from Step 4 of the old instructions.

Old instructions:

From here out I will assume all the important files are placed in /tmp.

US_ME302C-V5.0.21-0-ota-user.zip

fakeroot.zip

update_root.sh

update_system_5021.sh

I did this all as root for simplicity. It is assumed anything in a code box is typed at a root terminal prompt. If you use a real install please be extra careful of the commands.

Step 1) We create our image file and format it.

I've decided to set environment variables to save having to type long parameters repeatedly possibly generating typos. I will be using them in these instructions. If you don't want everything to be in /tmp just edit to where you would like them. If you choose to rename the scripts or create your own custom ones you can just change the filenames in the variables here and the rest of the instructions remain the same. This is also the case for the automated script make_US_image.sh.

IMAGE_FILE=/tmp/US_ME302C-V5.0.21.ext4.img
OTA_ZIP=/tmp/US_ME302C-V5.0.21-0-ota-user.zip
OTA_PERMISSIONS_SCRIPT=/tmp/update_system_5021.sh
ROOT_PERMISSIONS_SCRIPT=/tmp/update_root.sh

Create an empty image file to start with.

dd if=/dev/zero of=$IMAGE_FILE bs=1M count=1344

If all went correct your file should be 1409286144 bytes. You can check with

ls -l $IMAGE_FILE

If all is good then create the file system.

mkfs.ext4 -m 0 $IMAGE_FILE

You'll probably get a message like this

mke2fs 1.42 (29-Nov-2011)
US_ME302C-V5.0.21.ext4.img is not a block special device.
Proceed anyway? (y,n)

Say yes. Once your image is generated and formatted we need to mount. My scripts all reference /system for simplicity of editing from the updater-script in the OTA zip. If you don't want to mount in /system you'll need to edit the scripts to point where you choose.

mkdir /system
mount -o loop $IMAGE_FILE /system

Step 2) Extract everything to the mounted image

unzip -d / $OTA_ZIP "system/*"

Wait a bit as this may take a while.

Then we do some small unzips and file renaming for the root stuff.

unzip -j -d /system $OTA_ZIP "recovery/recovery-from-boot.p"
unzip -j -d /system/etc $OTA_ZIP "recovery/etc/install-recovery.sh"
mv /system/etc/install-recovery.sh /system/etc/install-recovery-2.sh
mv /system/build.prop /system/build-1.prop
unzip -d / fakeroot.zip "system/*" -x "system/etc/install-recovery-2.sh" "system/build-1.prop"

Step 3) Set permissions

Now that we finished unzipping everything, we just run the 2 permission setting scripts and unmount.

bash $OTA_PERMISSIONS_SCRIPT
bash $ROOT_PERMISSIONS_SCRIPT
umount /system
gzip $IMAGE_FILE

For continuity with my direct download links we'll rename to match up.

mv $IMAGE_FILE.gz US_ME302C-V5.0.21-JB_4.3-system.gz

Step 4) Flash the image.

Take your newly created image and use fastboot to flash it.

Make sure you followed the last step of step 3 to rename the file if you're cutting and pasting these instructions.

I use a windows machine normally so:

C:>fastboot erase system
C:>fastboot flash system US_ME302C-V5.0.21-JB_4.3-system.gz

Wait some stupid amount of time for it to finish. Reboot tablet and you're done.

Step 5) Flash 5.0.21 kernel

I have uploaded the kernel from the OTA zip from Asus (renamed to make it easier to identify). I would recommend flashing it as well. Download View attachment boot_(5.0.21-kv3.4.43).zip and unzip it, then run

fastboot flash boot boot.img

If something goes wrong you can still use the fastboot and recovery from 4.7.3 and reflash the OTA zip to go back to stock unrooted.

Edit: 2014-Nov-17 added semi-optional step 5 to flash new kernel image, which may be cause for some issues to some people.

Edit: 2014-Sep-09 root reminder for script execution.

Edit: 2014-Sep-05 updated links for DDL. Restructured the command sequence for manual creation and renamed file to follow my DDL naming. Added single download with 3 scripts to be used to create image more easily. The previous attachments are still there. Updated command list to add in the recovery image updater that I forgot about.