[Tutorial] Ubuntu on Epic ? Not Again! no wait, this is different

Homefix

Senior Member
Jan 30, 2010
122
32
0




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 lp:project-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
 
Last edited:
  • Like
Reactions: Uthman