On Github chitacan / aosp-build-with-vagrant
조금 더 편하게...
by chitacan(Android Open Source Project)
단지 조금, 아주 조금 귀찮을 뿐이죠...
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo $ chmod a+x ~/bin/repo $ mkdir android-5.0.2_r1 && cd android-5.0.2_r1 $ repo init -u https://android.googlesource.com/platform/manifest -b android-5.0.2_r1 $ repo sync $ . build/envsetup $ lunch $ make
AOSP 를 직접 빌드하시면,
AOSP 코드를 해킹하기가 완전 편해집니다.
+ 설치시간...
아놔...
AOSP 개발환경이 세팅된 box를 만들고,
드롭박스로 공유하면 편하지 않을까 ?
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "robust-android-v1" config.vm.box_url = "http://goo.gl/ftM2P9" config.vm.provider :virtualbox do |vb| vb.name = "robust-android-v1" vb.customize ["modifyvm", :id, "--memory", "1024"] vb.customize ["modifyvm", :id, "--cpus", "1"] vb.customize ["modifyvm", :id, "--cpuexecutioncap", "80"] end end
$ wget http://goo.gl/OnTHI4 -O Vagrantfile $ vagrant up $ vagrant ssh vagrant$ cd workspace/android-4.4_r1/ vagrant$ repo sync vagrant$ . build/envsetup vagrant$ lunch vagrant$ make
file { 'one': path => '/vagrant/one', content => 'one', } file { 'two': path => '/vagrant/two', source => '/vagrant/one', } File['one'] -> File['two']
# -*- mode: ruby -*- # vi: set ft=ruby : VAGRANTFILE_API_VERSION = "2" Vagrant.configure(VAGRANTFILE_API_VERSION) do |config| config.vm.box = "hashicorp/precise64" config.vm.provider :virtualbox do |vb| vb.customize ["modifyvm", :id, "--memory", "1024"] vb.customize ["modifyvm", :id, "--cpus", "1"] vb.customize ["modifyvm", :id, "--cpuexecutioncap", "80"] end config.vm.provision "puppet" do |puppet| puppet.module_path = "modules" puppet.manifests_path = "manifests" puppet.manifest_file = "default.pp" puppet.options = ['--verbose', '--debug'] end end
https://github.com/chitacan/aosp-env
config.vm.provision "puppet" do |puppet| puppet.facter = { "aospversion" => "android-5.0.2_r1" } end
$ git clone chitacan/aosp-env $ cd aosp-env $ vagrant up
$ vagrant ssh vagrant$ cd workspace/android-5.0.2_r1/ vagrant$ repo sync vagrant$ . build/envsetup vagrant$ lunch vagrant$ make
유용한 도구들이 추가됩니다.
vagrant$ . build/envsetup vagrant$ hmm Invoke ". build/envsetup.sh" from your shell to add the following functions to your environment: - lunch: lunch - - tapas: tapas [ ...] [arm|x86|mips|armv5] [eng|userdebug|user] - croot: Changes directory to the top of the tree. - m: Makes from the top of the tree. - mm: Builds all of the modules in the current directory, but not their dependencies. - mmm: Builds all of the modules in the supplied directories, but not their dependencies. - mma: Builds all of the modules in the current directory, and their dependencies. - mmma: Builds all of the modules in the supplied directories, and their dependencies. - cgrep: Greps on all local C/C++ files. - jgrep: Greps on all local Java files. - resgrep: Greps on all local res/*.xml files. - godir: Go to the directory containing a file. Look at the source to view more functions. The complete list is: ...
vagrant$ . build/envsetup vagrant$ lunch vagrant$ make -j8 updatepackage vagrant$ cp out/target/product/hammerhead/full_hammerhead-img-eng.vagrant.zip /vagrant/ vagrant$ exit $ adb reboot bootloader $ fastboot -w update full_hammerhead-img-eng.vagrant.zip
i7 -2600 3.4 GHz, 16 GB, HDD 1 TB (7200 rpm)
config.vm.provider "virtualbox" do |vb| vb.customize ["modifyvm", :id, "--memory", (1024*12).to_s] vb.customize ["modifyvm", :id, "--cpus", 8] vb.customize ["modifyvm", :id, "--cpuexecutioncap", 90] endandroid-5.0.2_r1 기준으로 약 1h 55m
에뮬레이터를 빌드하시면 됩니다.(디버깅엔 더 편합니다.)
vagrant$ . build/envsetup vagrant$ lunch vagrant$ make vagrant$ emulator -no-window