1.下载并安装jdk6
注意,版本一定要是jdk6,其他版本都会有问题。
网上流传的方法大都是apt-get install来安装jdk,实际操作证明这样是不行的,下面给出个下载jdk6的地址
https://jdk6.java.net/download.html 在这里根据自己机器配置情况选择自解压文件(self-extracting)就好了
上面下载得到jdk-6u38-linux-x64.bin文件,改变属性使其拥有可执行权限。
./jdk-6u38-ea-bin-b04-linux-i586-31_oct_2012.bin即可安装
2.Linux配置jdk的环境变量
# set jdk environment
export JAVA_HOME=/usr/local/java/jdk1.6.0_38
export JRE_HOME=$JAVA_HOME/jre
export CLASSPATH=.:$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH
export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH
3.更新环境变量使其生效
①source build/envsetup.sh
including device/asus/tilapia/vendorsetup.sh
including device/asus/flo/vendorsetup.sh
including device/asus/grouper/vendorsetup.sh
including device/asus/deb/vendorsetup.sh
including device/generic/armv7-a-neon/vendorsetup.sh
including device/generic/mips/vendorsetup.sh
including device/generic/x86/vendorsetup.sh
including device/samsung/manta/vendorsetup.sh
including device/lge/hammerhead/vendorsetup.sh
including device/lge/mako/vendorsetup.sh
including sdk/bash_completion/adb.bash
yetmare@yetmare-QiTianM4500-N000:~/AOSP$ lunch full-eng
============================================
②lunch full-eng
此时要选择一个编译平台
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=4.4
TARGET_PRODUCT=full
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=arm
TARGET_ARCH_VARIANT=armv7-a
TARGET_CPU_VARIANT=generic
HOST_ARCH=x86
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.19.0-25-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_BUILD_TYPE=release
BUILD_ID=KRT16M
OUT_DIR=out
============================================
编译结果如下:
Processing target/product/generic/obj/APPS/Email_intermediates/package.apk
Done!
Install: out/target/product/generic/system/app/Email.odex
Install: out/target/product/generic/system/app/Email.apk
target Symbolic: libwebviewchromium (out/target/product/generic/symbols/system/lib/libwebviewchromium.so)
target Strip: libwebviewchromium (out/target/product/generic/obj/lib/libwebviewchromium.so)
Install: out/target/product/generic/system/lib/libwebviewchromium.so
Install: out/target/product/generic/system/framework/webviewchromium.jar
Install: out/target/product/generic/fake_packages/webview-timestamp
build/tools/generate-notice-files.py out/target/product/generic/obj/NOTICE.txt out/target/product/generic/obj/NOTICE.html "Notices for files contained in the filesystem images in this directory:" out/target/product/generic/obj/NOTICE_FILES/src
Combining NOTICE files into HTML
Combining NOTICE files into text
Installed file list: out/target/product/generic/installed-files.txt
Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
Running: mkuserimg.sh out/target/product/generic/system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img ext4 system 576716800 out/target/product/generic/root/file_contexts
+ echo 'in mkuserimg.sh PATH=out/host/linux-x86/bin/:/usr/local/java/jdk1.6.0_38/bin:/home/yetmare/ASOP/out/host/linux-x86/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7/bin:/home/yetmare/ASOP/development/emulator/qtools:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:/home/yetmare/ASOP/development/scripts:/home/yetmare/ASOP/prebuilts/devtools/tools:/usr/local/java/jdk1.6.0_38/bin:/usr/local/java/jdk1.6.0_38/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games'
in mkuserimg.sh PATH=out/host/linux-x86/bin/:/usr/local/java/jdk1.6.0_38/bin:/home/yetmare/ASOP/out/host/linux-x86/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/mips/mipsel-linux-android-4.7/bin:/home/yetmare/ASOP/development/emulator/qtools:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-linux-androideabi-4.7/bin:/home/yetmare/ASOP/prebuilts/gcc/linux-x86/arm/arm-eabi-4.7/bin:/home/yetmare/ASOP/development/scripts:/home/yetmare/ASOP/prebuilts/devtools/tools:/usr/local/java/jdk1.6.0_38/bin:/usr/local/java/jdk1.6.0_38/jre/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games
+ ENABLE_SPARSE_IMAGE=
+ '[' out/target/product/generic/system = -s ']'
+ '[' 6 -ne 5 -a 6 -ne 6 ']'
+ SRC_DIR=out/target/product/generic/system
+ '[' '!' -d out/target/product/generic/system ']'
+ OUTPUT_FILE=out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img
+ EXT_VARIANT=ext4
+ MOUNT_POINT=system
+ SIZE=576716800
+ FC=out/target/product/generic/root/file_contexts
+ case $EXT_VARIANT in
+ '[' -z system ']'
+ '[' -z 576716800 ']'
+ '[' -n out/target/product/generic/root/file_contexts ']'
+ FCOPT='-S out/target/product/generic/root/file_contexts'
+ MAKE_EXT4FS_CMD='make_ext4fs -S out/target/product/generic/root/file_contexts -l 576716800 -a system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system'
+ echo make_ext4fs -S out/target/product/generic/root/file_contexts -l 576716800 -a system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system
make_ext4fs -S out/target/product/generic/root/file_contexts -l 576716800 -a system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system
+ make_ext4fs -S out/target/product/generic/root/file_contexts -l 576716800 -a system out/target/product/generic/obj/PACKAGING/systemimage_intermediates/system.img out/target/product/generic/system
Creating filesystem with parameters:
Size: 576716800
Block size: 4096
Blocks per group: 32768
Inodes per group: 7040
Inode size: 256
Journal blocks: 2200
Label:
Blocks: 140800
Block groups: 5
Reserved block group size: 39
Created filesystem with 1263/35200 inodes and 81851/140800 blocks
+ '[' 0 -ne 0 ']'
Install system fs image: out/target/product/generic/system.img
out/target/product/generic/system.img+ maxsize=588791808 blocksize=2112 total=576716800 reserve=5947392
8.在模拟器中运行
在模拟器中运行的步骤就比较简单了,只需在终端中执行如下命令即可:
emulator
运行成功后的界面如下:
最后在赠送一个Ubuntu上安装7z软件包的命令及使用方法
安装7z:apt-get install p7zip-full