Table of Contents

Android Post Install

Android Search Engine

Android Tools on Ubuntu


First activate adb wireless app on android device

sudo add-apt-repository ppa:nilarimogard/webupd8
sudo apt-get update
sudo apt-get install android-tools-adb android-tools-fastboot

adb connect 192.168.2.5:5555
connected to 192.168.2.5:5555

adb devices
List of devices attached 
192.168.2.5:5555	device

adb shell
root@android:/ # 

Android Busybox

For stability and security, dont overwrite original busybox

On PC:
wget https://www.digital-bit.ch/g1devel/JFv1.51_CRB43-EU_BuildEnvironment.tar.gz
tar xvfz JFv1.51_CRB43-EU_BuildEnvironment.tar.gz
cd Build/System/ModifiedFiles/xbin/
cp busybox busyboxw
adb push busyboxw /system/xbin
adb shell

Android Busybox Mount USB Drive/Stick

Only busyboxw is able to correctly mount USB Drive/Stick:

Mount:

cd /data

busyboxw vi m.sh
set -xv
su -c "busyboxw mount /dev/block/sda1 /mnt/usbhost0"

chmod 777 ./m.sh
./m.sh

UMount

cd /data

busyboxw vi um.sh
set -xv
su -c "busyboxw umount /dev/block/sda1"

chmod 777 ./um.sh
./um.sh

Mount Bind:

busyboxw mount --bind /mnt/usbhost0 /mnt/sdcard/Download

Make Android booting from SD Card for AllWinner SOC

Disclaimer

I am providing this guide only as a reference for linux develop and I am not responsible in any way of what happens to your pc/usb mini pc. It is provided AS-IS and by using it you take full responsability of the consequences or damage. Please backup your data first.

Tested on Ubuntu 14.04 LTS amd64

Micro SD Card: 8Gb Class 10

su
cd
mkdir akit
cd akit

Install Dependencies:
apt-get install build-essential u-boot-tools dosfstools
add-apt-repository ppa:ubuntu-wine/ppa
apt-get update
apt-get install wine1.7
apt-get install libblkid-dev:i386 libblkid1:i386
apt-get install libp11-kit-gnome-keyring:i386
ln -s /bin/umount /sbin/umount

Download and patch kitchen for 1Gb RAM Stick:
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/mele_flash_kitchen_v2.tgz/download -O mele_flash_kitchen_v2.tgz
tar xvfz mele_flash_kitchen_v2.tgz
cd mele_flash_kitchen
sed -i "s/\/bin\/sh/\/bin\/bash/" ./sdcard/mkA10card.sh
mkdir u-boot
cd u-boot/
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/uboot-1gb.zip/download -O uboot-1gb.zip
unzip uboot-1gb.zip
cp ./u-boot.bin ../sdcard/mele-u-boot.bin
cp ./sunxi-spl.bin ../sdcard/sun4i-spl.bin
cd ..

Download custom firmware:
wget http://www.lundman.net/ftp/mele/Mele_4.0_V1.2_custom_en_us_apex.img

Make SD Card:
cp Mele_4.0_V1.2_custom_en_us_apex.img original.img
Warning: you can damage your system (wipe hard disk, etc..) if you doesnt able to find out correct sd card device:
Find out usb sd card reader device ( df -k, fdisk -l, etc..):
export DEV=/dev/sdX
umount ${DEV}1
umount ${DEV}2
umount ${DEV}3
umount ${DEV}4
umount ${DEV}5
umount ${DEV}6
umount ${DEV}7
umount ${DEV}8
umount ${DEV}9
umount ${DEV}10

make clean
./clean
mkdir -p /system
make build_sdcard
cd sdcard
make
sync


Known issue for uhost: 
mele/mk802 firmware: wireless doesnt work but usb sound card works
uhost firmware: wireless work but usb sound card doesnt works

Root firmware on SD Card:
Mount SD Card Partition on PC Side and
go to boot partition and comment the following line:

vi init.sun4i.rc
#	mount ext4 /dev/block/mmcblk0p3 /system ro remount
#	mount rootfs rootfs / ro remount

and umount SD Card:
export DEV=/dev/sdX
umount ${DEV}1
umount ${DEV}2
umount ${DEV}3
umount ${DEV}4
umount ${DEV}5
umount ${DEV}6
umount ${DEV}7
umount ${DEV}8
umount ${DEV}9
umount ${DEV}10

Other configuration files for advanced users:

http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/img_1extract_tools.zip http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/partition.zip

Other Configs: to active the hdmi port: setprop au.ui.enable_hdmi_advanced true

How to Compile Android Kernel Module

On UHost get kernel version and toolchain version:
adb shell
cat /proc/version                                             
Linux version 3.0.8 (release@saserver) (gcc version 4.5.1 (Sourcery G++ Lite 2010.09-50) ) #1 PREEMPT Wed Oct 24 08:46:52 EDT 2012

On Ubuntu:
su
apt-get install uboot-mkimage build-essential git libncurses5-dev
cd
mkdir compile_uhost
cd compile_uhost/
wget http://www.codesourcery.com/sgpp/lite/arm/portal/package7853/public/arm-none-linux-gnueabi/arm-2010.09-50-arm-none-linux-gnueabi.bin
chmod +x arm-2010.09-50-arm-none-linux-gnueabi.bin
sudo dpkg-reconfigure -plow dash --> No
./arm-2010.09-50-arm-none-linux-gnueabi.bin --> install in /root/CodeSourcery/Sourcery_G++_Lite
sudo dpkg-reconfigure -plow dash --> Yes

#git clone  https://github.com/amery/linux-allwinner.git
#cd linux-allwinner
#git checkout lichee-3.0.8-sun4i

git clone git://github.com/linux-sunxi/linux-sunxi
cd linux-allwinner
git checkout lichee-3.0.8-sun4i

vi scripts/setlocalversion
search append a plus sign and comment
        #if test "${LOCALVERSION+set}" != "set"; then
        #       scm=$(scm_version --short)
        #       res="$res${scm:++}"
        #fi

make ARCH=arm sun4i_crane_defconfig 
export PATH="/root/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
./build.sh -p sun4i_crane
make ARCH=arm menuconfig 
Device Drivers -> Sound Card Support -> Advanced Linux Sound Architecture -> USB Sound Devices -> USB audio/midi Driver (M)
save configuration
mv Module.symvers Module.symvers.ori
adb pull /system/vendor/modules/Module.symvers .
make clean
./build.sh -p sun4i_crane
modinfo ./sound/usb/snd-usb-audio.ko --> vermagic:       3.0.8 preempt mod_unload modversions ARMv7
cd ./output/lib/modules/3.0.8/
adb push snd-usbmidi-lib.ko /system/vendor/modules/ 
adb push snd-usb-audio.ko /system/vendor/modules/ 
adb push snd-rawmidi.ko /system/vendor/modules/ 
adb push snd-hwdep.ko /system/vendor/modules/


On UHost:
cd /system/vendor/modules/
insmod snd-hwdep.ko
insmod snd-rawmidi.ko
insmod snd-usbmidi-lib.ko
insmod snd-usb-audio.ko

<3>[15939.111791] snd_hwdep: exports duplicate symbol snd_hwdep_new (owned by kernel)
<3>[16002.191792] snd_rawmidi: exports duplicate symbol snd_rawmidi_drain_input (owned by kernel)
<3>[16028.459804] snd_usbmidi_lib: exports duplicate symbol snd_usbmidi_create (owned by kernel)
<3>[16051.063892] snd_usb_audio: module is already loaded

Try to compile other module ( Joystick support, Playstation2 joystick via USB adapter, etc):

In .config From:
# CONFIG_HID_SONY is not set
to
CONFIG_HID_SONY=m 
in .config

./build.sh -p sun4i_crane
adb push hid-sony.ko /system/vendor/modules/

On UHost:
cd /system/vendor/modules/
insmod hid-sony.ko
root@android:/system/vendor/modules # lsmod
hid_sony 2231 0 - Live 0xbf050000


It's works.

Android Debian

Android Debian Romanrm on A10

#Superuser
su

#Download Software and Unpack
wget https://romanrm.net/dl/a10/debian/a10-debian-server-2gb.2013-09-20.img.bz2
bzip2 -d a10-debian-server-2gb.2013-09-20.img.bz2
wget http://dl.linux-sunxi.org/users/amery/sunxi-3.0/latest/mk802ii_hwpack.tar.xz
tar -xvf mk802ii_hwpack.tar.xz

#Mount file image
fdisk -l a10-debian-server-2gb.2013-09-20.img
Disk a10-debian-server-2gb.2013-09-20.img: 1782 MB, 1782579200 bytes
255 heads, 63 sectors/track, 216 cylinders, total 3481600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000cb560

                               Device Boot      Start         End      Blocks   Id  System
a10-debian-server-2gb.2013-09-20.img1            2048      127071       62512    e  W95 FAT16 (LBA)
a10-debian-server-2gb.2013-09-20.img2          131072     3451383     1660156   83  Linux

mkdir /tmp/part1 /tmp/part2
mount -o loop,offset=$(echo 2048*512 | bc) a10-debian-server-2gb.2013-09-20.img /tmp/part1
mount -o loop,offset=$(echo 131072*512 | bc) a10-debian-server-2gb.2013-09-20.img /tmp/part2

#UMount SDCard X=letter of your SDCard Device
export DEV=/dev/sdX
umount ${DEV}1
umount ${DEV}2
umount ${DEV}3
umount ${DEV}4
umount ${DEV}5
umount ${DEV}6
umount ${DEV}7
umount ${DEV}8
umount ${DEV}9
umount ${DEV}10

vi partition.txt
# partition table of /dev/sdb
unit: sectors

/dev/sdb1 : start=     2048, size=   129024, Id= e
/dev/sdb2 : start=   131072, size= 30984192, Id=83

#Create SDCard Partition and Format
dd if=/dev/zero of=${DEV} bs=1M count=3
sfdisk -f ${DEV} < partitions.txt
mkfs.vfat -F 32 -n "bootfs" ${DEV}1
mkfs.ext3 -L rootfs ${DEV}2

#Mount SDCard Partition
mkdir /tmp/sdcard_bootfs /tmp/sdcard_rootfs 
mount ${DEV}1 /tmp/sdcard_bootfs
mount ${DEV}2 /tmp/sdcard_rootfs

#Copy Debian Data
rsync -av /tmp/part1/* /tmp/sdcard_bootfs
rsync -av /tmp/part2/* /tmp/sdcard_rootfs
sync
umount /tmp/sdcard_bootfs
umount /tmp/sdcard_rootfs

#Install UBoot
dd if=bootloader/sunxi-spl.bin of=${DEV} bs=1024 seek=8
dd if=bootloader/u-boot.bin of=${DEV} bs=1024 seek=32

#Install CedarX Kernel
ssh 192.168.2.5 -l root
password: password
wget --no-check-certificate https://romanrm.net/dl/a10/kernels/video-3.4/3.4.67-r0-v-rm3%2b/linux-image-3.4.67-r0-v-rm3%2b_3.4.67-r0-v-rm3%2b-10.00.Custom_armhf.deb
dpkg -i linux-image-3.4.67-r0-v-rm3+_3.4.67-r0-v-rm3+-10.00.Custom_armhf.deb
cd /boot
wget --no-check-certificate https://romanrm.net/dl/a10/kernels/video-3.4/3.4.67-r0-v-rm3%2b/uImage-3.4.67-r0-v-rm3%2b
mv uImage uImage.old
cp uImage-3.4.67-r0-v-rm3+ uImage
reboot

#Configure/Upgrade
ssh 192.168.2.5 -l root
password: password
echo "export LC_ALL=C" >>/root/.bashrc
exit
ssh 192.168.2.5 -l root
password: password
apt-get update
apt-get upgrade
dpkg-reconfigure tzdata
passwd
apt-get install unzip file

Android Debian Chroot on ARM

On PC Side - Create Root File System

su -
cd /root
dd if=/dev/zero of=squeeze_armel.bin bs=1024k count=850
mkfs.ext2 ./squeeze_armel.bin -F
mkdir -p /tmp/squeeze
mkdir -p /tmp/squeeze/proc
mount -t proc none /tmp/squeeze/proc
mount -o loop ./squeeze_armel.bin /tmp/squeeze
apt-get install debootstrap debian-archive-keyring qemu-user-static
debootstrap --verbose --foreign --arch=armel --variant=minbase --include=aptitude,wget,netbase,locales,dialog,psmisc,vim,module-init-tools,ifupdown,procps,iproute,iputils-ping,ntpdate,less,traceroute,dnsutils,strace,file,dropbear,ngrep,lsof squeeze /tmp/squeeze
cp /usr/bin/qemu-arm-static /tmp/squeeze/usr/bin/
mkdir -p /tmp/squeeze/proc
mount -t proc none /tmp/squeeze/proc
chroot /tmp/squeeze/
./debootstrap/debootstrap --second-stage
apt-get clean
dpkg-reconfigure tzdata
dpkg-reconfigure locales
passwd

find /var/lib/apt/lists -type f -delete
echo "Debian" > /etc/hostname
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >>/etc/bash.bashrc
echo "PS1='$USER@Debian# '" >>/etc/bash.bashrc

cat <<EOF > /etc/resolv.conf
nameserver 192.168.2.1
EOF

ln -s /dev/null /etc/blkid.tab
ln -s /proc/mounts /etc/mtab
mkdir /data

cat <<EOF > /etc/hosts
127.0.0.1       localhost
EOF

cat <<EOF > /etc/apt/sources.list
deb http://ftp.uk.debian.org/debian/ squeeze main contrib non-free
#deb-src http://ftp.uk.debian.org/debian/ squeeze main contrib non-free

deb http://security.debian.org/ squeeze/updates main contrib non-free
#deb-src http://security.debian.org/ squeeze/updates main contrib non-free

deb http://ftp.uk.debian.org/debian squeeze-updates main
#deb-src http://ftp.uk.debian.org/debian squeeze-updates main
EOF

echo "export LC_ALL=C" >>/root/.bashrc

sync
exit

chroot /tmp/squeeze/
apt-get update
apt-get upgrade
#apt-get install lxde
#apt-get install tightvncserver
#apt-get install icewm
apt-get clean

rm /usr/bin/qemu-arm-static
exit
sync
umount /tmp/squeeze

save and push:
adb push squeeze_armel.bin /data/local
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/busyboxw/download -O busyboxw
adb push ./busyboxw /data/local
adb shell


On UHost - Mounting with no chroot

cd /data/local
chmod 777 ./busyboxw
cd /

/data/local/busyboxw vi ./ucbash_deb.sh
cd /data/local
chmod 777 ./busyboxw
mkdir -p /data/local/rootfs
./busyboxw mount /data/local/squeeze_armel.bin /data/local/rootfs
ln -s /data/local/rootfs/lib /lib
ln -s /data/local/rootfs/usr /usr
ln -s /data/local/rootfs/etc/alternatives /etc/alternatives
PS1='$USER@DEBIAN:${PWD:-?}> ' LINES=37 PATH="/data/local/rootfs/bin:/data/local/rootfs/sbin:/data/local/rootfs/usr/bin:/data/local/rootfs/usr/sbin:${PATH}" LD_LIBRARY_PATH="/data/local/rootfs/usr/lib:${PATH}" /data/local/rootfs/bin/bash


chmod 777 ./ucbash_deb.sh
su
./ucbash_deb.sh

--Create hard disk usb mount and overrride Download directory
vi m.sh
mount /dev/block/sda1 /mnt/usbhost0
mount --bind /mnt/usbhost0 /mnt/sdcard/Download
mount

chmod 777 ./m.sh


--Umount:
exit
rm /lib
rm /usr
./busyboxw umount /tmp/rootfsdeb

On UHost - Mounting with chroot

adb connect 192.168.2.4
adb shell
mkdir -p /tmp/squeeze
/data/local/busyboxw mount -o loop /data/local/squeeze_armel.bin /tmp/squeeze
/data/local/busyboxw mount -t proc none /tmp/squeeze/proc
BINDS="/dev /dev/pts /data /sys /system /cache /vendor /sdcard /mnt /mnt/asec /mnt/obb /mnt/private /mnt/secure/asec /mnt/sdcard/.android_secure"
for i in $BINDS
do
echo "mount -o bind ${i} /tmp/squeeze${i}"
mkdir -p /tmp/squeeze${i}
/data/local/busyboxw mount -o bind ${i} /tmp/squeeze${i}
done
#unset PS1 PROMPT_COMMAND
/data/local/busyboxw chroot /tmp/squeeze /bin/bash
#PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
service dropbear start

On UHost - UnMounting

adb connect 192.168.2.4
adb shell
service dropbear stop
exit
BINDS="/dev/pts /dev /data /sys /system /cache /vendor /sdcard /mnt/asec /mnt/obb /mnt/private /mnt/secure/asec /mnt/sdcard/.android_secure /mnt /sdcard /proc /."
for i in $BINDS
do
echo "umount /tmp/squeeze${i}"
busyboxw umount /tmp/squeeze${i}
done

Update: Debian ARMHF

su -
cd /opt/debian_arm
dd if=/dev/zero of=wheezy_armhf.bin bs=1024k count=850
mkfs.ext2 ./wheezy_armhf.bin -F
mkdir -p /tmp/wheezy
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
mount -o loop ./wheezy_armhf.bin /tmp/wheezy
apt-get install debootstrap debian-archive-keyring qemu-user-static
debootstrap --verbose --foreign --arch=armhf --variant=minbase --include=aptitude,wget,netbase,locales,dialog,psmisc,vim,module-init-tools,ifupdown,procps,iproute,iputils-ping,ntpdate,less,traceroute,dnsutils,strace,file,dropbear,ngrep,lsof,apt-utils,telnet,tcpdump,net-tools wheezy /tmp/wheezy
cp /usr/bin/qemu-arm-static /tmp/wheezy/usr/bin/
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
chroot /tmp/wheezy/
./debootstrap/debootstrap --second-stage
apt-get clean
dpkg-reconfigure tzdata
dpkg-reconfigure locales
passwd

find /var/lib/apt/lists -type f -delete
echo "Debian" > /etc/hostname
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >>/etc/bash.bashrc
echo "PS1='$USER@Debian# '" >>/etc/bash.bashrc

cat <<EOF > /etc/resolv.conf
nameserver 192.168.2.1
EOF

ln -s /dev/null /etc/blkid.tab
ln -s /proc/mounts /etc/mtab
mkdir /data

cat <<EOF > /etc/hosts
127.0.0.1       localhost
EOF

cat <<EOF > /etc/apt/sources.list
deb http://ftp.de.debian.org/debian/ wheezy main contrib non-free
#deb-src http://ftp.de.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main contrib non-free
#deb-src http://security.debian.org/ wheezy/updates main contrib non-free

deb http://ftp.de.debian.org/debian wheezy-updates main
#deb-src http://ftp.de.debian.org/debian wheezy-updates main
EOF

echo "export LC_ALL=C" >>/root/.bashrc

sync
exit

chroot /tmp/wheezy/
apt-get update
apt-get upgrade
#apt-get install lxde
#apt-get install tightvncserver
#apt-get install icewm
apt-get clean

rm /usr/bin/qemu-arm-static
exit
sync
umount /tmp/wheezy

save and push:
adb push wheezy_armhf.bin /data/local
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/busyboxw/download -O busyboxw
adb push ./busyboxw /data/local
adb shell


Android Debian Chroot on Virtualbox X86 32 Bit (Genymotion,Android_X86)

On PC Side - Create Root File System

su -
mkdir /opt/debian_x86_32
cd /opt/debian_x86_32
dd if=/dev/zero of=wheezy_x86_32.bin bs=1024k count=850
mkfs.ext2 ./wheezy_x86_32.bin -F
mkdir -p /tmp/wheezy
mkdir -p /tmp/wheezy/proc
mount -t proc none /tmp/wheezy/proc
mount -o loop ./wheezy_x86_32.bin /tmp/wheezy
apt-get install debootstrap debian-archive-keyring qemu-user-static
debootstrap --verbose --arch=i386 --variant=minbase --include=net-tools,apt-utils,aptitude,wget,netbase,locales,dialog,psmisc,vim,module-init-tools,ifupdown,procps,iproute,iputils-ping,ntpdate,less,traceroute,dnsutils,strace,file,dropbear,ngrep,lsof wheezy /tmp/wheezy
chroot /tmp/wheezy/
apt-get clean
dpkg-reconfigure tzdata
dpkg-reconfigure locales
passwd

find /var/lib/apt/lists -type f -delete
echo "Debian" > /etc/hostname
echo "export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" >>/etc/bash.bashrc
echo "PS1='$USER@Debian# '" >>/etc/bash.bashrc

cat <<EOF > /etc/resolv.conf
nameserver 192.168.2.1
EOF

ln -s /dev/null /etc/blkid.tab
ln -s /proc/mounts /etc/mtab
mkdir /data

cat <<EOF > /etc/hosts
127.0.0.1       localhost
EOF

cat <<EOF > /etc/apt/sources.list
deb http://ftp.us.debian.org/debian wheezy main

deb http://ftp.uk.debian.org/debian/ wheezy main contrib non-free
#deb-src http://ftp.uk.debian.org/debian/ wheezy main contrib non-free

deb http://security.debian.org/ wheezy/updates main contrib non-free
#deb-src http://security.debian.org/ wheezy/updates main contrib non-free

deb http://ftp.uk.debian.org/debian wheezy-updates main
#deb-src http://ftp.uk.debian.org/debian wheezy-updates main
EOF

echo "export LC_ALL=C" >>/root/.bashrc

sync
exit

chroot /tmp/wheezy/
apt-get update
apt-get upgrade
apt-get clean
exit
sync

cd /tmp
tar cvfz /opt/debian_x86_32/wheezy_x86.tgz wheezy
sftp put on sourceforge
umount /tmp/wheezy

save and push On Android Virtualbox:
adb connect 192.168.56.101
adb push wheezy_x86_32.bin /data/local

Download and install Busybox Static:
wget http://ftp.us.debian.org/debian/pool/main/b/busybox/busybox-static_1.20.0-7_i386.deb
ar -x busybox-static_1.20.0-7_i386.deb
gunzip data.tar.gz                   
tar xvf data.tar                            
rm control.* data.* debian-binary
cp ./bin/busybox busyboxw
adb push busyboxw /data/local
adb shell
cd /data/local
chmod 777 busyboxw
./busyboxw

Download tar:
wget http://sourceforge.net/projects/wdtvlivemods/files/store/linux/wheezy_x86.tgz/download -O wheezy_x86.tgz

On Virtualbox - Mounting with chroot

adb connect 192.168.56.101
adb shell
mkdir -p /data/local/tmp
mkdir -p /data/local/tmp/wheezy
/data/local/busyboxw mount -o loop -t ext2 /data/local/wheezy_x86_32.bin /data/local/tmp/wheezy
mkdir -p /data/local/tmp/wheezy/proc
/data/local/busyboxw mount -t proc none /data/local/tmp/wheezy/proc
BINDS="/dev /dev/pts /sys /mnt/secure /mnt/asec /mnt/obb /mnt/shell/emulated /data /system /cache"
for i in $BINDS
do
echo "mount -o bind ${i} /data/local/tmp/wheezy${i}"
mkdir -p /data/local/tmp/wheezy${i}
/data/local/busyboxw mount -o bind ${i} /data/local/tmp/wheezy${i}
done
LD_PRELOAD=""  /data/local/busyboxw chroot /data/local/tmp/wheezy /bin/bash
service dropbear start

On Virtualbox - UnMounting

service dropbear stop
exit
BINDS="/dev/pts /dev /sys /mnt/secure /mnt/asec /mnt/obb /mnt/shell/emulated /data /system /cache /proc"
for i in $BINDS
do
echo "umount /data/local/tmp/wheezy${i}"
/data/local/busyboxw umount /data/local/tmp/wheezy${i}
done
/data/local/busyboxw umount /data/local/tmp/wheezy

On Android_X86 - Mounting with chroot

su
cd /storage/usb0
wget http://sourceforge.net/projects/wdtvlivemods/files/store/linux/wheezy_x86.tgz/download -O wheezy_x86.tgz
gunzip wheezy_x86.tgz
dd if=/dev/zero of=wheezy_x86_32.bin bs=1024k count=10000000 
mkfs.ext2 ./wheezy_x86_32.bin -F
mkdir -p /storage/usb0/tmp  /storage/usb0/tmp/wheezy
mount -o loop -t ext2 /storage/usb0/wheezy_x86_32.bin /storage/usb0/tmp/wheezy
tar xvf wheezy_x86.tar -C /storage/usb0/tmp/wheezy
DEBIAN_ROOT=/storage/usb0/tmp/wheezy/wheezy
ls -l ${DEBIAN_ROOT}
mkdir -p ${DEBIAN_ROOT}/proc
mount -t proc none ${DEBIAN_ROOT}/proc
BINDS="/dev /dev/pts /sys /mnt/shell/emulated /data /system /cache"
for i in $BINDS
do
echo "mount -o bind ${i} ${DEBIAN_ROOT}${i}"
mkdir -p ${DEBIAN_ROOT}${i}
mount -o bind ${i} ${DEBIAN_ROOT}${i}
done
LD_PRELOAD="" chroot ${DEBIAN_ROOT} /bin/bash
service dropbear start

On Android_X86 - UnMounting

service dropbear stop
exit
BINDS="/dev/pts /dev /sys /mnt/shell/emulated /data /system /cache /proc"
for i in $BINDS
do
echo "umount ${DEBIAN_ROOT}${i}"
umount ${DEBIAN_ROOT}${i}
done
umount /storage/usb0/tmp/wheezy

Install Android SDK

Sun Java7:

 
sudo apt-get remove --purge openjdk-* icedtea-* icedtea6-*
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
java -version

ADT (Android Developer Tools):

 
wget http://dl.google.com/android/adt/adt-bundle-linux-x86_64-20130219.zip
unzip adt-bundle-linux-x86_64-20130219.zip
cd adt-bundle-linux-x86_64-20130219/eclipse/
./eclipse 

Android Compile CodeSourcery Sourcery_G++_Lite (GLIBC)

Compile Busybox Statically linked

su
cd
mkdir compile_busybox
cd compile_busybox/
apt-get install uboot-mkimage build-essential git libncurses5-dev
git clone git://busybox.net/busybox.git
export PATH="/root/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
export ARCH=arm
export CROSS_COMPILE=/root/CodeSourcery/Sourcery_G++_Lite/bin/arm-none-linux-gnueabi-
cd busybox/
make menuconfig

$ Busybox Settings --> Build Options --> Build Busybox as a static binary (no shared libs)  -  Enable this option by pressing "Y"
$ Busybox Settings --> Build Options --> Cross compiler prefix  -  Set this option equal to "arm-none-linux-gnueabi-"
$ Linux Module Utilities --> () Default directory containing modules - Set this option to nothing
$ Linux Module Utilities --> () Default name of modules.dep - Set this option to nothing

Select desired packages and save your configuration

make

file busybox
busybox: ELF 32-bit LSB executable, ARM, version 1 (SYSV), statically linked, for GNU/Linux 2.6.16, stripped

cp busybox busyboxm
adb push busyboxm /system/xbin
adb shell
busyboxm

Telnet Daemon with no password ( insicure, for testing purpose only):

ln -s /system/xbin/busyboxm /system/xbin/telnetd
telnetd -K -l sh -p 23

Vi:

ln -s /system/xbin/busyboxm /system/xbin/vi

Compile Bash Statically linked

mkdir compile_bash
cd compile_bash/
wget ftp://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xvfz bash-4.2.tar.gz
cd bash-4.2
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/bash-4.2-arm.patch/download -O bash-4.2-arm.patch
patch -p0 < bash-4.2-arm.patch

export PATH="/root/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
export CROSS="arm-none-linux-gnueabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc"
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"
./configure --host=arm-linux --enable-static-link --without-bash-malloc --disable-rpath --disable-nls
sed -i "s/CFLAGS = -g -O2/CFLAGS = -g -O2 -static/g" Makefile
make
$STRIP ./bash

adb push ./bash /data/local
adb shell
cd /data/local
chmod 777 ./bash
PS1='$USER@BASH:${PWD:-?}> ' ./bash
help

Compile Bftpd Statically linked

mkdir compile_bftpd
cd compile_bftpd
wget http://sourceforge.net/projects/bftpd/files/bftpd/bftpd-3.8/bftpd-3.8.tar.gz
tar xvfz bftpd-3.8.tar.gz
cd bftpd

export PATH="/root/CodeSourcery/Sourcery_G++_Lite/bin:${PATH}"
export CROSS="arm-none-linux-gnueabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc"
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"
./configure
sed -i "s/CFLAGS=/CFLAGS=-static /g" Makefile
sed -i "s/LDFLAGS=/LDFLAGS=-static /g" Makefile
make
$READELF -d ./bftpd
$STRIP ./bftpd
ls -l ./bftpd
cp bftpd.conf bftpd.conf.ori
sed -i "s/\/var\/log/\/data\/local/g" ./bftpd.conf
sed -i "s/\/var\/run\/bftpd/\/data\/local/g" ./bftpd.conf
sed -i 's%DENY_LOGIN="Anonymous login disabled."%#&%g'  bftpd.conf

adb push ./bftpd /data/local
adb push ./bftpd.conf /data/local
adb shell
cd /data/local
chmod 777 ./bftpd
./bftpd -d -c bftpd.conf

ftp 192.168.2.5
user: ftp
pwd: <blank>

Android Compile NDK (Bionic)

Compile Hello World dinamically linked

su
cd
mkdir /root/ndk 
cd /root/ndk
Download android-ndk-r8e-linux-x86_64.tar.bz2
tar xvfj android-ndk-r8e-linux-x86_64.tar.bz2 
 
mkdir compile_hello
cd compile_hello/

--Hello Word in C

vi hello.c
#include<stdio.h>
int main(){
    while(1){
        printf("Hello Open World\n");
        getchar();
    }
  }

export PATH="/root/ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin:${PATH}"
export SYSROOT="/root/ndk/android-ndk-r8e/platforms/android-5/arch-arm/"
export CROSS="arm-linux-androideabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc --sysroot=$SYSROOT "
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"


$CC hello.c -o hello
$STRIP ./hello

adb push ./hello /data/local
adb shell
cd /data/local
chmod 777 ./hello
./hello

Compile Bftpd dinamically linked

mkdir compile_bftpd
cd compile_bftpd
wget http://sourceforge.net/projects/bftpd/files/bftpd/bftpd-3.8/bftpd-3.8.tar.gz
tar xvfz bftpd-3.8.tar.gz
cd bftpd
Download patch created by: diff -Naur bftpd bftpd_android  > bftpd-android-patch
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/bftpd-android-patch/download -O bftpd-android-patch
patch -p1 < bftpd-android-patch

export PATH="/root/ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin:${PATH}"
export SYSROOT="/root/ndk/android-ndk-r8e/platforms/android-5/arch-arm/"
export CROSS="arm-linux-androideabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc --sysroot=$SYSROOT "
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"

./configure
make
$STRIP ./bftpd
$READELF -d ./bftpd

cp bftpd.conf bftpd.conf.ori
sed -i "s/\/var\/log/\/data\/local/g" ./bftpd.conf
sed -i "s/\/var\/run\/bftpd/\/data\/local/g" ./bftpd.conf
sed -i 's%DENY_LOGIN="Anonymous login disabled."%#&%g'  bftpd.conf

adb push ./bftpd /data/local
adb push ./bftpd.conf /data/local
adb shell
cd /data/local
chmod 777 ./bftpd
./bftpd -d -c bftpd.conf

ftp 192.168.2.5
user: ftp
pwd: <blank>

Compile Bftpd dinamically linked - NDK r9c - API 14 - Android 4.0

http://developer.android.com/tools/sdk/ndk/index.html

mkdir -p /opt/compile /opt/compile/ndk
cd /opt/compile/ndk
wget http://dl.google.com/android/ndk/android-ndk-r9c-linux-x86_64.tar.bz2
tar xvfj android-ndk-r9c-linux-x86_64.tar.bz2

mkdir /opt/compile/compile_bftpd
cd /opt/compile/compile_bftpd
wget http://sourceforge.net/projects/bftpd/files/bftpd/bftpd-3.8/bftpd-3.8.tar.gz
tar xvfz bftpd-3.8.tar.gz
cd bftpd
#Download patch created by: diff -Naur bftpd bftpd_android  > bftpd-android-patch
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/bftpd-android-patch/download -O bftpd-android-patch
patch -p1 < bftpd-android-patch

export PATH="/opt/compile/ndk/android-ndk-r9c/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86_64/bin:${PATH}"
export SYSROOT="/opt/compile/ndk/android-ndk-r9c/platforms/android-14/arch-arm/"
export CROSS="arm-linux-androideabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc --sysroot=$SYSROOT "
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"

./configure
make
$STRIP ./bftpd
$READELF -d ./bftpd

cp bftpd.conf bftpd.conf.ori
sed -i "s/\/var\/log/\/data\/local/g" ./bftpd.conf
sed -i "s/\/var\/run\/bftpd/\/data\/local/g" ./bftpd.conf
sed -i 's%DENY_LOGIN="Anonymous login disabled."%#&%g'  bftpd.conf

adb push ./bftpd /data/local
adb push ./bftpd.conf /data/local
adb shell
cd /data/local
chmod 777 ./bftpd
./bftpd -d -c bftpd.conf

ftp 192.168.2.5
user: ftp
pwd: <blank>

Compile Bash Statically linked

cd /root/ndk
mkdir compile_bash
cd compile_bash/
wget ftp://ftp.gnu.org/gnu/bash/bash-4.2.tar.gz
tar xvfz bash-4.2.tar.gz
cd bash-4.2
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/bash-4.2-arm.patch/download -O bash-4.2-arm.patch
patch -p0 < bash-4.2-arm.patch

export PATH="/root/ndk/android-ndk-r8e/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86_64/bin:${PATH}"
export SYSROOT="/root/ndk/android-ndk-r8e/platforms/android-5/arch-arm/"
export CROSS="arm-linux-androideabi-"
export STRIP="${CROSS}strip"
export CC="${CROSS}gcc --sysroot=$SYSROOT "
export CXX="${CROSS}g++"
export LD="${CROSS}ld"
export RANLIB="${CROSS}ranlib"
export AR="${CROSS}ar"
export AS="${CROSS}as"
export NM="${CROSS}nm"
export READELF="${CROSS}readelf"

./configure --host=arm-linux --enable-static-link --without-bash-malloc --disable-rpath --disable-nls
make
$STRIP ./bash

adb push ./bash /data/local
adb shell
cd /data/local
chmod 777 ./bash
PS1='$USER@BASH:${PWD:-?}> ' ./bash
help

Android Compile BuildRoot (UCLIBC)

Buildroot RootFS side by side with Android (No Chroot)

su
cd /opt
apt-get install build-essential libncurses-dev bison flex texinfo zlib1g-dev gettext libssl-dev autoconf subversion wget python unzip mercurial

dpkg-reconfigure dash 
and select No 

Open new terminal session with clean environment:
mkdir dl
wget http://buildroot.uclibc.org/downloads/buildroot-2013.05.tar.gz
rm -rf buildroot-2013.05/
tar xvfz buildroot-2013.05.tar.gz
cd buildroot-2013.05/

make menuconfig
Target Architecture (ARM (little endian))  --->
Target Architecture Variant (cortex-A8)  --->
Build options  --->
  (../dl) Download dir 
Toolchain  --->  
  [*] Enable large file (files > 2 GB) support
  [*] Enable IPv6 support
  [*] Enable RPC support
  [*] Enable WCHAR support
  [*] Enable toolchain locale/i18n support
  [*]   Enable C++ support 
  [*] Enable stack protection support
Package Selection for the target  --->
  [*]   Show packages that are also provided by busybox
  Compressors and decompressors  --->
    [*] bzip2
    [*] gzip
    [*] infozip
    [*] lzop
    [*] xz-utils
  Debugging, profiling and benchmark  --->
    [*] lsof
    [*] strace
  Development tools  --->
    [*] gawk
    [*] grep
    [*] sed
    [*] tar
  Hardware handling  --->
    [*] lshw
  Interpreter languages and scripting  --->
    [*] php
    [*] python 
  Networking applications  --->
    [*] lighttpd
    [*]   openssl support
    [*]   zlib support
    [*]   bzip2 support
    [*]   pcre support
    [*]   webdav support
    [*]   lua support
    [*] ngrep
    [*] netcat
    [*] rsync
    [*] wget 
  Shell and utilities  --->
    [*] file
    [*] bash
  System tools  --->
    [*] htop
    [*] psmisc 
  Text editors and viewers  --->
    [*] vim
  Filesystem images  --->
    [*] ext2 root filesystem
    [*] tar the root filesystem


save config
cp .config ../dl/config_01
make

--Put root file system on Android
adb push ./output/images/rootfs.ext2 /data/local
wget http://sourceforge.net/projects/wdtvlivemods/files/store/allwinner/busyboxw.gz/download -O busyboxw.gz
gunzip busyboxw.gz
adb push ./busyboxw /data/local
adb shell

--Mount
cd /data/local
chmod 777 ./busyboxw
cd /

vi ./ucbash.sh
cd /data/local
chmod 777 ./busyboxw
mkdir -p /tmp/rootfs
./busyboxw mount /data/local/rootfs.ext2 /tmp/rootfs
ln -s /tmp/rootfs/lib /lib
ln -s /tmp/rootfs/usr /usr
PS1='$USER@UCLIB:${PWD:-?}> ' LINES=37 PATH="/tmp/rootfs/bin:/tmp/rootfs/sbin:/tmp/rootfs/usr/bin:/tmp/rootfs/usr/sbin:${PATH}" LD_LIBRARY_PATH="/tmp/rootfs/usr/lib:${PATH}" /tmp/rootfs/bin/bash

chmod 777 ./ucbash.sh
su
./ucbash.sh

--Create hard disk usb mount and overrride Download directory
vi m.sh
mount /dev/block/sda1 /mnt/usbhost0
mount --bind /mnt/usbhost0 /mnt/sdcard/Download
mount

chmod 777 ./m.sh


--Umount:
exit
rm /lib
rm /usr
./busyboxw umount /tmp/rootfsdeb

Android Devel

China Post Tracking

Best Android Apps

Android Terminal Emulator

Hacker's Keyboard

Android XBMC External Player (XAF Version)

TubeMate YouTube Downloader

Next Browser

DeliciousDroid

ADB over Network

File Manager HD

AppMgr III (App 2 SD)

Realplayer

Clean Music Player

Copyleft Download Mp3 Music

Rocket Music Player

AnDLNA

GoodPlayer for Android

Subslauncher

GMT Subtitles

KeyTest

Rotation Locker

Google Quick Office

Microsoft Remote Desktop

AWD - PHP/HTML/CSS/JS IDE

JuiceSSH - SSH Client

Aptoide

Game Guardian

Best Linux/Android Tricks

android/android_post_install.txt · Last modified: 2014/08/03 12:41 by rkpisanu
www.chimeric.de Creative Commons License Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0





Mail