I was looking for a way to speed up my TF700t, running Cyanogenmod 11. Generally I'm very happy with my tablet, but over the last months Chrome performance got worse and worse, both while browsing and when switching to other apps / the homescreen.
Googling a bit I found the browser2ram thing, which in principle simply mounts a tmpfs over the browser cache directory. As the scripts I found for download, were pretty bloated and did not hint at cyanogenmod integration, I came up with my own scripts, which I'm about to share here.
To make the chrome cache reside in a 100MB tmpfs, copy the following code snippet to /data/local/userinit.d/chrome_cache_to_ram, creating the directory when it's missing, and then make the script executable (chmod 755 /data/local/userinit.d/chrome_cache_to_ram)
Code:
#! /system/bin/sh
CHROME_CACHE=/data/data/com.android.chrome/cache
[ -d $CHROME_CACHE ] || exit 0
fgrep chrome_cache /proc/mounts >/dev/null && exit 0
set $(stat $CHROME_CACHE | fgrep Uid | tr '(/)' ' ')
mount -t tmpfs -o size=100m,mode=$2,uid=$5,gid=$8 chrome_cache $CHROME_CACHE
You can do the same for gmail, using this script saved and made executable as /data/local/userinit.d/gmail_cache_to_ram :
Code:
#! /system/bin/sh
GMAIL_CACHE=/data/data/com.google.android.gm/cache
[ -d $GMAIL_CACHE ] || exit 0
fgrep gmail_cache /proc/mounts >/dev/null && exit 0
set $(stat $GMAIL_CACHE | fgrep Uid | tr '(/)' ' ')
mount -t tmpfs -o size=50m,mode=$2,uid=$5,gid=$8 gmail_cache $GMAIL_CACHE
Related
So, I've been playing around with QuickSSHd and one thing I noticed is there aren't many tools available in the shell. I put an arm build of Fedora on the phone, and now I have access to strace, gdb, gcc, etc..
I figured I'd post my steps here in case anyone else is interested.
1) First thing I did was root the phone with the Unrevoked app.
2) Then I bought a 16 gb microsd card so I wouldn't have to split the 8gb card that came with the phone
3) I partitioned the new card on my linux box using fdisk. I did two partitions, the first a FAT partition and the second a linux one. It was something like:
# fdisk /dev/sdb
d 1
n
p
1
t
c
n
p
2
w
# /sbin/mkfs.vfat /dev/sdb1
# /sbin/mkfs.ext3 /dev/sdb2
4) One that was done, i mounted the ext3 partition and grabbed this prebuilt fedora chroot tarball:
ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f12.tar.bz2
and untarred it into a directory i called "fedora" on the ext3 partition.
5) I then turned off my phone, pulled out the battery and swapped the existing sdcard with my newly formatted one, put the phone back together and booted it up. It took a long time to boot after this and in the notification panel it said it was "preparing the sdcard"
6) Then i started QuickSSHd back up and ssh'd to the machine as root
7) next i ran "busybox sh" to get a better shell than whatever was started before
8) then I created a shell script called f12.sh that looked like this:
--8<----------
#!/bin/sh
cd $HOME
mkdir -p mnt/fedora
mkdir -p dev
ln -sf /dev/block/vold/179\:2 dev/sdcard2
grep -q dev/sdcard2 /proc/mounts || mount dev/sdcard2 mnt/fedora
grep -q rootfs-f12/dev /proc/mounts || mount --bind /dev mnt/fedora/rootfs-f12/dev
grep -q rootfs-f12/sys /proc/mounts || mount --bind /sys mnt/fedora/rootfs-f12/sys
grep -q rootfs-f12/proc /proc/mounts || mount --bind /proc mnt/fedora/rootfs-f12/proc
grep -q rootfs-f12/tmp /proc/mounts || mount -ttmpfs tmpfs mnt/fedora/rootfs-f12/tmp
mkdir -p mnt/fedora/rootfs-f12/mnt/system
mkdir -p mnt/fedora/rootfs-f12/mnt/data
grep -q rootfs-f12/mnt/system /proc/mounts || mount --bind /system mnt/fedora/rootfs-f12/mnt/system
grep -q rootfs-f12/mnt/data /proc/mounts || mount --bind /system mnt/fedora/rootfs-f12/mnt/data
mkdir -p mnt/fedora/rootfs-f12/debug
grep -q rootfs-f12/debug /proc/mounts || mount -tdebugfs debugfs mnt/fedora/rootfs-f12/debug
export LD_LIBRARY_PATH=`pwd`/mnt/fedora/rootfs-f12/lib:`pwd`/mnt/fedora/rootfs-f12/usr/lib
export HOME=/root
cd mnt/fedora/rootfs-f12
lib/ld-linux.so.3 usr/sbin/chroot . bin/bash --login
------>8---------------------
I used vi for this, you could use cat > f12.sh instead.
One weird part of this is the /dev/block/vold/179\:2 symlink. The busybox version of mount apparently can't grok source devices with colons in them. The symlink is just to rename it to something that mount can understand. I imagine the 179 part varies from system to system.
9) Then i ran sh f12.sh which put me in a fedora chroot.
10) I notice the rpm database is a little screwy in the chroot so I ran
# rm -f /var/lib/rpm/__db*
# rpm --rebuilddb
11) At this point I could yum:
# yum -y install strace gdb screen gcc vim-enhanced powertop
Some useful things:
- The kernel debug filesystem is in /debug
- Parts of the phone OS are available in /mnt/data and /mnt/system
Attached is an updated f12.sh (minor tweaks made as I've noticed issues come up)
wow, this is quite interesting!
i might venture into giving this a try.
two pieces of information, only as an FYI, i make no claim to whether or not these are better than the method you provide, only an alternate method which might or might not be better. perhaps a combination of methods would be best? i'll leave it up to the end user to decide.
1) some of those binaries you mention, like strace are already provided by the userdebug PC36IMG.zip (root part 1) in system/xbin from HTC. if anybody wants these binaries, they can be extracted from the system.img inside of the .zip file using unyaffs. if requested, i can post.
2) android open source project, which contains all the source files for android, provides dropbear has a compact arm compiled ssh client.
thanks for taking the time to test all this out and posting up the detailed step by step along with your .sh file!!!
UPDATE GO HERE: http://forum.xda-developers.com/showthread.php?t=932754
Revised Ubuntu Installation Created By Homefix and RooferDave
I just put this together today, gotta get back to work, the snowstorms over (im from western NY) might be errors will edit and update as time permits
all scripts contain original authors and credits where aplicable.This tutorial will show you how to create a Debian Image, Emulate that image using The Qemu Emulator in Ubuntu.And finally setup that image on your EVO
I cannot be held responsible if your foolish enough to do, what is outlined below!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I will take the time to post the credits soon.
However the scripts speak for themselves and the creators have left there info in them.
Thanks really goes out to them.
Most of this came from here: https://wiki.edubuntu.org/ARM/BuildArmPackages
Things you need:
# I hope you have the EVO (last i heard radio shack may have 1 left. DRIVE CAREFULLY, theres snow everywere).
# Computer BestBuy ? I prefer to build my own (Brite Computers Fishers NY).and a small note, you need ubuntu ruuning do do any of the image creation-manipulation.
I wasnt able to get VBOX to emulate the Image so... UPDATE yes i was able to get it working i was having a router issue.So give VBOX a try http://www.virtualbox.org/wiki/Downloads
you can either try to get it to work with VBOX,(goodluck), or dust off one of your old computers and get Ubuntu up.
But you may have to do what i did, i yanked out the family computer from the living room and fit in my literally 4' x 7' office to get this done.
i dont worry to much, i know they love me for spending the last 2 weeks with my face attached to the monitor.
# Rom: CyanogenMod-6. You could try others. (i tell my daughter who always copies her sister "you are your own nucklehead").(good luck finding these links) http://wiki.cyanogenmod.com/index.php?title=Latest_Version#HTC_Evo_4G
Nightlies here: (i prefer this addiction over others). http://mirror.teamdouche.net/?type=nightly # PLENTY OF PATIENCE
Get your phone ready: http://forum.xda-developers.com/wiki/index.php?title=HTC_Supersonic/Guides_%26_Tutorials#Guides_For_Root
Root: http://forum.xda-developers.com/wik...Supersonic/Guides_&_Tutorials#Guides_For_Root
Setup ADB: http://forum.xda-developers.com/showthread.php?t=694250
Setup Ubuntu http://www.ubuntu.com/desktop/get-ubuntu/download
My 3G Karmic Rootstock Image http://www.megaupload.com/?d=SJY6ZB58
login dad
passwd f
root passwd not set
then go to line 1000
let me know if i have the right one posted.
Setup Rootstock IN THE BEGINING
In your Ubuntu terminal type: "mkdir /<your home directory>/qemuArm"
(dont includ the < >'s or the ""'s) your home directory usually is /home/<your user name>/
then: cd /<your home directory>/qemuArm
then: sudo apt-get install qemu qemu-kvm-extras
then: sudo apt-get install debootstrap (if you dont have it already)
then: sudo apt-get install fakeroot (if you dont have it already)
then: sudo apt-get install bzr (if you dont have it already)
then: (download rootstock bzr branch)
sudo bzr branch lp:roject-rootstock
then: (download kernel to /<your home directory>/qemuArm) just
make sure you dont leave the, /<your home directory>/qemuArm directoryCREATION
then: (create your image)
sudo project-rootstock/rootstock --fqdn ubuntu --login ubuntu --password ubuntu --notarball --imagesize 3G --seed nano
or: custimize your image with the info in the readme file, in the /<your home directory>/qemuArm/project-rootstockfolder(when your image is complete)
then: (make a copy)
cp qemu-armel-<replace with your #>.img <whatever you name it>.img (remove the <>'s)EMULATION
Download the http://ports.ubuntu.com/ubuntu-ports/dists/lucid/main/installer-armel/current/images/versatile/netboot/ to ~/qemuArm
USE THIS WEBPAGE AND FIND THE LINK FOR YOUR KERNEL VERSATILE
https://wiki.edubuntu.org/ARM/BuildArmPackages
Then: (start your emulation) -----> dont forget to remove the <>'s <------
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw"
then: (hopefully you will see a blank screen)
press alt-F1 if you do not see a login prompt go back to the beginingSO LET THER BE LIGHT
then: log in
then: (to change password)
sudo tmppwd ubuntu and to change login name never do "usermod -l newname -m -d /home/newname oldname" pic the right name at creation.
then: sudo tmppwd root (if you want to set root password) THEN THERE WERE TWO
In the Emulated terminal:
(configure network connections)sudo nano /etc/network/interfaces
add: (under existing entries of the file):
auto eth0
iface eth0 inet dhcp then cntrl-X, confirm save, and exit.
then sudo ifconfig eth0 up
then sudo dhclient eth0
then sudo apt-get update (if it aint broke dont fix it) otherwise go back to the beginningBORN AGAIN
On the Host System make sure Qemu is not running.
then: (install some more stuff)
sudo apt-get install bridge-utils
This assumes if you have a basic networking system with eht0 as interface
then: (configure network bridge)
sudo nano /etc/network/interfaces
add: (under existing entries of the file)
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_maxwait 0 then: cntrl-X, confirm save, and exit.
then: sudo ifconfig eth0 0.0.0.0
then: sudo ifup br0
then: (Load the tun module (you can add tun to /etc/modules if you want it to load on boot)
sudo modprobe tun
then: set permissions
sudo chmod 0666 /dev/net/tun
then: (change Qemu Script)
sudo nano /etc/qemu-ifup
add: a "#" symbol to all existing entries except the first line (got it?)
add: (under existing entries of the file):
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
then: set permissions
sudo chmod +x /etc/qemu-ifup
then: start emulation
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw" -net nic -net tapthen: login
then: sudo apt-get install openssh-server
if: that goes well, your home free (we'll discuss errors later)LEARN TO TALK
Now: you can ssh into or scp to your ARM VM from the host.
get ip address to ssh into or scp to, by simply running ifconfig in the ARM terminal.
install your applications
Or just get right to it and see what this is all aboutLEARN TO WALK
Now: we will setup the chroot
Change your imagename to ubuntu.img
Using file manager, Create a folder (on your phone) /sdcard/ubuntu,
and transfer ubuntu.img to your sdcard folder, ubuntu.Copy the following text including the (#) and paste into notepad++ (get it http://notepad-plus-plus.org/download) or in linux gedit or Eqvlnt. Save as sdcard/ubuntu/bootubuntu (no extension)nothing more.#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
AND DO THE SAME FOR THE NEXT 4 FILES AND NAME THEM CORRECTLY AND USE THE RIGHT TEXT EDITOR
This next file is called sdcard/ubuntu/unionfs (remember no file ext.)
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts
This next file is called sdcard/ubuntu/fsrw (remember no file ext.)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"
This next file is called sdcard/ubuntu/mountonly (remember no file ext.)
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email [email protected]
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: [email protected]"
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash
This next file is called sdcard/ubuntu/ubuntu.sh (this one has .sh for file ext)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootubuntu /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/ubuntu
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
After you have,
bootubuntu
fsrw
mountonly
unionfs
ubuntu.sh
ubuntu.img
in your /sdcard/ubuntu folder
Open adb shell
Enter: su
then: cd /sdcard/ubuntu
then: sh ./ubuntu.sh
then: apt-get update
then: apt-get install tightvncserver
then: apt-get install lxde
this is LINE 1000
then: export USER=root
then: vncserver :0 -geometry 1024x800
then: cat > front
then: export USER=root
then: cd /
then: rm -r -f /tmp
then: mkdir /tmp
then: cd /
then: vncserver :0 -geometry 1024x800
then: press "cntrl D", "cntrl D" again, then Enter)
then: cat front /root/.bashrc > temp
then: cp temp /root/.bashrc
then:
Get Android VNC for you phone (market)
open app
enter 5900 for port
enter password you setup for vncserver
enter (for nick) username you picked during creation
enter (for address) localhost
set graphics for 24 bit
Connect
let the fun begin
Next update: How to network with Hamachi
It does work
nice work
Lol im usually all for this stuff but this looks much too frigthening
thetony said:
Lol im usually all for this stuff but this looks much too frigthening
Click to expand...
Click to collapse
Its really easy, download the zip,
put the ubuntu folder on your sdcard go to line 1000 in the tutorial.
Can u make or received call
alphaeagle777 said:
Can u make or received call
Click to expand...
Click to collapse
yes you have full function of your phone
Alright, I'm going to give this a try while I'm at work (shhhh). I'm curious though, why did you use Karmic? Is it possible with Maverick?
ioos said:
Alright, I'm going to give this a try while I'm at work (shhhh). I'm curious though, why did you use Karmic? Is it possible with Maverick?
Click to expand...
Click to collapse
Well? How did it go?
Hemidroids said:
Well? How did it go?
Click to expand...
Click to collapse
yes it works with maverick theres really no differance that i noticed
UPDATE GO HERE:
http://forum.xda-developers.com/showthread.php?p=10972597#post10972597
Revised Ubuntu Installation Created By Homefix and RooferDave
This tutorial will show you how to create a Debian Image, Emulate that image using The Qemu Emulator in Ubuntu.And finally setup that image on your EPIC
I just put this together yesterday, its from my EVO post: http://forum.xda-developers.com/showthread.php?t=881401 .gotta get back to work, the snowstorms over (im from western NY) might be errors will edit and update as time permits
This is made for the epic, but i will try to catch all the changes, i think i got most of em.
Listen up you knuckles, on the evo i can ssh, setup and use samba shares(using hamachi network for connectability), nautilus-shares works, programs dont close, cpu meter works, it truly is like a mini computer in your pocket.
I hope with CyanogenMod i can have the same results because obviosly the epic exceeds the evo because of the keyboard (for this kind of stuff). It sucks to loose half your screen to the input method (with the evo), But i wish the screensize was larger.
For now until there are some kernel changes(hamachi does not work) I have to spend my time playing with that.(Hamachi works in the Evo
However ubuntu seems to run better on the evo
UPDATE cant get Hamachi installed gotta wait for kernel changes -
I guess you can never have the best of both worlds
all scripts contain original authors and credits where aplicable.
I cannot be held responsible if your foolish enough to do, what is outlined below!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
I will take the time to post the credits soon.
However the scripts speak for themselves and the creators have left there info in them.
Thanks really goes out to them.
Most of this came from here: https://wiki.edubuntu.org/ARM/BuildArmPackages
Things you need:
# I hope you have the Epic (last i heard radio shack may have 1 left. DRIVE CAREFULLY, theres snow everywere).
# Computer maybe , BestBuy ? I prefer to build my own (Brite Computers Fishers NY).
and a small note, you need ubuntu ruuning do do any of the image creation-manipulation.
I wasnt able to get VBOX to emulate the Image so...
you can either try to get it to work with VBOX,(goodluck), or dust off one of your old computers and get Ubuntu up.
UPDATE: got VBOX working was router issue. so give it a try.
But you may have to do what i did, i yanked out the family computer from the living room and fit in my literally 4' x 7' office to get this done.
i dont worry to much, i know they love me for spending the last 2 weeks with my face attached to the monitor.
# Rom: CyanogenMod-6. You could try others. (i tell my daughter who always copies her sister "you are your own nucklehead").
http://android.stolenrobot.com/Epic4G/epic.htm
Nightlies here: (i prefer this addiction over others). http://mirror.teamdouche.net/?type=nightly
# PLENTY OF PATIENCE
Get your phone ready: http://forum.xda-developers.com/showthread.php?t=770388
Setup ADB: http://forum.xda-developers.com/showthread.php?t=694250
Setup Ubuntu http://www.ubuntu.com/desktop/get-ubuntu/download
My 3G Prebuilt Image is http://www.megaupload.com/?d=SJY6ZB58
login dad
passwd f
root passwd not set
DO NOT USE THOSE SCRIPTS USE THESE: http://www.megaupload.com/?d=1NLU3XDU
sorry im late, having trouble upload (free account). this is for the evo. let me know if you can create new files on your desktop, if not you will have to wait until i foward the epic image.
Setup Rootstock
IN THE BEGINING
In your Ubuntu terminal type: "mkdir /<your home directory>/qemuArm"
(dont includ the < >'s or the ""'s) your home directory usually is /home/<your user name>/
then: cd /<your home directory>/qemuArm
then: sudo apt-get install qemu qemu-kvm-extras
then: sudo apt-get install debootstrap (if you dont have it already)
then: sudo apt-get install fakeroot (if you dont have it already)
then: sudo apt-get install bzr (if you dont have it already)
then: (download rootstock bzr branch)
sudo bzr branch lproject-rootstock
then: (download kernel to /<your home directory>/qemuArm) just
make sure you dont leave the, /<your home directory>/qemuArm directory
CREATION
then: (create your image)
sudo project-rootstock/rootstock --fqdn ubuntu --login ubuntu --password ubuntu --notarball --imagesize 3G --seed nano
or: custimize your image with the info in the readme file, in the /<your home directory>/qemuArm/project-rootstockfolder
(when your image is complete)
then: (make a copy)
cp qemu-armel-<replace with your #>.img <whatever you name it>.img (remove the <>'s)
EMULATION
1.Download the http://ports.ubuntu.com/ubuntu-port...aller-armel/current/images/versatile/netboot/ to ~/qemuArm
USE THIS WEBPAGE AND FIND THE LINK FOR YOUR KERNEL VERSATILE
https://wiki.edubuntu.org/ARM/BuildArmPackages
Then: (start your emulation) -----> dont forget to remove the <>'s <------
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw"
then: (hopefully you will see a blank screen)
press alt-F1 if you do not see a login prompt go back to the begining
SO LET THER BE LIGHT
then: log in
then: (to change password)
sudo tmppwd ubuntu and to change login name never do "usermod -l newname -m -d /home/newname oldname" pic the right name at creation.
then: sudo tmppwd root (if you want to set root password)
THEN THERE WERE TWO
In the Emulated terminal:
(configure network connections)
sudo nano /etc/network/interfaces
add: (under existing entries of the file):
auto eth0
iface eth0 inet dhcp
then cntrl-X, confirm save, and exit.
then sudo ifconfig eth0 up
then sudo dhclient eth0
then sudo apt-get update (if it aint broke dont fix it) otherwise go back to the beginning
BORN AGAIN
On the Host System make sure Qemu is not running.
then: (install some more stuff)
sudo apt-get install bridge-utils
This assumes if you have a basic networking system with eht0 as interface
then: (configure network bridge)
•sudo nano /etc/network/interfaces
add: (under existing entries of the file)
auto br0
iface br0 inet dhcp
bridge_ports eth0
bridge_maxwait 0
then: cntrl-X, confirm save, and exit.
then: sudo ifconfig eth0 0.0.0.0
then: sudo ifup br0
then: (Load the tun module (you can add tun to /etc/modules if you want it to load on boot)
sudo modprobe tun
then: set permissions
sudo chmod 0666 /dev/net/tun
then: (change Qemu Script)
sudo nano /etc/qemu-ifup
add: a "#" symbol to all existing entries except the first line (got it?)
add: (under existing entries of the file):
echo "Executing /etc/qemu-ifup"
echo "Bringing up $1 for bridged mode..."
sudo /sbin/ifconfig $1 0.0.0.0 promisc up
echo "Adding $1 to br0..."
sudo /usr/sbin/brctl addif br0 $1
sleep 2
then: set permissions
sudo chmod +x /etc/qemu-ifup
then: start emulation
sudo qemu-system-arm -M versatilepb -cpu cortex-a8 -kernel ./vmlinuz -hda <whatever you name it>.img -m 256 -append "root=/dev/sda mem=256M devtmpfs.mount=0 rw" -net nic -net tap
then: login
then: sudo apt-get install openssh-server
if: that goes well, your home free (we'll discuss errors later)
LEARN TO TALK
Now: you can ssh into or scp to your ARM VM from the host.
get ip address to ssh into or scp to, by simply running ifconfig in the ARM terminal.
install your applications
Or just get right to it and see what this is all about
LEARN TO WALK
Now: we will setup the chroot
Change your imagename to ubuntu.img
Using file manager, Create a folder (on your phone) /sdcard/ubuntu,
and transfer ubuntu.img to your sdcard folder, ubuntu.
Copy the following text including the (#) and paste into notepad++
(get it http://notepad-plus-plus.org/download) or in linux gedit or Eqvlnt.
Save as sdcard/ubuntu/bootubuntu (no extension)nothing more.
Hold on HERE: these scripts are for the EVO modify the loop1 entries to loop2 or loop5 and modify mtdblock3 to mtdblock2 if things dont work
(i cant do everything)
#modprobe ext2
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/ubuntu
export bin=/system/bin
if [ ! -d /data/local/ubuntu ]
then
mkdir /data/local/ubuntu
fi
export mnt=/data/local/ubuntu
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
mknod /dev/loop1 b 7 0
losetup /dev/block/loop1 /sdcard/ubuntu/ubuntu.img
mount -t ext2 /dev/block/loop1 /data/local/ubuntu
#mount -o loop,noatime -t ext2 $kit/ubuntu.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
sysctl -w net.ipv4.ip_forward=1
echo "Setting /etc/resolv.conf to Google Open DNS 8.8.8.8 and 8.8.4.4"
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "Setting localhost on /etc/hosts "
echo "127.0.0.1 localhost" > $mnt/etc/hosts
echo "READY TO ROCK AND ROLL BABY! "
echo "Brought to you by NexusOneHacks.net and the open source community! "
echo " "
chroot $mnt /bin/bash
#After exit command is executed clear it all up
echo " "
echo "Shutting down Ubuntu"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
losetup -d /dev/loop1
AND DO THE SAME FOR THE NEXT 4 FILES AND NAME THEM CORRECTLY AND USE THE RIGHT TEXT EDITOR
This next file is called sdcard/ubuntu/unionfs (remember no file ext.)
busybox insmod unionfs
mount -t unionfs -o dirs=$mnt/etc=rw:/etc=ro unionfs /etc
mount -o remount,rw /
ln -s $mnt/lib /
for x in \
bin boot home media mnt \
opt selinux srv usr var
do
ln -s $mnt/$x /
done
rmdir /root
ln -s $mnt/root /
mount -o remount,ro /
mount -t unionfs -o dirs=$mnt/sbin=rw:/sbin=ro unionfs /sbin
mount -t unionfs -o dirs=$mnt/dev=rw:/dev=rw unionfs /dev
mount -t devpts devpts /dev/pts
This next file is called sdcard/ubuntu/fsrw (remember no file ext.)
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
echo "Filesytem remounted as read/write"
This next file is called sdcard/ubuntu/mountonly (remember no file ext.)
# Based on Saurik's remount.sh - modified by Mark Walker of http://www.androidfanatic.com
# Email [email protected]
modprobe ext2
clear
mount -o remount,rw -t yaffs2 /dev/block/mtdblock3 /system
export kit=/sdcard/debian
export bin=/data/local/bin
export mnt=/data/local/mnt
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
busybox insmod ext2
clear
echo " "
mount -o loop,noatime $kit/debian.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
echo "Custom Linux IMG Mounter V1.0 - by Mark Walker"
echo "WEB: http://www.androidfanatic.com"
echo "EML: [email protected]"
sleep 1
echo "AutoMounter started"
sleep 1
echo "REBOOT PHONE TO PROPERLY DISMOUNT"
echo " "
# chroot $mnt /bin/bash
This next file is called sdcard/ubuntu/ubuntu.sh (this one has .sh for file ext)
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
modprobe ext2
clear
rm -f /data/local/bin/fsrw
rm -f /data/local/bin/bootubuntu
rm -f /data/local/bin/unionfs
rm -f /data/local/bin/installer.sh
rm -f /data/local/bin/mountonly
mkdir /data/local/mnt
clear
rm /system/bin/fsrw
rm /system/bin/bootubuntu
rm /system/bin/unionfs
rm -/system/bin/mountonly
cp -f fsrw /system/bin
cp -f bootubuntu /system/bin
cp -f unionfs /system/bin
cp -f mountonly /system/bin
cd /sdcard/ubuntu
chmod 4777 *
cd /system/bin/
chmod 4777 *
cd /
clear
echo " "
echo "Ubuntu Chroot Bootloader v0.1"
echo "Ubuntu Bootloader is now installed!"
echo "This process does NOT damage Android OS!"
echo " "
echo "Original Installer by Charan Singh"
echo "Modified for Ubuntu Chroot by Max Lee at NexusOneHacks.net"
echo " "
echo "To enter the Debian Linux console just type 'bootubuntu'"
bootubuntu
After you have,
bootubuntu
fsrw
mountonly
unionfs
ubuntu.sh
ubuntu.img
in your /sdcard/ubuntu folder
Open adb shell
Enter: su
then: cd /sdcard/ubuntu
then: sh ./ubuntu.sh
then: apt-get update
then: apt-get install tightvncserver
then: apt-get install lxde
then: export USER=root
then: vncserver :0 -geometry 1024x800
then: cat > front
then: export USER=root
then: cd /
then: rm -r -f /tmp
then: mkdir /tmp
then: cd /
then: vncserver :0 -geometry 1024x800
then: press "cntrl D", "cntrl D" again, then Enter)
then: cat front /root/.bashrc > temp
then: cp temp /root/.bashrc
then:
Get Android VNC for you phone (market)
open app
enter 5900 for port
enter password you setup for vncserver
enter (for nick) username you picked during creation
enter (for address) localhost
set graphics for 24 bit
Connect
let the fun begin
Next update: How to network with Hamachi
It does work <-----Havent gotten that far with the epic
Let me buy you a beer or whatever you sip. I just wanted to save someone the headace of setting this up and creating there own image instead of using someone else's.
SEE ya
NICE
A very nice tutorial, TY for the attention to details.
One of the fun things you can do on your Android device, is to play around with different ways of getting a real distro (Debian, Ubuntu etc.) working along side the Android system. There are several (A lot) of tutorials in here on how to do this, so this part will not be covered here. This thread only contains some scripts that will help make it easier working with the chroot.
Most of the scripts that comes with the endless pool of chroot tutorials, is only made to mount and unmount the distro image in the most simple way. But nothing that helps walking in and out of the chroot without mount/unmount, and nothing that takes different services, busy devices etc. into consideration.
The debian.sh script in this thread has many tasks. It will on execution check to see if the image is mounted or not. If the image is mounted, it will just enter the chroot. If not, it will mount the image and then enter the chroot. On exit it will provide you with the option of exiting the chroot or exit and unmount.
Also it provides 4 custom scripts that is placed and executed inside the chroot. One for mount, unmount, enter chroot, leave chroot. This makes it possible to control chroot services much easier.
The script debian.sh is executed using the command "debian". You can also unmount the chroot from within the android shell by executing "debian unmount" instead of entering the chroot and then exit choosing to unmount.
The unmount process has several and different unmount attempts in case of busy devices, running services etc. which will make sure that the chroot is successfully unmounted.
File: /system/bin/debian
Code:
#!/system/bin/sh
su -c "/system/bin/debian.sh [email protected]"
File: /system/bin/debian.sh
Code:
#!/system/bin/sh
createLinuxBoot() {
if [ ! -f $FILESYSTEM ]; then
echo "Missing the $DIST filesystem image!"
return 0
elif [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If the loop device is already mounted, we do nothing.
echo " - $DIST is already mounted. Entering chroot..."
else
echo " - Executing mount proccess of $DIST..."
if [ ! -d $MOUNTPOINT ]; then
# Create the mount point if it does not already exist
busybox mkdir -p $MOUNTPOINT 2> /dev/null
if [ ! -d $MOUNTPOINT ]; then
echo "It was not possible to create the missing mount location ($MOUNTPOINT)!"
return 0
fi
fi
# Android places loop devices in /dev/block/ instead of root /dev/
# If there are none in /dev/ we create links between /dev/loopX and /dev/block/loopX so that losetup will work as it should.
if [ ! -e /dev/loop0 ]; then
for i in 0 1 2 3 4 5 6 7
do
# Create each block device
mknod /dev/loop$i b 7 $i
done
fi
# Android also placed the frame buffer in /dev/grapichs instead of /dev
if [ ! -e /dev/fb0 ]; then
mknod /dev/fb0 b 29 0
fi
# Locate the current loop device file
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# If the filesystem file is already attached to an loop device, we get the path to the device file.
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
else
# If the filesystem file is not yet attached, we attach it.
loblk=$(losetup -f)
losetup $loblk $FILESYSTEM 2> /dev/null
# Make sure that the device was successfully attached to a loop device file
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "It was not possible to attach the $DIST filesystem to a loop device!"
return 0
fi
fi
# Mount the filesystem
mount $loblk $MOUNTPOINT 2> /dev/null
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Bind some Android dirs to the linux filesystem
for i in $MOUNT_BIND
do
# Bind the dirs if they are not already binded
if [ -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
# Create any missing dirs in the mountpoint
if [ ! -d $MOUNTPOINT/$i ]; then
busybox mkdir -p $MOUNTPOINT/$i 2> /dev/zero
fi
mount --bind /$i $MOUNTPOINT/$i
fi
done
# FIX the "stdin: is not a tty" error in direct hadware case.
if [ -z "$(mount | grep "$MOUNTPOINT/dev/pts ")" ]; then
mount -t devpts devpts $MOUNTPOINT/dev/pts
fi
# For the network.
#sysctl -w net.ipv4.ip_forward=1
echo 1 > /proc/sys/net/ipv4/ip_forward
# Cleanup tmp folder.
rm -rf $MOUNTPOINT/tmp/*
else
echo "It was not possible to mount $DIST at the specified location ($MOUNTPOINT)!"
return 0
fi
if [ -f $MOUNTPOINT/etc/init.chroot/rc_mount.sh ]; then
# Execute the mount init file, if it exists
chroot $MOUNTPOINT /etc/init.chroot/rc_mount.sh
fi
echo " - $DIST was successsfully mounted. Entering chroot..."
fi
return 1
}
removeLinuxBoot() {
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# If linux is not mounted, then do nothing.
echo " - $DIST is already unmounted. Exiting..."
else
echo " - Executing unmount process of $DIST..."
if [ -f $MOUNTPOINT/etc/init.chroot/rc_unmount.sh ]; then
# Execute the unmount init script, if it exist.
chroot $MOUNTPOINT /etc/init.chroot/rc_unmount.sh
fi
sync
# The sleep part is very important. It may take some time before /dev is no longer busy
# after executing some services in the rc_unmount.sh script.
sleep 1
# Make sure that we have an loop device file to use
if [ ! -z "$(losetup | grep "$FILESYSTEM")" ]; then
# Get the loop device file
loblk=$(losetup | grep "$FILESYSTEM" | cut -d ":" -f 1)
for i in $UMOUNT_BIND
do
# Unmount all binding dirs
if [ ! -z "$(mount | grep "$MOUNTPOINT/$i ")" ]; then
umount $MOUNTPOINT/$i 2> /dev/zero
fi
done
sync
# Unmount the device
# In most cases one umount attempt will be enough.
# However it may take up to 3 tries in order to make it work.
# It depends on the types of services running or has been running before unmounting.
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
sync
umount $MOUNTPOINT 2> /dev/null && sleep 1 2> /dev/zero
fi
# If the device could not be unmounted
if [ ! -z "$(mount | grep "$MOUNTPOINT ")" ]; then
echo " - Unable to unmount $DIST. Will attempt to kill attached processes..."
# Try to kill all processes holding the device
fuser -k -9 $loblk
sync
# Use umount with the -l option to take care of the rest
umount -l $MOUNTPOINT 2> /dev/null && sleep 1
fi
# Make sure the device has been successfully unmounted
if [ -z "$(mount | grep "$MOUNTPOINT ")" ]; then
# Try to detach the device from the loop device file
losetup -d $loblk 2> /dev/null
# Make sure that the device was successfully detached
if [ -z "$(losetup | grep "$FILESYSTEM")" ]; then
echo "$DIST has been successfully unmounted!"
else
echo "$DIST has been successfully unmounted, but was not able not detach the loop device!"
fi
else
echo "$DIST could not be successfully unmounted!"
fi
else
echo "Could not locate the loop device. $DIST was not unmounted!"
fi
fi
}
if [ -z "$EXPORTED" ]; then
export EXPORTED="TRUE"
# Basic needed variables
export TERM=linux
export HOME=/root
export USER=root
export LOGNAME=root
export UID=0
export SHELL=bash
# Here you can add all of the paths that should be binded. One list for mount and one reversed list for unmount.
export MOUNT_BIND="dev dev/pts dev/cpuctl proc sys sys/kernel/debug system d vendor acct sdcard cache sd-ext data"
export UMOUNT_BIND="dev/cpuctl dev/pts dev proc sys/kernel/debug d sys vendor acct sdcard cache sd-ext system data"
# Here you can change mount and image paths
export DIST="Debian" # The name of the distro. Is used for the messages.
export FILESYSTEM=/mnt/sdcard/debian.img # Path to the distro image file
export MOUNTPOINT=/data/debian # Path where the distro is to be mounted
fi
export OLDPATH=$PATH
export PATH=/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin:/bin:/root/bin:$PATH
if [ "$1" = "unmount" ]; then
removeLinuxBoot
else
createLinuxBoot
if [ $? -eq 1 ]; then
if [ -f $MOUNTPOINT/etc/init.chroot/rc_enter.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_enter.sh
fi
chroot $MOUNTPOINT /bin/bash -i
if [ -f $MOUNTPOINT/etc/init.chroot/rc_leave.sh ]; then
chroot $MOUNTPOINT /etc/init.chroot/rc_leave.sh
fi
echo -n " - Type [Y] to unmount $DIST or random key to exit chroot ]# "
read ACTION
if [ "$ACTION" = "y" ] || [ "$ACTION" = "Y" ]; then
removeLinuxBoot
fi
fi
fi
# Restore the PATH variable when executing chroot
export PATH=$OLDPATH
By default debian.sh will look for /mnt/sdcard/debian.img and mount it at /data/debian
The script has build-in first-time-install functionality that will create missing directories etc. Just change the variable "FILESYSTEM" in debian.sh to the correct path and filename of your distro image, and it will handle the rest.
Chroot Init Scripts
Inside your chroot, you can create the directory /etc/init.chroot and create the fallowing files.
rc_mount.sh - Executed after mount
rc_unmount.sh - Executed before unmount
rc_enter.sh - Executed when entering chroot
rc_leave.sh - Executed when leaving chroot
Here are an example of a mount and unmount script used to control tightvncserver.
File: (chroot) /etc/init.chroot/rc_mount.sh
Code:
#!/bin/sh
# Make sure that the vncserver is completly stopped before starting.
if [ ! -f /tmp/.X11-unix/X1 ] && [ ! -f /tmp/.X1-lock ]; then
# Start vncserver
vncserver -geometry 800x480 :1
else
# This is in case something went wrong the last time
# it was shut down. Perhaps an uncomplete unmount.
vncserver -kill :1 2> /dev/zero
unset /tmp/.X11-unix/X1 2> /dev/zero 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero 2> /dev/zero
vncserver -geometry 800x480 :1
fi
File: (chroot) /etc/init.chroot/rc_unmount.sh
Code:
#!/bin/sh
# Only stop this if it is started
if [ -f /tmp/.X11-unix/X1 ] || [ -f /tmp/.X1-lock ]; then
vncserver -kill :1
# Make sure that these are removed
unset /tmp/.X11-unix/X1 2> /dev/zero
unset /tmp/.X1-lock 2> /dev/zero
fi
Using these scripts, the VNC Server is started on chroot mount and stopped on chroot unmount. You can still leave and enter the chroot keeping the VNC Server running.
Greetings.
Ive used following script , HTC jetsteam rooted unlocked bootloader.
Code:
if [ "$perm" != "0" ];then echo "This Script Needs Root! Type : su";exit;fi
mount -o remount,rw /dev/block/mmcblk0p5 /system
export kit=/sdcard/bt
export bin=/system/bin
export mnt=/data/local/mnt
mkdir -p $mnt
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root
if [ -b /dev/loop2 ]; then
echo "Loop device exists"
else
busybox mknod /dev/loop2 b 7 0
fi
mount -o loop,noatime -t ext2 $kit/bt5.img $mnt
mount -t devpts devpts $mnt/dev/pts
mount -t proc proc $mnt/proc
mount -t sysfs sysfs $mnt/sys
busybox sysctl -w net.ipv4.ip_forward=1
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
echo "127.0.0.1 localhost bt5" > $mnt/etc/hosts
busybox chroot $mnt /bin/bash
echo "Shutting down BackTrack ARM For Xoom"
umount $mnt/dev/pts
umount $mnt/proc
umount $mnt/sys
umount $mnt
but keep getting error message .
can't execute /bin/bash no such file or directory.
Hope to hear from you guys.
Regards
Net_Spy
May be u might not have busybox installed after rooting ur phone
Hit thanks rather than typing it
Well I do have busybox installed in my device.
Regards
Net_Spy