blob: dd4abf5a25b4702b85feb709b113c782ce3899d2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
DEBRIOD
=======
Install a full blown Debian GNU/Linux Chroot on a LG G3 D855 CyanogenMod 12. Needs root and needs developer mode activated.
[](Debroid.png)
On Linux (tested on Fedora 22) prepare a Debian GNU/Linux Jessie base image.
```code
sudo yum install debootstrap
# 5g
dd if=/dev/zero of=jessie.img bs=$[ 1024 * 1024 ] \
count=$[ 1024 * 5 ]
# Show used loop devices
losetup -f
# Use the next free one (replace the loop number)
losetup /dev/loop0 jessie.img
mkdir jessie
sudo mkfs.ext4 /dev/loop0
sudo mount /dev/loop0 jessie
sudo debootstrap --foreign --variant=minibase \
--arch armel jessie jessie/ \
http://http.debian.net/debian
sudo umount jessie
```
Initial (manual) setup on external SD card on the Phone via Android Debugger:
```
adb root
adb shell
mkdir -p /storage/sdcard1/Linux/jessie
exit
adb push jessie.img /storage/sdcard1/Linux
adb shell
cd /storage/sdcard1/Linux
# Show used loop devices
losetup -f
# Use the next free one (replace the loop number)
losetup /dev/block/loop1 $(pwd)/jessie.img
mount -t ext4 /dev/block/loop1 $(pwd)/jessie
# Bind-Mound proc, dev, sys`
busybox mount --bind /proc $(pwd)/jessie/proc
busybox mount --bind /dev $(pwd)/jessie/dev
busybox mount --bind /dev/pts $(pwd)/jessie/dev/pts
busybox mount --bind /sys $(pwd)/jessie/sys
# Bind-Mound the rest of Android
mkdir -l $(pwd)/jessie/storage/sdcard{0,1}
busybox mount --bind /mnt/shell/emulated \
$(pwd)/jessie/storage/sdcard0
busybox mount --bind /storage/sdcard1 \
$(pwd)/jessie/storage/sdcard1
# Check mounts
mount | grep jessie
```
Second debootstrap stage, but inside the chroot on android!
```
LD_PRELOAD='' chroot $(pwd)/jessie /bin/bash -l
export PATH=/bin:/usr/bin:/usr/local/bin:/sbin:/usr/sbin:/usr/local/sbin
/debootstrap/debootstrap --second-stage
exit
```
Last setup steps
```
cat <<END >~/.bashrc
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$PATH
export EDITOR=vim
hostname $(cat /etc/hostname)
# Example how to start single services
# service uptimed status &>/dev/null || service uptimed start
# Fixing an error messages while loading the profile
sed -i s#id#/usr/bin/id# /etc/profile
# Setting the hostname
echo phobos > /etc/hostname
echo 127.0.0.1 phobos > /etc/hosts
hostname phobos
# Apt-sources
cat <<END > sources.list
deb http://ftp.uk.debian.org/debian/ jessie main contrib non-free
deb-src http://ftp.uk.debian.org/debian/ jessie main contrib non-free
END
apt-get update
```
Enter chroot script (as root):
```
cp jessie.sh /storage/sdcard1/Linux/jessie.sh
cd /storage/sdcard1/Linux
sh jessie.sh enter
```
Enjoy!
|