Debian united on Transformer

This is Experimental stuff! and under further modifications.

The prerequisite is to first install Debian Linux on Transformer TF701.

My debian-kit loop file uses 4G and the Linux loop file uses another 4G.

So, it is best if the Linux loop file is also used by debian-kit to save 4G of disk space. Additionally, it is also easier to maintain the Debian packages.

My debian-kit /etc/group contains the Android system groups, so that should be copied over to the Linux /etc/group. I have to add the userid of my Android Terminal Emulator to /etc/passwd for ssh login in Android. For ref, see Android X Server.

Next, is to copy over all the debian-kit /etc/ssh/ configs and keys to Linux /etc/ssh/ .


To test with the Linux loop file, change the image path in /data/local/deb/bootdeb using the IMG variable: below, the previous IMG is commented and the new IMG is added.

/data/local/deb/bootdeb

1     #IMG=${BIN}/debian.img 
2 IMG=/data/media/debian-root
3

When the device is rebooted from Debian Linux to Android, there are 2 problems:

  1. the loop file cannot be mounted, because the /data link that is created in Linux should not be around in Android, for it will force debian-kit to move the Android /data when it try to merge the Linux top dirs into Android.
  2. Android X Server cannot be started if the Linux X server /tmp/.X11-unix is not removed, because it will behave as if a X server is already running.

To fix both problems, I patch the /etc/init.d/tf701 :

 1     #! /bin/sh
2 # Simple init | Trel725
3 # sky mod:
4 # + rm android dirs on umount
5 # + clean up X in /tmp in Android
6
7 if [ -d /system ]; then
8
9 if [ -d /tmp ]; then
10 cd /tmp || exit 0
11 [ "$(/usr/bin/find . -maxdepth 0 -perm -002)" = "." ] || exit 0
12 rm -f .X*-lock
13 rm -rf .X*
14 fi
15 exit 0
16 fi
17
18 echo 16 > /sys/class/graphics/fb0/bits_per_pixel
19 echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
20 echo interactive > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
21 echo interactive > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
22 echo interactive > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
23
24
25 # Mounting android directories to
26 case "$1" in
27 start)
28 mount /dev/mmcblk0p14 /mnt/data
29 mount /dev/mmcblk0p4 /mnt/system
30
31 ln -s /mnt/data /data
32 ln -s /mnt/system/vendor /vendor
33 ln -s /mnt/data/media/0 /storage
34 ;;
35 stop)
36 rm /data
37 rm /storage
38 rm /vendor
39 umount /dev/mmcblk0p4
40 umount /dev/mmcblk0p14
41 ;;
42 *)
43 echo "Usage: /etc/init.d/test {start|stop}"
44 exit 1
45 ;;
46 esac
47
48 exit 0
49

When the device is now rebooted from Debian Linux to Android, the 2 problems should be fixed.


There is now another issue, which has to do with the Linux /run dir.

The upgraded jessie /run is now a temporary filesystem (tmpfs) which only stores volatile runtime data which does not persist on reboot.

The debian-kit mount bind the /run dir, thus persisting the data.

Another line in /data/local/deb/bootdeb needs to be modified to exclude /run from being mount bind, this is the case statement line that is above the Do nothing comment:

/data/local/deb/bootdeb

1     merge_root_work() {
2 # Substitute all from $1 (debian root) to $2 (android root)
3 local d
4 for d in "${1}"/*;do
5 local a=${2%/}/${d##*/}
6 if [ ! "${d}" -ef "${a}" ] && [ ! -e "${2%/}/.${d##*/}.debian-android" ];then
7 case ${d##*/} in dev|mnt|proc|run|sys|lost+found)
8 # Do nothing
9

Somehow, the /run dir is auto-created when the init.d scripts are run { see Debian on Android }, and Android will not persist the top dirs as well, so everything seems to work fine after this.

After some more testing, and backing up the previous debian.img , we can then remove the debian.img to save 4G of space.


Ref: Debian kit

Comments

blog comments powered by Disqus