ã«ãŒãã«ãšAndroidãªãã¬ãŒãã£ã³ã°ã·ã¹ãã å
šäœãåæ§ç¯ããå¿
èŠãããå€ãã®ã¿ã¹ã¯ããããŸãã ããšãã°ãç¬èªã®ã¢ãžã¥ãŒã«ã®äœæãšãããã°ãã·ã¹ãã ãããã¡ã€ãªã³ã°ã®ãµããŒãã®æå¹åãæ°ããããŒãžã§ã³ã®Androidã§ã®ã¢ããªã±ãŒã·ã§ã³ã®ãã¹ããªã©ã§ãã
VirtualBoxä»®æ³ãã·ã³å
ã§Android x86ãå®è¡ããæ©èœã«ãããæ奜家ããã¡ãŒã ãŠã§ã¢ã®äœæè
ã¯ãã·ã¹ãã èšå®ãæãäžããã«ãŒãã«ãæ§æããã³åæ§ç¯ããåæã«å®éã®ããã€ã¹ããããªãã¯ãããããšã¯ã§ããŸããã VirtualBoxã¯ãLinuxéçºè
ã«éŠŽæã¿ã®ããOSãããã°ããŒã«ã䜿çšããæ©èœãæäŸããŸãã éåžžã®Androidã¢ããªã±ãŒã·ã§ã³éçºè
ã«ãšã£ãŠãIntel Hardware Accelerated Execution Managerãã¯ãããžãŒã䜿çšãããšãã¥ã¬ãŒã¿ãŒã¯çŽ æŽããããã®ã§ãã ïŒè©³çŽ°ã¯
ãã¡ããã芧ãã ãã ïŒ
ãã®èšäºã§ã¯ãVirtualBoxä»®æ³ãã·ã³ã§å®è¡ããAndroid x86ã€ã¡ãŒãžã®æ§ç¯ãšãšãã¥ã¬ãŒã¿ãŒã®æ§ç¯ã«é¢ããå®çšçãªãã³ããæäŸããŸãã AndroidãœãŒã¹ã³ãŒãã¯ã
AOSP ïŒAndroidãªãŒãã³ãœãŒã¹ãããžã§ã¯ãïŒãããžã§ã¯ãã®å
¬åŒãªããžããªããååŸãããIntelã®Linux 2.6ã«ãŒãã«ã®é©å¿ããŒãžã§ã³ãã«ãŒãã«ãšããŠäœ¿çšãããŸãã
ãã«ãç°å¢ã®èšå®
Androidããã«ãããã«ã¯ã64ãããããŒãžã§ã³ã®Linuxãå¿
èŠã§ãã ãã1ã€ã®éèŠãªãã€ã³ãïŒã·ã¹ãã ã«ã€ã³ã¹ããŒã«ãããŠããGCCã®ããŒãžã§ã³ã«æ³šæããŠãã ããã Googleã¯GCCããŒãžã§ã³4.4以éããµããŒãããŠããŸãã ãŸããã·ã¹ãã ã«Oracleã®Javaå®è£
ãã€ã³ã¹ããŒã«ããå¿
èŠããããŸãã
Ubuntu 12.04ã®è¿œå ã®äŸåé¢ä¿ã®ã€ã³ã¹ããŒã«ïŒ
sudo -i apt-get update sudo apt-get install git-core gnupg flex bison gperf build-essential \ zip curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \ libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \ libgl1-mesa-dev g++-multilib mingw32 openjdk-6-jdk tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386
ååã®ç«¶åã解決ããã·ã³ããªãã¯ãªã³ã¯ãèšå®ããŸãã
sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1 /usr/lib/i386-linux-gnu/libGL.so
ãœãŒã¹ããªãŒãããŠã³ããŒããã
ãªããžããªã®ã€ã³ã¹ããŒã«
Repoã¯ãGit for Androidã§ã®äœæ¥ãç°¡çŽ åãããªããžããªç®¡çãŠãŒãã£ãªãã£ã§ãã 詳现ã«ã€ããŠã¯ããã¡ãïŒhttp://source.android.com/source/version-control.htmlïŒãã芧ãã ããã
Repoãã€ã³ã¹ããŒã«ãåæåãããã³æ§æããã«ã¯ã次ã®æé ãå®è¡ããŸãã
â¢ããŒã ãã£ã¬ã¯ããªã«binãã£ã¬ã¯ããªããããPATHã«èšè¿°ãããŠããããšã確èªããŸãã
mkdir ~/bin PATH=~/bin:$PATH
â¢Repoã¹ã¯ãªãããããŠã³ããŒãããå®è¡æš©éãèšå®ããŸãã
curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo chmod a+x ~/bin/repo
Repoã¯ã©ã€ã¢ã³ãã®åæå
Repoãã€ã³ã¹ããŒã«ããåŸãAndroidãœãŒã¹ã³ãŒããªããžããªãžã®ã¢ã¯ã»ã¹ãèšå®ããŸãã
â¢ãœãŒã¹ãã¡ã€ã«çšã®ç©ºã®ãã£ã¬ã¯ããªãäœæããããã«ç§»åããŸãã ããšãã°ã次ã®ããã«ãªããŸãã
mkdir aosp cd aosp
â¢repo initã¹ã¯ãªãããå®è¡ããŠãRepoèªäœã®ããŒãžã§ã³ãæŽæ°ããŸãã
repo init -u https://android.googlesource.com/platform/manifest
ãã®ã³ãã³ãã¯ãAndroidãœãŒã¹ããªãŒããmasterãã©ã³ããæ¥ç¶ããŸãã -bã¹ã€ããã䜿çšããŠãä»ã®ãã®ãæå®ã§ããŸãã
repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r6
å©çšå¯èœãªãã¹ãŠã®ãã©ã³ãã衚瀺ããã«ã¯ã次ã®ã³ãã³ããå
¥åããŸãã
git --git-dir .repo/manifests/.git/ branch -a
Googleã®ææ°ããŒãžã§ã³ã®Androidã«èå³ããããŸãã
- Jelly BeanïŒãªã¢ãŒã/èµ·æº/ android-4.1.1_r6
- ã¢ã€ã¹ã¯ãªãŒã ãµã³ãã€ããïŒãªã¢ãŒã/èµ·æº/ android-4.0.4_r2.1
奜ã¿ã«åãããŠã©ãã§ãéžæã§ããŸããããã以éã®æé ã¯å€ãããŸããã VirtualBoxã§ãã«ãããã»ã¹ãå®èšŒããã«ã¯ãJelly BeanïŒJBïŒã®ããŒãžã§ã³ã䜿çšããŸãã
åæåã«æåãããšããã£ã¬ã¯ããªã§Repoãåæåããããã®äžã«.repoãã©ã«ããŒã衚瀺ãããããšã瀺ãã¡ãã»ãŒãžã衚瀺ãããŸã
ãã¡ã€ã«ãã¢ããããŒããã
ãªããžããªããäœæ¥ãã£ã¬ã¯ããªã«ãœãŒã¹ãã¡ã€ã«ãããŠã³ããŒãããã«ã¯ã次ã®ã³ãã³ããå®è¡ããŸãã
repo sync -j 16
æåã®åæã«ã¯1æé以äžãããå ŽåããããŸãã
ã«ãŒãã«ã¢ã»ã³ããª
Androidã¯äž»ã«ãžã§ã¹ãã£ãŒå¶åŸ¡ããã€ã¹åãã«èšèšãããŠãããããã©ã«ãã§ã¯ããŠã¹ããµããŒãããŠããŸããã ãããã£ãŠãäŸãšããŠãããŠã¹ãµããŒããæå¹ã«ããŠãœãŒã¹ããã«ãŒãã«ãåæ§ç¯ããŸãã
ã«ãŒãã«ãœãŒã¹ãæ ŒçŽãããã£ã¬ã¯ããªãäœæããŸãã
mkdir ~/android_kernel cd ~/android_kernel
Intelã®äºåã«æºåãããããŒãžã§ã³ã®ã«ãŒãã«ã䜿çšããŸãã
wget http://software.intel.com/sites/landingpage/android/Intel_x86_sysimg_2.3.7_Source_Files.zip unzip Intel_x86_sysimg_2.3.7_Source_Files.zip tar -xvf kernel_sdk_x86.tar.gz
ã«ãŒãã«ãã£ã¬ã¯ããªã«è¡ããŸãããïŒ
cd kernel
ããã§ã«ãŒãã«ãœãŒã¹ãã§ããŸããã æ§æãã¡ã€ã«ãå€æŽããŠåæ§ç¯ããå¿
èŠããããŸãã ã«ãŒãã«ãå®å
šã«æ§æããæéãççž®ããããã«ãéçºè
åãã«æºåããæ§æãã¡ã€ã«ã䜿çšããŸãã éèŠãªãã€ã³ã-ã«ãŒãã«ãæ§ç¯ãããŠããã¢ãŒããã¯ãã£ãæå®ããããšãå¿ããªãã§ãã ããããã®å Žåã¯x86ã§ãã
cp arch/x86/configs/vbox_defconfig .config make ARCH=x86 menuconfig
æ°ç§åŸãã°ã©ãã£ã«ã«ãªã«ãŒãã«æ§æã¡ãã¥ãŒãããŒããããŸãã äžç¢å°ãšäžç¢å°ã䜿çšããŠã¡ãã¥ãŒé
ç®ã移åããEnterããŒãæŒããŠãµãã¡ãã¥ãŒã«å
¥ããŸãã ãã¹ãŠãéåžžã®Linuxã«ãŒãã«ãšãŸã£ããåãã§ãã
ããŠã¹ã®ãµããŒããæå¹ã«ããã«ã¯ïŒ
â¢ããã€ã¹ãã©ã€ããŒã«ç§»å
â¢ãå
¥åããã€ã¹ã®ãµããŒãããéžæããŸã
â¢ãããŠã¹ãããã§ãã¯ããŸã
ãããŠã¹ããµãã¡ãã¥ãŒã«ç§»åããŠãè¿œå ã®ãã©ã€ããŒèšå®ã確èªã§ããŸãã
次ã«ãã«ãŒãã«æ§æã¡ãã¥ãŒãçµäºããŸãã ããã¯ããEscããæ°åã¯ãªãã¯ããããšã§å®è¡ã§ããŸãã æ§æã¡ãã¥ãŒãããããè¡ãããã«æ±ããããããå¿ããã«èšå®ãä¿åããŠãã ããã
å¿
èŠãªã«ãŒãã«èšå®ãè¡ã£ããããããçµã¿ç«ãŠãŸãã ããã¯ãç¹ã«ãã«ãã³ã¢ãã·ã³ã䜿çšããŠããå Žåãããã»ã©æéã¯ããããŸãã-makeã³ãã³ããªãã·ã§ã³ãæå®ã§ããŸãïŒ-j Nãããã§Nã¯ã³ã¢ã®æ°ã§ãïŒããšãã°ãmake -j 32ã¯èšäºã®äœæã«äœ¿çšãããŸããïŒã
make ARCH=x86 âj 32
ã³ã³ãã€ã«ãæåãããšã次ã®ã¡ãã»ãŒãžã衚瀺ãããŸãã
Kernel: arch/x86/boot/bzImage is ready
æ°ããã«ãŒãã«ãžã®ãã¹ã¯æåŸã®è¡ã«ç€ºãããŠããŸãã
ã«ãŒãã«ã®ãªãããŸã
VirtualBoxã®ã¢ã»ã³ããªã§äœ¿çšãããã«ãŒãã«ãžã®ãã¹ã¯ã次ã®ããã«æ±ºå®ã§ããŸãã
grep "LOCAL_KERNEL :=" ~/aosp/build/target/board/vbox_x86/device.mk
以äžã衚瀺ãããã¯ãã§ãã
LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel-vbox
èŠã€ãã£ããã¹ã§bzImageãã³ããŒããŸãã
cp ~/kernel/arch/x86/boot/bzImage ~/aosp/prebuilt/android-x86/kernel/kernel-vbox
Androidãã«ã
ãã«ãç°å¢ãèšå®ããŸãã
cd ~/aosp . ./build/envsetup.sh
ããã§ãAndroidãœãŒã¹ã®ã³ã³ãã€ã«ãéå§ããæºåããã¹ãŠæŽããŸããã æåã®ã¹ãããã¯ãã¢ã»ã³ããªã®ç®çãæå®ããããšã§ãã
lunch vbox_x86-eng
ã³ãã³ããå®è¡ãããšã次ã®ãã«ãã«é¢ããæ
å ±ã衚瀺ãããŸãã
============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.1.1 TARGET_PRODUCT=vbox_x86 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86 HOST_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-2.6.32-131.0.15.el6.x86_64-x86_64-with-redhat-6.1-Santiago HOST_BUILD_TYPE=release BUILD_ID=JRO03R OUT_DIR=out ============================================
次ã«ãmakeã³ãã³ãã§ãœãŒã¹ã¢ã»ã³ããªãéå§ããå¿
èŠããããŸãã ãã«ããã°ãä¿æããããšããå§ãããŸããããã¯ãteeãŠãŒãã£ãªãã£ã䜿çšããŠå®è¡ã§ããŸãã
make âj 16 | tee vbox_build.log
ã¢ã»ã³ããªããã»ã¹ã«ã¯ããªãã®æéããããå ŽåããããŸããå
·äœçãªæ°å€ã¯ãäžå€®åŠçè£
眮ã®ãã¯ãŒãšãã·ã³ã®RAMã®éã«ãã£ãŠç°ãªããŸãã èšäºã®æºåã«äœ¿çšãããã·ã¹ãã ã§ã¯ãããã«ã¯çŽ1æéããããŸããã ã¢ã»ã³ããªã«æšå¥šãããã¹ã¬ããæ°ã¯ãã¹ã¬ããããã2GBã®RAMã®èšç®ãã決å®ã§ããŸãã
ã³ã³ãã€ã«ãæåãããšãåºåã®æåŸã®è¡ã«ã€ã¡ãŒãžã®ãã¹ãšãµã€ãºãå«ãŸããŸãã
Install system fs image: out/target/product/vbox_x86/system.img out/target/product/vbox_x86/system.img+ total size is 268435456
次ã«ãVirtualBoxã®ããŒãã€ã¡ãŒãžãäœæããå¿
èŠããããŸãã
make installer_vdi
ã¢ã»ã³ããªãæåããå Žåããšã³ããªãã³ã³ãœãŒã«ã«è¡šç€ºãããŸãã
Done with VirtualBox bootable installer image -[ out/target/product/vbox_x86/installer.vdi ]-
VirtualBoxãæ§æãã
次ã«ãVirtualBoxãã»ããã¢ããããŸãããã æ°ããä»®æ³ãã·ã³ãäœæãããAndroid_ICSããšåŒã³ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ãšããŠLinuxãéžæããAndroidã«æãé©ããããŒãžã§ã³ãšããŠ[ãã®ä»]ã«èšå®ããå¿
èŠããããŸãã
次ã®ã¹ãããã¯ãRAMã®å²ãåœãŠã§ãã 512ã¡ã¬ãã€ã以äžãæšå¥šããŸãã ç§ãã¡ã®å Žåãã®ã¬ãã€ãã«ãªããŸãã
次ã«ãããŒããã£ã¹ã¯ã®ãµã€ãºãæ§æããŸãã äž»ãªããšã¯ãã»ããã¢ãããå®äºããåŸããã¹ãŠã®VirtualBoxããŒããã©ã€ããIDEã³ã³ãããŒã©ãŒã«æ¥ç¶ãããããšã§ãã
ããŒãå¯èœãªAndroidã€ã¡ãŒãžãä»®æ³ãã·ã³ã®2çªç®ã®ããŒãã£ã·ã§ã³ãšããŠã€ã³ã¹ããŒã«ããŸãã
ä»®æ³ãã·ã³ã®æåã®èµ·åæã«ãAndroidã®ã€ã³ã¹ããŒã«ãéå§ããå¿
èŠããããŸãã èµ·åäžã«F12ãæŒããŠBIOSèšå®ã¡ãã¥ãŒã«å
¥ããŸãã 2ããã©ã€ããªã¹ã¬ãŒãããéžæããŸããããã¯ãAndroidã®ã€ã³ã¹ããŒã«ã€ã¡ãŒãžãå«ãŸããŠããå Žæã§ãã
ã€ã³ã¹ããŒã«ãæåãããšããã€ã³ã¹ããŒã©ãŒæ§æã®åŠçãå®äºããŸããããšè¡šç€ºãããŸãã æåã®ã€ã³ã¹ããŒã«æã«ãšã©ãŒãçºçããå ŽåããããŸããããäžåºŠå®è¡ããŠãã ããã 次ã«ãæ°ããã€ã³ã¹ããŒã«ããAndroidã§ä»®æ³ãã·ã³ãåèµ·åããŸãïŒ
ãšãã¥ã¬ãŒã¿ãŒãžã§ãªãŒããŒã³
ãšãã¥ã¬ãŒã¿ãŒã®ãã«ãã¯ãVirtualBoxã®ãã«ãããŒãžã§ã³ãšããã»ã©å€ãããŸããã ãã§ã«ãœãŒã¹ã³ãŒããããå Žåã¯ãç°å¢ã®åæåæé ããã¢ã»ã³ããªãç¶è¡ããŸãã å®éšã®çŽåºŠã®ããã«ããšãã¥ã¬ãŒã¿ãæ§ç¯ããããã»ã¹ã®æŠèŠãæåããæŠèª¬ããŸãã ãã®ãããJelly Bean Emulatorçšã«å¥ã®ãã£ã¬ã¯ããªãäœæããããç¥ãããŠããæé ãç¹°ãè¿ããŸãã
mkdir ~/jb cd ~/jb
ãªããžããªã®åæå
repo init -u https://android.googlesource.com/platform/manifest -b android-4.1.1_r6
ãœãŒã¹ãããŠã³ããŒã
repo sync -j 16
ç°å¢ã®åæå
. ./build/envsetup.sh
ãšãã¥ã¬ãŒã¿ãŒãã«ãã®éžæ
lunch full_x86-eng
æåãããšã以äžã衚瀺ãããŸãã
============================================ PLATFORM_VERSION_CODENAME=REL PLATFORM_VERSION=4.1.1 TARGET_PRODUCT=full_x86 TARGET_BUILD_VARIANT=eng TARGET_BUILD_TYPE=release TARGET_BUILD_APPS= TARGET_ARCH=x86 TARGET_ARCH_VARIANT=x86-atom HOST_ARCH=x86 HOST_OS=linux HOST_OS_EXTRA=Linux-2.6.32-131.0.15.el6.x86_64-x86_64-with-redhat-6.1-Santiago HOST_BUILD_TYPE=release BUILD_ID=JRO03L OUT_DIR=out ============================================
ã¢ã»ã³ããªãéå§ããŸãã
make âj 16 | tee emulator_build.log
ã³ã³ãã€ã«ããã»ã¹ã®é²è¡äžã«ãæ§æãã¡ã€ã«ãã³ããŒãããšãã¥ã¬ãŒã¿ãŒçšã®ã«ãŒãã«ãã¢ã»ã³ãã«ããŸãã
cd kernel cp arch/x86/configs/goldfish_defconfig .config make ARCH=x86 -j16
ããã§ãšãã¥ã¬ãŒã¿ãŒã®çµã¿ç«ãŠãå®äºããŸããã
æãç°¡åãªå®è¡æ¹æ³ïŒ
emulator
ããšãã°ã480x800ã®è§£å床ã512 MBã®RAMãããã³ããŒããŠã§ã¢ã°ã©ãã£ãã¯ã¹ã¢ã¯ã»ã©ã¬ãŒã·ã§ã³ãæå¹ã«ããŠãæ°ãããã«ããããã«ãŒãã«ã§å®è¡ã§ããŸãã
emulator -kernel ~/kernel/arch/x86/boot/bzImage -skin WVGA800 -memory 512 -gpu on
ãšãã¥ã¬ãŒã¿ã®æ©èœãšèšå®ã®è©³çŽ°ã«ã€ããŠã¯ã
ãã¡ããã芧ãã ããããããã«
ãã®èšäºã§ã¯ãVirtualBoxçšã®Jelly Beanã®Android x86ããŒãžã§ã³ãã€ã³ã¹ããŒã«ããã«ã¹ã¿ã ã«ãŒãã«ãšãšãã¥ã¬ãŒã¿ãŒãæ§ç¯ããæ¹æ³ã«ã€ããŠèª¬æããŸãã ãã®èšäºã§ã¯ãAndroidã®ããŸããŸãªããŒãžã§ã³ãæ§ç¯ããã³æ§æããããã®ããŸããŸãªããªãã¯ãšã¢ãããŒãããããŸãã ããã§ã¯ãOS Androidã®äžçãžã®æ
ãå§ããããã®åºæ¬çãªè³æãã¬ã€ã¢ãŠãããŸããã