Build an Impractical But Awesome Lego Mindstorm Dock

The vast majority of what we cover here on the XDA-Developers News Portal relates to … more

MultiROM Makes its Way Over to the HTC One (M8)

While browsing our forum, you will undoubtedly find more than a few enticing ROMs available … more

Welcome to the New XDA-Developers Portal!

You may recall that a few weeks ago, we opened up the XDA-2015 forum themesto intrepid users … more

An Android Enthusiast’s Apple iPhone 6 Challenge

The media has gone batty again over Apple “revolutionizing” smartphones. … more
Post Reply

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

12th January 2012, 05:02 PM   |  #1  
gnarlyc's Avatar
OP Retired Recognized Developer
Flag Raleigh, NC
Thanks Meter: 55
 
441 posts
Join Date:Joined: Feb 2010
More
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.
Last edited by gnarlyc; 22nd January 2012 at 12:18 PM.
The Following 2 Users Say Thank You to gnarlyc For This Useful Post: [ View ]
13th January 2012, 02:27 AM   |  #2  
synesthete's Avatar
Senior Member
Flag Los Angeles
Thanks Meter: 16
 
128 posts
Join Date:Joined: Mar 2010
More
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.
13th January 2012, 11:20 AM   |  #3  
gnarlyc's Avatar
OP Retired Recognized Developer
Flag Raleigh, NC
Thanks Meter: 55
 
441 posts
Join Date:Joined: Feb 2010
More
Quote:
Originally Posted by synesthete

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.
15th January 2012, 12:31 AM   |  #4  
Member
Thanks Meter: 5
 
49 posts
Join Date:Joined: Jan 2010
Where do we put the image? Do we have to create a new partition?

Sent from my Galaxy Nexus using XDA App
15th January 2012, 01:30 AM   |  #5  
gnarlyc's Avatar
OP Retired Recognized Developer
Flag Raleigh, NC
Thanks Meter: 55
 
441 posts
Join Date:Joined: Feb 2010
More
Quote:
Originally Posted by ttereve

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.
Last edited by gnarlyc; 15th January 2012 at 01:58 AM.
15th January 2012, 06:53 AM   |  #6  
Member
Thanks Meter: 5
 
49 posts
Join Date:Joined: Jan 2010
I'm guessing we can use ext3 (or even ext4) instead of ext2?
15th January 2012, 12:00 PM   |  #7  
gnarlyc's Avatar
OP Retired Recognized Developer
Flag Raleigh, NC
Thanks Meter: 55
 
441 posts
Join Date:Joined: Feb 2010
More
Quote:
Originally Posted by ttereve

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

I dunno. It won't hurt to try!
15th January 2012, 04:30 PM   |  #8  
JTECJ's Avatar
Member
Flag Dallas
Thanks Meter: 11
 
46 posts
Join Date:Joined: Oct 2010
More
Is there any chance that this will work on GSM GN?

Sent from my Galaxy Nexus using xda premium
15th January 2012, 05:27 PM   |  #9  
gnarlyc's Avatar
OP Retired Recognized Developer
Flag Raleigh, NC
Thanks Meter: 55
 
441 posts
Join Date:Joined: Feb 2010
More
Quote:
Originally Posted by JTECJ

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.
15th January 2012, 08:24 PM   |  #10  
Member
Thanks Meter: 5
 
49 posts
Join Date:Joined: 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)?

Post Reply Subscribe to Thread
Previous Thread Next Thread
Thread Tools
Display Modes


Top Threads in Verizon Galaxy Nexus Android Development by ThreadRank