[SCRIPT]Debian Image Builder (01-22-2012) - Samsung Galaxy Nexus

Debian Image Builder...
So basically, I've been reading several different articles, etc. on running Debian and/or Ubuntu on Android. I did this on my Eris and D1 in the past, and I figured that it would work even better on the Galaxy Nexus. Of course it does... Anyway, it can be run from a loop mounted image or a separate partition on most phones. However, for phones like this one with no sdcard slot, it makes sense to just do the image thing.
After building and rebuilding an image a few times, I decided to do what I normally do and turn those crazy linux commands into a script. It's not really all that complex or fancy, but it works and can be improved. I hope you find it helpful.
NOTE: This is really just the first step in getting Debian running on your phone. This will just create the image. You still have some work to do. There are other ways to do this, but I like having control of the initial image...
1/14/2012 - fixed some typos and added 'apt' as a default package (debootstrap did this by default, but apparently multistrap doesn't)
1/16/2012 - removed multistrap and went back to debootstrap for now
1/21/2012 - added a setup script to do the second stage and updates after booting into Debian on the phone, fixed extra package install code
1/22/2012 - updated variable code per swordrune10's suggestion
Download: https://github.com/gnarlyc/DebianImageBuilder
Currently requires Debian 6, but feel free to fix that for me.
Rock on.

Thanks. I had fun with Debian on my Eris back when that was being worked on. I am sure this will be much faster on this beast.

synesthete said:
Thanks. I had fun with Debian on my Eris back when that was being worked on. I am sure this will be much faster on this beast.
Click to expand...
Click to collapse
It does, and it's pretty sweet with a bluetooth keyboard & mouse and a monitor via a MHL video cable. I've even compiled a kernel or two on it.

Where do we put the image? Do we have to create a new partition?
Sent from my Galaxy Nexus using XDA App

ttereve said:
Where do we put the image? Do we have to create a new partition?
Sent from my Galaxy Nexus using XDA App
Click to expand...
Click to collapse
No, you don't have to create a partition. Here's what I do:
I use Connectbot for a terminal emulator, but there are others out there.
One time:
1) 'mkdir /data/local/debian' (don't type the single quotes)
2) copy the image to /sdcard/
Each time I start up (actually, I've made a script for this too):
1) 'su'
2) 'mount -o loop -t ext2 /sdcard/linux.img /data/local/debian'
3) 'chroot /data/local/debian /bin/bash'
4) ta-da!
You should be at a Debian bash prompt. Check /etc/apt/sources.list to make sure it's there and has 'deb http://ftp.us.debian.org/debian squeeze main'. You might also have to do 'dkpg --configure -a'. If it looks like that's needed each time, I'll automate it. If you install a desktop gui like xfce or whatever, you'll probably want to install tightvncserver in Debian and get an Android VNC client from the Market. I'll probably add more options to make these things a little easier in the future.
I'm still going through the entire process over and over until I get things how I want it, so the script will be updated as I get the time.

I'm guessing we can use ext3 (or even ext4) instead of ext2?

ttereve said:
I'm guessing we can use ext3 (or even ext4) instead of ext2?
Click to expand...
Click to collapse
I dunno. It won't hurt to try!

Is there any chance that this will work on GSM GN?
Sent from my Galaxy Nexus using xda premium

JTECJ said:
Is there any chance that this will work on GSM GN?
Sent from my Galaxy Nexus using xda premium
Click to expand...
Click to collapse
Yes. This just builds the rootfs in an image. It should work for nearly any arm based Android device. I'm still working out some kinks with getting vnc and SSH servers working though. These worked fine when I used debootstrap to create the rootfs, but multi strap is much more flexible. So, I'm going to keep trying multi strap for a bit.

alright I can get into [email protected] bash but i can't start ssh because well, there is no ssh in/etc/init.d/ how do I get it in there? (i built my own ubuntu rootfs with rootstock)?

ttereve said:
alright I can get into [email protected] bash but i can't start ssh because well, there is no ssh in/etc/init.d/ how do I get it in there? (i built my own ubuntu rootfs with rootstock)?
Click to expand...
Click to collapse
Did you install openssh-server?
EDIT: Yeah, some things aren't working quite right with installing and updating packages. I might have to re-work it with debootstrap again... Oh well.

Ok. Give me a day or two. I've re-written the script using debootstrap instead. I'll update the repo as soon as I do my initial test, which should be later tonight.

sweet I got it all to work! I'll try and get a script up for the way I did it.
btw I used a rootstock ubuntu rootfs
now I need to figure out how to setup gnome through command line!

ttereve said:
sweet I got it all to work! I'll try and get a script up for the way I did it.
btw I used a rootstock ubuntu rootfs
now I need to figure out how to setup gnome through command line!
Click to expand...
Click to collapse
Cool! I read something about rootstock, but never really looked too deep. Yeah, post your code. That would be great. I have used debootstrap before, so I know it works. The thing that I never liked is that you have to run '/debootstrap/debootstrap --second-stage' after you boot into Debian on the phone. With multistrap, the packages are supposed to all be there and ready to go. (At least, that's how I understand it.) Anyway, I'm working out debootstrap again, and will just do a one-shot startup script or something. Or maybe, I'll switch gears and do it your way instead...

from: http://androlinux.com/android-ubuntu-development/how-to-build-chroot-arm-ubuntu-images-for-android/
build rootfs
Code:
sudo rootstock \
--fqdn ubuntu \
--login ubuntu \
--password ubuntu \
--imagesize 4G \
--seed linux-image-omap,build-essential,ssh,tightvnc
then make an image:
Code:
dd if=/dev/zero of=ubuntu.img bs=1MB count=0 seek=4096
format as ext4
Code:
mkfs.ext4 -F ubuntu.img
mount empty image
Code:
sudo mount -o loop ubuntu.img /mnt
extract rootfs inot image
Code:
sudo tar -C /mnt -zxf armel-rootfs-datetag.tgz
and unmount
Code:
sudo umount /mnt
this is my script to get chroot working (but this script fails and idk why so any help would be appreciated) (modified from the script http://burningbroccoli.se/post/949205350/chrootd-ubuntu-on-samsung-galaxy-s-android):
Code:
#!/bin/sh
echo "mount the image"
mount -o loop -t ext4 /sdcard/ubuntu.img /data/local/ubuntu
echo 'Mounting proc,sys and dev'
busybox mount -t proc proc /data/local/ubuntu/proc
busybox mount --bind /sys /data/local/ubuntu/sys
busybox mount --bind /dev /data/local/ubuntu/dev
echo 'Exporting a proper path'
export PATH=/bin:/usr/bin:/sbin:/usr/sbin:$PATH
echo 'Chrooting and starting ssh server'
chroot /data/local/ubuntu /bin/bash
echo "And your ip is:"
busybox ifconfig | busybox grep "inet addr"

I looked at rootstock. It doesn't appear to be Debian friendly, but maybe I'm just missing something. As soon as I'm happy with this on Debian, I'll look into making it work on Ubuntu also. I also realized that debootstrap has an option to install extra packages, so that's cool.
Right now, this is working well for me, but there are things that I would like to add.

ran into a problem, apparently it doesnt know let so it pretty much didnt work..
Code:
./debianImageBuilder.sh: 20: let: not found
running oneiric and the UI is gnome3
---------- Post added at 04:53 PM ---------- Previous post was at 04:37 PM ----------
nvm, i got it to work by modifying it to this.. u can do whatever to the code, im just happy to help... tho im not sure why let doesnt work for me x.x
Code:
export image_name=debian.img
export build_folder=image_folder
real_image_size=$(6442450944)
echo "******************************"
echo "Installing dependencies"
echo "******************************"
apt-get install debootstrap
echo "******************************"
echo "Gather info"
echo "******************************"
echo -n "What size image would you like to create? (in GBs): "
read image_size
real_image_size=$(((($image_size * 1024) * 1024) * 1024))

swordrune10 said:
ran into a problem, apparently it doesnt know let so it pretty much didnt work..
Code:
./debianImageBuilder.sh: 20: let: not found
running oneiric and the UI is gnome3
---------- Post added at 04:53 PM ---------- Previous post was at 04:37 PM ----------
nvm, i got it to work by modifying it to this.. u can do whatever to the code, im just happy to help... tho im not sure why let doesnt work for me x.x
Code:
export image_name=debian.img
export build_folder=image_folder
real_image_size=$(6442450944)
echo "******************************"
echo "Installing dependencies"
echo "******************************"
apt-get install debootstrap
echo "******************************"
echo "Gather info"
echo "******************************"
echo -n "What size image would you like to create? (in GBs): "
read image_size
real_image_size=$(((($image_size * 1024) * 1024) * 1024))
Click to expand...
Click to collapse
Cool. That does look a bit cleaner. The code for installing extra packages wasn't right/all there, so I'm working on that now.

Thanks for this script. It worked perfectly for me. It's great to be able to apt-get things on my phone, and it's interesting to run debian's utilities on Android. A lot of other methods are about getting some sort of Linux desktop on Android, but I really appreciate the barebones CLI that this provides. To my knowledge this is the only way to be able to run ping6 on Android.
To anyone thinking of setting this up - make sure to install busybox!
I made a couple of helper scripts to get cleanly in and out of the chroot, and to make the sdcard directory available within debian. I'm keeping this stuff stored in /sdcard/debian:
Code:
[email protected]:/sdcard/debian # ls
debian.img
debroot
start.sh
stop.sh
start.sh
Code:
mount -o loop -t ext2 debian.img debroot
busybox mount --bind /sdcard debroot/mnt
chroot debroot /bin/bash
stop.sh
Code:
umount /mnt/sdcard/debian/debroot/mnt
umount /mnt/sdcard/debian/debroot/dev/pts
umount /mnt/sdcard/debian/debroot/proc
umount /mnt/sdcard/debian/debroot/sys
umount /mnt/sdcard/debian/debroot

Related

Installing Debian Squeeze on Android Optimus - Walkthrough

Installing Debian Squeeze on Android Optimus S - Walk-throughs
This is slowly becoming a larger topic. So for now i will post various ways proven to work on the Optimus S and V as links below:
Installing Debian Squeeze on Android Optimus - Walk-through Compiled by uamadman
Install Debian Squeeze - non-loop sd-ext chroot method (prebuilt!) By bigsupersquid
ALL-Thumbs GUI to replace LXDE By bigsupersquid
4 Steps to Linux on your Optimus S - written by uamadman hosted by uamadman
All of this work was done by other people. I am simply compiling information and specializing it to the Optimus S.
This method does not require a pc, and everything is done through your android interface.
Current Abilities I've tested with success.
Play Sound
Surf the web
Access entire SD Card
Currently Working on:
Flash Support through IceWeasel
Completed:
Making this a simple download and phone restore - Done
Needs:
A GUI with bigger buttons and scaled for 480x320 - Done thanks bigsupersquid
Transparent Keyboard
Sources:
Howto Install Ubuntu by NexusOneHacks.net
secret hidden note to self psychocats.net/ubuntu/nonfree
Lets begin.
You need the following requirements:
Recommended: 2+ gigabytes of free SD card Space (Minimum 1.25gb)
A Rooted Optimus S
Kernel/Recovery: Xionia CWMA v1.2518.6
ROM:The Scott Pilgrim ROM (CM7 Gingerbread, Zefie Edition)
BusyBox Installer - You can get this from google apps store by JRummy16
Linux Installer – You can get this from google apps store by Galoula
Items worth having to things that make this easier:
A Wifi Internet Connection
A fully Charged Battery and a Wall Charger ^.^
2 Bottles of Mountian Dew
Your favorite Movie
and
The Patience to NOT Touch/use your phone for the 2 hours needed to complete the initial install process.
I started this endeavor with a clean install of the ROM listed above.
!!Make backups if you MUST save your data before you proceed any further!!
Warning: In The Simplest Terms(More detail will be in the final walkthrough)
Sometimes the Linux Installer doesn't work or if it is working and the process is interrupted while creating the .LOOP or extracting the build. The Linux Installer will stop working. I've found two (2) ways to fix the issues. The first is to go into setting and clear the cache for Linux Installer, Then open the superuser app and forget the permissions assigned to Linux Installer (Note: Try this a few times before resorting to a clean wipe, this method sometimes takes a few tries). The second is a clean wipe/recovery of the phone. Additionally if for some reason there is a interruption and the process stops. reboot the phone delete linux.loop off your sdcard and start from scratch. BEWARNED
*Walk-through - Under Construction*
To clarify any confusion the button names I use from left to right:
Home : Menu : Back : Search
Pre-Install Check List for Formatting/Reloading Rom
install sdcard with ROM/Recovery's
Reboot > Recovery
wipe data/factory reset
mounts and storage> format system
install zip from sdcard >choose zip from sdcard > update-cm-7-04282011-NIGHTLY
install zip from sdcard >choose zip from sdcard > gapps-gb-20110120
Remove sdcard with ROMS
Install sdcard marked for Linux
mounts and storage > format sdcard
reboot system now
Pre-install Checklist phone prep. (If you choose to overclock your phone this would be a great time to do it)
Wait 2 minutes for phone to fully load
tap droid
tap skip
tap next/done
Settings > Display > Screen timeout > 30 minutes
Settings > Applications > Check Unknown sources (not sure if nessesary)
Settings > Applications > Development > Check Stay awake (Required!!!!)
Settings > Accounts & Sync > Add Account (Go Through Menu's should take you though Market Install)
Market > Search Busy Box > tap BusyBox Installer by JRummy16 > free > ok
Market > Search Linux Installer > tap Linux Installer by Galoula > free > ok
Market > Search vnc > tap android-vnc-viewer Installer by androidVNC team + antlersoft > free > ok
Press Home Key
Apps> Busybox Installer >Allow Permissions> OK > Install
Install Check List
Warning
DO NOT ROTATE YOUR PHONE
ALLOW THE SCREEN TO SHUT OFF
LOCK THE PHONE
WHILE THIS APP IS OPEN UNLESS STATED
(you will see bad things if you do)
For Debian
Apps > Linux Installer > Allow SU Permissions > Allow SU Permissions > Allow SU Permissions > Click OK (First time start up, Yes 3 Approvals. If you don't recieve 3 notifications from super user it means Linux Installer is bugged. Go Settings>Applications>Manage Applications> under the Downloaded tab find Linux Installer > Select > Clear Data > Try step again. May take a few tries.)
Press Menu Key > Tap Setup > Tap File Size > Set to 1250 or more but must be less than the size of your SD Card.> ok > Press The Back Key (Linux installer will exit to your apps menu)
For Ubuntu - Currently bugged. I would avoid this. The source.list seems to have issues and won't download packages.
REQUIRED: Set you phone some where flat plugged into power Do Not Let The Screen Rotate!!!!!Apps>Linux Installer > Tap 1) Create target loop
Be Patient Wait until the Creating LOOP menu disappears. The length of time is dependent on the size of Megabytes set in the File Size option. About 10 minutes for 1500 Mb
Tap Liberate Loop -- Really Fast
Tap Format target loop (ext2) - This is the Buggy Part. If you get an Error message everything is most likely ok. Pickup your phone and Physically Rotate it so the screen rotates. Two additional menu's should appear. [3) Copy and Extract into loop and Install Linux Boot Script]
Lay your phone back down flat it doesn't matter if the screen rotates back to its original.
From here on DO NOT let the Screen Rotate Again! The process will be interrupted and you will get to start from step 1
Tap 3) Copy and Extract into Loop (it will start downloading and extracting the packages necessary to install Linux) This can take up to an hour. On a good 3g connection less than 45minutes.
Tap 4) Install into loop (This takes less than 10 minutes)
Tap Install Linux boot script
30 Seconds Later you officially have a version of Linux installed on your phone
CONGRATS
Verify Install Works
Apps > Terminal Emulator > Type: su > Enter > Grant Permissions > Type: linuxboot > Enter
You should get a string of code then get something like:
[email protected]:/
Most of the next portion comes from the Nexusonehecks.net
Setting up VNC and LXDE (so you don't have to look at terminal lines all day)
Apps > Terminal Emulator > Type: linuxboot > Enter <---If your not already in already.
Type > apt-get update > enter --- 5 minutes
Tight VNC Server
Type > apt-get install tightvncserver > Type y > Press enter --10 minutes
LXDE
Type > apt-get install lxde > type y > Press enter - 30 Minutes+
After a while you should get this screen
Press Menu > Preferences > Control key > Choose Camera Key > Back key > Back Key
Fully Depress the Camera Button Down and Tap the number 9 on the soft key board > Release Camera key > Tap Space Bar -- now two times more
Fully Depress the Camera Button Down and Tap the number 9 on the soft key board > Release Camera key > Tap Space Bar
Fully Depress the Camera Button Down and Tap the number 9 on the soft key board > Release Camera key > Tap Space Bar
The process should continue installing LXDE
tightvncserver Setup
Type> export USER=root > enter
Type> vncserver -geometry 1024x800 > enter
enter password > enter (use something simple you can remember i used 123123123 like they did on the nexusonehacks.net writeup)
verify password > enter
Press Enter after typing each line of the following code. Be Very Slow and Deliberate. Double Check Each line for Capitalization and accuracy before pressing Enter! I do not know how to edit this again --hidden note-->Perhaps some one can show me/tell me how
cat > /root/.vnc/xtartup
#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
icewm &
lxsession
Now Press and Hold the Camera Key and Tap D twice on the soft keyboard > Press Enter (it may ask to press 1 do not and only press enter)
If your camera key wasn't set look here to set it again--->Press Menu > Preferences > Control key > Choose Camera Key > Back key > Back Key
Setting up VNC on android ... After all those command lines I'm sure this is a very very nice change xD
Press Home Screen
Apps > androidVNCviewer > For Password enter 123123123 (Or whatever you set it to in the previous server setup)
Scroll to Port and enter 5901
Change the Color Format if you wish. It runs rather nicely on 24bit color but consumes more cpu cycles.
Tap Connect -- A Very Pretty LXDE should appear with a working CPU Monitor and everything nice
I know you want to play but we have a little more work to do this next step uses Terminal Emulator as the auto start/config file to boot linux and start and configure tightvncserver
Press Home
Open Termial > Menu Key > Preferences > Initial Command > Tap to Edit
Make Edit look like this
export PATH=/data/local/bin:$PATH
linuxboot
vncserver -geometry 600x480
Tap OK > Back out of Teminal to home
vncserver -geometry 600x480<--- this is where you change your screen size. you need a minimum of 600x480 to use the synaptic package manager and a few other things. but when i'm surfing the net or other things I prefer 480x320 (The Exact Size of the Optimus S Screen)
Now whenever you want to run linux simply open the Terminal Emulator. Wait 60 seconds for the code to run.
open androidVNCviewer and click Connect
DONE
Extra things go here
apt-get install synaptic - installs synaptic manager a nice GUI interface for the apt-get command
I have been running a Debian chroot on my optimus V for a few months now, squeeze and sid both work fine. I did it manually without the stuff from the market, and I use the sd-ext partition instead of a loop file
per your GUI issues:
I like xfce4 better than lxde on my optimus V.
Code:
apt-get install xfce4 xfce4-goodies
instead of lxde.
oh, also, the OP pointed out to me that
Code:
apt-get install xfce4-goodies
alone will also pull down xfce4 as a dependency (and that I left out the word install which is now corrected.)
modify the /root/.vnc/xstartup accordingly.
replace
Code:
icewm&
lxsession
with
Code:
xfce4-session&
or, you can cut-and paste my complete file here:
Code:
echo "#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
xfce4-session&" > /root/.vnc/xstartup
I have modified a theme for xfce to be more finger-friendly.
see attachment
decompress that file, it contains a folder, Xfce_large.
place the folder in /usr/share/themes
tap on the rat in the lower-left of the desktop (opens menu)
select Settings by tapping its arrow (xfce is twitchy about the menu through the VNC, it may take a few tries to select items on the main menu.)
select Appearance. Then Style.
Scroll down to Xfce_large and tap it, then tap Close at the bottom.
Voila, oversized scrollbars and menu bar buttons!
If you don't like the size, the settings I modified are in the gtk-2.0 subfolder of Xfce_large in the file gtkrc
the modified settings are not tabbed over like the rest of the settings in the file.
I also changed the default font size, icon size, icon font size, and DPI settings, but that has to be done in the settings menus.
The optimus display is about 120 DPI, the default is 75. 120 looks much nicer I think.
You are awesome
good luck with flash. gnash only plays ads on my V, not whole videos.
get-flash-videos from google code works nicely, but it's a capture utility.
it does try to play with mplayer, but only shows a couple of frames per few seconds because the VNC display method of manually copying the framebuffer is very slow.
using a bandwidth meter (debian package cbm to be exact) the vnc uses from 14 to 80Kb per second of system bandwith on device l0.
I don't know what's pegging your CPU use, mine only tops out when the debian system is doing something. I built my chroot with debootstrap instead of using the market installer, no telling what is preinstalled on the image it downloads.
I am going to try this out once i'm finished trying to get the ubuntu side of the house working.
Can I append this to my post here and androidcentral with proper credits due to you so all may share?
uamadman said:
...Can I append this to my post here and androidcentral with proper credits due to you so all may share?
Click to expand...
Click to collapse
certainly. just test the instructions for functionality before adding them in.
I considered starting a thread on this myself but never got around to it.
I'll continue to contribute info as this develops.
as an extra, here's a link I've posted, a few places on both forums, with a clean debootstrapped debian filesystem, tarred up to shrink it for download.
I goofed a bit when compressing it though, when decompressed it's a single folder containing the filesystem.
http://www.4shared.com/file/iWuUtZgS/squeeze_05_2011tar.html
uncompressed, 9645 items, totalling 264.3 MB
compressed, 116.3 MB (121929580 Bytes)
this will either need the contents of the freshsqueeze folder it contains copied to an ext2 (or ext3/ext4 if you want to brave the damage from journalling on a SD card, which seemed to cause corruption when I tried ext4) partition on your SD card, or, copied into a blank loop ext filesystem if you prefer.
with an empty debian img file mounted as a loop filesystem on a linux box, you can copy everything from the freshsqueeze folder to the loop filesystem by:
Code:
cp -av /path/to/freshsqueeze/* /path/to/loopmountedimg
the loop filesystem method should allow you to continue using your startup scripts as-is, they'll need slight modifications to work with an ext partition like I'm using.
its resolv.conf and sources.list are already configured for 3g access and the main Debian repository, so it's pretty much plug-n-play. no extra packages are installed, you'll need to apt-get tightvncserver and a window manager of your choice, unless you just want the bash shell.
the first time you chroot in, you should use passwd to set a root password, and adduser to get a non-root account on there.
this is not a loop filesystem like what you are using. it is a full directory tree of a base squeeze install.
I would like to see this on the V.its my only phone right now.if I had 2 I would try it.
Sent from my BumbleV using XDA Premium App.
ummkiper said:
I would like to see this on the V.its my only phone right now.if I had 2 I would try it.
Sent from my BumbleV using XDA Premium App.
Click to expand...
Click to collapse
I don't think a chroot can hurt your phone. I even run mine bind-mounted into the root filesystem, with system r/w, and haven't ever had any problems a reboot didn't solve. and it's been since April since I had a forced reboot from running stuff in debian.
now, I don't know about the installer from the market, if it asks for root access multiple times, I'm not sure just what it's doing. I'll post my sd-ext startup script and instructions for using it here after dinner if you want to try it that way instead of with the installer app.
honestly, it's a much simpler process than the OP, but, hey, if it works, I'm not one to dismiss the method out-of-hand.
bigsupersquid said:
I don't think a chroot can hurt your phone. I even run mine bind-mounted into the root filesystem, with system r/w, and haven't ever had any problems a reboot didn't solve. and it's been since April since I had a forced reboot from running stuff in debian.
now, I don't know about the installer from the market, if it asks for root access multiple times, I'm not sure just what it's doing. I'll post my sd-ext startup script and instructions for using it here after dinner if you want to try it that way instead of with the installer app.
honestly, it's a much simpler process than the OP, but, hey, if it works, I'm not one to dismiss the method out-of-hand.
Click to expand...
Click to collapse
Sounds good to me.
non-loop sd-ext chroot method (prebuilt!)
Standard disclaimer:
These scripts and chroot method may bork up your phone, trash your userdata, destroy system files, get you slapped by your mother, make your phone catch fire and/or explode, and etc., ad nauseum.
Use at your own risk.
MAKE A NANDROID BACKUP BEFORE DOING THIS!
You'll probably be just fine, but it's nice to have a backup in case something goes haywire.
Disclaimer aside, it's worked great for me since March, hasn't crashed for months, and I use it multiple times per day.
My main inspiration was Saurik and his Debian & Android together on G1.
I'm sorry that I can't point to all the many, many sources I read through over the couple weeks it took me to get this set up, I took little bits from here, there, and everywhere, but Saurik's work was the main core of this system.
Apologies if you see some tidbit of your work in this... let me know and I'll be happy to give you credit.
Dysfunctions:
things that don't work while the chroot is running:
wifi hotspot in aospCmod and Bumblebee won't initialize; does work during chroot in aospCmod if turned on before chroot, though.
network info II app won't start during chroot; if opened before chroot it's fine.
ringtones on SDcard don't work in Bumblebee; but OI File Manager can read the sdcard during chroot.
these things still work ok once the chroot is exited on aospCmod. The chroot borks wifi on Bumblebee until reboot.
Click to expand...
Click to collapse
Info:
This script remounts / and /system both read/write and leaves them that way until you type exit in the bash shell of the chroot. Without r/w mounting of the / directory, installing Debian packages gives some errors, since it's running in the real root filesystem. Also, the / directory is wiped out on a reboot, so it's relatively safe to have mounted r/w. /system doesn't need to be r/w, I just like it that way, and I haven't had trouble with it since I was first experimenting with this. Feel free to modify the 'boot' script if having /system mounted r/w makes you nervous.
This has been tested on Zefie'sCM7 (outdated) and aospCmodOV ROMs.
It also worked on Bumblebee, but not as effectively.
The chroot will not stop Android from functioning. If Debian is busy with something, it will slow Android down, though.
You will still get/can make phone calls, text messages, etc. You can send the VNC viewer to the background and use Android apps while the Debian system is in the background.
Click to expand...
Click to collapse
On to the meat of the matter. I'm using an 8Gb SD card. I advise no smaller than 4Gb unless you just want to do command-line work in Debian and don't need a GUI.
First, these instructions require a Linux pc. On M$ Windoze? Use a Live CD or a virtual box, or you're on your own.
The first part of these instructions is to be completed on your pc. I'll let you know when to switch to the phone.
1) Mount your <empty> SD card on the pc. If it's not empty, back it up, because this will wipe it out. You'll need at least two partitions on it, three if you're using something like apps2sd (which I'm not using, and not really familiar with, so this tutorial is set up assuming you don't need to dodge an existing ext partition,) and another if you have a swap-enabled kernel and want to use it.
2) Use Gparted or a similar tool to partition the SD card. First partition FAT32 for Android, whatever size you feel you need. I'm using 1Gb.
Second partition is an ext2, ext3, or ext4 partition. Apps2SD style, you know what size and filesystem type you need here, I don't. For Debian on the 2nd partition, I advise 3Gb or more, ext2. ext4 corrupted my files, so I switched back to ext2. If you need an apps2sd partition, Debian will go on the 3rd partition, and you'll have to modify the two attached scripts accordingly.
If you're lucky enough to have a swap-enabled kernel, you can make a swap partition; it'll go last, whatever size is left. 256Mb-1Gb should be plenty depending on whether you use image processing or large compiling projects or some other memory hogging programs.
3) Mount the sd FAT32 and Debian ext partitions on the pc.
4) Download to your pc the base Debian Squeeze filesystem which I've debootstrapped, configured, and uploaded for you to save hours of hassle.
Also download to the same directory the two attached script files.
boot.txt
firstrun.txt
5) Open a ROOT shell. You need root privleges to untar the filesystem and retain its permissions. If you don't have a root shell, put sudo in front of the tar and cp-av commands.
6) cd to the directory you downloaded the squeeze_05_2011.tar.gz into. then type
Code:
tar -zxvf squeeze_05_2011.tar.gz
cp -av ./freshsqueeze/* /full/path/to/sdextDebianpartition
sync
and wait for it to finish.
7) type
Code:
cp ./boot.txt /full/path/to/sdFAT32partition/boot
cp ./firstrun.txt /full/path/to/sdFAT32partition/firstrun
sync
8) Now is the time to copy back the stuff you backed up from the SD card to the FAT32 partition, and any apps2sd style stuff if you have it. Then unmount your SD card and put it in the phone.
Now all remaining steps are done on your Optimus. You're finished with the desktop pc.
9) Open a terminal on your Optimus. I like SL4A, but Terminal Emulator works well too. Both are free.
10) Next step merges your existing Android system files into the Debian partition. This is neccesary because I haven't compiled a kernel and don't know of one for the Optimus with UFS enabled. So, Debian gets bind-mounted over the Android rootfs ( / directory) and having the Android system files accessible in the Debian filesystem is required to keep them playing nicely together, while protecting the original Android files from Debian at the same time.
Code:
sh /sdcard/firstrun
You won't need this script ever again unless you change ROMs and/or need to reinstall Debian. Changing ROMS without reinstalling a fresh copy of Debian may mess things up a bit since system files vary between ROMs and you'll still have the Android files from your previous ROM in your Debian filesystem.
This script and the 'boot' script are both listed at the bottom of this post if you want to read 'em.
11) Next, remount system r/w, copy the 'boot' file to /system/xbin and chmod 4755 /system/xbin/boot. If scripts are in /system/xbin and executable, you can run them with 'su -c'
Code:
su
mount -o remount,rw /system /system
cp /sdcard/boot /system/xbin
chmod 4755 /system/xbin/boot
mount -o remount,ro /system /system
OK, a basic Debian filesystem with no extra packages is now installed!
my Debian filesystem is on my 2nd sdcard partition. The comments in the 'boot' script should explain how to use another partition if you have apps2sd running or somesuch (I don't have many Android apps on my phone so don't need/use apps2sd function)
to use the script as-is, your linux flavor should be in the 2nd card partition. I use Debian, but any Debian-based distro should work, for example Ubuntu or DSL.
open a terminal and type
Code:
su -c boot
don't kill the terminal app... leave it running in the background.
when you're finished with linux, reopen the same terminal and type
Code:
exit
to cleanly dismount your linux. No reboot required!
Before you exit the first run of your new Debian system, you should download some packages. I advise tightvncserver, xfce4 (and xfce4-goodies if you want the extra glitz like a cpu monitor, bandwidth monitor, and such, without hunting the individual packages) and iceweasel so you can have a real rebranded firefox on your Optimus.
Code:
apt-get update
apt-get install tightvncserver xfce4 xfce4-goodies iceweasel
It'll take a while to download all that. Lots of data.
Once it's done downloading, configure tightvncserver.
Code:
vncserver
It'll ask you for a password. Choose one that's easy to remember. You'll need to enter it in the VNC viewer as well (next step)
IMPORTANT!
tightvncserver will ask you if you want a view-only password. Tell it no!
next:
Code:
vncserver -kill :1
to politely exit the vncserver. Otherwise you'll have to exit the chroot, reboot the phone, and run the 'boot' script again or it'll open server :2, :3, and so on each time you type vncserver. Each instance will eat more CPU, RAM, etc.
configure /root/.vnc/xstartup
Code:
echo '#!/bin/sh
xrdb $HOME/.Xresources
xsetroot -solid grey
export XKL_XMODMAP_DISABLE=1
xfce4-session&' > /root/.vnc/xstartup
after that,
you should use
Code:
passwd
to set a root password, and
Code:
adduser
to get a non-root account on there.
Code:
exit
will close the chroot. You can close the terminal after that until you're finished setting up the VNCviewer and want to start your lovely GUI.
Now, set up the VNC viewer like in the OP. Make sure your password matches the one you gave tightvncserver!
I advise 24 bit color. It slows things down ever so slightly, but to me, it's well worth the increase in eye candy you get over 8 bit.
most of the tutorials on the VNC suggest modifying the /root/.bashrc file to start the vncserver automatically (like here on xda) but I don't like that myself. I use the shell a lot, and the vncserver eats system resources. So, I manually start and stop the vncserver from the command line.
Code:
vncserver
to start, it defaults to a 1024x768 which seems to make programs happier than the 480x320 phone native resolution.
Code:
vncserver -kill :1
to stop it politely. Otherwise a phone reboot is required to get rid of vncserver files (by clearing out everything in the / directory which isn't replaced by the boot.img ramdisk) which make it open desktop :2, :3, and so on each time you run the program.
One major advantage to the bind-mounting in the rootfs is that Thunar works as a root explorer, and has access to the entire Android filesystem (except for the bind-mounted Debian directories, which hide the Android directories underneath, including /system/etc which is symlinked to /etc by the boot.img ramdisk,) as well as the complete Debian filesystem.
Pretty much everything I've tried works, unless it wants speed from the display. The VNC just slows that down way to much to use for video or games or suchlike. I'm working on native window support for X, but I need more practice in C to get it done.
Iceweasel works great, if a little slow, a rebranded full firefox on an ARMv6 device that mozilla won't release an apk for its wussy mobile version on. Go figure. The biggest problem is finding plugins compiled for ARM, the 'get plugin' button send you to sites offering x386 versions of the plugins. Yuk.
Icedtea open source java works fine.
Gnash plays ads but not videos.
Gimp works well.
Qemu works!
Eclipse even installs and runs (very slowly)
get-flash-videos captures flash exceptionally well. combined with an Android video player for .mp4 files, you can download and watch flash from lots of places, just not streaming.
alsa audio works through Iceweasel. Played audio clips from yodajeff.com just to test it.
3g works great.
Wifi detects the connection with iwconfig, I haven't tried sending data through it but the way 3g plugs right in I bet that wifi works equally well.
Since wifi and 3g work out of the box, I bet bluetooth would too with some config, but it needs extra packages to see the functionality.
The network meter plugin for xfce works. The device is rmnet0.
The cpu meter plugin also works.
At one point I had the battery meter from xfce-power-manager working but my last install broke it somehow. Ah, well.
once it's all together
open a terminal
to start it up:
Code:
su -c boot
for a gui,
Code:
vncserver
to kill the GUI,
Code:
vncserver -kill :1
to exit the chroot,
Code:
exit
the first time you run the GUI, you might want to add my Xfce_large theme to make the scrollbars and menubars easier to hit on the touchscreen. See the earlier post.
hopefully this helps people out. I spent quite a while getting it just how I wanted it, many googlings and picking bits from here and there.
contents of the scripts follow.
firstrun
Code:
#make /sd-ext directory if it doesn't exist
if [ ! -d /sd-ext ]
then
mkdir /sd-ext
fi
# mount 2nd sdcard partition
# if your linux is on a different partition than 2, substitute that number for the 2 in .../mmcblk0p2 below
# first unmount it; if not already mounted, system will echo 'umount: can't forcibly umount /dev/block/mmcblk0p2: Invalid argument' but this isn't an error to worry about
umount -l /dev/block/mmcblk0p2
mount -o noatime,exec,suid /dev/block/mmcblk0p2 /sd-ext
#copy files from Android to Debian without overwriting anything
yes n | cp -aiv /etc/* /sd-ext/etc
yes n | cp -aiv /root/* /sd-ext/root
yes n | cp -aiv /sbin/* /sd-ext/sbin
yes n | cp -aiv /sys/* /sd-ext/sys
boot
Code:
# debian lives here
export mnt=/sd-ext
# remount / and /system rw
mount -o remount,rw / /
mount -o remount,rw /system /system
# make new subdirectories in / for binding
for x in \
bin boot home lib media \
opt selinux tmp usr var
do
mkdir /$x
done
#make $mnt directory if it doesn't exist
if [ ! -d $mnt ]
then
mkdir $mnt
fi
# mount 2nd sdcard partition
# if your linux is on a different partition than 2, substitute that number for the 2 in .../mmcblk0p2 below
# first unmount it; if not already mounted, system will echo 'umount: can't forcibly umount /dev/block/mmcblk0p2: Invalid argument' but this isn't an error to worry about
umount -l /dev/block/mmcblk0p2
mount -o noatime,exec,suid /dev/block/mmcblk0p2 $mnt
# cleanup last session's tmp files, including last VNC session
rm -r -f $mnt/tmp
mkdir $mnt/tmp
# bind mount debian directories to /
for x in \
bin boot home lib media \
opt selinux tmp usr var \
etc root sbin
do
mount --bind $mnt/$x /$x
done
# set some system variables
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/etc:/sys:$PATH
export TERM=linux
export USER=root
export HOME=/root
# mount proc,sys,devpts
umount -l devpts
mount -o remount -t proc proc /proc
mount -o remount -t sysfs sysfs /sys
mount -t devpts devpts /dev/pts
# softlink framebuffer (for future use,) and existing mounts
ln -s /dev/graphics/fb0 /dev/fb0
cat /proc/mounts > /etc/fstab
cat /proc/mounts > /etc/mtab
# 'boot' with chroot into debian bash shell at /
chroot / /bin/bash
# done now, clean up after exit to keep Android happy
# remove softlinks and replace backed up mtab and fstab
rm /dev/fb0
cd /
# unmount subdirectories
for x in \
bin boot home lib media \
opt selinux tmp usr var \
etc root sbin
do
umount -l /$x
done
# remove non-Android subdirectories
for x in \
bin boot home lib media \
opt selinux tmp usr var
do
rmdir /$x
done
# remount / and /system ro
mount -o remount,ro / /
mount -o remount,ro /system /system
That is an excellent write up. Link added to first post.
appreciate the compliment.
it took two hours to type up and another two to redo it all after firefox crashed on my pc right as I was finishing.
if anyone notices issues or errors in it, let me know and I'll try to fix 'em.
I'll try to help out if anyone has problems getting it working, odds are I missed some detail or typo.
well it took me all day to install ubuntu on this pc to find out it was my video card so im using the built in video on the mb and it worked.I will be doing this tomorrow as its 2am here now.ive never had a problem installing ubuntu before lol.the live cd would just freeze no matter which flavor of linux i used.
ummkiper said:
well it took me all day to install ubuntu on this pc to find out it was my video card so im using the built in video on the mb and it worked.I will be doing this tomorrow as its 2am here now.ive never had a problem installing ubuntu before lol.the live cd would just freeze no matter which flavor of linux i used.
Click to expand...
Click to collapse
eek.
I don't really like ubuntu much, it reminds me too much of Windoze, all bloated up and running a bunch of stuff I never told it to
but I put it on after reading dev reccomendations to use it when making the final switch from windoze, and now I only use it for watching dvds and the stupid digital tv the broadcasters switched to a while back to obsolete everyone's receivers (use an hvr950 usb tuner, which I had to force an older driver into the kernel to get working.)
put debian on the pc to dev with, much less gripey and intrusive, but trickier to configure.
ummkiper said:
well it took me all day to install ubuntu on this pc to find out it was my video card so im using the built in video on the mb and it worked.I will be doing this tomorrow as its 2am here now.ive never had a problem installing ubuntu before lol.the live cd would just freeze no matter which flavor of linux i used.
Click to expand...
Click to collapse
I have yet to get Ubuntu running nicely on a android. I'm sure i'll figure it out soon enough. I'm donating close to 2-4 hours a day to this right now. I hope i can get everything running how i like without learning how to write my own code... which would take forever ...
oh i dont want it on android i just wanted it on my desktop but it appears my desktop has issues while everything works fine in windows ubuntu still freezes or restarts the gui.i have xubuntu on my ibm thinkpad its slow but runs its ubuntu with xfce so i guess ill use my laptop to do this and keep win on my desktop.
ummkiper said:
oh i dont want it on android i just wanted it on my desktop but it appears my desktop has issues while everything works fine in windows ubuntu still freezes or restarts the gui.i have xubuntu on my ibm thinkpad its slow but runs its ubuntu with xfce so i guess ill use my laptop to do this and keep win on my desktop.
Click to expand...
Click to collapse
it shouldn't really matter too much what machine you use to set things up, the key things you need are a way to untar the premade filesystem, ext2 support, and a usb port to transfer files to the phone.
you could download the files in windoze if your laptop lack web access.
you <might> be able to use a windoze utility to format the first part of the SD card with a small FAT32 partition, then use CWMA recovery to add an ext2 partition to the card, then extract with 7zip on windoze into the ext partition.
I used to have a freeware program to add ext2 support to windoze, but it's buried on one of my old 500Mb harddrives in a box somewhere. bet you could google something like that up if your laptop gives you trouble.
cp ./boot.txt /media/disk/boot
cp ./firstrun.txt /media/disk/firstrun
sync
cp: cannot stat `./boot.txt': no such file or directory
cp: cannot stat `./firstrun.txt': no such file or directory
yeah um i dont see these files in the tar and this is the errorr im getting so where do i get these 2 files from
ummkiper said:
cp ./boot.txt /media/disk/boot
cp ./firstrun.txt /media/disk/firstrun
sync
cp: cannot stat `./boot.txt': no such file or directory
cp: cannot stat `./firstrun.txt': no such file or directory
yeah um i dont see these files in the tar and this is the errorr im getting so where do i get these 2 files from
Click to expand...
Click to collapse
I made the tar some time back.
boot.txt and firstrun.txt are attached to the bottom of the instructions.
edit: per ummkiper's suggestion I have also linked the attachments right after the filesystem link.

Got My Xoom running Debain native (without chroot)

Hey all,
I've installed Debian on my Xoom with the help of a few kernel patches applied to the Tiamat Sources and thought I'd share.
I can't post in the development section because I don't have enough posts. (Admin edit: Now in Development!)
I've got a full writeup of the process of installation from the ground up below
I'll be uploading the rootfs and boot.img for it when I get a chance, but i just thought some people would be interested to know that it is indeed possible (without VNC or Chroot...)
WiFi works under linux when you manually run wpasupplicant, the modem is detected by network-manager automatically and I've gotten the touchscreen working so it's actually pretty usable. no sound or graphics acceleration though as they rely on binary blobs from Nvidia.
Cheers,
Matt
Hey all,
I've seen a lot of people running linux on their android devices but chrooted under android and using a VNC client to make use of the chrooted install. quite messy and less than efficient IMHO, so I set out to install it natively on my Xoom
I've managed to get Debian installed on my Xoom with the only issues being no sound and no Bluetooth, this is due to the proprietary nature of the sound drivers for the Tegra, and the lack of documentation for the BCM4329 Bluetooth under linux. if anyone has any tips with these I'd love to hear them.
Anyway, since the Xoom is an android device with an unlockable bootloader from the factory this wasn't too difficult. the only issues were with the TegraFB and Touchscreen drivers. Thankfully Lilstevie from GalaxyLinux helped me out with the touchscreen driver and Robert Morell from NVidia provided a patch to Chromium for the FB which is here http://codereview.chromium.org/6672056
(Todo: Add guide for using WIFI, upload prebuilt images)
(Update: Fixed the links)
Basically all you need to do is build a root fs and a kernel for your Debian install. this is actually quite easy. here's how..
Contents:
Requirements
Building the RootFS
Building the Kernel
Preparing the SDCard
Putting it all together
Rolling back to Android
Acknowledgements
Disclaimer
YOU DO THIS AT YOUR OWN RISK! I TAKE NO RESPONSIBILITY FOR ANY DAMAGES TO YOU, YOUR DEVICE,
YOUR COMPUTER, OR ANY OF YOUR PROPERTY OR SOMEONE ELSE'S PROPERTY
Requirements
A Rooted Xoom with ClockWorkRecovery Installed
[*] Make sure you have a nandroid backup. you will need this to boot back into Android!
A running install of Debian, Ubuntu might work too
An SDCard with at least 4GB for the install, preferably separate from your main SDCard and an SDCard reader for your PC
Android–SDK
An Arm–linux toolchain to compile the kernel, if you're lazy like me you can just use the one that comes with the Android NDK
This Xorg Config
Kernel sources
Fastboot tool
mkbootimg
Building the RootFS
Before we do anything we'll need to get the Wifi Firmware off the default install of Android
To do this run the following commands
Code:
# adb pull /system/vendor/firmware/fw_bcm4329.bin
# adb pull /system/etc/firmware/bcm4329.hcd
MAKE A BACKUP OF YOUR SDCARD AND YOUR XOOM USING CLOCKWORK RECOVERY BEFORE CONTINUING AND KEEP IT SOMEWHERE SAFE!
Now lets install the tools you'll need to create the rootfs
Code:
# apt–get install binfmt–support qemu qemu–user–static debootstrap
Once that's done, make a directory for the rootfs to sit in until it's ready for the SDCard and start installing the debian base
Code:
# cd ~
# mkdir deb_arm
# mkdir deb_arm/boot
# sudo /usr/sbin/debootstrap ––foreign ––arch armel squeeze deb_arm/ [url]http://ftp.au.debian.org/debian[/url]
Once that's done you'll need to copy across some qemu files so you can chroot into the deb_arm folder and finish the installation of the base system
Code:
# sudo cp /usr/bin/qemu–arm–static deb_arm/usr/bin
# sudo chroot deb_arm
# export LC_ALL=C
# export LANGUAGE=C
# export LANG=C
# cd /debootstrap
# ./debootstrap ––second–stage
once that's done you'll need to edit your apt sources, to do so run the following
Code:
# echo debandroid > /etc/hostname
# echo "deb [url]http://ftp.debian.org/debian/[/url] squeeze main contrib non–free" > /etc/apt/sources.list
# apt–get update
And then install any of the apps you'll want to run on your xoom, I'd recommend at least xorg, gdm3 and gnome, so
Code:
# apt–get install xserver–xorg–video–fbdev xserver–xorg–input–evdev gdm3 gnome initramfs–tools wpa-supplicant
You may find that you get an error like the following
Errors were encountered while processing: bluez gnome–bluetooth gnome–user–share gnome–desktop–environment
If you do, it's safe to ignore this for now. you can always complete the installation of any non–critical packages on the device. it seems to be something weird with the chroot or the qemu emulation of ARM (if anyone knows a way to fix this I'd be glad to hear it!)
Once that's done, you'll not only want to set your root password but you'll want to add a standard user account too
Code:
# passwd root
# adduser liv2
# addgroup ––gid 3003 inet
# usermod –aG 3003 liv2
The addgroup and usermod are especially important, the android kernel doesn't normally allow network access to non–root accounts. so we have to add the special group then give the user access to that group (or you could compile the kernel to not use the android paranoid network settings)
Once that's done, exit out of the chroot by hitting CTRL+D and copy the xorg config to deb_arm/etc/X11/ and copy in the wireless firmware you copied at the start
Code:
# mkdir ~/deb_arm/lib/firmware
# cp ~/fw_bcm4329.bin ~/deb_arm/lib/firmware
# cp ~/bcm4329.cal ~/deb_arm/lib/firmware
Building the Kernel
For this part, make sure you've extracted the kernel sources, and the android–ndk to somewhere, in my case they've been extracted in ~/Downloads
Code:
# cd ~/Downloads/Tiamat–AOSP–Tiamat–Xoom–798572c/
# export CROSS_COMPILE=~/Downloads/android–ndk–r5b/toolchains/arm–eabi–4.4.0/prebuilt/linux–x86/bin/arm–eabi–
# export ARCH=arm
# export INSTALL_PATH=~/deb_arm/boot
# export INSTALL_MOD_PATH=~/deb_arm
# make tiamat_defconfig
# make menuconfig
Once you've got the menuconfig screen up, go to Device Drivers > Character Devices > and enable "Virtual Terminal"
go to Device Drivers > Graphics Support > Console Display Driver support > enable "Framebuffer Console Support"
once you've enabled that, exit out and save the changes
Build the kernel and prepare it for use
Code:
# make –j2
# sudo make modules_install
# sudo cp arch/arm/boot/zImage ~/deb_arm/boot
# cp System.map ~/deb_arm/boot/
# chroot ~/deb_arm
# mkinitramfs –o /boot/initrd.img.gz `ls /lib/modules`
mkinitramfs may show some warnings like "warning: can't open /etc/mtab:" and "pkg: version '2.6.36.4Tiamat_Xoom–v1.4.4–Full_Throttle' has bad syntax: invalid character in version number" but it doesn't seem to have caused any issues for me.
Preparing the SDCard
Plug your SDCard reader into your computer and insert the card, you'll then need to partition and format it so make sure you've backed up the content of the card.
Partition it so you have two partitions, the first one being a FAT32 Partition for CWR and for anything you might want to use it for under Android.
Your second partition will need to be EXT3 and big enough to fit your debian install with some room to breathe (about 4GB in my case), you can check how much space you'll need for this by running du -sh ~/deb_arm
Once you've partitioned it, format the first partition as FAT32 and the second partition as EXT3. once you've done that you should put the SDCard back in your Xoom and make a new nandroid backup just to be sure
Code:
# sudo mkfs.ext3 /dev/sdb2
# sudo mkfs.msdos /dev/sdb1
Putting it all together
First we'll mount the SDCard on your PC and copy across the Root FS
# sudo mkdir /mnt/sdcard
# sudo mount /dev/sdb2 /mnt/sdcard
# sudo cp -arv ~/deb_arm/* /mnt/sdcard/
# umount /mnt/sdcard
Click to expand...
Click to collapse
Go to the folder you unpacked mkbootimg to and copy in the boot.img from your CWR backup.
Once you've done that, follow the below steps to create the new boot.img for Debian to use
Code:
# cd ~/Downloads/mkbootimg
# cp ~/deb_arm/boot/zImage .
# cp ~/deb_arm/boot/initrd.img.gz .
# mkdir out
# ./unpackbootimg –i boot.img –o out/
# ./mkbootimg ––kernel zImage ––ramdisk initrd.img.gz ––base "`cat out/boot.img–base`" \
––cmdline "root=/dev/mmcblk0p2 console=tty0" –o newimg.img
Now reboot your Xoom into Fastboot mode and insert the SDCard, this can be done by holding power + volume up until the screen goes black, then power it back on and hold down the volume down key
Code:
# cp ~/Downloads/fastboot .
# ./fastboot flash boot newimg.img
# ./fastboot reboot
Your Xoom should now boot up into Debian, on the login screen select the accessibility options and enable on-screen keyboard to log in.
Alternatively, if you happen to have a USB-OTG adapter you can just use a keyboard and mouse to interact with the system.
Going Back to Android
To Roll back to Android, simply boot into Clockwork Recovery, go to Backup/Restore > Advanced Restore and restore boot.img only, reboot and you'll be back in Android
Acknowledgements
Lopi from the IX Project was a great help, and so was everyone from #IX
Lilstevie from @GalaxyLinux provided the Touchscreen patches
Framebuffer Patch was originally provided by Robert Morell for the Chromium Project
RootFS instructions are based on info at the Debian Wiki
Wow fantastic work, soon as I have some time to dedicate to this, I"m going to have a crack at it.
Reserved. Awesome. Hey OP just bump this thread to get your post count up so you can post this in developement. I was looking for an alternative that didn't require vnc.
Sent from my PC36100 using XDA App
I've asked a mod to move it now, I think I have the required postcount now anyway.
Just to note, you should be able to install Ubuntu, Gentoo, Fedora etc as long as you can build the root and the initrd for it.
If you do go through with this, be sure to post here! I'd love to see some ubuntu or gentoo or anything running on people's xooms really.
Also, I'm currently uploading a video I made showing how usable it really is
Cheers
maybe one day we can have a dual boot....<insert e-gasm>
Another reason xoom is a great tablet. I'm not linux savvy so I hope this becomes much easier in the future.
bilago said:
maybe one day we can have a dual boot....<insert e-gasm>
Click to expand...
Click to collapse
Actually, you kinda can!
If you don't need 3G support under Linux, you can flash the boot.img to the recovery partition and boot it that way.
If you need to use CWR later you can just restore the partition from a backup
LIV2 said:
Actually, you kinda can!
If you don't need 3G support under Linux, you can flash the boot.img to the recovery partition and boot it that way.
If you need to use CWR later you can just restore the partition from a backup
Click to expand...
Click to collapse
Can you post a pre configured build for users that dont know much about linux can use once you get sound working?
Unfortunately it's not likely I'll get the sound working due to the proprietary nature of the sound drivers. I should be able to upload the prebuilt packages soon though.
Isn't sound support typically built into the kernel or at least built as a kernel module? Is there something i'm missing?
Hey,
The problem with the sound is the same reason there is no GPU Acceleration, it requires proprietary support from NVidia binary blobs that I don't have.
It's possible I will be able to get it going properly once they release the next Linux4Tegra, but I'm not sure.
I've tried to get this going with Gentoo all weekend. I can't seem to get any boot.img to boot on the Xoom once flashed (just stays frozen at the Moto logo). Apparently fastboot boot is locked out as well so I am unable to get any debug info on screen...
Hey equid0x
I'd be glad to help
Did you make sure to enable vt support in your kernel and set console=tty0 in your boot parameters?
Is it rebooting itself when you try to use your boot.img? if so make sure your initrd is being stored in the SRV4 format, you can do this by gunziping it then type file initramdisk.img which will tell you the version.
if that doesn't help let me know
looks like i left out a step in the kernel config section
which is "go to Device Drivers > Graphics Support > Console Display Driver support > enable "Framebuffer Console Support" " after enabling VT Support
I've updated the OP now.
hi LIV2, interesting stuff you're working on here. i'm not sure if you're aware, if you aren't this is gonna be a good news most likely: http://phoronix.com/forums/showthread.php?56505-Linux-for-Tegra-release-12-alpha-1-Released
I believed there are binary blobs inside the package (haven't got the time to look at it), but there might be kernel changes needed to make it work too. I'm not sure as I'm not an expert in this area. But hopefully, this would realize a full blown linux OS on our Xoom.
Hebrew + Easy Dual Boot + Awesomeness
Well aint this something !!!
Have been waiting for this type of functionality for a long time !!! This absolutely awesome !!
So first of all - THANK YOU !
Second of all - Is there any chance you could include hebrew package with the RTL support ?
P.S : the dual boot idea is cool, but is there a way to make the device just boot into linux with a click on an icon ? (I mean run an app from android that'll reboot the tab into debian)
Firstly: this is awesome. Thank you for putting this how-to together. I've been wanting to boot Linux natively off my Xoom pretty much since the day I got it.
I originally tried to set up the chroot environment on Fedora and had all kinds of weird issues with the packages. I'm not sure if it was me or Fedora, but I ended up doing it in an Ubuntu VM instead and it worked out fine. Ultimately I'd like to actually get Fedora on the Xoom (maybe Ubuntu if I can get Unity to behave; the interface could be nice with a touchscreen).
Also, a question: How did you get your wifi set up? You noted that wpa_supplicant would work but I don't even seem to have a wifi interface present unless it has a name other than wlanX. It's not the usb0 interface, is it? My 3G adapter seems like it's recognized in the NM applet but I don't have a data plan, so it doesn't do me much good.
Lastly, I'll add a picture to the collection. Nothing super exciting - this is XFCE running on top of Debian. I've never been a big fan of GNOME and I figured it might be a little snappier
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
arctu said:
hi LIV2, interesting stuff you're working on here. i'm not sure if you're aware, if you aren't this is gonna be a good news most likely: http://phoronix.com/forums/showthread.php?56505-Linux-for-Tegra-release-12-alpha-1-Released
I believed there are binary blobs inside the package (haven't got the time to look at it), but there might be kernel changes needed to make it work too. I'm not sure as I'm not an expert in this area. But hopefully, this would realize a full blown linux OS on our Xoom.
Click to expand...
Click to collapse
Awesome
I've compiled a kernel with the audio components from the L4T Kernel sources but they don't seem to include codec support for the Xoom, I'm still playing around with this
However that is going to hopefully help with GPU support
Hyperion82 said:
Well aint this something !!!
Second of all - Is there any chance you could include hebrew package with the RTL support ?
P.S : the dual boot idea is cool, but is there a way to make the device just boot into linux with a click on an icon ? (I mean run an app from android that'll reboot the tab into debian)
Click to expand...
Click to collapse
I'll see what I can find re: language. shouldn't be too difficult, it'd just be a few different steps
As for the dualboot idea, it'd be possible to do so but I'm no coder
All it'd require is dding the boot img from within android, not sure how the NAND would hold up to constant rewrites though
eldarerathis said:
Firstly: this is awesome. Thank you for putting this how-to together. I've been wanting to boot Linux natively off my Xoom pretty much since the day I got it.
I originally tried to set up the chroot environment on Fedora and had all kinds of weird issues with the packages. I'm not sure if it was me or Fedora, but I ended up doing it in an Ubuntu VM instead and it worked out fine. Ultimately I'd like to actually get Fedora on the Xoom (maybe Ubuntu if I can get Unity to behave; the interface could be nice with a touchscreen).
Also, a question: How did you get your wifi set up? You noted that wpa_supplicant would work but I don't even seem to have a wifi interface present unless it has a name other than wlanX. It's not the usb0 interface, is it? My 3G adapter seems like it's recognized in the NM applet but I don't have a data plan, so it doesn't do me much good.
Lastly, I'll add a picture to the collection. Nothing super exciting - this is XFCE running on top of Debian. I've never been a big fan of GNOME and I figured it might be a little snappier
Click to expand...
Click to collapse
Awesome!
Something I have to add to the guide is the wifi, to do this you should have the module for bcm4329 in your /lib/modules somewhere
so to use it, run modprobe bcm4329 nvram_path=/lib/firmware/bcm4329.cal firmware_path=/lib/firmware/fw_bcm4329.bin
then you should see the interface as eth0
you'll need to make sure your wpa_supplicant conf has ap_scan=1 and fast_reauth=1 set, otherwise it won't find any APs
LIV2 said:
Awesome!
Something I have to add to the guide is the wifi, to do this you should have the module for bcm4329 in your /lib/modules somewhere
so to use it, run modprobe bcm4329 nvram_path=/lib/firmware/bcm4329.cal firmware_path=/lib/firmware/fw_bcm4329.bin
then you should see the interface as eth0
you'll need to make sure your wpa_supplicant conf has ap_scan=1 and fast_reauth=1 set, otherwise it won't find any APs
Click to expand...
Click to collapse
D'oh, I didn't even think to try running modprobe, I just assumed it was loaded That was the ticket, and wireless is working great (posting from the Debian install now!).
Looks like it's play time for me...thanks again!

[modules] cifs.ko, md4.ko, nls_utf8.ko, stock [4.2 / 4.2.2] 3.4.5-g4e6298b / gaf9c307

I have managed to get CIFS working on stock Nexus 10.
It's quite a bit more problematic on the Nexus 10 than normal.
There are 2 main issues to deal with. Newer versions of the Linux kernel require a UNC variable to be passed to them and the current version of busybox doesn't do this. There is a patch out. I have extracted the patched busybox binary from craigacomez's AOSP Nexus 10 rom.
(Check it out here: http://forum.xda-developers.com/showthread.php?t=1998585 ). Otherwise it should work on the stock mount command if you specify the unc= mount option with the share.
The other issue is the multiuser stuff. If you execute the mount command from inside Terminal Emulator (or a script program) it looks like it mounts ok and you can 'ls' in the directory but it doesn't work for Android apps, they just see an empty directory but if you do it via a 'adb shell' it works fine in Android apps. My theory is ADB is outside of the multiuser stuff. adb actually ships on the device.
1) Unlock bootloader (fastboot oem unlock)
2) Flash recovery adb flash recovery whatever.img
3) Root device (flash CWM-SuperSU-0.98.zip)
4) Install BusyBox (from the market)
5) Copy md4.ko and cifs.ko to device. The files can go anywhere you like. In this example I will just use the root of the sdcard. Some people like them in /system/modules or /system/lib/modules
6) busybox mount -o rw,remount /
7) adb shell
8) Override /system/bin/busybox with the patched version (maybe move it first so it's backed up).
9) insmod /sdcard/md4.ko
10) insmod /sdcard/cifs.ko
11) busybox mount -t cifs -o username=MYUSER,password=MYPASS,unc=\\\\192.168.1.1\\storage //192.168.1.1/storage /data/media/0/cifs/Storage
You will need to manually preform the last 3 commands each time you reboot the device from a adb shell.
NOTE: You can probably get rid of the -o flags completely. In theory the patched version of busybox makes the UNC bit redundant. Possibly you can use the stock busybox with the UNC flag and avoid using the patched one totally. I have just included it to be sure.
Make sure you type 'busybox mount' not 'mount', by default they are different binaries. Otherwise you can remove the /system/bin/mount command and make a new one linking /system/bin/mount to /system/bin/busybox.
Possibly there is some way to get the mount working in the multiuser environment without requiring busybox. If you figure it out please tell ☺
Some threads on the issue:
http://forum.xda-developers.com/showthread.php?p=34397868#post34397868
http://forum.xda-developers.com/showthread.php?t=733490&page=6
http://www.mail-archive.com/[email protected]/msg17650.html
The modules are for 3.4.5-g4e6298b.
EDIT: I added nls_utf8.ko by request
EDIT2: Since adb comes on the device, it is possible to use it to connect to local host:
1) Install cifs modules to /system/lib/modules
2) Install Script Manager from the play store
3) Copy script to device
4) Start SManager
5) Find your script and open it.
6) Tick the su box
7) Hit save
8) Goto home sccreen
9) Add a 'SMShortcuts' widget to your home screen
10) "Add one script shortcut"
11) Choose your script
12) Optionally use this pretty icon ☺
13) Give it a nice name like "Mount Shares"
Here is a shell script...
Code:
#!/system/bin/sh
# Your settings here
USERNAME="USERNAME"
PASSWORD="PASSWORD"
IPADDRESS="192.168.1.1"
SHARE="storage"
MOUNT_POINT="/data/media/0/cifs/Storage"
# If you need to change the mount command edit this
MOUNT_CMD="\
mount -t cifs \
\
-o \
user=$USERNAME,\
password=$PASSWORD,\
unc=\\\\\\\\\\\\\\\\$IPADDRESS\\\\\\\\$SHARE \
\
//$IPADDRESS/$SHARE \
$MOUNT_POINT"
COMMANDS="\
insmod /system/lib/modules/md4.ko; \
insmod /system/lib/modules/nls_utf8.ko; \
insmod /system/lib/modules/cifs.ko; \
$MOUNT_CMD
"
# Starting ADB...
PORT=`getprop service.adb.tcp.port`
setprop service.adb.tcp.port 5555
adb kill-server
adb start-server
stop adbd
start adbd
adb connect localhost
# Make sure we only use the first device (sometimes there is more than one)
SERIAL=`adb devices | head -n2 | tail -n1 | cut -f1`
if [ "$SERIAL" = "" ] ; then
echo "ERROR: Could not find ADB device.";
fi
echo Mounting share via adb...
adb -s $SERIAL shell su root -c "$COMMANDS"
# If you started adb, then stop it here for security:
adb disconnect localhost
stop adbd
setprop service.adb.tcp.port $PORT
start adbd
RESULT=`mount | grep $MOUNT_POINT`
if [ "$RESULT" = "" ] ; then
echo "Mounting failed..."
else
echo "Mounting sucess!"
fi
echo Done... You may close this script window.
EDIT3: Added usbserial.ko, option.ko and usb_wwan.ko
EDIT4: Some users have reported that the need to modify the script to get it working with their version of SU.
EDIT5: I have uploaded modules for 4.2.2, kernel 3.4.5-gaf9c307 but I haven't actually tested them myself (still on 4.2.1). Apparently the adb loophole has also been patched but it is possible to reenable it by putting a RSA key onto the device. Check out this set of instructions here.
EDIT6: I have updated to 4.2.2 on my Nexus 10 and can confirm the new modules work.
You must setup the adbkey or you will get a "device: offline" message. By default adb when adb first runs it tries to create the keys in the $HOME dir which is /data/.android, but the data directory isn't accessible by the 'shell' user.
I got it working simply by setting the HOME variable to /sdcard and restarting the adb server in the script then Android popped up a query (I have update the script above).
IMPORTANT: The Android Media scanner recursively scans folders for media to add the the database so it shows up in programs like Google Music. On large shares this can be a long process and use heaps of battery life. To prevent this add a blank file with the name ".nomedia" to the root of your mount points (or each individual share if you aren't used 1 folder for all your mounts). This will stop music showing up in programs though.
If you find that the device stops responding (the launcher might work but apps fail to load) or you get reboots (often after the previous bug) this is probably due to a bad wifi connection.
Is it posible to make a CWM flash file?
Great
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
alias_neo said:
This is great progress, do you know if there is some way I can use the same to mount my usb OTG with ADB shell so that I can read/write to my pen drives from my android apps/file managers?
I have tried using the busybox mount but that didn't work, do I need the modified mount or will none of this help anyway?
Click to expand...
Click to collapse
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
craigacgomez said:
Code:
busybox mount -t FSTYPE /dev/block/sda1 MOUNT_LOCATION
Example:
Code:
busybox mount -t vfat /dev/block/sda1 /storage/sdcard0/usbotg
Click to expand...
Click to collapse
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Although I don't have nexus 10, I am having the similar mounting issue on my nexus 7 until I saw this post.
Advise about "adb shell" really helps me resolve the multiuser issue.
Thanks for sharing.
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
H3g3m0n said:
1) Unlock bootloader (adb oem unlock)
Click to expand...
Click to collapse
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
momulah said:
Is it posible to make a CWM flash file?
Click to expand...
Click to collapse
Not a high priority right now as currently you need to do the manual adb shell stuff by hand to get things mounted, a little extra setup work isn't a huge difference.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
Are you mounting in a 'adb shell' or locally in something like terminal emulator? My OTG cable won't be here for a while so I can't really test myself.
weasal said:
Any chance you could post the nls-utf8.ko for utf8 support?
Thanks!
Click to expand...
Click to collapse
Posted, haven't tested it but it seemed to insmod fine.
espionage724 said:
Isn't it fastboot that unlocks the bootloader, and not adb? (unless adb can do it too; I've only heard of fastboot though)
Click to expand...
Click to collapse
Yeh typoed, i'll fix that now.
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
alias_neo said:
How is this different to what I'm doing already? Mounting this way doesn't work, only the process that mounted it can see the files.
Click to expand...
Click to collapse
I've been working on getting OTG support natively in my AOSP based custom ROM and I have had some success... check out my ROM for details
H3g3m0n said:
Currently I'm thinking of ways to hack around the 'adb shell' requirement, as a basic hackish fix would be to make a program that turns on adb wireless, connects to the local device and issues a command. Of course possibly there is a 'proper' way to do mounting. Another lazy way for those with their shares on a Linux system would be a script issue commands to the server via a ssh, getting it to log back into the phone and mount stuff over adb wireless.
Click to expand...
Click to collapse
Just wanted to thank H3g3m0n as I was able to successfully mount over adb. Also came up with a workaround to bypass connecting to a PC, grabbed the arm fastboot binary from this thread and installed it on my nexus 7. Used it to connect wireless adb on the 10 and ran the mount commands on the 7.
H3g3m0n said:
Posted, haven't tested it but it seemed to insmod fine.
Click to expand...
Click to collapse
Thanks, I'll give it a try!
You might find my posts #156 and #162 at http://forum.xda-developers.com/showthread.php?t=1781411&page=17 helpful.
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
spdwiz18 said:
Sorry for the noob ? ...
What are the KO's do?
What is the practical use of then.
Sorry I did a little research on then but I could not find an answer in layman terms
Thank you for allowing me to learn.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
http://en.wikipedia.org/wiki/Loadable_kernel_module
craigacgomez said:
http://en.wikipedia.org/wiki/Loadable_kernel_module
Click to expand...
Click to collapse
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
These modules are needed to enable support for CIFS (Windows share) mounts...
spdwiz18 said:
That helps allot.... Now i have an understanding of ko's in general. But what specificly do the modules this thread refers to do and the practical use of then. Thanks foot the help.
Sent from my toroplus using xda premium
Click to expand...
Click to collapse
Basically you can setup a shared folder from a remote computer. It allows you to have files on another system accessible as if it was part of the internal storage in the device.
Just found out that Android ships with the adb binary on the device itself (after crosscompiling it myself :/, oh well the experience was useful).
It should be possible to setup a script to start the adb server, connect to the localhost and execute the mount without too much difficulty.
Ok, added a script and instructions to the front page for simple on tablet mounting.

SOLVED! Python on the command line (scripts on post #17)

Hello everyone,
If your just reading this, skip to page 2 to save me some embarassment... Been a learning curve.
Go here .... http://forum.xda-developers.com/showpost.php?p=47607547&postcount=17
First post here and well I hope it's in the right place. I am definitely a novice programmer, am a little comfortable writing small python scripts which leads to this...
I got my phone rooted, I have sl4a ( It Nice! I like it. You like dogs?), and I just got my CM 10 source on Ubuntu 10 like Google recommends. I got adb working and Terminal IDE so I originally wanted to get python to be able to be called by the bash shell it provides ( I think its bash). I sorta got it working for a single session but what a drag, and I would get an error along the lines that the title suggests, so I,m not happy about that.
I also managed to get a copy of python from com.googlecode.pythonforandroid into /system/bin/ and now when I type "python" into an ADB shell I get the python interpreter!!! Whoo hooo, but I still got that same error. A "import sys", "import ephem", and maybe a few more workes but still something is wrong it said something thiss stuff here..
"""[email protected]:/data/data # python
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
'import site' failed; use -v for traceback
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>>
"""
update/bump
Ok so looking at the error message again it seems that it wants two prefixes for the $PYTHONHOME variable, I assume two paths and the secon one is to the executable that I put in /system/bin/ which is already in my path hence why python is callable. I had also fumbled around haphazardly with my $PATH vriables the other day and may have added the path to some of the libs python was asking for such as libpython2.6.so, I think I added the directory that lib is found in to my path (its found in "/data/data/com.googlecode.pythonforandroid/files/python/lib/" I think, need to double check that one), so thats what ive done that made this 'click' so to speak into popping out the python interpretor.
Also I found this file...MSM8960_lpm.rc but I forgot from where it came. It looks as if it contains some global variables that get set during boot, am I right?
This is the top part of it...
"""
on early-init
start ueventd
on init
sysclktz 0
loglevel 3
# setup the global environment
export PATH /sbin:/vendor/bin:/system/sbin:/system/bin:/system/xbin
export LD_LIBRARY_PATH /vendor/lib:/system/lib
export ANDROID_BOOTLOGO 1
export ANDROID_ROOT /system
export ANDROID_ASSETS /system/app
export ANDROID_DATA /data
export EXTERNAL_STORAGE /mnt/sdcard
export EXTERNAL_STORAGE2 /mnt/sdcard/external_sd
export USBHOST_STORAGE /mnt/sdcard/usbStorage
export ASEC_MOUNTPOINT /mnt/asec
export LOOP_MOUNTPOINT /mnt/obb
export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
"""
So I am thinking that if I set the paths to my Python exec and libs here, as well as Paths for Lua, Perl, JRuby, Python 2.7, Etc, etc then I would have an assortment of scripting languages to launch into ffrom ADB, am I right? This would help me and others write scripts for ADB in many languages to do repetitive grunt work from scripts.
Any advice would be great as it works but its like python is injured, "import os" didnt work ;( but "import sys" did
It would also be nice if these same vriables could be set for Terminal Emulator, Terminal IDE, and the like, I know SSH is in the works with T. IDE and that one has telnet though I havent figured that out yet.
What should I do? This seems like an OS related issue but if the interpreter is there and compiled for arm and the libs aswell why would this not work?
python -v output
this is the "python -v" output to show what's happening, maybe it'll help....
"""
[email protected]:/ # python -v
Could not find platform independent libraries <prefix>
Could not find platform dependent libraries <exec_prefix>
Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>]
# installing zipimport hook
import zipimport # builtin
# installed zipimport hook
'import site' failed; traceback:
ImportError: No module named site
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> import os
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named os
>>>
# clear __builtin__._
# clear sys.path
# clear sys.argv
# clear sys.ps1
# clear sys.ps2
# clear sys.exitfunc
# clear sys.exc_type
# clear sys.exc_value
# clear sys.exc_traceback
# clear sys.last_type
# clear sys.last_value
# clear sys.last_traceback
# clear sys.path_hooks
# clear sys.path_importer_cache
# clear sys.meta_path
# clear sys.flags
# clear sys.float_info
# restore sys.stdin
# restore sys.stdout
# restore sys.stderr
# cleanup __main__
# cleanup[1] zipimport
# cleanup[1] signal
# cleanup[1] exceptions
# cleanup[1] _warnings
# cleanup sys
# cleanup __builtin__
# cleanup ints: 3 unfreed ints
# cleanup floats
[email protected]:/ #
"""
That snippet you posted is from the init.rc inside the boot.img...so yes, it has all sorts of initialization code
CNexus said:
That snippet you posted is from the init.rc inside the boot.img...so yes, it has all sorts of initialization code
Click to expand...
Click to collapse
Ok, so I'll so some reading on setting $PYTHONHOME variable and others, I need to learn how that all works anyways. Most if not all of what I find documents how to set the variables for Windows, Mac, or Linux and not for Android. I will do my best to use that knowledge to fit this situation. I also need to dive around the file system a bit more and find all those libs and try to get the paths set for those to work with ADB and not just SL4A.
If I can do that maybe some more Linux programs/commands can be moved into Android's system, I know alot of the GUI apps for Linux have dependencies for python and gtk and qt, those modules might be portable to Android if they haven't already done so. Not to mention the other interpreters like Perl. To be perfectly honest what I want to do is port over Kali's toolset (at least the cmd line tools) over to android to they can be run from a terminal emulator or adb its self. Thats what I want to do with it, then wrap it all up into a ROM and build it. I know they have already compiled most of Kali's and BackTrack's programs on ARM so I was thinking of pulling those apps from there after an upgrade and then moving them into Androids system e.g /system/bin : /system/lib : /etc/* and so on, if the file systems are too different I suppose I can add directories and make a PATH for them or add them to $PATH once I learn how all that works.
Any good documentation on related issued anyone might be able to link to would be great, I'll be droppin by every so often while I'm grinding through google, thanks in advance for any help and thank you for your time, a bit of a read I suppose.
Environment variables like that would need to be set inside the boot.img, so if you want to unpack it and see exactly how things are defined and what other files are there (good exercise all around IMO), grab my tools from over here and unpack it for yourself and take a look:
cool tools
CNexus said:
Environment variables like that would need to be set inside the boot.img, so if you want to unpack it and see exactly how things are defined and what other files are there (good exercise all around IMO), grab my tools from over here and unpack it for yourself and take a look:
Click to expand...
Click to collapse
Well I downloaded twrp 2.3.1.0-d2spr and I used the split_boot tool in the package and got a little tree of files including the init.rc and the other msm one, they seem very similar if not identical (?), weird.
I just have a quick question, do I need to repack all this at a certain size? In other words, if I make any changes in the ramdisk image will it refuse to boot? I browsed over some sites and read somewhere that if I changed the kernal image it would fail a hash check and that the type of hashing ( I use bubble bags, but that's for another forum). How much attention do I need to pay to the size of these files I may alter before I repack and flash to the device?
Edge-Case said:
Well I downloaded twrp 2.3.1.0-d2spr and I used the split_boot tool in the package and got a little tree of files including the init.rc and the other msm one, they seem very similar if not identical (?), weird.
I just have a quick question, do I need to repack all this at a certain size? In other words, if I make any changes in the ramdisk image will it refuse to boot? I browsed over some sites and read somewhere that if I changed the kernal image it would fail a hash check and that the type of hashing ( I use bubble bags, but that's for another forum). How much attention do I need to pay to the size of these files I may alter before I repack and flash to the device?
Click to expand...
Click to collapse
Yes, actually. You need to repack at certain offsets/addresses or the device will be unable to read it properly
Run the boot_info script on your .img file and it will give you everything you need to know to repack the boot.img correctly
First you gotta repack the ramdisk (repack_ramdisk [optional out file])
Then after you do that, you can use the mkbootimg binary along with the info from my boot_info script to make a new boot.img with the right offsets
I've done a ton of boot.img splitting, so here's what it should look like (I forget the cmdline parameter)
Code:
mkbootimg --kernel KERNEL --ramdisk RAMDISK --base 0x80200000 --oversize 2048 --cmdline 'android.I.don't.remember.this.one' --ramdiskaddr 0x81500000 -o new_boot.img
Sent from my S3 on Sense 5 (you jelly?)
CNexus said:
Yes, actually. You need to repack at certain offsets/addresses or the device will be unable to read it properly
Run the boot_info script on your .img file and it will give you everything you need to know to repack the boot.img correctly
First you gotta repack the ramdisk (repack_ramdisk [optional out file])
Then after you do that, you can use the mkbootimg binary along with the info from my boot_info script to make a new boot.img with the right offsets
I've done a ton of boot.img splitting, so here's what it should look like (I forget the cmdline parameter)
Code:
mkbootimg --kernel KERNEL --ramdisk RAMDISK --base 0x80200000 --oversize 2048 --cmdline 'android.I.don't.remember.this.one' --ramdiskaddr 0x81500000 -o new_boot.img
Sent from my S3 on Sense 5 (you jelly?)
Click to expand...
Click to collapse
Thanks,
I actually just got the CWM ROM manager, I updated my CWM and am backing up my rom now, its pretty much stock lacking updates cuz of root I think, I eventually wanna get over to CM or some other rom but CM seems to be supported pretty well.
1) So the backup just finished a second ago, can I pull a boot image out of that? :EDIT: Check. I saw it in the recovered folder.
2) I'll use the boot info on that img when I get it.
3) I guess this is all for testing the variables and getting interpreters to run from adb and T.E. after that I need to install CM 10 to get some blobs, thats all thats hanging me up from modifying the source to build my own version, this is great exercise as it will need to be done when building this "Cyano-Kali" or whatever, I was also thinking "Kali0id" as in Kalioid and Kali zero i.d.
ok well I did some messing around and I got this lill chroot setup working from adb which is kool, I just took a no gui kali.img and a script I found to chroot into it ( Maybe Google "Weaponizing Android"), it needs a lil investigating though I get a couple errors, it looks like it was modified from a chroot into ubuntu (arm).
I put the script into /system/xbin/ and then made it executable (that seems to be the only place I could chmod), I looked at the sript at it points to a coded directory for the kali.img which is something like "/storage/sdcard0/kali/kail.img". This puts the script in a location that is already in the environ variable and you can call it from any cwd by typing "kali".
Note: Interesting tip (may be trivial to the pros), typing "bash" gives me a colorful interface and the bash interpreter, this is good for a first command when entering the terminal or adb because then you can modify the bash rc file found in "/system/etc/bash/" (I think, I'll double check later.*FIXED*).
So, I think I might be able to mod those variables there to include PYTHONPATH, PYTHONHOME, etc...
Then when I launch bash i should be able to launch python and whatever else. (*Check*, it works but you must first "bash" and then "python" to allow the bashrc file to get ran and add PYTHONHOME and PYTHONPATH to the enviroment)
I think the first shell that you get put into is shell and not bash but maybe I'm wrong.
*side note, If you want to su into bash its best ime to do that first, then bash, otherwise when you su while in bash you loose the color, idk why.
heres my results so far...
Code:
[email protected]:~$ adb devices
List of devices attached
xxxxxxxxxx device
[email protected]:~$ adb shell
[email protected]:/ $ su
[email protected]:/ # bash
void endpwent()(3) is not implemented on Android
localhost / # kali
ioctl LOOP_SET_FD failed: Device or resource busy
mount: Device or resource busy
net.ipv4.ip_forward = 1
[[email protected] ~$ cd .. && ls
bin dev home lost+found mnt proc run selinux sys usr
boot etc lib media opt root sbin srv tmp var
[[email protected] /$ which macchanger
/usr/bin/macchanger
[[email protected] /$ which ophcrack
/usr/bin/ophcrack
[[email protected] /$ which reaver
/usr/bin/reaver
[[email protected] /$ which aircrack-ng
/usr/bin/aircrack-ng
[[email protected] /$ python --version
Python 2.7.3
[[email protected] /$ perl --version
This is perl 5, version 14, subversion 2 (v5.14.2) built for arm-linux-gnueabi-thread-multi-64int
(with 80 registered patches, see perl -V for more detail)
Copyright 1987-2011, Larry Wall
Perl may be copied only under the terms of either the Artistic License or the
GNU General Public License, which may be found in the Perl 5 source kit.
Complete documentation for Perl, including FAQ lists, should be found on
this system using "man perl" or "perldoc perl". If you have access to the
Internet, point your browser at http://www.perl.org/, the Perl Home Page.
[[email protected] /$ bash --version
GNU bash, version 4.2.37(1)-release (arm-unknown-linux-gnueabi)
Copyright (C) 2011 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software; you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
[[email protected] /$ python
Python 2.7.3 (default, Jan 2 2013, 22:35:13)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import sys
>>>
[[email protected] /$ exit
Shutting down Kali ARM
failed: Device or resource busy
losetup: /dev/block/loop255: Device or resource busy
localhost / # exit
1|[email protected]:/ # ^D
1|[email protected]:/ $ ^D
[email protected]:~$
Does anybody know how to mount an external sdcard from the command line on the Debian version of Linux on Android?
Is that even possible, like driver wise and what not?
Nice!
To mount it, first you would need it's device name or UUID..
Sent from my S3 on Sense 5 (you jelly?)
Success!
Alright! I got Python working from the terminal emulator!
I ended up copying the files that got installed by the original installer into my system/ lib, xbin, and, bin directories I just kinda put stuff here or there and then I just got one error about platform independent libraries instead of both dependent and independent. I'm alil add about things sometimes. Then about ten minutes ago while chilling on the patio the syntax for the PythonHome and path variables became clear to me. So i changed it to export and wrapped the paths in quotes and figured out the prefix : exec_prefex thing.
Now python works!!!!!!! ill run it on adb tomorrow and show the results as well as exactly how to get it working after i figure out exactly what i did right. It was probably the last thing.
Edge-Case said:
Alright! I got Python working from the terminal emulator!
I ended up copying the files that got installed by the original installer into my system/ lib, xbin, and, bin directories I just kinda put stuff here or there and then I just got one error about platform independent libraries instead of both dependent and independent. I'm alil add about things sometimes. Then about ten minutes ago while chilling on the patio the syntax for the PythonHome and path variables became clear to me. So i changed it to export and wrapped the paths in quotes and figured out the prefix : exec_prefex thing.
Now python works!!!!!!! ill run it on adb tomorrow and show the results as well as exactly how to get it working after i figure out exactly what i did right. It was probably the last thing.
Click to expand...
Click to collapse
Nice
Sent from my S3 on Sense 5 (you jelly?)
Solution !
Ok I got everything cleaned up a bit, lets see whats going on here...
So hopefully bash is preinstalled for everyone, I just found it, the only changes I made in the past week are installing...
1) CyanogenMod, I believe you will need to already be rooted, have busybox, and a custom recovery to get this far. If you can get CyanogenMod working then you'll probably be able to replicate this, mayeb even with just root and busybox on a stock sprint rom, idk.
2) SL4A along with Python 2.6, Perl, and JRuby. (I hope normal ruby programs can be ran will JRuby, if not I'll either mod the programs or port ruby to android or look for another port.
3) Terminal IDE. This could have been a source of bash if it wasn't native to android or the Terminal Emulator/busybox.
Once you have The above, at least python 2.6 with SL4A, Terminal Emulator, Busybox, and root.
You can (the file system maybe different for different phones but since we are in a specific place of this forum I'll stick with what I found on my phone specifically)
Use a root browser and find a way to remount your file system to read/write or r/w or rw mode so you can write to /system directory. It is located in the / directory of the entire system, not just the sdcard0 partition.
You can open a terminal and type "set" to get a closer look at whats happening here on Android. We are mainly interested in the Environment Variables.
What I did was copy
"/storage/sdcard0/com.googlecode.pythonforandroid/extras/python" ----> "/system/etc/python" ##THIS IS A DIRECTORY
"/data/data/com.googlecode.pythonforandroid/files/python/lib/python2.6" ----> "/system/lib/python2.6" ##THIS IS A DIRECTORY
"/data/data/com.googlecode.pythonforandroid/files/python/bin/python" -> "/system/xbin/python ##THIS IS A FILE, IT IS AN EXECUTABLE!
"/"/data/data/com.googlecode.pythonforandroid/files/python/lib/" ----> "/system/lib/python2.6/" ##WE WANT ALL THE "*.so" FILES NEXT TO THE ORIGIONAL "*/PYTHON2.6/" DIR IN THE "DATA/DATA/" SIDE OF THE TREE TO BE COPIED TO THE SYSTEM SIDE AND INTO THE "/system/lib/python2.6/" DIR NEXT TO THE "/system/lib/python2.6/lib-dynload/" DIR
We want our "/system/lib/python2.6" directory to contain the following :
"/lib-dynload" is a dir; and all the .so files from earlier there are about 8 with a fresh install of python and no modules, some of you may already know how to incorporate modules from this point, but I still need to do some experimenting.
---------------------------------------------------------
OK
if you still following then your gonna wanna do the following
go to "/system/etc/bash" and open the bashrc file, we need to add PYTHONPATH and PYTHONHOME to it, this is how I set it up....
About half way down it will read
Code:
"""
# set some environment variables
HOME=/sdcard
TERM=linux (maybe change this to "Administrator" but that may break something)
"""
# Our additions follow:
export PYTHONHOME="/system/etc/python:/system/xbin/python"
export PYTHONPATH="/system/etc/python:/system/lib/python2.6/lib-dynload:/system/lib/python2.6"
Ok, now if you go to your teminal emulator or ADB shell you can type:
bash [press enter]
python [press enter]
and check out the results
or
su [enter]
bash [enter]
python [enter]
and see what happens
whats happening is that your PYTHONHOME and PYTHONPATH variables are being set when you enter bash, and since they are exported from the bashrc file they get carried over to any child activities that may spawn, such as "python". Correct me if I am wrong.
I may have forgot some little file I put somewere a few days ago or something so let me know if it doesn't work for you i'll do my best to help you get it working on your phone to,
other then finding a rc file for the shell that you start with when you launch the terminal or any other process maybe even, I may need to do what CNex suggested and complete the change in a boot.img to flash to my phone. that should result in the variables being passed to all activities.
Peace yo
Any questions I'll drop around if this dies of from here, well live and let die I suppose.
Just a screen shot
Just a screen shot.
I found the "mkshrc" file in "/system/etc" today so I added the PATHs to that file and now when teminal emulator starts it has access to python's libs. ("/system/etc/mkshrc" should be the location)
I've run into two problems, the first I can live with, the second is only more reason to port Kali's toolset into android.
1) I can't yet access the pydocs for interactive help, for example...
Code:
[email protected]:~$ adb shell
[email protected]:/ $ python
dlopen libpython2.6.so
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import android
>>> help (android)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/site.py", line 431, in __call__
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/pydoc.py", line 1720, in __call__
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/pydoc.py", line 1766, in help
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/pydoc.py", line 1508, in doc
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/pydoc.py", line 1314, in pager
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/pydoc.py", line 1338, in getpager
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/tempfile.py", line 286, in mkstemp
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/tempfile.py", line 254, in gettempdir
File "/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/lib/python2.6/tempfile.py", line 201, in _get_default_tempdir
IOError: [Errno 2] No usable temporary directory found in ['/tmp', '/var/tmp', '/usr/tmp', '/']
>>>
And
2) When I chroot into Kali.img the PYTHONPATH and PYTHONHOME variables get carried over and interfear with python within Kali. ????
Work around: is just modifing "bashrc" then when you want python or other inerpreters launch bash first and call kali from shell.
Solution: is porting Kali's Toolkit and more Linux programs and commands into Android. Then release as rom or give instructions on how to set up.
No Really, I think I got it figured out this time.
If your running python 2.6 via Py4a then youll use the first script to access python from the command line or over adb, you'll need su to but it in /system/bin or /system/xbin and to use this command to write to the system partition "mount -wo remount systemfs /system" when your done use "mount -ro remount systemfs /system" (with out the quotes of course).
Note: adbd can only be ran as root, so this method will only work as root. Also I had some trouble disconnecting from adb as "exit", it hung till I unplugged the phone from usb. But, still I got to run scripts python that utilize the androids api with-out having to directly open sl4a and then the python interpreter from there.
Note2: Maybe one who was slick enough could get the source for sl4a and pick out the server and facade code, then make a little dex to be ran from the command-line instead of starting the server via "am" and instead of using sockets, maybe ashmem to share the JSON results that get sent back to python.
This is the script for 2.6 :​
Code:
#!/system/bin/sh
am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER \
-n com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher \
--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT 54326
export AP_PORT=54326
export AP_HOST=127.0.0.1
adbd &
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.pythonforandroid
export PY4A=/data/data/com.googlecode.pythonforandroid/files/python
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python
PYTHONPATH=${PYTHONPATH}:$PY4A/lib/python2.6/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python/tmp
export HOME=/sdcard
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY4A
export LD_LIBRARY_PATH=$PY4A/lib
$PYTHONHOME/bin/python "[email protected]"
This one is for 3.2 :​
Code:
#!/system/bin/sh
am start -a com.googlecode.android_scripting.action.LAUNCH_SERVER \
-n com.googlecode.android_scripting/.activity.ScriptingLayerServiceLauncher \
--ei com.googlecode.android_scripting.extra.USE_SERVICE_PORT 54332
export AP_PORT=54332
export AP_HOST=127.0.0.1
adbd &
export EXTERNAL_STORAGE=/mnt/sdcard/com.googlecode.python3forandroid
export PY34A=/data/data/com.googlecode.python3forandroid/files/python3
export PY4A_EXTRAS=$EXTERNAL_STORAGE/extras
PYTHONPATH=$EXTERNAL_STORAGE/extras/python3
PYTHONPATH=${PYTHONPATH}:$PY34A/lib/python3.2/lib-dynload
export PYTHONPATH
export TEMP=$EXTERNAL_STORAGE/extras/python3/tmp
export HOME=/sdcard
export PYTHON_EGG_CACHE=$TEMP
export PYTHONHOME=$PY34A
export LD_LIBRARY_PATH=$PY34A/lib
$PYTHONHOME/bin/python3 "[email protected]"
Explanation:​-First, the server which handles calls to Android's APIs gets starts by it's activity with am and port is set.
-Second, AP_PORT and AP_HOST get exported so that android.py will have its parameters set to interact with the "facade"
-Third, adbd gets started in the background (I cant give a full explanation, but I found the RPC mechanism between the python interpreter and the sl4a server when android.py is imported and droid.* is attempted)
-Fourth, Python's environment variables get set, doing it this way helps to avoid copying the whole python installation to /system (as I did in the past ), just put one of these scripts in /system/bin or /system/xbin and name it "python" then chmod the script "chmod 755 python" you will be able to call the interpreter and put the shabang in your python scripts (ie "#!/system/bin/python").
-Fifth, launch the interpreter.
Here is a short session over adb:​
Code:
[email protected]:/ # python
dlopen libpython2.6.so
Python 2.6.2 (r262:71600, Mar 20 2011, 16:54:21)
[GCC 4.4.3] on linux-armv7l
Type "help", "copyright", "credits" or "license" for more information.
>>> import android
>>> droid = android.Android()
>>> droid.makeToast("Hello!")
Result(id=0, result=None, error=None)
>>> droid.getLastKnownLocation()
Result(id=1, result={u'passive': {u'bearing': 0, u'altitude': 0, u'time': 1384816643565L, u'longitude': -67.551754299999999,
u'provider': u'network', u'latitude': 96.0520909, u'speed': 0, u'accuracy': 3533}, u'network': {u'bearing': 0, u'altitude': 0, u'time':
1384816643565L, u'longitude': -67.551754299999999, u'provider': u'network', u'latitude': 96.0520909, u'speed': 0, u'accuracy':
3533}, u'gps': None}, error=None)
>>> exit()
And some credit to others:
http://code.google.com/p/python-for...sh?r=997929b1bbaa53cdf76acfff419ec13c13f869b7
http://stackoverflow.com/questions/10839879/python-sl4a-development
Those are links to where I got some info from to help put this together. The adbd thing was just trying "adb forward tcp:xxxx tcp:xxxx" but that didn't work, so I tried adbd forward tcp:xxxx tcp:xxxx and it looked like it hung there, so I ctl^ c and then just adbd and it hung there again, but when used the "&" to background it and then went to python to try android.py, it worked:good:
And for a lot of fun, go here:
http://code.google.com/p/android-scripting/wiki/ApiReference
-or here-
http://www.mithril.com.au/android/doc/index.html

Download Acceleration

Is it possible to accelerate downloads on Android using multiple connections just like IDM does in pc
Sent from my Galaxy Nexus using Tapatalk
Wrong thread
Actually I am looking for some mod that will enable this
Sent from my Galaxy Nexus using Tapatalk
This should be in Q&A section. Anyway I think isn't possible to accelerate downloads. Maybe you can try this: https://play.google.com/store/apps/details?id=com.download.internet.download.manager.nivax
CoDe LaZaRuS said:
Is it possible to accelerate downloads on Android using multiple connections just like IDM does in pc
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
I haven't really seen any apps that do it. You can always try using the command line though. I've attached a common linux binary I compiled called "axel" which can be used to download a file using multiple connections, e.g., download with <n> max connections:
Code:
axel -n <n> <download_url>
Unfortunately I've had some trouble making the connections which has something to do with the /etc/resolv.conf. The binary is good, I just need to figure out how to fix this /etc/resolv.conf error. I get the same error using "aria", a similar but more advanced multi-connection downloader.
It might be worth checking out and seeing if you can solve the error, especially if you use your phone sometimes to download large 1gb size media.
edit: I went ahead and compiled aria2c. I've tested it downloading a few files and it works. There were still a few urls I tried that I had to use wget or curl with, but it's a good tool to use a first try.
Code:
aria2c -s <n> <url|uri|magnet|torrent|...>
Aria's a very powerful tool, so you can use it with a bunch of different download types.
7175 said:
I haven't really seen any apps that do it. You can always try using the command line though. I've attached a common linux binary I compiled called "axel" which can be used to download a file using multiple connections, e.g., download with <n> max connections:
Code:
axel -n <n> <download_url>
Unfortunately I've had some trouble making the connections which has something to do with the /etc/resolv.conf. The binary is good, I just need to figure out how to fix this /etc/resolv.conf error. I get the same error using "aria", a similar but more advanced multi-connection downloader.
It might be worth checking out and seeing if you can solve the error, especially if you use your phone sometimes to download large 1gb size media.
edit: I went ahead and compiled aria2c. I've tested it downloading a few files and it works. There were still a few urls I tried that I had to use wget or curl with, but it's a good tool to use a first try.
Code:
aria2c -s <n> <url|uri|magnet|torrent|...>
Aria's a very powerful tool, so you can use it with a bunch of different download types.
Click to expand...
Click to collapse
Seems exactly what i need but how do i use it
Sent from my Galaxy Nexus using Tapatalk
CoDe LaZaRuS said:
Seems exactly what i need but how do i use it
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
So yeah I'd definitely say just go with using aria instead axel. Axel has less options,abilities,functionality and I may have broken the binary when I stripped it(removed debugging symbols to make it smaller). Basically to install it, you want to download the aria2c.zip file. Then unzip it to /system/bin in Android Terminal Emulator with:
Code:
busybox mount -o rw,remount /system
busybox unzip /sdcard/Download/aria2c.zip -d /system/bin
busybox chmod 0555 /system/bin/aria2c
busybox mount -o ro,remount /system
You could also use your favorite root file manager. I find the terminal faster these days though.. Now that aria's installed you can download a file like http://download.zip(just an example url, pro'lly doesn't work) splitting the connection 5 ways for more speed with:
Code:
aria2c -s 5 -d /sdcard/Download http://download.zip
The "-d /sdcard/Download" part will place the downloaded file in /sdcard/Download where things usually download. When you execute aria2c, a nice little terminal text interface will display showing progress and download speed. It'll give an end average download speed too, so you can compare different settings.
**If you run into problems with https links, try changing 'em to http.
Honestly, I'm surprised no one has made an aria app or a download manager utilizing the aria2c binary. You could make some beaucoup bucks if you made an app that uses aria2c, especially with the torrent abilities. I've just started getting into app development so I'll keep this in mind. A download accelerator/manager would make an excellent first project. Anyway, hope that's a little more informative about using the aria2c binary in the terminal.
7175 said:
So yeah I'd definitely say just go with using aria instead axel. Axel has less options,abilities,functionality and I may have broken the binary when I stripped it(removed debugging symbols to make it smaller). Basically to install it, you want to download the aria2c.zip file. Then unzip it to /system/bin in Android Terminal Emulator with:
Code:
busybox mount -o rw,remount /system
busybox unzip /sdcard/Download/aria2c.zip -d /system/bin
busybox chmod 0555 /system/bin/aria2c
busybox mount -o ro,remount /system
You could also use your favorite root file manager. I find the terminal faster these days though.. Now that aria's installed you can download a file like http://download.zip(just an example url, pro'lly doesn't work) splitting the connection 5 ways for more speed with:
Code:
aria2c -s 5 -d /sdcard/Download http://download.zip
The "-d /sdcard/Download" part will place the downloaded file in /sdcard/Download where things usually download. When you execute aria2c, a nice little terminal text interface will display showing progress and download speed. It'll give an end average download speed too, so you can compare different settings.
**If you run into problems with https links, try changing 'em to http.
Honestly, I'm surprised no one has made an aria app or a download manager utilizing the aria2c binary. You could make some beaucoup bucks if you made an app that uses aria2c, especially with the torrent abilities. I've just started getting into app development so I'll keep this in mind. A download accelerator/manager would make an excellent first project. Anyway, hope that's a little more informative about using the aria2c binary in the terminal.
Click to expand...
Click to collapse
Thanx alot
I want to check out aria in a bit more detail so could you provide me with the link to the thread
Sent from my Galaxy Nexus using Tapatalk
7175 said:
So yeah I'd definitely say just go with using aria instead axel. Axel has less options,abilities,functionality and I may have broken the binary when I stripped it(removed debugging symbols to make it smaller). Basically to install it, you want to download the aria2c.zip file. Then unzip it to /system/bin in Android Terminal Emulator with:
Code:
busybox mount -o rw,remount /system
busybox unzip /sdcard/Download/aria2c.zip -d /system/bin
busybox chmod 0555 /system/bin/aria2c
busybox mount -o ro,remount /system
You could also use your favorite root file manager. I find the terminal faster these days though.. Now that aria's installed you can download a file like http://download.zip(just an example url, pro'lly doesn't work) splitting the connection 5 ways for more speed with:
Code:
aria2c -s 5 -d /sdcard/Download http://download.zip
The "-d /sdcard/Download" part will place the downloaded file in /sdcard/Download where things usually download. When you execute aria2c, a nice little terminal text interface will display showing progress and download speed. It'll give an end average download speed too, so you can compare different settings.
**If you run into problems with https links, try changing 'em to http.
Honestly, I'm surprised no one has made an aria app or a download manager utilizing the aria2c binary. You could make some beaucoup bucks if you made an app that uses aria2c, especially with the torrent abilities. I've just started getting into app development so I'll keep this in mind. A download accelerator/manager would make an excellent first project. Anyway, hope that's a little more informative about using the aria2c binary in the terminal.
Click to expand...
Click to collapse
It's not working for me. Terminal Emulator keeps saying it can't find file or directory aria2c ?
Sent from my sushi grade tuna
CoDe LaZaRuS said:
Thanx alot
I want to check out aria in a bit more detail so could you provide me with the link to the thread
Sent from my Galaxy Nexus using Tapatalk
Click to expand...
Click to collapse
Yeah, definitely. I checked out these links:
http://aria2.sourceforge.net/
http://wiki.drupalschool.net/index.php/Aria2_How_To
Tezlastorme said:
It's not working for me. Terminal Emulator keeps saying it can't find file or directory aria2c ?
Sent from my sushi grade tuna
Click to expand...
Click to collapse
Hmm, can you post what you from:
Code:
which aria2c
Code:
echo $PATH
Code:
find /system -name aria2c
7175 said:
Yeah, definitely. I checked out these links:
http://aria2.sourceforge.net/
http://wiki.drupalschool.net/index.php/Aria2_How_To
Hmm, can you post what you from:
Code:
which aria2c
Code:
echo $PATH
Code:
find /system -name aria2c
Click to expand...
Click to collapse
Sent from my sushi grade tuna
7175 said:
Yeah, definitely. I checked out these links:
http://aria2.sourceforge.net/
http://wiki.drupalschool.net/index.php/Aria2_How_To
Hmm, can you post what you from:
Code:
which aria2c
Code:
echo $PATH
Code:
find /system -name aria2c
Click to expand...
Click to collapse
Thanks I appreciate the help
Sent from my Galaxy Nexus using Tapatalk
Sure, no problem man.
Tezlastorme said:
Sent from my sushi grade tuna
Click to expand...
Click to collapse
Thanks. Everything looks good. Not sure why you're getting that error, could you post the exact command you used so I can try it?
7175 said:
Sure, no problem man.
Thanks. Everything looks good. Not sure why you're getting that error, could you post the exact command you used so I can try it?
Click to expand...
Click to collapse
Sent from my sushi grade tuna
Tezlastorme said:
Sent from my sushi grade tuna
Click to expand...
Click to collapse
Alright, I'm pretty sure I figured it out. It turns out the binary was compiled dynamically instead of statically, even though I specified static like 4 times when compiling and the -static flag was fed to gcc and g++. So it's looking for the linker upon execution, specifically /lib/ld-linux-armhf.so.3. I've gathered together the linker and any other libs it may look for and made a package of them. I'm gonna see if I can manipulate how the source is compiled some more and see if I can force out a purely static binary since configuring the libs is a huge hassle to run it. That's weird it's been working on my phone though.
EDIT: I eventually did get a static aria2c built, but it was calling some shared libraries on execution which breaks it. The axel I posted seems to work pretty well though with links. I'm not sure what the issue I had before was, something with /etc/resolv.conf or other, but it's been working for me now, using split connections and such.
Also the reason the dynamic aria2c was working on my phone was because I've modified my whole system to include various standard linux libraries and directories, ie. /usr, /bin, /lib, etc. I might eventually make an installer that includes the bare minimal linked libraries for dynamic aria2c once I get this python project I'm working on to where I want it.
EDIT2: Found a dynamically linked aria2 build for android. Check it out. Attached.
Also here's the readme file for Android aria2:
Code:
aria2 for Android devices
=========================
aria2 is a lightweight multi-protocol & multi-source download utility
operated in command-line. It supports HTTP/HTTPS, FTP, BitTorrent and
Metalink.
Install
-------
aria2 is not an ordinary Android Java application. It is a C++ native
application and operates in command-line. You don't have to 'root'
your device to use aria2. Because aria2 is a command-line program,
you need a terminal emulator. First install Android Terminal Emulator
from Android Market (or build it from source and install. See
https://github.com/jackpal/Android-Terminal-Emulator/).
1. Copy aria2c executable to ``/mnt/sdcard`` on your device.
2. Run Android Terminal Emulator.
3. ``mkdir /data/data/jackpal.androidterm/aria2``
4. ``cat /mnt/sdcard/aria2c > /data/data/jackpal.androidterm/aria2/aria2c``
5. ``chmod 744 /data/data/jackpal.androidterm/aria2/aria2c``
6. Add the following commands to the initial command of Android
Terminal Emulator::
export HOME=/data/data/jackpal.androidterm/aria2; cd $HOME
----------
See `the online manual
<http://aria2.sourceforge.net/manual/en/html/>`_.
Notes
-----
aria2c executable was generated using android-ndk-r10b.
The following libraries were statically linked.
* openssl 1.0.1i
* expat 2.1.0
* c-ares 1.10.0
Since Android does not have ``/etc/resolv.conf``, c-ares (asynchronous
DNS resolver) is disabled by default. But name resolution is sometimes
a little bit slow, so I recommend to enable c-ares. You can enable it
using ``--async-dns`` and specify DNS servers using
``--async-dns-server`` option, like this::
--async-dns --async-dns-server=`getprop net.dns1`,`getprop net.dns2`
Because it is tedious to type these long parameters every time you use
aria2c, the following wrapper shell script would be handy::
#!/system/bin/sh
/data/data/jackpal.androidterm/aria2c \
--async-dns \
--async-dns-server=`getprop net.dns1`,`getprop net.dns2` \
"[email protected]"
Please note that you need to add executable file mode bit to this
wrapper script too. (e.g., ``chmod 744 /PATH/TO/SCRIPT``)
Known Issues
------------
* Since Android does not have ``/dev/stdout``, ``-l-`` does not work.
* Android Terminal Emulator sometimes stops updating console. It looks
like aria2c hangs, but aria2c continues to run.
To use this binary with lollipop, replace /system/bin/linker with the no-pie version that zzpianoman cooked up: http://forum.xda-developers.com/showpost.php?p=57554982&postcount=321
7175 said:
Alright, I'm pretty sure I figured it out. It turns out the binary was compiled dynamically instead of statically, even though I specified static like 4 times when compiling and the -static flag was fed to gcc and g++. So it's looking for the linker upon execution, specifically /lib/ld-linux-armhf.so.3. I've gathered together the linker and any other libs it may look for and made a package of them. I'm gonna see if I can manipulate how the source is compiled some more and see if I can force out a purely static binary since configuring the libs is a huge hassle to run it. That's weird it's been working on my phone though.
EDIT: I eventually did get a static aria2c built, but it was calling some shared libraries on execution which breaks it. The axel I posted seems to work pretty well though with links. I'm not sure what the issue I had before was, something with /etc/resolv.conf or other, but it's been working for me now, using split connections and such.
Also the reason the dynamic aria2c was working on my phone was because I've modified my whole system to include various standard linux libraries and directories, ie. /usr, /bin, /lib, etc. I might eventually make an installer that includes the bare minimal linked libraries for dynamic aria2c once I get this python project I'm working on to where I want it.
EDIT2: Found a dynamically linked aria2 build for android. Check it out. Attached.
Click to expand...
Click to collapse
I had to add 'su' to the top of initial command, otherwise I got a permission denied error, but now it works fine, thanks
Well, I haven't tested the functionality, but it does run at least.
https://play.google.com/store/apps/details?id=it.opbyte.superdownload
I bought this app to support the dev. Hope the guy comes back... Anyway, it looked like the dev stopped like a year ago. The app I linked uses data/WiFi at the same time.. There are quite a bit if apps on play that use the whole multi threading deal. The one I found to be the best for ME(and I emphasize ME because, well, you know) was ADM. That was the best I found... plenty of configurable options and because some sites only pull from one place and don't work otherwise{while downloading}. BTW, I haven't been keeping up to date for a few months. .... PONYdroid(downloading app) is on my wish list as soon as I get the cash flow back. Hope this helps a bit. [emoji41][emoji41]

Categories

Resources