PDA

Ver la versión completa : Tutorial cómo instalar Linux en android



Carlos24
27/07/2012, 17:55
Primero de todo los requisitos mínimos para funcionar son los siguientes :

- Tener un Kernel compatible que soporte Loop ésto lo detectareis al pasar el script y monta bien la imagen de la aplicación Linux Installer (new)

- Requiere tener busybox instalado hay una app en google play que facilita éste paso https://play.google.com/store/apps/details?id=stericson.busybox

- Tener instalado termanial shell https://play.google.com/store/apps/details?id=jackpal.androidterm

- Ser Root y tener la depuracion USB habilitada.

- Instalar está aplicación facilitará muchos los pasos https://play.google.com/store/apps/details?id=com.zpwebsites.linuxonandroid (** Para versiones archlinux y fedora de momento solo está disponible en las versiones de donación/pago)

Una vez instalada Vamos a Instalación Guía/Install guides según el idioma y nos guiamos de la Guia que queramos instalar Ubuntu10/ubuntu12 o Debian. Nos bajamos la imagen hay varias en el caso de ubuntu

- La básica sin Interfaz Gráfica (X11) solo texto
- La pequeña que lleva interfaz gráfica Lxde y firefox (Requiere 2GB de espacio al descomprimir es lo que ocupa)
- La más grande ocupa 3,5GB

Tendremos que extraer el zip y copiarlo en /mnt/sdcard/ ubuntu.img también copiar el checksum que sin él no funcionará.

Por último instalar AndroidVNC https://play.google.com/store/apps/details?id=android.androidVNC

Una vez acabado yo aconsejo añadir el widget desde el escritorio de android para ubuntu o debian y darle click para ir más directo y práctico y seguir los pasos que os van saliendo si todo va bien debería de salirte la contraseña a elegir y la resolución de la pantalla una vez terminado estaremos en la consola

Si ya llegaisteis hasta aquí enorabuena ya estás en modo linux pero OJO no se puede actualizar de versión a una más nueva Sí lo haceis la imagen se dañara y dejará de ir y tendremos que repetir los pasos desde el principio y descargar de nuevo la imagen pero sí se puede instala/actualizar una aplicación o Instalar Gnome por poner un ejemplo siempre que tengamos espacio para ello.

GameMaster
27/07/2012, 18:26
El proximo sera como instalar windows en windowsCE

Speranto
27/07/2012, 18:39
GameMaster, últimamente todos tus comentarios me parecen ofensivos. Si no tienes nada bueno que decir, ¿por qué hablas?

Yo lo he intentado con un nexus One y con una tablet sin marca que tengo en casa, pero siempre me da error al descomprimir la imagen de Ubuntu.

GameMaster
27/07/2012, 18:41
donde esta la ofensa ? si es que saltais por cualquier cosa...

Dullyboy
27/07/2012, 18:48
GameMaster, últimamente todos tus comentarios me parecen ofensivos. Si no tienes nada bueno que decir, ¿por qué hablas?

Yo lo he intentado con un nexus One y con una tablet sin marca que tengo en casa, pero siempre me da error al descomprimir la imagen de Ubuntu.
Me suena haber leido que se necesita doble núcleo como requerimiento mínimo.

nintiendo1
27/07/2012, 18:55
¿Pero esto quita todas las capas de Android, o el cacharro tiene que tirar de Android y de Ubuntu? Porque si es así debe ir de pena. Por cierto, ¿como es el rendimiento que ofrece?

Saludos.

Carlos24
27/07/2012, 19:43
Para extraer el zip yo recomiendo una aplicación que soporte zip tarda un poco por la simple razón que requiere 2GB de espacio salvo que instales la imagen sin interfaz gráfica requiere 750Mb aproximadamente libres por eso hay que tener espacio para la imagen y es recomendable una sdcard rápida si no te quieres morir en el intento.

El rendimiento es aceptable no he tenido tiempo para comprobar con aplicaciones pesadas para ver si peca el rendimiento , pero su rendimiento dependera del kernel de android en la guia de la aplicación lo pone. Apartir de ahí son distros standard Armel teniendo todos los comandos de linux existientes

Carlos24
27/07/2012, 21:23
Despues de estar un rato con linux ya puedo decir que el rendimiento se ve mermado si se abre muchas ventanas utilizando el navegador he utilizado chrome browser ya que firefox es muy pesado por lo que como uso diario no sirve si se le va exigir mucho pero para probar aplicaciones en linux y hacer tus pinitos en linux compilar una aplicación desde linux y probarla es una alternativa mas para éstos dispositivos.

El rendimiento mejorará cuando se tenga acceso y un driver X11 directamente sin pasar por una VNC que es el principal problema que reside en la actualidad

nintiendo1
27/07/2012, 22:05
Gracias, por lo que veo no es un SO como para usarlo de forma habitual, si no como algo esporádico ya que el rendimiento es igual o peor que Android.

Saludos.

otto_xd
27/07/2012, 22:31
GameMaster, últimamente todos tus comentarios me parecen ofensivos. Si no tienes nada bueno que decir, ¿por qué hablas?

Yo lo he intentado con un nexus One y con una tablet sin marca que tengo en casa, pero siempre me da error al descomprimir la imagen de Ubuntu.

Pero si tienes mas razon que un santo!

A mi lo que me gustaria ver es, en vez de instalar debian u otra distribucion, ver si se puede instalar un entorno de escritorio distinto a Android corriendo en paralelo. No he buscado nada, asi que no descarto que ya exista

Carlos24
27/07/2012, 23:41
el gran problema no tienes aceleración cuando estas fuera de android por muy ligera que fuese al no detectar un driver compatible todo lo que haces es sin ayuda de la GPU y si ya le vas metiendo muchas aplicaciones sin cerrar llega un momento que se cierra alguna por falta de memoria o inestabiidad

Lo único a favor los navegadores cómo chrome en su version linux que tiene mayor compatibilidad con los standares dando 385 puntos en test html5 por encima del los navegadores en android que eso para navegar es un punto a favor ya que cada vez se está apostando por html5 en algunas webs .

También probe freedoom para linux y funciona sin audio ya que da error en alsa y no va mal de velocidad pero tiene pequeños glitches parpadeos que hacen temblar la imagen ya que una VNC no está preparado para capturar movimientos rápidos si no un escritorio.

Para curiosar está bien descubres cosas nuevas y para aplicaciones pequeñas y básicas es pasable pero limitado por lo que he explicado

Sí alguien quiere los scripts de linux por zacthespack aquí lo dejo.

Bootscript.sh


###########################################
# Linux boot script V7.1 for Android #
# Built by Zachary Powell (zacthespack) #
# and Martin Møller (Tuxling) #
# Thanks to: #
# Johan Vromans #
# Marshall Levin #
# and to everyone at XDA! #
###########################################
# $ver: V7.3 #
###########################################


###########################################
# This is a function we use to stop the #
# script in case of errors #
###########################################
error_exit() {
echo "Error: $1"
exit 1
}

###########################################
# Check for root #
###########################################
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then error_exit "This script requires root! Type: su"; fi
#mount -o remount,rw /dev/block/mmcblk0p5 /system

###########################################
# Set up variables #
###########################################
export usermounts=android # Base folder all user mounts are done in, should be moved to app later

export imgfile=$(dirname $0)/ubuntu.img # Default image file, another can be set by using an argument
export bbox=/system/xbin/busybox
export bin=/system/bin
export mnt=/data/local/mnt
export USER=root
if [[ ! -d $mnt ]]; then mkdir $mnt; fi
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root

###########################################
# Handle arguments if present #
###########################################
if [ $# -ne 0 ]; then
if [ -f $1 ]; then # Is full path present?
imgfile=$1

elif [ -f $(dirname $0)/$1 ]; then # Is only a filename present?
imgfile=$(dirname $0)/$1

else
error_exit "Image file not found!($1)"
fi
fi

################################################## ##########
# Find out which app the user have and use busybox from it #
################################################## ##########
if [ -f /data/data/com.zpwebsites.linuxonandroid/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid/files/busybox
fi

###########################################
# If a md5 file is found we check it here #
###########################################
if [ -f $imgfile.md5 ]; then
echo -n "Validating image checksum... "
$bbox md5sum -c -s $imgfile.md5
if [ $? -ne 0 ];then
echo "FAILED!"
error_exit "Checksum failed! The image is corrupted!"
else
echo "OK"
rm $imgfile.md5
fi
fi

###########################################
# Set up loop device and mount image #
###########################################
echo -n "Checking loop device... "
if [ -b /dev/block/loop255 ]; then
echo "FOUND"
else
echo "MISSING"
# Loop device not found so we create it and verify it was actually created
echo -n "Creating loop device... "
$bbox mknod /dev/block/loop255 b 7 255
if [ -b /dev/block/loop255 ]; then
echo "OK"
else
echo "FAILED"
error_exit "Unable to create loop device!"
fi
fi

$bbox losetup /dev/block/loop255 $imgfile
if [ $? -ne 0 ];then error_exit "Unable to attach image to loop device! (Image = $imgfile)"; fi

$bbox mount -t ext2 /dev/block/loop255 $mnt
if [ $? -ne 0 ];then error_exit "Unable to mount the loop device!"; fi

###########################################
# Mount all required partitions #
###########################################
$bbox mount -t devpts devpts $mnt/dev/pts
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/dev/pts!"; fi
$bbox mount -t proc proc $mnt/proc
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/proc!"; fi
$bbox mount -t sysfs sysfs $mnt/sys
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/sys!"; fi
$bbox mount -o bind /sdcard $mnt/sdcard
if [ $? -ne 0 ];then error_exit "Unable to bind $mnt/sdcard!"; fi

if [[ ! -d $mnt/root/cfg ]]; then mkdir $mnt/root/cfg; fi
$bbox mount -o bind $(dirname $imgfile) $mnt/root/cfg


###########################################
# Checks if you have a external sdcard #
# and mounts it if you do #
###########################################
if [ -d /sdcard/external_sd ]; then
$bbox mount -o bind /sdcard/external_sd $mnt/external_sd
fi
if [ -d /Removable/MicroSD ]; then
$bbox mount -o bind /Removable/MicroSD $mnt/external_sd
fi
# This is for the HD version of the Archos 70 internet tablet, may be the same for the SD card edition but i dont know.
if [ -d /storage ]; then
$bbox mount -o bind /storage $mnt/external_sd
fi

###########################################
# Mount all user defined mounts if any #
###########################################
if [ -f $imgfile.mounts ]; then
olddir=$(pwd)
echo "Mounting user mounts"

cd $mnt
if [[ ! -d $mnt/$usermounts ]]; then $bbox mkdir -p $usermounts; fi

echo "# Script to unmount user defined mounts, do not delete or edit!" > $imgfile.shutdown
echo "cd $mnt/$usermounts" > $imgfile.shutdown

cd $mnt/$usermounts
for entry in $(cat "$imgfile.mounts"); do
ANDROID=${entry%;*}
LINUX=${entry#*;}

if [[ -d $ANDROID ]]; then
echo -n "Mounting $ANDROID to $usermounts/$LINUX... "
if [[ ! -d $mnt/$usermounts/$LINUX ]]; then $bbox mkdir -p $LINUX; fi
$bbox mount -o bind $ANDROID $mnt/$usermounts/$LINUX &> /dev/null
if [ $? -ne 0 ];then
echo FAIL
if [[ -d $mnt/$usermounts/$LINUX ]]; then $bbox rmdir -p $LINUX; fi
else
echo OK
echo "$bbox umount $mnt/$usermounts/$LINUX" >> $imgfile.shutdown
echo "$bbox rmdir -p $LINUX" >> $imgfile.shutdown
fi
else
echo "Android folder not found: $ANDROID"
fi
done
echo "cd $mnt" >> $imgfile.shutdown
echo "$bbox rmdir -p $usermounts" >> $imgfile.shutdown
cd $olddir

else
echo "No user defined mount points"
fi

###########################################
# Sets up network forwarding #
###########################################
$bbox sysctl -w net.ipv4.ip_forward=1
if [ $? -ne 0 ];then error_exit "Unable to forward network!"; fi

# If NOT $mnt/root/DONOTDELETE.txt exists we setup hosts and resolv.conf now
if [ ! -f $mnt/root/DONOTDELETE.txt ]; then
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
if [ $? -ne 0 ];then error_exit "Unable to write resolv.conf file!"; fi
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
if [ $? -ne 0 ];then error_exit "Unable to write hosts file!"; fi
fi


###########################################
# Chroot into ubuntu #
###########################################
$bbox chroot $mnt /root/init.sh $(basename $imgfile)

###########################################
# Shut down ubuntu #
###########################################
echo "Shutting down Ubuntu ARM"
#for pid in `lsof | grep $mnt | sed -e's/ / /g' | cut -d' ' -f2`; do kill -9 $pid >/dev/null 2>&1; done
for pid in `$bbox lsof | $bbox grep $mnt | $bbox sed -e's/ / /g' | $bbox cut -d' ' -f2`; do $bbox kill -9 $pid >/dev/null 2>&1; done
sleep 5

###########################################
# Unmount all user defined mounts if any #
###########################################
if [ -f $imgfile.shutdown ]; then
echo "Unmounting user defined mounts"
sh $imgfile.shutdown
rm $imgfile.shutdown
fi

$bbox umount $mnt/root/cfg
$bbox umount $mnt/sdcard
$bbox umount $mnt/external_sd
$bbox umount $mnt/dev/pts
$bbox umount $mnt/proc
$bbox umount $mnt/sys
$bbox umount $mnt
$bbox losetup -d /dev/block/loop255 &> /dev/null


Autobootsript.sh


###########################################
# Ubuntu boot script V7.1 for Android #
# Built by Zachary Powell (zacthespack) #
# and Martin Møller (Tuxling) #
# Thanks to: #
# Johan Vromans #
# Marshall Levin #
# and to everyone at XDA! #
###########################################
# $ver: V7.3 #
###########################################

###########################################
# This is a function we use to stop the #
# script in case of errors #
###########################################
error_exit() {
echo "Error: $1"
exit 1
}

###########################################
# Check for root #
###########################################
perm=$(id|cut -b 5)
if [ "$perm" != "0" ];then error_exit "This script requires root! Type: su"; fi
#mount -o remount,rw /dev/block/mmcblk0p5 /system

###########################################
# Set up variables #
###########################################
export usermounts=android # Base folder all user mounts are done in, should be moved to app later

export imgfile=$(dirname $0)/ubuntu.img # Default image file, another can be set by using an argument
export bbox=/system/xbin/busybox
export bin=/system/bin
export mnt=/data/local/mnt
export USER=root
if [[ ! -d $mnt ]]; then mkdir $mnt; fi
export PATH=$bin:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH
export TERM=linux
export HOME=/root

###########################################
# Handle arguments if present #
###########################################
if [ $# -ne 0 ]; then
if [ -f $1 ]; then # Is full path present?
imgfile=$1

elif [ -f $(dirname $0)/$1 ]; then # Is only a filename present?
imgfile=$(dirname $0)/$1

else
error_exit "Image file not found!($1)"
fi
fi

################################################## ##########
# Find out which app the user have and use busybox from it #
################################################## ##########
if [ -f /data/data/com.zpwebsites.linuxonandroid/files/busybox ]; then
export bbox=/data/data/com.zpwebsites.linuxonandroid/files/busybox
fi

###########################################
# If a md5 file is found we check it here #
###########################################
if [ -f $imgfile.md5 ]; then
echo -n "Validating image checksum... "
$bbox md5sum -c -s $imgfile.md5
if [ $? -ne 0 ];then
echo "FAILED!"
error_exit "Checksum failed! The image is corrupted!"
else
echo "OK"
rm $imgfile.md5
fi
fi

###########################################
# Set up loop device and mount image #
###########################################
echo -n "Checking loop device... "
if [ -b /dev/block/loop255 ]; then
echo "FOUND"
else
echo "MISSING"
# Loop device not found so we create it and verify it was actually created
echo -n "Creating loop device... "
$bbox mknod /dev/block/loop255 b 7 255
if [ -b /dev/block/loop255 ]; then
echo "OK"
else
echo "FAILED"
error_exit "Unable to create loop device!"
fi
fi

$bbox losetup /dev/block/loop255 $imgfile
if [ $? -ne 0 ];then error_exit "Unable to attach image to loop device! (Image = $imgfile)"; fi

$bbox mount -t ext2 /dev/block/loop255 $mnt
if [ $? -ne 0 ];then error_exit "Unable to mount the loop device!"; fi

###########################################
# Mount all required partitions #
###########################################
$bbox mount -t devpts devpts $mnt/dev/pts
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/dev/pts!"; fi
$bbox mount -t proc proc $mnt/proc
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/proc!"; fi
$bbox mount -t sysfs sysfs $mnt/sys
if [ $? -ne 0 ];then error_exit "Unable to mount $mnt/sys!"; fi
$bbox mount -o bind /sdcard $mnt/sdcard
if [ $? -ne 0 ];then error_exit "Unable to bind $mnt/sdcard!"; fi

if [[ ! -d $mnt/root/cfg ]]; then mkdir $mnt/root/cfg; fi
$bbox mount -o bind $(dirname $imgfile) $mnt/root/cfg


###########################################
# Checks if you have a external sdcard #
# and mounts it if you do #
###########################################
if [ -d /sdcard/external_sd ]; then
$bbox mount -o bind /sdcard/external_sd $mnt/external_sd
fi
if [ -d /Removable/MicroSD ]; then
$bbox mount -o bind /Removable/MicroSD $mnt/external_sd
fi
# This is for the HD version of the Archos 70 internet tablet, may be the same for the SD card edition but i dont know.
if [ -d /storage ]; then
$bbox mount -o bind /storage $mnt/external_sd
fi

###########################################
# Mount all user defined mounts if any #
###########################################
if [ -f $imgfile.mounts ]; then
olddir=$(pwd)
echo "Mounting user mounts"

cd $mnt
if [[ ! -d $mnt/$usermounts ]]; then $bbox mkdir -p $usermounts; fi

echo "# Script to unmount user defined mounts, do not delete or edit!" > $imgfile.shutdown
echo "cd $mnt/$usermounts" > $imgfile.shutdown

cd $mnt/$usermounts
for entry in $(cat "$imgfile.mounts"); do
ANDROID=${entry%;*}
LINUX=${entry#*;}

if [[ -d $ANDROID ]]; then
echo -n "Mounting $ANDROID to $usermounts/$LINUX... "
if [[ ! -d $mnt/$usermounts/$LINUX ]]; then $bbox mkdir -p $LINUX; fi
$bbox mount -o bind $ANDROID $mnt/$usermounts/$LINUX &> /dev/null
if [ $? -ne 0 ];then
echo FAIL
if [[ -d $mnt/$usermounts/$LINUX ]]; then $bbox rmdir -p $LINUX; fi
else
echo OK
echo "$bbox umount $mnt/$usermounts/$LINUX" >> $imgfile.shutdown
echo "$bbox rmdir -p $LINUX" >> $imgfile.shutdown
fi
else
echo "Android folder not found: $ANDROID"
fi
done
echo "cd $mnt" >> $imgfile.shutdown
echo "$bbox rmdir -p $usermounts" >> $imgfile.shutdown
cd $olddir

else
echo "No user defined mount points"
fi

###########################################
# Sets up network forwarding #
###########################################
$bbox sysctl -w net.ipv4.ip_forward=1
if [ $? -ne 0 ];then error_exit "Unable to forward network!"; fi

# If NOT $mnt/root/DONOTDELETE.txt exists we setup hosts and resolv.conf now
if [ ! -f $mnt/root/DONOTDELETE.txt ]; then
echo "nameserver 8.8.8.8" > $mnt/etc/resolv.conf
if [ $? -ne 0 ];then error_exit "Unable to write resolv.conf file!"; fi
echo "nameserver 8.8.4.4" >> $mnt/etc/resolv.conf
echo "127.0.0.1 localhost" > $mnt/etc/hosts
if [ $? -ne 0 ];then error_exit "Unable to write hosts file!"; fi
fi