配置要求
-
设备需要root权限,并且安装了BusyBox
-
最小 1GHz 处理器(推荐)
-
Android 系统版本 2.1 或以上
-
Android 设备需要自定义的ROM固件
-
SD卡至2.5GB (安装大映像的需要3.5GB)
-
设备需要支持WIFI (这个用于其他设备通过WIFI登录)
-
支持 Ext2 文件系统(大部分 Android 设备应该都支持)
-
我的设备
-
手机型号:Mi-One Plus
-
处理器主频:1.5GHz * 2
-
SD卡:16G class 4
-
系统ROM:MIUI_v4_2.8.10
-
BusyBox版本:1.20.2
需要的软件
打包 ubuntu.rar
启动脚本这里更新个完整的 需要的时候修改
export kit=/sdcard/ubuntu
$bbox mount -o bind /sdcard $mnt/sdcard
这两行 第一行为img文件所在目录 脚本跟img放一起
########################################### # Linux boot script V8.1 # # for N7100 Android v4.3 # # Built by Zachary Powell (zacthespack) # # and Martin Møller (Tuxling) # # Thanks to: # # Johan Vromans # # Marshall Levin # # Vaykadji # shile # # and to everyone at XDA! # # Feel free to edit/use this script as you# # like but credit Linuxonandroid.org # ########################################### # $ver: V8.1 for N7100 Android v4.3 # ########################################### ########################################### # This is a function we use to stop the # # script in case of errors # ########################################### error_exit() { echo "Error: $1" exit 1 } ########################################### # Set up variables # ########################################### if [ -f /data/data/com.zpwebsites.linuxonandroid/files/busybox ]; then export bbox=/data/data/com.zpwebsites.linuxonandroid/files/busybox elif [ -f /data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox ]; then export bbox=/data/data/com.zpwebsites.linuxonandroid.opensource/files/busybox else export bbox=/system/xbin/busybox fi export kit=/sdcard/ubuntu export usermounts=android # Base folder all user mounts are done in, should be moved to app later export imgfile=$kit/ubuntu.img # Default image file, another can be set by using an argument 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 $kit/$1 ]; then # Is only a filename present? imgfile=$kit/$1 else error_exit "Image file not found!($1)" fi fi ########################################### # If a md5 file is found we check it here # ########################################### if [ -f $imgfile.md5 ]; then echo "MD5 file found, use to check .img file? (y/n)" read answer if [ $answer == y ]; 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 fi ################################ # Find and read config file # # or use defaults if not found # ################################ use_swap=no cfgfile=$imgfile.config # Default config file if not specified if [ -f $imgfile.config ]; then source $imgfile.config fi ########################################### # Set Swap up if wanted # # # ########################################### if [ $use_swap == yes ]; then if [ -f $imgfile.swap ]; then echo "Swap file found, using file" echo "Turning on swap (if it errors here you do not have swap support" swapon $imgfile.swap else echo "Creating Swap file" dd if=/dev/zero of=$imgfile.swap bs=1048576 count=1024 mkswap $imgfile.swap echo "Turning on swap (if it errors here you do not have swap support" swapon $imgfile.swap 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 ext4 /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 $bbox mount -o bind /sys/fs/selinux $mnt/selinux ########################################### # 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 $mnt/external_sd ]]; then mkdir $mnt/external_sd;fi if [ -d /storage/extSdCard ]; then $bbox mount -o bind /storage/extSdCard $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 Linux 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/dev $bbox umount $mnt/proc $bbox umount $mnt/sys $bbox umount $mnt/selinux $bbox umount $mnt $bbox losetup -d /dev/block/loop255 &> /dev/null
-
Android Terminal Emulator (终端模拟器) :用于运行 shell 脚本
-
BusyBox :用于提供 shell 命令的支持 Google Play
-
Android VNC Viewer:用于 Android 设备的远程连接工具 Google Play
-
Ubuntu 12.04 的映像文件:用于安装 Ubuntu 的映像文件
-
选择下载:Full(http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/12.04/full/ubuntu1204-v4-full.zip/download )、Small(http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/12.04/small/ubuntu1204-v4-small.zip/download )、Core(http://sourceforge.net/projects/linuxonandroid/files/Ubuntu/12.04/core/ubuntu1204-v4-core.zip/download )
-
ubuntu.sh :Ubuntu 的安装脚本
-
bootscript.sh:Ubuntu 的启动脚本
-
安装ubuntu并不难,只是许多小伙伴们第一次安装时有点不熟悉,可能会花费时间
1、你的手机必须root,如果你是v5稳定版的,请先root。
2、在你手机根目录里创建一个名为ubuntu的文件夹(其实什么名字都没关系,下面我只以这个名字来命名)
3、我们把刚才下载的压缩包解压,安装里面的软件,并给他ROOt权限
4、Ubuntu完整镜像下载:点击下载
如果打不开请使用翻墙路由器,我们这里下载的是ubuntuV5-image.zip(压缩后体积1.7G,解压缩后为3.6G,很庞大,所以你得机身内存得够)
5、将下载好的Ubuntu镜像和脚本文件解压缩,复制到ubuntu目录中。
6、将下载下来中的解压包(楼主发的解压包)里面的ubuntu.sh复制到ubuntu目录下
7、安装并运行busybox安装器,运行时会提示root授权,授权后按照提示就可以了,这个软件的安装提示毕竟多,耐心选择后安装即可。
8、终端模拟器安装好,打开就是一个类似于Windows中CMD的命令输入窗口,在这个界面里,我们首先需要输入下面命令: su(回车)〈因为我们刚才已经给它权限〉
接下来输入下面的命令:
cd /sdcard/ubuntu/(回车)
sh ubuntu.sh(回车)
接下来,系统提示我们填写分辨率,2s的分辨率为1280x720(注意格式,1280x720是英文字母x)填好后回车
之后还有一个选项,是选择使用哪一套系统界面的,1是LXDE,2是Gnome界面。这里我们要选1,因为选择Gnome无法成功登陆。
出现“root@localhost:/#”说明脚本运行成功。
7、接下来我们直接按home键后台运行,打开VNC viwer,设置如图所示
Nickname,随便填写一个
密码要写:ubuntu
Adress这里填写 localhost
Port端口默认的就是5900,不用改
Username不用填。
Color Format是设置系统颜色的,这里建议选择“24bit-color(4bpp)”真彩色。
Local mouse pointer建议打上钩
Fore Full-screen bitmap强制全屏,选on
都设置好后,选择软件界面上面的“Connect”按钮开始运行ubuntu
大家尽情享受吧Screenshot_2015-02-10-11-06-31.png
注意,退出Ubuntu并不能直接关闭软件,而是需要现在Ubuntu界面下按一下菜单键,然后弹出菜单,选择 disconnect即可退回VNC界面,然后退出VNC,在打开超级终端模拟器里 ,然后输入下面一个命令:exit(回车)
想再次使用Ubuntu,还需要安装上面的步骤,重装做一下!,,大家可以OTG外接键盘鼠标,这样就变成你的电脑了
下次启动的时候只需要开启 终端,然后输入 “su” 获得 root 权限,再输入 “cd /sdcard/ubuntu” 来到ubuntu文件夹下,然后在输入 “sh bootscript.sh”或 sh ubuntu.sh 运行启动脚本就可以运行启动 Ubuntu 了,需要连接桌面的话按照上面说的用 Android VNC 就可以了。