[CHROOT] with Debian, much easier than Arch from eariler post - RAZR i Android Development

Building a "chroot" is very easy in Debian. According to http://wiki.debian.org/chroot, you just need following steps.
Code:
sudo apt-get install debootstrap
mkdir chroot
sudo debootstrap --arch i386 wheezy chroot
copy all the contents in "chroot" to the prepared sd partation, say the partation is "/dev/block/mmcblk1p2" and the mount point is "/mnt/debian".
run
Code:
busybox chroot /mnt/debian /bin/bash
to enter debian enviroment. In fact, to make the chroot environment more useable, you must add some mount point to the new root, read attached script for more. Thanks @Robbilie for his original work.
If you want to use a normal user under chroot enviroment, you must add the user to a specific group to use the network hardware. Its hard coded in android kernel.
Code:
# groupadd -g 3003 aid_inet
# usermod -G aid_inet new_user

Ehh. How will you install debootstrap with apt-get when that package manager isent available for our phone? :silly:

totex71 said:
Ehh. How will you install debootstrap with apt-get when that package manager isent available for our phone? :silly:
Click to expand...
Click to collapse
The procedure before copying files to sdcard is done in a PC with Debian installed. So you can prepare the root file system in PC, and copy file to the sd card using an USB adapter.

Related

[MOD] Full Linux (Debian) inside WebTop! v0.2.7 [2012/01/18] [11.30 GMT+2:00]

[size=+4]Take back WebTop![/size]​
Use anythings you can imagine! LibreOffice, Java, Firefox 4, ecc...
[size=+2]WHAT THIS MOD DOES:[/size]
Installing WebTopMOD your awm dock will be populated with 3 new icons: leafpad, lxterminal and a penguin.
Leafpad and lxterminal works inside WebTop but clicking on the penguin you get a Debian menu chrooted http://en.wikipedia.org/wiki/Chroot in a Debian enviroment. In xterm you can use synaptic and apt-get to install anything in this new enviroment.
For example I need gimp:
Code:
# apt-get update //refresh packages list from internet
# apt-get install gimp
# gimp //
Clicking another time on the penguin open another xterm IN THE SAME ENVIROMENT so I can start another program
Code:
# oo-writer //openoffice writer
NOTE: Debian disk contain a Debian stable (squeeze) release, some software could be "outdated", if you would live on the edge change stable to unstable in /etc/apt/sources.list IN CHROOT ENVIRONMENT. DO NOT TRY TO CHANGE REPOSITORY IN ORIGINAL WEBTOP ROOT
Look here (http://www.debian.org/releases/) to understand what differ between Debian branches
For example LibreOffice is not yet in stable branch, so you can install OpenOffice or switch repo to testing or unstable
Firefox is renamed Iceweasel and the latest version in unstable is 3.5 and from experimental 4.0.
REMEMBER THAT 0.x VERSION MEAN THAT THIS SOFTWARE CAN BE BUGGED AND I CONSIDER IT IN ALPHA TESTING
[size=+2]PREREQUISITES:[/size]
- A rooted Atrix
- At least 2GB free in internal memory (could be more or less with the customized installation)
- A little bit terminal knowledge and willpower
- Brain
- Liquorice mojito
[size=+2]INSTALLATION:[/size]
[size=+1][1st way - EASY METHOD][/size]
Prerequisite for this method is:
On your phone: CWM installed
0) Download Debian disk - http://droid.makrit.net/WebTopMOD/WebTopMOD-20110707.7z
1) Unpack in your internal or external storage (path should be /sdcard(-ext)/WebTopMOD/linuxdisk)
Please don't use "adb push" it corrupt big files
2) Download easy-signed.zip - http://www.multiupload.com/C5GEIHDEM0, MIRROR
3) Install using CWM, reboot and enter in WebTop!
Uninstaller for version >=0.2.7 http://www.multiupload.com/18H5OHND90, MIRROR
Uninstaller for version <= 0.2.2 http://www.multiupload.com/W37DT6HJ7X
Uninstaller for version 0.2.1 http://www.multiupload.com/TO6W9X7CBU
Uninstaller for version >= 0.2 http://www.multiupload.com/GLKUZA2KP9
[size=+1][2nd way - CUSTOM METHOD][/size]
Temporary deprecated
Code:
Prerequisite for this method is:
On your computer: have a Debian installation or a Debian live cd or download this file ([url]http://www.multiupload.com/403F0OQEDA[/url] -> 2GB disk in 66MB), unpack it and skip to step 8
On your phone: install a "complete" busybox thought any free market apps and be connected to internet with a wireless network.
[b][On your phone][/b]
0) Start WebTop and leave it opened
[b][On your computer][/b]
1) Create a file with the dimensions that fit your needs using dd (I used this command to create the 2GB file: dd bs=1024 count=1 seek=$((1024*1024*2-1)) if=/dev/zero of=debian)
2) Format the new "disk" using ext3 (mkfs.ext3 debian)
3) Create a folder to mount the disk (mkdir temp)
4) Mount the disk (sudo mount -t ext3 -o loop debian temp)
5) Debootstrap! (sudo debootstrap --foreign --arch armel stable temp [url]http://ftp.debian.org/debian[/url])
6) Wait...
7) Unmount disk (sudo umount temp) and remove temp directory (rmdir temp)
8) Copy debian in your internal storage inside a folder called "DEBIAN" (uppercase without quotes)
[b][On your computer if you are using adb (recommended) or on your phone using terminal emulator, connectbot, ecc)][/b]
9) Open a terminal and type:
Get superuser permissions
[code]
# su
edit sudoers
Code:
# vi /etc/sudoers
You should add "%admin ALL=NOPASSWD: ALL" after the line containing "%admin ALL=(ALL) ALL". You can try typing this:
Please note that if you are using a terminal emulator on your phone escape is bad interpreted by Android using a physical keyboard, you have to send the escape key in another way.
Code:
GkyyPjwwwld3wi
NOPASSWD: [with a space]
[Escape]
:wq!
Now we enter in a more complete and privileged bash
Code:
# /usr/bin/sudo -H -u adas bash
Enable AWM to launch anything
Search→Go To… line 1317
Take this line:
use_profile 3
and turn it into:
use_profile 2
Code:
sudo leafpad /etc/tomoyo/domain_policy.conf
Now you can add any launcher to your AWM, look in easy-signed.zip (/usr/share/applications and /home/michele/easy/home/adas/.gconf/apps/avant-window-navigator)
Mount debian disk:
Code:
# cd /sdcard/DEBIAN
# mkdir root
# sudo mount -t ext3 -o loop=/dev/block/loop7 debian root
Debootstrap! (second stage)
Code:
# sudo chroot root /debootstrap/debootstrap --second-stage
Disable X ACL (in WebTop)
Code:
# export DISPLAY=:0
# xhost +
Enter in the new system
Code:
# sudo cp /etc/hosts /sdcard/DEBIAN/root/etc/hosts
# sudo cp /etc/fstab /sdcard/DEBIAN/root/etc/fstab
# sudo cp /etc/resolv.conf /sdcard/DEBIAN/root/etc/resolv.conf
# sudo mount -o bind /proc /sdcard/DEBIAN/root/proc
# sudo mount -o bind /dev /sdcard/DEBIAN/root/dev
# sudo mount -o bind /dev/pts /sdcard/DEBIAN/root/dev/pts
# sudo mount -o bind /dev/shm /sdcard/DEBIAN/root/dev/shm
# sudo mount -o bind /sys /sdcard/DEBIAN/root/sys
# sudo mount -o bind /var/run/dbus/ /sdcard/DEBIAN/root/var/run/dbus/
# sudo chroot /sdcard/DEBIAN/root /bin/bash
Export X display (in chroot)
Code:
# export DISPLAY=:0
Add Debian main repository
Code:
# echo "deb http://ftp.debian.org/debian/ stable main non-free contrib" > /etc/apt/sources.list
Finish debian installation
Code:
# apt-get update ; apt-get install dbus dialog locales
Configure your locale
Code:
# dpkg-reconfigure locales
Install xterm
Code:
# apt-get install xterm
Run xterm!
Code:
# xterm
Now you can install anything simply using "apt-get install PROGRAM_NAME" or installing synaptic
Before unplug HDMI cable you should exit form chroot environment and unmount the chroot:
Code:
# exit
# sudo umount /sdcard/DEBIAN/root/proc
# sudo umount /sdcard/DEBIAN/root/dev
# sudo umount /sdcard/DEBIAN/root/dev/pts
# sudo umount /sdcard/DEBIAN/root/dev/shm
# sudo umount /sdcard/DEBIAN/root/sys
# sudo umount /sdcard/DEBIAN/root/var/run/dbus
# sudo umount /sdcard/DEBIAN/root
[size=+2]USE:[/size] (ONLY FOR CUSTOM METHOD)
[On your computer if you are using adb or on your phone using terminal emulator, connectbot, ecc)]
9) Open a terminal and type:
Get superuser permissions
Code:
# su
Now we enter in a more complete and privileged bash
Code:
# /usr/bin/sudo -H -u adas bash
Mount debian disk:
Code:
# cd /sdcard/DEBIAN
# sudo mount -t ext3 -o loop=/dev/block/loop7 debian root
Disable X ACL (in WebTop)
Code:
# export DISPLAY=:0
# xhost +
Enter in the new system
Code:
# sudo cp /etc/hosts /sdcard/DEBIAN/root/etc/hosts
# sudo cp /etc/fstab /sdcard/DEBIAN/root/etc/fstab
# sudo cp /etc/resolv.conf /sdcard/DEBIAN/root/etc/resolv.conf
# sudo mount -o bind /proc /sdcard/DEBIAN/root/proc
# sudo mount -o bind /dev /sdcard/DEBIAN/root/dev
# sudo mount -o bind /dev/pts /sdcard/DEBIAN/root/dev/pts
# sudo mount -o bind /dev/shm /sdcard/DEBIAN/root/dev/shm
# sudo mount -o bind /sys /sdcard/DEBIAN/root/sys
# sudo chroot /sdcard/DEBIAN/root /bin/bash
Export X display (in chroot)
Code:
# export DISPLAY=:0
Run xterm!
Code:
# xterm
Before unplug HDMI cable you should exit form chroot environment and unmount the chroot:
Code:
# exit
# sudo umount /sdcard/DEBIAN/root/proc
# sudo umount /sdcard/DEBIAN/root/dev
# sudo umount /sdcard/DEBIAN/root/dev/pts
# sudo umount /sdcard/DEBIAN/root/dev/shm
# sudo umount /sdcard/DEBIAN/root/sys
# sudo umount /sdcard/DEBIAN/root
[/code]
[size=+2]THANKS TO:[/size]
Sogarth - for http://forum.xda-developers.com/showthread.php?t=983208
kennethpenn - for motoblur remove tool! many many thanks!
Chainfire - for Gingerbreak
makr8100 - for http://droid.makrit.net/ mirror
and many other users that works actively to hack this phone!
[size=+2]NOTE:[/size]
- exporting library you can start a lot of programs without starting chroot (obviously mounting the loop device), for example you can use xterm inside WebTop launching
Code:
# LD_LIBRARY_PATH=.:/sdcard/DEBIAN/root/usr/lib /sdcard/DEBIAN/root/usr/bin/xterm
- you can use sd-card replacing /sdcard/DEBIAN to /sdcard-ext/DEBIAN
If you would like to support my work click the this droid
[size=+2]MANY THANKS FOR CONTRIBUTOR:[/size]
Francisco Bravo
Robert Johnson
[size=+2]CHANGELOG:[/size]
v0.2.7 [2012/01/18] [11.30 GMT+2:00]
easy-signed: http://www.multiupload.com/C5GEIHDEM0
uninstaller: http://www.multiupload.com/18H5OHND90
EASY:
- Disabled Tomoyo (no more firefox issues between different webtop versions)
- New uninstaller
v0.2.6 [2011/07/07] [14.15 GMT+2:00]
Debian disk: http://droid.makrit.net/WebTopMOD/WebTopMOD-20110707.7z
easy-signed: http://droid.makrit.net/software/atrix/easy_v0.2.6.zip-signed.zip
EASY:
- binded in chroot tmp folders
- correct typo in missing disk message
- changed umount function (should works fine now!)
- added linuxdisk check (0 size, is a file)
- 2.3.4 compatibility
- cleaned mount function
LINUXDISK:
- added pdmenu and menu
- added device etc mountpoint in /mnt/DEVICE/etc
- dynamic change of resolv.conf (thanks to krkeegan)
- linuxdisk now is ~4gb (4095MB)
- added device etc mountpoint in /mnt/DEVICE/usr
- added plugins folder symlink to use flash player or other plugins between browser (inside and outside chroot) (FLASH DOESN'T WORK YET)
v0.2.5.1b [2011/07/07] [10.15 GMT+2:00]
Debian disk: unmodified
easy-signed: http://www.multiupload.com/ZAPZW2XX45
EASY:
- removed firmware check
- using a newer version of update-binary
v0.2.5 [2011/05/27] [9.30 GMT+2:00]
Debian disk: unmodified
easy-signed: http://www.multiupload.com/F68D73KF26
EASY:
- fixed unmount function
- removed motorola links
- fixed leafpad icon
v0.2.4 [2011/05/26] [20.30 GMT+2:00]
Debian disk: unmodified
easy-signed: http://www.multiupload.com/VI4JEFWLI6
EASY:
- corrected calls to loopdevice function (thanks Cryofix)
- check awm folders existence and fully reset permissions
- set different permissions to linux script, xmessage, lxterminal and WebTopMOD folder
v0.2.3 [2011/05/26] [15.45 GMT+2:00]
Debian disk: unmodified
easy-signed: http://www.multiupload.com/2JAO6F42Z4
EASY:
- corrected typo (remember..) in installation
- make new loop device (avoid conflict)
- renfoced unmount function
- fix permission for linux.desktop (awm launcher)
v0.2.2 [2011/05/25] [22.00 GMT+2:00]
Debian disk: http://www.multiupload.com/DVF6BJGJR3
easy-signed: http://www.multiupload.com/NKSFL81ODW
EASY:
- removed /mnt/androidroot (doesn't work)
- added /mnt/sdcard and /mnt/sdcard-ext
- code clean
- corrected lxterm policy
- replaced backup script
- corrected sudoers replace
- replaced debian with a more generic linux notation
- added check disk existence
- disk can be in sdcard or sdcard-ext
CUSTOM:
- Temporary deprecated (I've no time to update it today)
v0.2.1 [2011/05/25] [10.30]
DebianEnabler: http://www.multiupload.com/F8TMHY8VQA
Images: 2gb: http://www.multiupload.com/A1B6LG9YYF
easy-signed.zip: http://www.multiupload.com/HPA820KCKR
EASY:
- replaced xterm with native lxterminal
- introduced backup original files
- added uninstaller for version >= 0.2 http://www.multiupload.com/GLKUZA2KP9
- added uninstaller for version <= 0.2.1 http://www.multiupload.com/TO6W9X7CBU
v0.2 [2011/05/24] [17.30]
EASY:
DebianEnabler: http://www.multiupload.com/F8TMHY8VQA
Images: 2gb: http://www.multiupload.com/A1B6LG9YYF
easy-signed.zip: http://www.multiupload.com/NHJGJD7E3E
- easy method!
- symbolic link in /mnt/androidroot to real root
- added image already configured with dbus, locales and dialog
- added launcher for debian chroot and xterm in awm
CUSTOM:
- added instruction to make custom launcher in awm
- added instruction to configure locales, dbus and dialog
- corrected chroot adding /var/run/dbus
v0.1 [2011/05/24]
- initial release
Pro. This looks like the real deal (no compromises). I will be waiting for the noob version though
Sent from my MB860 using XDA Premium App
What versions does this work with? 1.8.3, 1.5.7, 1.2.6 ?
XxKILLx3RxX said:
What versions does this work with? 1.8.3, 1.5.7, 1.2.6 ?
Click to expand...
Click to collapse
I used an ATT Atrix with 1.8.3 firmware.
However this guide should be applicable to any atrix (att, bell, ecc) with any firmware...
Can i use ubuntu as the debian system on the pc to do the image, secondly how do i make a 4 or even 6 gb image, thirdly is this similar to the chroot modes?
crnkoj said:
Can i use ubuntu as the debian system on the pc to do the image, secondly how do i make a 4 or even 6 gb image, thirdly is this similar to the chroot modes?
Click to expand...
Click to collapse
6gb:
Code:
dd bs=1024 count=1 seek=$((1024*1024*6-1)) if=/dev/zero of=debian
5gb:
Code:
dd bs=1024 count=1 seek=$((1024*1024*5-1)) if=/dev/zero of=debian
4gb:
Code:
dd bs=1024 count=1 seek=$((1024*1024*4-1)) if=/dev/zero of=debian
3gb:
Code:
dd bs=1024 count=1 seek=$((1024*1024*3-1)) if=/dev/zero of=debian
1gb:
Code:
dd bs=1024 count=1 seek=$((1024*1024*1-1)) if=/dev/zero of=debian
debootstrap from ubuntu
Code:
sudo apt-get install debootstrap
sudo debootstrap --foreign --arch armel squeeze temp http://ftp.debian.org/debian
Thanks man, ill go and try it out within the next few hours. Btw i already have lxterminal working in the webtop, can i use that instead of adb/ terminal emulator to enter those commands?
crnkoj said:
Thanks man, ill go and try it out within the next few hours. Btw i already have lxterminal working in the webtop, can i use that instead of adb/ terminal emulator to enter those commands?
Click to expand...
Click to collapse
Sure! I assumed that on 1.8.3 terminal is not available...
SystemR89 said:
Sure! I assumed that on 1.8.3 terminal is not available...
Click to expand...
Click to collapse
ye thats true, i copied it over from an old /osh dump and it seems to work fine, if you want/need it i can send it to you (only the lxterminal or the whole /osh dump) just started the procedures to get it on.
SystemR89 said:
6gb:
Code:
dd if=/dev/zero of=/data/6GB.swap bs=1024 count=6144000
4gb:
Code:
dd if=/dev/zero of=/data/6GB.swap bs=1024 count=4096000
debootstrap from ubuntu
Code:
sudo apt-get install debootstrap
sudo debootstrap --foreign --arch armel squeeze temp http://ftp.debian.org/debian
Click to expand...
Click to collapse
those commands returned the error:
dd: opening '/data/6GB/swap': No such file or directory
hmm in your first post the one for dding a 2gb file is different as these two.
AWESOME!!
You beat me to it!! I just ordered a Atrix and it's enroute to me over here in Japan... I was thinking I would try to build Gentoo on the webtop somehow.
I have experience there doing the whole bootstrapping thing, but then it hit me-- "How will I compile the programs?" since everything gets made from source and not from RPMs or DEBs in that distro.
Now I am totally chomping at the bit for my Atrix to get here; I am going to experiment using it as my ONLY computer at work, and out and about. I tend to use cloud-based apps even when creating content (I'm a teacher/photographer/web developer) and I feel uneasy about taking my loaded-to-the-gills Macbook on crowded Tokyo trains with me everyday.
Now with your find, I can still manage to do some light graphics work at times in GIMP too maybe?
crnkoj said:
those commands returned the error:
dd: opening '/data/6GB/swap': No such file or directory
hmm in your first post the one for dding a 2gb file is different as these two.
Click to expand...
Click to collapse
ops.. you are right.. corrected!
starrwulfe said:
Now with your find, I can still manage to do some light graphics work at times in GIMP too maybe?
Click to expand...
Click to collapse
I've not tried gimp, but it should works, we have 1gB of ram!
I was thinking how great gentoo would be too. kholk said once he manages to get kexec and a custom kernel to work he will start work for on gentoo to replace the webtop, that ought to be awesome than
Cannot wait to give this a shot! I just need to order a blue tooth mouse and keyboard.
SystemR89 said:
ops.. you are right.. corrected!
Click to expand...
Click to collapse
ya thought so to just change to debian, btw why do you say if in ubuntu you use the squeeze tag and if just debian you use the stable tag when doing the debootstrap?
crnkoj said:
ya thought so to just change to debian, btw why do you say if in ubuntu you use the squeeze tag and if just debian you use the stable tag when doing the debootstrap?
Click to expand...
Click to collapse
I'm not sure that stable tag works with ubuntu..
Wow amazing I will try when I can, will be funny or nice if we can connect the display to a chinese tablet xD so we can get a portable display xD
.......................................................
Sent from my loved atrix ;D
update.zip, multiple size disk and terminal-less installation and usage will be ready in the next hours!
Stay tuned!

[GUIDE] Build Debian image to run on Tab via chroot

I've been experimenting and gathering information all day on how to build a Debian image to run on the Tab (and any other ARM Android devices, for that matter). I've found all the stuff on how to use the Ubuntu images posted, but I really wanted to know how to build a minimal system that I could have complete control over. (I used the latest version of Debian available, Squeeze, when building this, so anything that references "Squeeze" in the commands is because of that. You can easily substitute in a more generic name for files.)
I am going to break this down into a few sections.
Requirements:
Debian or Ubuntu machine (I used a VM with Ubuntu 11.04 installed on it)
Rooted Tab with BusyBox installed
Create the Image:
On the Linux machine you will need to install debootstrap
Code:
sudo apt-get install debootstrap
Create a blank image, format it and then mount it
Code:
dd if=/dev/zero of=squeeze.img bs=1M count=512
mkfs.ext4 -F squeeze.img
sudo mkdir /mnt/squeeze/
sudo mount -t ext4 -o loop squeeze.img /mnt/squeeze/
Note: The image file above is for 512MB, change it to "count=1024" for 1GB, I tried 512MB and it was very limited in space once X was installed.
Run debootstrap and install the system into the image
Code:
sudo debootstrap --verbose --arch armel --foreign squeeze /mnt/squeeze/ http://ftp.debian.org/debian
Unmount the image
Code:
sudo umount /mnt/squeeze/
Install the Image
Create a folder on the Tab, I used /sdcard/debian/ as my storage for my Debian files. Copy your newly created image over into the folder.
Installation will involve the following:
Creating a mount point and mounting the image
Chrooting into the Debian system
Setting some variables
Running the debootstrap installation
Either in a terminal on the device or using adb, do the following to install the system. (The code is commented to better explain how things are working.)
Code:
# Gain root access
su
# Create a mount point and mount the image file into it
# You can substitute any folder instead /data/local/debian/
mkdir /data/local/debian/
mount -o loop,noatime -t ext4 /sdcard/debian/squeeze.img /data/local/debian/
# Chroot into the Debian system
chroot /data/local/debian/ /bin/sh
# Set some required variables
export PATH=$bin:/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/
export USER=root
# Set the shell prompt just in case it got overwritten by something else
export PS1='[email protected]$HOSTNAME:${PWD-?} # '
# Run debootstrap
sh /debootstrap/debootstrap --second-stage
# Start a bash shell
/bin/bash
DO NOT EXIT THE SHELL BEFORE MOVING ON TO THE NEXT SECTION
First Boot
Technically the system is running, but if you start to use it you will quickly notice some things just aren't right. There are a few things that I've found that I've needed to do in order to get things running right. You should only need to do these the first time the system is run.
In the Debian shell that is still running on the Tab, do the following
Code:
# This is for working DNS
echo "nameserver 8.8.8.8" > /data/local/debian/etc/resolv.conf
echo "nameserver 8.8.4.4" >> /data/local/debian/etc/resolv.conf
echo "127.0.0.1 localhost" > /data/local/debian/etc/hosts
# Needed to install packages from the repository
echo "deb http://ftp.debian.org/debian/ squeeze main contrib non-free" > /etc/apt/sources.list
echo "deb-src http://ftp.debian.org/debian/ squeeze main contrib non-free" > /etc/apt/sources.list
# Do the initial update of the package repository
apt-get update
Once that is complete return to the Android system by running the exit command
Code:
exit
So that's a fully running system right there. But we haven't addressed starting and shutting down the system.
Here is what a simple boot script would look like to both run and stop the system:
Code:
clear
echo "Mounting Debian Squeeze..."
mount -t ext4 -o loop squeeze.img /mnt/squeeze/
echo "Setting environmental variables..."
export PATH=$bin:/usr/bin:/usr/sbin:/bin:/sbin:$PATH
export TERM=linux
export HOME=/
export USER=root
export PS1='[email protected]:${PWD-?} # '
echo "Mounting devpts/proc/sysfs..."
mount -t devpts devpts /data/local/debian/dev/pts
mount -t proc proc /data/local/debian/proc
mount -t sysfs sysfs /data/local/debian/sys
echo "Chrooting into Debian Squeeze..."
chroot /data/local/debian/ /bin/bash
echo "Unmounting devpts/proc/sysfs..."
umount /data/local/debian/dev/pts
umount /data/local/debian/proc
umount /data/local/debian/sys
echo "Unmounting Debian Squeeze..."
umount /mnt/squeeze/
You will notice that the script also mounts and unmounts additional system filesystems. Also, the script basically pauses right after the chroot command waiting for the process to end, which occurs when you type exit inside of the Debian system. In effect, the script queues up the umount commands for whenever the Debian system is exited.
I use a script similar to that (without the mount/umount because I prefer to do that myself) to start my system. I have it saved to /sdcard/debian/debian and I start the system with the following command:
Code:
su
sh /sdcard/debian/debian
Issues:
The following issues have been encountered:
If the image file is mounted then unmounted, if you try to remount the image again it will error out. (Reboot to solve)
Optional Installation:
Of course the steps above leave you with a working system, but no doubt you will want more functionality.
I've installed TightVNC using the following command:
Code:
apt-get install tightvncserver
To start it:
Code:
vncserver -geometry 1280×752
After that you can connect to it using any VNC software, either local or over the network. If you connect local, be sure to use 127.0.0.1:5901.
Note: This does not install a window manager, if you VNC into the Tab you will get a blank desktop.
I also found that the less command was missing. Turns out the easy fix was to do the following:
Code:
apt-get install less
Finally...
All of this has just been what I've encountered so far today, haven't done much more than set up the system. Please let me know if I'm missing any key parts of the system or if there are any ways that this could be more streamlined.
Hope this helps someone
Thanks man, after rooting my SGT i have been looking for something like this, i'll try it when arrive home.
does touch screen work?
hardt2788 said:
does touch screen work?
Click to expand...
Click to collapse
Dear god man read! It runs as a Virtual Machine on your tablet and you use a VNC client to control it. So yes touchscreen works but it is not a duel boot and is "piggy backing" off android.
So if someone emails you can switch to the email app then back to the vnc app.
You need pills.
Sent from my GT-P7510 using XDA Premium App
maniac3389, have you tried running lxde instead of gnome to see if it runs any faster?
hardt2788 said:
does touch screen work?
Click to expand...
Click to collapse
Sorry, been a few days since I've been on here. Well, the concept is that you run a VNC server in the Debian system and you "remote" into it via a VNC client on the Honeycomb side.
jamezelle said:
maniac3389, have you tried running lxde instead of gnome to see if it runs any faster?
Click to expand...
Click to collapse
Been a bit since I've worked with it, it installed and worked but something was quirky about it. (can't recall what it was)

[GUIDE] Rolling your own CM7 kernel

I have like 3 private messages per day asking help on the kernel so I decided to write a short tutorial on how to build your own CM7 kernel.
Requirements:
- Linux distro such as Ubuntu (recommended).
- Time and 10 GB.
Instructions:
(Instructions tailored for Ubuntu, somewhat similar for other distros)
1. First we need to download some stuff, open your terminal and type these commands:
Code:
sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
sudo apt-get update
sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev gcc-arm-linux-gnueabi
Toolchain is already included.
If you're in a 64-bit machine, run this command too:
Code:
sudo apt-get install ia32-libs lib32z1-dev lib32ncurses5-dev gcc-multilib g++-multilib
2. Open terminal, navigate to a folder where you want the kernel source and type this:
Code:
git clone git://github.com/CyanogenMod/lge-kernel-sniper.git
After the download, navigate (in the terminal of course) to the new folder.
3. Now we need to edit the Makefile in that newly created folder, open it. Look for the flags:
Code:
ARCH ?= ...
CROSS_COMPILE ?= ...
Change to:
Code:
ARCH ?= arm
CROSS_COMPILE ?= /usr/bin/arm-linux-gnueabi-
Save and close.
4. Now we need a .config file. Run this command (the terminal must be in that kernel folder where Makefile is):
Code:
make ARCH=arm cyanogenmod_hub_defconfig
Voilá, you can find the .config in the folder (control+h to show hidden files).
5. Edit the kernel as you want. You can grab some ideas from my incomplete source of knzo kernel for CM7: http://github.com/mnlsrv/kernel
6. Let's compile it! Run the command:
Code:
make -j4
In the end you'll get a zImage and .ko files (modules).
7. Now use unpackbootimg or Dsixda kitchen to unpack CM7's boot.img (you can extract it from a nightly), replace zImage with yours and repack.
8. Now you need to flash the boot.img; just use the zip for knzo kernel and replace the boot.img for yours; replace the modules too (/system/lib/modules).
9. Flash and enjoy.
Hope I didn't forget to mention any step.
I am not an active dev, but would like to thank you at the first place. Any beginner in android development will surely be grateful to this simple step wise guide....
A few tips:
Custom governors go into /drivers/cpufreq.
Custom I/O schedulers go into /block/.
For each addition you need to change Kconfig and Makefile. Then the .config will need to be updated and this is automatic when you run the make command. Open and edit .config when you're more familiar with all of it.
Here https://github.com/mnlsrv/kernel/commits/master you can see some commits (changes) I did to the kernel and if you click on one of it, it will show exactly how and which files were changed.
Only a remark:
- To completely add a governor, you have to edit /include/linux/cpufreq.c too in order to set a different default governor without compile errors.
if i have more time ,i'll have a try
thank you knzo,you did a great job!
So kind of you knzo... I'll definitely try this if I still have black....
However... Black is still the best phone I ever had.... miss my black very much...
Keep the good works guys, i keep my eyes to this community, wondering how far this device will go....
Beginners guide to making kernel images
Here I have logged down my own experiences with making Optimus Black kernel binary. Being a Windows person myself I know how troublesome and confusing a development under MinGW can get so I decided to do it under VirtualBox instead. I sincerely hope that the steps described below are a good reference to everybody who is interested in modding his or her own kernel but hasn't gotten over the administrative burden yet. Written as from beginner to beginner I tried to be as concise as possible, leaving out nothing important and everything optional. Just enough to get from zero to updated kernel on your phone.
1. Prepare the environment
Download VirtualBox from https://www.virtualbox.org/wiki/Downloads and install it. I downloaded version 4.1.6 which was the latest version at the moment (http://download.virtualbox.org/virtualbox/4.1.6/VirtualBox-4.1.6-74713-Win.exe)
Download Ubuntu from http://www.ubuntu.com/download/ubuntu/download and install it under VirtualBox. I downloaded latest 32-bit version (http://www.ubuntu.com/start-download?distro=desktop&bits=32&release=latest). Install Guest Additions afterwards as well if you want to use clipboard between host and guest operating systems.
Open terminal and create a folder under your home directory for all the things involved.
Code:
mkdir android
cd android
Install Git and get the kernel source. I had to use http protocol as git protocol was blocked for me.
Code:
sudo apt-get install git
git clone http://github.com/CyanogenMod/lge-kernel-sniper.git
2. This is the part where you change the code
Done? Move to the next step and cross your fingers. For the purpose of this guide we are not changing anything.
3. Make the kernel image
Go to kernel directory
Code:
cd lge-kernel-sniper
Install Arm toolchain and make the kernel image
Code:
sudo apt-get install gcc-arm-linux-gnueabi lzma
export ARCH=arm
export CROSS_COMPILE=/usr/bin/arm-linux-gnueabi-
make cyanogenmod_hub_defconfig
make
There was one thing I had to modify before make completed without errors. Inside drivers/net/wireless/bcm4329 I had to remove -Werror from the Makefile because the warnings were considered as errors otherwise. If everything goes well you'll find zImage under arch/arm/boot directory.
4. Create and deploy the update image (see also http://forum.xda-developers.com/showthread.php?t=1350679)
Download Kernel Injector update image template
Code:
cd ..
wget -O output.zip http://forum.xda-developers.com/attachment.php?attachmentid=785468
Update zImage inside update.zip
Code:
zip -j update.zip lge-kernel-sniper/arch/arm/boot/zImage
Update modules inside update.zip
Code:
mkdir modules
find lge-kernel-sniper/ -name "*.ko" -exec cp {} modules \;
zip -d update modules/\*
zip update modules/*
Use your favourite method of getting the update.zip to your phone's SD card, boot into recovery and flash.
Good luck! And as always - comments and suggestions are most welcome!
- Aprold

[Q] help w jb root

all is good until the last step whats going on?
[email protected]:/tmp/share$ tar xvf motoshare.tgz
adb
busybox
pwn
su
Superuser.apk
[email protected]:/tmp/share$ sudo chown root:root pwn
[email protected]:/tmp/share$ sudo chmod 6755 pwn
[email protected]:/tmp/share$ /tmp/share/adb shell /storage/rfs0/pwn
bash: /tmp/share/adb: No such file or directory
[email protected]:/tmp/share$
Please give me the response for the terminal command:
ls -l /tmp/share/adb
re jb root
[email protected]:/tmp/share$ ls -l /tmp/share/adb
-rwsr-sr-x 1 jody jody 204436 Feb 11 11:49 /tmp/share/adb
jodybgoode said:
[email protected]:/tmp/share$ ls -l /tmp/share/adb
-rwsr-sr-x 1 jody jody 204436 Feb 11 11:49 /tmp/share/adb
Click to expand...
Click to collapse
I will get back to you after I talk with Dan. Unless another set of eyes knows the solution.
Sent from my MB886 using xda app-developers app
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Help confused
djrbliss said:
As promised, this post describes how to root the Atrix HD Jelly Bean build. This should also work on other Motorola 4.1.2 builds (Razr/Razr Maxx, Razr HD, Razr M, etc.).
The exploit requires setting up a special Samba share and mounting this share on your phone using the File Manager app. I apologize that this process may seem involved for some of you, and request that members of this community help each other out if some of you are having problems completing the procedure. I'm not able to provide individual tech support to every user who wants to root this phone.
The following instructions require a working Linux installation. The following instructions are for Ubuntu. If you don't want to install Ubuntu permanently on your machine, I suggest using a LiveCD installation. Instructions on setting this up are described here:
https://help.ubuntu.com/community/LiveCD#How-To_LiveCD_Ubuntu
Once you're booted into Ubuntu, open a terminal. Create a new directory for your Samba share:
Code:
mkdir /tmp/share
Next, install the samba package:
Code:
sudo apt-get install samba
Edit the configuration file for samba:
Code:
sudo gedit /etc/samba/smb.conf
Add the following lines to the end of the configuration file and save your changes:
Code:
[share]
path = /tmp/share
available = yes
valid users = guest
read only = yes
browsable = yes
public = yes
Close the text editor once you've saved your changes.
Next, create a user for the Samba share by typing in the terminal:
Code:
sudo useradd guest -m -G users
Set a password for the new user. Remember this password:
Code:
sudo passwd guest
Provide a password here and press enter. You won't see the characters you're typing, so be careful.
Next, set a password on the share. Use the same password you just provided:
Code:
sudo smbpasswd -a guest
Type the password you created before and press enter.
Next, restart the Samba server:
Code:
sudo restart smbd
Finally, download and prepare the required files to the Samba share:
Code:
cd /tmp/share
wget [url]http://vulnfactory.org/public/motoshare.tgz[/url]
tar xvf motoshare.tgz
sudo chown root:root pwn
sudo chmod 6755 pwn
At this point, you'll need to know the IP address of your Linux host, which you can get by running "ifconfig" from your terminal (it should be of the form "192.168.x.x").
Next, move over to your Android device. Ensure you have enabled USB Debugging Mode (under Settings -> Development Settings). Ensure your device is connected via Wifi.
Open the "File Manager" app, and select "Remote storage". Click "Add storage", and fill in fields as follows:
Code:
Host IP address: [your Linux machine's IP address]
Domain name: WORKGROUP
Shared folder name: share
User: guest
Password: [the password you created above]
At this point, the phone will mount your Linux share. To complete the process, plug in your phone via USB to your Linux machine, and type the following in your Linux terminal:
Code:
sudo /tmp/share/adb kill-server
sudo /tmp/share/adb shell /storage/rfs0/pwn
If it's successful, this should print "[+] Rooting complete!".
Finally, install Supersu by typing the following in the terminal:
Code:
sudo /tmp/share/adb install /tmp/share/eu.chainfire.supersu.apk
Congratulations, enjoy your rooted device.
I can't stress this enough: I can't provide individualized tech support for everyone on this forum. Please help each other.
TTLayland has been successfully rooted using this technique and has volunteered to help. If you get stuck and can't find support on these forums, feel free to email him at ttlayland (at) gmail (dot) com.
Paypal:
http://goo.gl/zBGb0
Click to expand...
Click to collapse
Got this error:
[email protected]:/tmp/share$ sudo /tmp/share/adb shell /storage/rfs0/pwn
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
mount: Operation not permitted
sh: can't create /system/xbin/busybox: Read-only file system
Unable to chmod /system/xbin/busybox: No such file or directory
sh: busybox: not found
cp: /system/bin/su: Read-only file system
Unable to chown /system/bin/su: No such file or directory
Unable to chmod /system/bin/su: No such file or directory
link failed Read-only file system
[+] Rooting complete!
[email protected]:/tmp/share$
Then it says: "There is no SU binary installed, and SuperSU cannot install it. This is a problem!" when opening SuperSU
PLEASE HELP HERE OR MY EMAIL! : [email protected]
Thanks in advanced
progrockguy said:
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Click to expand...
Click to collapse
progrockguy said:
Try running the last command as simply "adb shell /storage/rfs0/pwn"
(i.e. without the prefix /tmp/share/)
Click to expand...
Click to collapse
that worked kinda. well it says rooting complete but when i update superuser or root checker says root fail
Please Help: error: device offline
I am getting the following error
[email protected]:/tmp/share$ sudo /tmp/share/adb kill-server
[email protected]:/tmp/share$ sudo /tmp/share/adb shell /storage/rfs0/pwn
* daemon not running. starting it now on port 5037 *
* daemon started successfully *
error: device offline
[email protected]:/tmp/share$
I am running the LiveCD in VMware Workstation
Sorry for the duplicate posts
worked perfectly after i used a 32 bit live disk
jodybgoode said:
worked perfectly after i used a 32 bit live disk[/QUOTE
Did you use Ubuntu and which version?
do you have a link to the CD?
Did you boot a machine or you used VMware or Virtualbox?
Click to expand...
Click to collapse
Why would anyone even attempt to use a VM for this simple root method? You could've been rooted already if you had just followed the instructions.
Same problem here. I couldn't get past the adb kill-server command. It would tell me there is no such directory. If any one can get past this can someone please tell me what they did to get past it.
Black_halo said:
Same problem here. I couldn't get past the adb kill-server command. It would tell me there is no such directory. If any one can get past this can someone please tell me what they did to get past it.
Click to expand...
Click to collapse
I am stuck, I have tried so many machine to no luck
Please someone help
Start over and just copy and paste each single line and hit enter do not copy multiple code lines .
ATRIX HD running BATAKANG 1.10
sickkside13 said:
Start over and just copy and paste each single line and hit enter do not copy multiple code lines .
ATRIX HD running BATAKANG 1.10
Click to expand...
Click to collapse
I did, no luck
Dammz man idk what else to tell you yesterday i spend all day trying to root too but just when i was about to give up i got everything g working
ATRIX HD running BATAKANG 1.10
sickkside13 said:
Dammz man idk what else to tell you yesterday i spend all day trying to root too but just when i was about to give up i got everything g working
ATRIX HD running BATAKANG 1.10
Click to expand...
Click to collapse
hehehehe
Does the root method have anything to do with having android sdk and ndk on your system? Im thinking thats what it is now. Would i have to have linux sdk to run with terminal root or windows sdk?
Black_halo said:
Does the root method have anything to do with having android sdk and ndk on your system? Im thinking thats what it is now. Would i have to have linux sdk to run with terminal root or windows sdk?
Click to expand...
Click to collapse
No, you don't need the Android SDK/NDK, since I included a copy of ADB in the tarball file that you extracted to /tmp/share.
What's the output of "ls -l /tmp/share/adb" on your Linux machine?
I had to re-flash official JB firmware in RSD Lite before the exploit would work. Before that, the Exploit would return "Root Complete", but there was no root access (though I could su to # in adb). I run Ubuntu 12.04 x64 at work already with Windows in VirtualBox.
RSD Lite doesn't seem to want to complete a flash in the Windows VMs I run in VirtualBox at work, so I waited until I got home and used my Windows 8 Pro machine to RSD the phone with the official JB firmware. I run Ubuntu 12.04 in a VirtualBox on that machine already, so after the RSD flash, I ran the exploit from that VM - BINGO - worked on the first try.
Failing other options, you might want to try re-flashing JB in RSD Lite and running the exploit on a fresh device.
I used the firmware in this thread (To fix the issue the thread is about):
http://forum.xda-developers.com/showthread.php?t=2057078
If you decide to try that, Be SURE to get the firmware zip AND THE XML and replace the XML before flashing!!

How to set up Android SDK in Linux

*If you find this Guide Thread helpful, feel free to hit the "thanks" button below!
I'm doing this guide because when I switched to arch linux ,I found no guides to setup sdk in it.Arch is a beautiful OS, but for newcomers like me ,I took some time to get used to it.So,In this guide, we’ll take a look at how to set up a development environment for Android in Arch linux(or Arch based Linux Distros) so you can start working on your Projects.Most of the Arch Linux are pro linux users so there is really no need of this guide, but this guide is meant for those who are switching from ubuntu/mint/fedora/any other disto which are not based on Arch, to say it in short its meant for new users of Arch Linux. Anyway Let's set up.
First let's set see how to install Platform tools.
Setting up platform-tools in UBUNTU(or Ubuntu based distros/Linux Mint)
In ubuntu platform tools can be setup very easily.
1.Open terminal(Default shortcut is ctrl+alt+T)
2. Type "sudo apt-get install android-tools-adb" (this will install the adb)
3. Type "sudo apt-get install android-tools-fastboot"(this will install the fastboot)
Step 4: Check whether the above tools are working by typing an adb command. For e.g. "adb devices"
Now its time to install SDK in Ubuntu and set it up but before that let me tell you there is already a great thread by matt95.You can see the guide and thank him herehttp://forum.xda-developers.com/showthread.php?t=2302780
Fedora/CentOS/RedHat
First lets install Eclipse[You can also use Android Studio if you want]
Code:
sudo yum install eclipse-jdt
Now lets download the sdk from here. http://developer.android.com/sdk/index.html. Its about 500mb , Just wait and let it downlaod. Once the download is done extract it wherever you want.
For newcomers I recommend to extract it to 'home'.So the file is now extracted inside /home/user/AndroidSDK .
Now lets setup .bash_profile file so that we can access adb anywhere or else you have to type the whole location again use the adb command which is lot of work . So let's shorten it up.
Type "sudo vim .bash_profile"in terminal.
Code:
PATH=$PATH:$HOME/AndroidSDK:$HOME/AndroidSDK/tools
export PATH
# For SDK version r_08 and higher, also add this for adb:
PATH=$PATH:$HOME/AndroidSDK/platform-tools
export PATH
Now lets install android plugin for eclipse.
Open Eclipse and click on Help.Select Install New Software. Then click Add, at the top right of that window. Type in Android Plugin for the name and https://dl-ssl.google.com/android/eclipse/ for the address.
Once this is done, click on the Available Software Sites hyperlink below the Add button, then highlight the Android Plugin source and click on Reload. Now exit this window, and choose Android Plugin from the “Work with” dropdown menu. Choose the developer tools option that you see here and Proceed with the installation.
After the installation configure your Android virtual devices.
ARCH LINUX(or Arch based Distros)
Lets install android sdk
Open terminal and type
Code:
wget https://aur.archlinux.org/packages/an/android-sdk/android-sdk.tar.gz
Note:- If terminal shows wget is not found. Type this in the terminal
Code:
pacman -Suy && pacman -S wget
Once it fetches the tarball, lets extract it by typing
Code:
tar -xvzf android-sdk.tar.gz
wait for it to finish. Change the directory to android-sdk by using the command
Code:
cd android-sdk
.
Now lets make the package by using the command
Code:
makepkg -s
now lets install it by typing
Code:
sudo pacman -U *.pkg.tar.xz
Platform tools for Arch
Let's install platform-tools now.Just like above steps ,well get a package and install it.
1. Type
Code:
wget https://aur.archlinux.org/packages/an/android-sdk-platform-tools/android-sdk-platform-tools.tar.gz
2.Type
Code:
tar -xvzf android-sdk-platform-tools.tar.gz
3.Change directory.
Code:
cd android-sdk-platform-tools
4.
Code:
makepkg -s
5.Install it
Code:
sudo pacman -U *.pkg.tar.xz
All the files are installed in /opt/android-sdk/ . Just like we had .bash_profile in FEDORA, we use symbolic links in Arch linux to use commands from anywhere .
Code:
sudo ln -s /opt/android-sdk/platform-tools/adb /usr/bin/adb //this one's for adb
sudo ln -s /opt/android-sdk/platform-tools/fastboot /usr/bin/fastboot //This one's for Fastboot
sudo ln -s /opt/android-sdk/tools/ddms /usr/bin/ddms //This is for DDMS
sudo ln -s /opt/android-sdk/tools/android /usr/bin/android //This is for Android
Now run android by typing "android" in terminal. :good:
Simple as that. If you are yet to switch to Arch linux then I recommened you to use "BBQLinux " its an Arch linux for Android developers. It comes with most of the things needed for android development. You can download it from Here.
Thanks for reading this. Help me by giving me e-books.:angel:
PM me or post here if you have any doubts. :victory:
Install an aur wrapper like pacaur .
pacaur -S android-sdk android-studio android-udev android-platform-tools
Done
Sent from my Nexus 5
Pirateghost said:
Install an aur wrapper like pacaur .
pacaur -S android-sdk android-studio android-udev android-platform-tools
Done
Sent from my Nexus 5
Click to expand...
Click to collapse
Thanks for the reply, I havent tried pacaur repository though. Will give it a try soon.:good:
sorry, I made an error:
Code:
pacaur -S android-sdk android-sdk-platform-tools android-udev android-studio android-sdk-build-tools
you dont need both platform and build tools, it looks like build-tools is more recent. if you want eclipse instead of android studio, just use 'eclipse-android' instead of android-studio

Categories

Resources