EmDebian in Android BOX

Prerequisite: Android box should be rooted and a available linux system.
Equipment: KaiBoer F4
My process is as follows:

    Any one running linux machine (my system is ubuntu x64):
mkdir -p ~/debian
cd ~/debian
dd if=/dev/zero of=debian.img bs=100M count=20
mkfs.ext4 debian.img
sudo mount -o loop debian.img /mnt
sudo apt-get install debootstrap
cd /mnt
debootstrap --verbose --arch=armel --foreign wheezy debian http://ftp.cn.debian.org/debian
sudo umount /mnt
    Then copy debian.img into root directory of the sdcard in your android box.
    Ssh to your android box(rooted and installed openssh server):
busybox mkdir /mnt/sdcard/vms
busybox mknod /dev/block/loop254 b 7 254
busybox losetup /dev/block/loop254 /mnt/sdcard/debian.img
busybox mount -t ext4 /dev/block/loop254 /mnt/sdcard/vms
busybox mkdir -p /mnt/sdcard/vms/debian/dev/pts
busybox mkdir -p /mnt/sdcard/vms/debian/mnt/sdcard
busybox mount -o bind /mnt/sdcard /mnt/sdcard/vms/debian/mnt/sdcard
busybox mount -t proc proc /mnt/sdcard/vms/debian/proc
busybox mount -t sysfs sysfs /mnt/sdcard/vms/debian/sys
busybox mount -t devpts devpts /mnt/sdcard/vms/debian/dev/pts
echo " localhost" > /mnt/sdcard/vms/debian/etc/hosts
export PATH=/usr/bin:/usr/sbin:/bin:$PATH
export TERM=linux
export HOME=/root
export USER=root
busybox chroot /mnt/sdcard/vms/debian/ /bin/bash
/debootstrap/debootstrap --second-stage
echo "deb http://ftp.cn.debian.org/debian wheezy main contrib non-free" >> /etc/apt/sources.list
export LC_ALL=C
apt-get update
apt-get install openssh-server -y
mount -o remount,rw /system
echo "sh /system/etc/init.d/startdeb.sh" >> /system/etc/install-recovery.sh
busybox mkdir -p /system/etc/init.d
echo "#!/system/bin/sh" > /system/etc/init.d/startdeb.sh
echo "busybox sleep 120" >> /system/etc/init.d/startdeb.sh
echo "busybox mknod /dev/block/loop254 b 7 254" >> /system/etc/init.d/startdeb.sh
echo "busybox losetup /dev/block/loop254 /mnt/sdcard/debian.img" >> /system/etc/init.d/startdeb.sh
echo "busybox mount -t ext4 /dev/block/loop254 /mnt/sdcard/vms" >> /system/etc/init.d/startdeb.sh
echo "busybox mount -o bind /mnt/sdcard /mnt/sdcard/vms/debian/mnt/sdcard" >> /system/etc/init.d/startdeb.sh
echo "busybox mount -t proc proc /mnt/sdcard/vms/debian/proc" >> /system/etc/init.d/startdeb.sh
echo "busybox mount -t sysfs sysfs /mnt/sdcard/vms/debian/sys" >> /system/etc/init.d/startdeb.sh
echo "busybox mount -t devpts devpts /mnt/sdcard/vms/debian/dev/pts" >> /system/etc/init.d/startdeb.sh
echo "export PATH=/usr/bin:/usr/sbin:/bin:$PATH" >> /system/etc/init.d/startdeb.sh
echo "export TERM=linux" >> /system/etc/init.d/startdeb.sh
echo "export HOME=/root" >> /system/etc/init.d/startdeb.sh
echo "export USER=root" >> /system/etc/init.d/startdeb.sh
echo "busybox chroot /mnt/sdcard/vms/debian/ /bin/bash -c "srvstart"" >> /system/etc/init.d/startdeb.sh
busybox chmod 755 /system/etc/init.d/startdeb.sh
    Ssh to your chroot debian:
echo "#!/bin/bash" > /bin/srvstart
echo "/usr/sbin/service ssh start" >> /bin/srvstart
chmod 755 /bin/srvstart

OK, Reboot your box and Good Luck!


:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: