vak: (Default)
[personal profile] vak
Novo7 tablet can be used as a MIPS-based Linux workstation, for generic development tasks. To get command line access, you can use any terminal emulator application or adb utility from Android SDK.

From a user point of view, an Android environment is very different from Linux: it lacks many generic things like /bin, /usr, /tmp, Posix-compliant utilities etc. But it's possible to build a Debian-based environment, located in a separate disk space and used via chroot.

* No modification to Android system is required
* All additional files placed on SD card
* Full traditional Linux environment is provided

To make a minimal root filesystem, you need a live MIPS Debian system. I used IASim on a virtual Malta board. First you need to install a multistrap utility:
sudo apt-get install multistrap
Create a file multistrap.conf and put the following lines to it:
[General]
arch=mipsel
noauth=true
unpack=true
debootstrap=Debian
aptsources=Debian

[Debian]
packages=apt
source=http://ftp.us.debian.org/debian
keyring=debian-archive-keyring
suite=squeeze
Fetch ftp.us.debian.org public key:
gpg --keyserver pgpkeys.mit.edu --recv-key AED4B06F473041FA
gpg -a --export AED4B06F473041FA | sudo apt-key add -
Run multistrap to build a directory debian/ with the minimal set of installed packages:
multistrap -a mipsel -d debian -f multistrap.conf
Put ftp.us.debian.org public key to a destination directory:
rm debian/etc/apt/trusted.gpg.d/*
cp /etc/apt/trusted.gpg debian/etc/apt
Add a default Google DNS resolver:
echo nameserver 8.8.8.8 > debian/etc/resolv.conf
Fix a list of mounted filesystems:
ln -s /proc/mounts debian/etc/mtab
Edit file debian/root/.bashrc and add the following lines to it:
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
export TERM=xterm
unset HOSTNAME SHELL LOOP_MOUNTPOINT ASEC_MOUNTPOINT 
unset ANDROID_PROPERTY_WORKSPACE ANDROID_ASSETS
unset ANDROID_BOOTLOGO LD_LIBRARY_PATH BOOTCLASSPATH
unset ANDROID_DATA MKSH ANDROID_ROOT EXTERNAL_STORAGE
Check that a minimal filesystem works as expected:
busybox chroot debian /bin/bash  -- start a shell in a new root filesystem
apt-get update                   -- check network access to Debian repository
exit                             -- exit from chroot shell
Pack the root directory into a single tarball:
tar cvzf debian.tgz debian
The size of resulting file will be about 55 Mbytes.

Put a file debian.tgz to your tablet, and enter a remote shell. Use adb utility from Android SDK:
adb push debian.tgz /sdcard/debian.tgz
adb shell
                     -- prompt of a target command line appears here
It may happen that a loop device node is missing on your device: create it.
busybox mknod /dev/loop0 b 7 0
Now let's create a filesystem image, mount it and unpack the tarball to it.  An example is for 1Gbyte image size; you can change it as needed.
cd /sdcard
dd if=/dev/zero of=debian.img seek=1073741823 bs=1 count=1
mke2fs -F debian.img
mkdir debian 
busybox mount -o loop debian.img debian
busybox tar -xvzf debian.tgz
busybox umount debian
A resulting image is available for download here: ftp://ftp.vak.ru/unix/debian-mini.img.gz
There is also an alternative image, with GCC and other development tools installed: ftp://ftp.vak.ru/unix/debian-with-gcc.img.gz

To start a shell in a new Debian environment, use this script:
test -b /dev/loop0 || busybox mknod /dev/loop0 b 7 0
busybox mount -o loop /mnt/sdcard/debian.img /mnt/sdcard/debian
busybox mount --bind /dev /mnt/sdcard/debian/dev
busybox mount --bind /proc /mnt/sdcard/debian/proc
busybox mount --bind /sys /mnt/sdcard/debian/sys
HOME=/root busybox chroot /mnt/sdcard/debian /bin/bash
You can install any needed packages, using a standard utility apt-get:
apt-get install vim build-essential git cvs subversion openssh-client
apt-get install dialog iputils-ping autoconf automake libtool gettext
apt-get install flex bison byacc gdb locate procps
To unmount, use the script:
busybox umount /mnt/sdcard/debian/dev
busybox umount /mnt/sdcard/debian/proc
busybox umount /mnt/sdcard/debian/sys
busybox umount /mnt/sdcard/debian
busybox losetup -d /dev/loop0

Enjoy!

Date: 2012-02-16 08:41 (UTC)
From: [identity profile] b0p0h0k.livejournal.com
Чем отличается это Novo7?
Почему я не мого сделать всё то же самое на своём [подставить модель] андроидном телефоне?
Ну, с точностью до arch.

Date: 2012-02-16 19:41 (UTC)
From: [identity profile] Евгений Будников (from livejournal.com)
а то же самое, только с выносом андроида и установкой нормального линуксового ядра делается?