Thierry Merle | 29 Jun 23:00 2012
Picon

armedslack on android

Hi all,
I managed to put armedslack on my Android ICS device, using a miniroot 
image.
My aim is to put Armedslack on Android media center (Melee A2000, I 
don't have it yet), that will be an Armedslack NAS/email server at the 
same time.

The method is quite simple:
1/ create a disk image containing miniroot, on the sdcard (or whatever, 
I feel safe on a sdcard)
2/ mount that disk image as a loop device in /local/data/armedslack for 
example
3/ chroot /local/data/armedslack

You need root access, and loop device support on your Android device due 
to the loop mount/chroot commands.
1/ Disk image creation: Inspired from this [1] link
Download slack-13.37-miniroot_01May11.tar.xz
dd if=/dev/zero of=/path/to/c.img bs=516096c count=1000 #creates a 500MB 
image
fdisk -u -C1000 -S63 -H16 /path/to/c.img
perform commands o, n, a, p,w to add a linux primary partitioan and 
write (follow the [1] link for explanations)
losetup -o32256 /dev/loop0 /path/to/c.img
mke2fs -b1024 /dev/loop0
mount -text2 /dev/loop0 /mnt/wherever
cd /mnt/wherever
tar -Jxvf /where/is/slack-13.37-miniroot_01May11.tar.xz
cd #get out of the mountpoint
umount /dev/loop0 losetup -d /dev/loop0
dd if=/path/to/c.img of=root.img bs=32256 skip=1 #extract the ext2 
partition since busybox mount does not support the offset option
adb push root.img /mnt/external_sd/ #or whatever, the aim is to have 
root.img on your sdcard2/ mount this image as a loop device on the 
Android device

2/ Now on the Android device:
open a shell (download Android terminal emulator, or use adb shell)
cd /mnt/external_sd
mkdir armedslack
su
mount -o loop root.img armedslack/

3/ you need to mount some special filesystems before chroot (inspired 
from this [2] link):
mount -t devpts devpts armedslack/dev/pts
mount -t proc proc armedslack/proc
mount -t sysfs sysfs armedslack/sys
chroot armedslack /bin/bash
. /etc/profile #in order to load environment with correct bin path
/etc/rc.d/rc.S #will initialize the armedslack system as init would do. 
An error on filesystem check occurs (of cours rootfs is mounted rw), not 
fatal.
/etc/rc.d/rc.M #perform multi-user initializations, ssh server for example

Note: that all occurs with /system in ro mode, so should be harmless for 
the Android system, after a reboot.

I don't have a clean method to quit the chroot armedslack (finding out 
processes launched in armedslack is not easy) but rebooting restores the 
initial state.

The only side effect is system time: I get a shift that changes the 
Android time; I guess this is in the /etc/rc.d/rc.S script. Running 
ntpdate solves the issue.

You can run a vnc server (like tightvnc) and use the android-vnc app to 
get an Armedslack graphic interface on your Android device, ... but I 
guess this setup is the same as for headless targets.
Unfortunately the Android linux kernel does not include nfsd (my aim), 
but there are solutions for nfs in userspace, need to try...

Regards,
Thierry

[1] http://wiki.osdev.org/Loopback_Device#Creating_an_image
[2] 
http://technoreview.net/2011/10/installing-ubuntu-on-android-with-chroot.html

Gmane