diff options
| author | Paul Buetow (uranus) <paul@buetow.org> | 2015-12-05 13:21:36 +0000 |
|---|---|---|
| committer | Paul Buetow (uranus) <paul@buetow.org> | 2015-12-05 13:21:36 +0000 |
| commit | 7ef975956cb21cc8410966e366736bdcb0bc2b95 (patch) | |
| tree | 41e6fde7ef0a5ec9919147b31adfe70dca195092 | |
| parent | a5542b650fb4bea4b9cf5bbd62bee7ebbbf18ba0 (diff) | |
| -rw-r--r-- | README.md | 59 | ||||
| -rw-r--r-- | data/local/debroid.sh | 12 | ||||
| -rw-r--r-- | data/local/userinit.sh | 10 | ||||
| -rw-r--r-- | storage/sdcard1/Linux/jessie.sh | 4 |
4 files changed, 46 insertions, 39 deletions
@@ -1,48 +1,57 @@ Debroid ======= -Install a full blown Debian GNU/Linux Chroot on a LG G3 D855 CyanogenMod 12. Needs root and needs developer mode activated. +Install a full blown Debian GNU/Linux Chroot on a LG G3 D855 CyanogenMod 13 (Android 6). Needs root and needs developer mode activated.  -On Linux (tested on Fedora 22) prepare a Debian GNU/Linux Jessie base image. +On Linux (tested on Fedora 23) prepare a Debian GNU/Linux Jessie base image. + +First debootstrap stage, on the Fedora Linux machine ```code -sudo yum install debootstrap +sudo dnf 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 +sudo losetup -f +# Store the next free one to $loop +loop=loopN +sudo losetup /dev/$loop jessie.img mkdir jessie -sudo mkfs.ext4 /dev/loop0 -sudo mount /dev/loop0 jessie -sudo debootstrap --foreign --variant=minibase \ +sudo mkfs.ext4 /dev/$loop +sudo mount /dev/$loop jessie +sudo debootstrap --foreign --variant=minbase \ --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 wait-for-device && adb shell mkdir -p /storage/sdcard1/Linux/jessie exit -adb push jessie.img /storage/sdcard1/Linux + +# Sparse image problem, may be too big for copying otherwise +gzip jessie.img +# Copy over +adb push jessie.img.gz /storage/sdcard1/Linux/jessie.img.gz adb shell cd /storage/sdcard1/Linux +gunzip jessie.img.gz # Show used loop devices losetup -f +# Store the next free one to $loop +loop=loopN # Use the next free one (replace the loop number) -losetup /dev/block/loop1 $(pwd)/jessie.img -mount -t ext4 /dev/block/loop1 $(pwd)/jessie +losetup /dev/block/$loop $(pwd)/jessie.img +mount -t ext4 /dev/block/$loop $(pwd)/jessie # Bind-Mound proc, dev, sys` busybox mount --bind /proc $(pwd)/jessie/proc @@ -51,8 +60,8 @@ 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 \ +mkdir -p $(pwd)/jessie/storage/sdcard{0,1} +busybox mount --bind /storage/emulated \ $(pwd)/jessie/storage/sdcard0 busybox mount --bind /storage/sdcard1 \ $(pwd)/jessie/storage/sdcard1 @@ -63,7 +72,7 @@ mount | grep jessie Second debootstrap stage, but inside the chroot on Android! ``` -LD_PRELOAD='' chroot $(pwd)/jessie /bin/bash -l +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 # Leave chroot @@ -74,7 +83,7 @@ Setup various scripts: ``` # jessie.sh -adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/ +adb push storage/sdcard1/Linux/jessie.sh /storage/sdcard/Linux/jessie.sh adb shell cd /storage/sdcard1/Linux sh jessie.sh enter @@ -84,6 +93,7 @@ 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) +END # Fixing an error message while loading the profile sed -i s#id#/usr/bin/id# /etc/profile @@ -99,6 +109,8 @@ 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 +apt-get upgrade +apt-get dist-upgrade exit # Exit chroot ``` @@ -120,16 +132,13 @@ exit # Exit adb shell ``` -Include to Android startup (userinit.sh seems not to work on CM12, so we use a different way here): +Include to Android startup: ``` -adb push data/local/debroid.sh /data/local -``` - -Afterwards install a program like ROM Toolbox and add the following bootup command: - -``` -/system/bin/sh /data/local/debroid.sh +adb push data/local/userinit.sh /data/local/userinit.sh +adb shell +chmod +x /data/local/userinit.sh +exit ``` Reboot & test! diff --git a/data/local/debroid.sh b/data/local/debroid.sh deleted file mode 100644 index 69f91c5..0000000 --- a/data/local/debroid.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/system/bin/sh - -while : ; do - /system/xbin/mountpoint /storage/sdcard1 - if [ $? -eq 0 ]; then - cd /storage/sdcard1/Linux - /system/bin/sh jessie.sh start_services - /system/bin/date - exit 0 - fi - /system/bin/sleep 1 -done diff --git a/data/local/userinit.sh b/data/local/userinit.sh new file mode 100644 index 0000000..48c87a0 --- /dev/null +++ b/data/local/userinit.sh @@ -0,0 +1,10 @@ +#!/system/bin/sh + +while : ; do + if [ -d /storage/sdcard1/Linux/jessie ]; then + cd /storage/sdcard1/Linux && /system/bin/sh jessie.sh start_services + /system/bin/date + exit 0 + fi + /system/bin/sleep 1 +done diff --git a/storage/sdcard1/Linux/jessie.sh b/storage/sdcard1/Linux/jessie.sh index 637ffdc..16d06c3 100644 --- a/storage/sdcard1/Linux/jessie.sh +++ b/storage/sdcard1/Linux/jessie.sh @@ -8,11 +8,11 @@ export LOOP_DEVICE=/dev/block/loop1 export SHELL=/bin/bash function start_services { - HOME=/root LD_PRELOAD='' chroot $ROOT $SHELL /etc/rc.debroid + HOME=/root chroot $ROOT $SHELL /etc/rc.debroid } function enter_chroot { - HOME=/root LD_PRELOAD='' chroot $ROOT $SHELL -l + HOME=/root chroot $ROOT $SHELL -l } function mount_chroot { |
