Thursday, August 20, 2009

Media2SD for n00bs

Requirements:
Root
BusyBox
Apps2SD (EXT2/3/4 w/20+MB free)
ADB (free) OR SUFBS ($2.99 in market, get it if you can afford to)
TEXTPAD or Notepad++
Patience
20 minutes of your time

Please note that I have only tested this with Cyanogen’s mods. If you haven’t flashed his rom, I would highly suggest giving it a shot. If you are not running CM, this may not work.

If this breaks your phone, it’s not my fault.
Do not use notepad or wordpad to edit your userinit.sh.
use textpad or notepad++

Step 1:
Grab your favorite resource.zip file (Compressed audio files here)
Extract the contents of the zip somewhere easy to remember.
Example:

C:\tools\media\

Once the files are extracted you should have 4 folders in your audio folder:

C:\tools\media\audio\ ui | ringtones | notifications | alarms

Step 2:
Create target folder.

Using TERMINAL or ADB shell type the following commands:
Su
Cd /system/sd
Mkdir media

Step 3:
Move the extracted resource files to your phone.
Using adb push:
Adb push c:\tools\media /system/sd/media
And wait a while

Using SUFBS:
Mount your SDCARD
Copy the audio folder to your SDCARD
Open SUFBS
Navigate to /sdcard
Find your audio folder long press to copy
Press the back arrow and go to /system/sd/media/
Menu -> paste and wait
Delete /sdcard/audio to avoid duplicates. (not /system/sd/media/audio/)

Step 4:
Removing /system/media (your old audio folder)

WARNING! THIS IS WHERE THINGS CAN GO WRONG. BE CAREFUL. YOU HAVE BEEN WARNED.

TERMINAL:
busybox mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
busybox rm -rf /system/media

ADB SHELL:
Adb remount
Rm –rf /system/media

SUFBS:
Press the “s” button near the top so it turns red
Navigate to /system
Long press on media and delete.

Step 5:
Symlinks (a shortcut of sorts, when android looks for /system/media it will be redirected to /system/sd/media/

TERMINAL:
busybox ln -s /system/sd/media /system/media

ADB SHELL:
ln -s /system/sd/media /system/media

SUFBS:
Navigate to /system/sd/
Long press on media
Select “sym link”
Navigate to /system/
Long press on media
Select “link to here”

Step 6:

Permissions (android needs the proper permissions to read the ringtones and such, otherwise it will fail. Folders need to have the permission 666 and the files need 777)

TERMINAL:
Su
cd /system/sd

chmod 666 media

cd media

chmod 666 audio

cd audio

chmod 666 *

cd alarms

chmod 777 *

cd ../notifications

chmod 777 *

cd ../ringtones

chmod 777 *

cd ../ui

chmod 777 *


ADB SHELL:
This is the same as TERMINAL.

SUFBS:
This will take you forever. Use terminal or adb

Step 7:

Reboot and verify that you have ringtones. Please wait up to 5 minutes after your phone has rebooted before doing this, the system needs to find all its files first.

Go to settings -> sound & display -> phone ringtone.
You should have a very long list of ringtones now.

Step 8:
Optional
(however you will have to repeat steps 4 and 5 every time you flash a new ROM)

Add these lines to your
/system/sd/userinit.sh

Once again do not use wordpad or notepad
(use TEXTPAD or NOTEPAD++ or SUFBS)

busybox mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system;
busybox rm -rf /system/media;

busybox ln -s /system/sd/media /system/media;

busybox mount -o ro,remount -t yaffs2 /dev/block/mtdblock3 /system;


Don’t have one? Use mine

TERMINAL:
adb push c:\tools\userinit.sh /system/sd/userinit.sh

 
COMPCACHE is enabled by default on my userinit.sh
My userinit.sh is only designed to work with cyanogens mod 4.0.1 or higher. You have been warned.

  
If there is anything wrong with this tutorial, or you have issues with any step please let me know so I can correct the issue and/or help you

1 comments:

  1. You have your permissions backwards, it should be 777 (or 755) for folders and 666 for the files.

    ReplyDelete