I'm setting up Archlinux on my old Galasy S phone (gen1). I wrote a shell script to to the mount/umount/chroot stuff so I don't have to type this manually. I use sshdroid on the phone as the SSH server, so you might want to adjust the script etc.
- Code: Select all
#!/data/data/berserker.android.apps.sshdroid/home/bin/ash
export PATH=$PATH:/data/data/berserker.android.apps.sshdroid/home/bin:/data/data/berserker.android.apps.sshdroid/dropbear
unset _chroot
_chroot="/mnt/emmc/chroot"
unset _tmp
_tmp="/mnt/sdcard/losetup.txt"
unset _rootfsimage
_rootfsimage="/mnt/emmc/alarm.img"
if [ ! -e "$_rootfsimage" ]; then
echo "$_rootfsimage not found, exiting"
exit 1
#else
#echo "$_rootfsimage found, continuing"
fi
# Checking if losetup is done
busybox [ -e "$_tmp" ] && rm -f $_tmp
busybox losetup > $_tmp
unset _line
echo >> "$_tmp"
while read _line; do
case "$_line" in
*"alarm.img"* )
echo "Loop found."
break
;;
* )
echo "Setting up loop"...
busybox losetup /dev/loop1 "$_rootfsimage" || exit 1
;;
esac
done < $_tmp
echo "Mounting file systems..."
mount -t ext2 -o rw,noatime /dev/loop1 $_chroot || exit 1
mount -o bind /dev/ $_chroot/dev || exit 1
mount -t devpts devpts $_chroot/dev/pts || exit 1
mount -t proc proc $_chroot/proc || exit 1
mount -t sysfs sysfs $_chroot/sys || exit 1
echo "Entering chroot..."
busybox chroot $_chroot /usr/bin/env HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login +h
echo "chroot exited. umount..."
umount $_chroot/dev/pts || exit 1
umount $_chroot/dev || exit 1
umount $_chroot/proc || exit 1
umount $_chroot/sys || exit 1
umount $_chroot || exit 1
echo "Deactivating loop..."
busybox losetup -d /dev/loop1
echo "Done. Bye!"
busybox [ -e "$_tmp" ] && rm -f $_tmp
exit 0
What I want to do:
* Get X up and running (VNC first)
* Find out of I can (maybe with help of Clockwork Mod Recovery?) boot straight into Archlinux instead of Android ICS
* Get X to run on a framebuffer (needs the previous done first)
Problems:
* The chroot environment seems to inherit all environment variables by the Android host, so you have to (re)set path, home etc. Annoying
*
- Code: Select all
[root@galaxys ~]# df -h
df: ‘/acct’: No such file or directory
df: ‘/mnt/asec’: No such file or directory
df: ‘/mnt/obb’: No such file or directory
df: ‘/system’: No such file or directory
df: ‘/cache’: No such file or directory
df: ‘/radio’: No such file or directory
df: ‘/data’: No such file or directory
df: ‘/datadata’: No such file or directory
df: ‘/efs’: No such file or directory
df: ‘/mnt/emmc’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/emmc/.android_secure’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/emmc/.android_secure’: No such file or directory
df: ‘/mnt/sdcard’: No such file or directory
df: ‘/mnt/secure/asec’: No such file or directory
df: ‘/mnt/sdcard/.android_secure’: No such file or directory
Filesystem Size Used Avail Use% Mounted on
rootfs 756M 464M 285M 62% /
/dev/loop1 756M 464M 285M 62% /
Perhaps this can be solved if proc is mounted after the chroot has been entered.
