Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,730,130 Members 52,802 Now Online
XDA Developers Android and Mobile Development Forum

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

Tip us?
 
gnarlyc
Old
(Last edited by gnarlyc; 22nd January 2012 at 12:18 PM.)
#1  
gnarlyc's Avatar
Retired Recognized Developer - OP
Thanks Meter 55
Posts: 441
Join Date: Feb 2010
Location: Raleigh, NC
Default [SCRIPT]Debian Image Builder (01-22-2012)

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.
The Following 2 Users Say Thank You to gnarlyc For This Useful Post: [ Click to Expand ]
 
synesthete
Old
#2  
synesthete's Avatar
Senior Member
Thanks Meter 14
Posts: 123
Join Date: Mar 2010
Location: Los Angeles
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.
 
gnarlyc
Old
#3  
gnarlyc's Avatar
Retired Recognized Developer - OP
Thanks Meter 55
Posts: 441
Join Date: Feb 2010
Location: Raleigh, NC
Quote:
Originally Posted by synesthete View Post
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.
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.
 
ttereve
Old
#4  
Member
Thanks Meter 5
Posts: 49
Join Date: Jan 2010
Where do we put the image? Do we have to create a new partition?

Sent from my Galaxy Nexus using XDA App
 
gnarlyc
Old
(Last edited by gnarlyc; 15th January 2012 at 01:58 AM.)
#5  
gnarlyc's Avatar
Retired Recognized Developer - OP
Thanks Meter 55
Posts: 441
Join Date: Feb 2010
Location: Raleigh, NC
Quote:
Originally Posted by ttereve View Post
Where do we put the image? Do we have to create a new partition?

Sent from my Galaxy Nexus using XDA App
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.
 
ttereve
Old
#6  
Member
Thanks Meter 5
Posts: 49
Join Date: Jan 2010
I'm guessing we can use ext3 (or even ext4) instead of ext2?
 
gnarlyc
Old
#7  
gnarlyc's Avatar
Retired Recognized Developer - OP
Thanks Meter 55
Posts: 441
Join Date: Feb 2010
Location: Raleigh, NC
Quote:
Originally Posted by ttereve View Post
I'm guessing we can use ext3 (or even ext4) instead of ext2?
I dunno. It won't hurt to try!
 
JTECJ
Old
#8  
JTECJ's Avatar
Member
Thanks Meter 11
Posts: 46
Join Date: Oct 2010
Location: Dallas
Is there any chance that this will work on GSM GN?

Sent from my Galaxy Nexus using xda premium
 
gnarlyc
Old
#9  
gnarlyc's Avatar
Retired Recognized Developer - OP
Thanks Meter 55
Posts: 441
Join Date: Feb 2010
Location: Raleigh, NC
Quote:
Originally Posted by JTECJ View Post
Is there any chance that this will work on GSM GN?

Sent from my Galaxy Nexus using xda premium
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.
 
ttereve
Old
#10  
Member
Thanks Meter 5
Posts: 49
Join Date: Jan 2010
alright I can get into root@localhost 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)?

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes