linuxonandroid ubuntu12.04-v4-core启动文件(N7100 Android 4.3)
一. 测试环境
手机型号:三星 N7100 Android 4.3 已root,已禁用selinux(Permissive)
系统版本:linuxonandroid ubuntu12.04-v4-core
small和full应该也可以使用此脚本。安装教程:
http://jingyan.baidu.com/article/25648fc1db54c69191fd00e7.html
环境的搭建不再详述。
二. 修改后的bootscript4-3.sh
官网的脚本bootscript.sh,经本人测试,在N7100 Android4.3上有点小问题。
在官网的脚本基础上,修改网卡的接口为wlan0,修改了存储卡的名字为手机上显示的实际名字。测试可以正常使用。
全部代码如下:
###########################################@H_301_31@
# Linux boot script V8.1 #@H_301_31@
# for N7100 Android v4.3 #@H_301_31@
# Built by Zachary Powell (zacthespack) #@H_301_31@
# and Martin Møller (Tuxling) #@H_301_31@
# Thanks to: #@H_301_31@
# Johan Vromans #@H_301_31@
# Marshall Levin #@H_301_31@
# Vaykadji@H_301_31@
# shile #@H_301_31@
# and to everyone at XDA! #@H_301_31@
# Feel free to edit/use this script as you#@H_301_31@
# like but credit Linuxonandroid.org #@H_301_31@
###########################################@H_301_31@
# $ver: V8.1 for N7100 Android v4.3 #@H_301_31@
###########################################@H_301_31@
###########################################@H_301_31@
# This is a function we use to stop the #@H_301_31@
# script in case of errors #@H_301_31@
###########################################@H_301_31@
error_exit@H_301_31@@H_301_31@() {
echo@H_301_31@ "Error: $1@H_301_31@"@H_301_31@
exit@H_301_31@ 1@H_301_31@
}
###########################################@H_301_31@
# Set up variables #@H_301_31@
###########################################@H_301_31@
if@H_301_31@ [ -f@H_301_31@ /data/data/com.zpwebsites.linuxonandroid/files/busyBox ]; then@H_301_31@
export@H_301_31@ bBox=/data/data/com.zpwebsites.linuxonandroid/files/busyBox
elif@H_301_31@ [ -f@H_301_31@ /data/data/com.zpwebsites.linuxonandroid.opensource/files/busyBox ]; then@H_301_31@
export@H_301_31@ bBox=/data/data/com.zpwebsites.linuxonandroid.opensource/files/busyBox
else@H_301_31@
export@H_301_31@ bBox=/system/xbin/busyBox
fi@H_301_31@
export@H_301_31@ usermounts=android # Base folder all user mounts are done in,should be moved to app later@H_301_31@
export@H_301_31@ imgfile=$(dirname $0@H_301_31@)/ubuntu.img # Default image file,another can be set by using an argument@H_301_31@
export@H_301_31@ bin=/system/bin
export@H_301_31@ mnt=/data/local/mnt
export@H_301_31@ USER=root
if@H_301_31@ [[ ! -d@H_301_31@ $mnt@H_301_31@ ]]; then@H_301_31@ mkdir $mnt@H_301_31@; fi@H_301_31@
export@H_301_31@ PATH=$bin@H_301_31@:/usr/bin:/usr/local/bin:/usr/sbin:/bin:/usr/local/sbin:/usr/games:$PATH@H_301_31@
export@H_301_31@ TERM=linux
export@H_301_31@ HOME=/root
###########################################@H_301_31@
# Handle arguments if present #@H_301_31@
###########################################@H_301_31@
if@H_301_31@ [ $#@H_301_31@ -ne@H_301_31@ 0@H_301_31@ ]; then@H_301_31@
if@H_301_31@ [ -f@H_301_31@ $1@H_301_31@ ]; then@H_301_31@ # Is full path present?@H_301_31@
imgfile=$1@H_301_31@
elif@H_301_31@ [ -f@H_301_31@ $(dirname $0@H_301_31@)/$1@H_301_31@ ]; then@H_301_31@ # Is only a filename present?@H_301_31@
imgfile=$(dirname $0@H_301_31@)/$1@H_301_31@
else@H_301_31@
error_exit@H_301_31@ "Image file not found!($1@H_301_31@)"@H_301_31@
fi@H_301_31@
fi@H_301_31@
###########################################@H_301_31@
# If a md5 file is found we check it here #@H_301_31@
###########################################@H_301_31@
if@H_301_31@ [ -f@H_301_31@ $imgfile@H_301_31@.md5 ]; then@H_301_31@
echo@H_301_31@ "MD5 file found,use to check .img file? (y/n)"@H_301_31@
read@H_301_31@ answer
if@H_301_31@ [ $answer@H_301_31@ == y ]; then@H_301_31@
echo@H_301_31@ -n "Validating image checksum... "@H_301_31@
$bBox@H_301_31@ md5sum -c -s@H_301_31@ $imgfile@H_301_31@.md5
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@
echo@H_301_31@ "Failed!"@H_301_31@
error_exit@H_301_31@ "Checksum Failed! The image is corrupted!"@H_301_31@
else@H_301_31@
echo@H_301_31@ "OK"@H_301_31@
rm $imgfile@H_301_31@.md5
fi@H_301_31@
fi@H_301_31@
fi@H_301_31@
################################@H_301_31@
# Find and read config file #@H_301_31@
# or use defaults if not found #@H_301_31@
################################@H_301_31@
use_swap=no
cfgfile=$imgfile@H_301_31@.config # Default config file if not specified@H_301_31@
if@H_301_31@ [ -f@H_301_31@ $imgfile@H_301_31@.config ]; then@H_301_31@
source@H_301_31@ $imgfile@H_301_31@.config
fi@H_301_31@
###########################################@H_301_31@
# Set Swap up if wanted #@H_301_31@
# #@H_301_31@
###########################################@H_301_31@
if@H_301_31@ [ $use_swap@H_301_31@ == yes ]; then@H_301_31@
if@H_301_31@ [ -f@H_301_31@ $imgfile@H_301_31@.swap ]; then@H_301_31@
echo@H_301_31@ "Swap file found,using file"@H_301_31@
echo@H_301_31@ "Turning on swap (if it errors here you do not have swap support"@H_301_31@
swapon $imgfile@H_301_31@.swap
else@H_301_31@
echo@H_301_31@ "Creating Swap file"@H_301_31@
dd if@H_301_31@=/dev/zero of=$imgfile@H_301_31@.swap bs=1048576@H_301_31@ count=1024@H_301_31@
mkswap $imgfile@H_301_31@.swap
echo@H_301_31@ "Turning on swap (if it errors here you do not have swap support"@H_301_31@
swapon $imgfile@H_301_31@.swap
fi@H_301_31@
fi@H_301_31@
###########################################@H_301_31@
# Set up loop device and mount image #@H_301_31@
###########################################@H_301_31@
echo@H_301_31@ -n "Checking loop device... "@H_301_31@
if@H_301_31@ [ -b /dev/block/loop255 ]; then@H_301_31@
echo@H_301_31@ "FOUND"@H_301_31@
else@H_301_31@
echo@H_301_31@ "MISSING"@H_301_31@
# Loop device not found so we create it and verify it was actually created@H_301_31@
echo@H_301_31@ -n "Creating loop device... "@H_301_31@
$bBox@H_301_31@ mknod /dev/block/loop255 b 7@H_301_31@ 255@H_301_31@
if@H_301_31@ [ -b /dev/block/loop255 ]; then@H_301_31@
echo@H_301_31@ "OK"@H_301_31@
else@H_301_31@
echo@H_301_31@ "Failed"@H_301_31@
error_exit@H_301_31@ "Unable to create loop device!"@H_301_31@
fi@H_301_31@
fi@H_301_31@
$bBox@H_301_31@ losetup /dev/block/loop255 $imgfile@H_301_31@
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@ error_exit@H_301_31@ "Unable to attach image to loop device! (Image = $imgfile@H_301_31@)"@H_301_31@; fi@H_301_31@
$bBox@H_301_31@ mount -t ext4 /dev/block/loop255 $mnt@H_301_31@
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@ error_exit@H_301_31@ "Unable to mount the loop device!"@H_301_31@; fi@H_301_31@
###########################################@H_301_31@
# Mount all required partitions #@H_301_31@
###########################################@H_301_31@
$bBox@H_301_31@ mount -t devpts devpts $mnt@H_301_31@/dev/pts
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@ error_exit@H_301_31@ "Unable to mount $mnt@H_301_31@/dev/pts!"@H_301_31@; fi@H_301_31@
$bBox@H_301_31@ mount -t proc proc $mnt@H_301_31@/proc
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@ error_exit@H_301_31@ "Unable to mount $mnt@H_301_31@/proc!"@H_301_31@; fi@H_301_31@
$bBox@H_301_31@ mount -t sysfs sysfs $mnt@H_301_31@/sys
if@H_301_31@ [ $? -ne@H_301_31@ 0@H_301_31@ ];then@H_301_31@ error_exit@H_301_31@ "Unable to mount $mnt@H_301_31@/sys!"@H_301_31@; fi@H_301_31@
$bBox@H_301_31@ mount -o bind@H_