Ubuntu 12.0 64位源码编译Android4.0
在Ubuntu上下载、编译和安装Android最新源代码
在Ubuntu上下载、编译和安装Android最新源代码在Ubuntu上下载、编译和安装Android最新源代码官⽹内容:Initializing a Build EnvironmentThe "Getting Started" section describes how to set up your local work environment, how to use Repo to get the Android files, and how to build the files on your machine. To build the Android source files, you will need to use Linux or Mac OS. Building undernot currently supported.Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.For an overview of the entire code-review and code-update process, see Life of a Patch.Setting up a Linux build environmentThe Android build is routinely tested in house on recent versions of Ubuntu LTS (10.04), but most distributions should have the required build tools available. Reports of successes or failures on other distributions are welcome.Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.In general you will need:Python 2.4 -- 2.7, which you can download from .JDK 6 if you wish to build Gingerbread or newer; JDK 5 for Froyo or older. You can download both from .Git 1.7 or newer. You can find it at .Detailed instructions for Ubuntu 10.04+ follow.Installing the JDKThe Sun JDK is no longer in Ubuntu's main package repository. In order to download it, you need to add the appropriate repository and indicate to the system which JDK should be used.Java 6: for Gingerbread and newer$ sudo add-apt-repository "deb / lucid partner"$ sudo apt-get update$ sudo apt-get install sun-java6-jdkJava 5: for Froyo and older$ sudo add-apt-repository "deb /ubuntu hardy main multiverse"$ sudo add-apt-repository "deb /ubuntu hardy-updates main multiverse"$ sudo apt-get update$ sudo apt-get install sun-java5-jdkInstalling required packages64-bit (recommended)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxm On newer versions of Ubuntu such as 11.10 you may need to do the following:$ sudo ln -s /usr/lib/i386-linux-gnu/libX11.so.6 /usr/lib/i386-linux-gnu/libX11.so32-bit (experimental)$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev libc6-dev libncurses5-dev x11proto-core-dev libx11-dev libreadline6-dev libgl1-mesa-dev tofrodos python-markdown libxml2-utilsConfiguring USB AccessUnder GNU/linux systems (and specifically under Ubuntu systems), regular users can't directly access USB devices by default. The system needs to be configured to allow such access.The recommended approach is to create a file /etc/udev/rules.d/51-android.rules (as the root user) and to copy the following lines in it.must be replaced by the actual username of the user who is authorized to access the phones over USB.# adb protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e12", MODE="0600", OWNER="<username>"# fastboot protocol on passion (Nexus One)SUBSYSTEM=="usb", ATTR{idVendor}=="0bb4", ATTR{idProduct}=="0fff", MODE="0600", OWNER="<username>"# adb protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e22", MODE="0600", OWNER="<username>"# fastboot protocol on crespo/crespo4g (Nexus S)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e20", MODE="0600", OWNER="<username>"# adb protocol on maguro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="04e8", ATTR{idProduct}=="6860", MODE="0600", OWNER="<username>"# fastboot protocol on maguro (Galaxy Nexus)SUBSYSTEM=="usb", ATTR{idVendor}=="18d1", ATTR{idProduct}=="4e30", MODE="0600", OWNER="<username>"Those new rules take effect the next time a device is plugged in. It might therefore be necessary to unplug the device and plug it back into the computer.This is known to work on both Ubuntu Hardy Heron (8.04.x LTS) and Lucid Lynx (10.04.x LTS). Other versions of Ubuntu or other variants of GNU/linux might require different configurations.Setting up a Mac OS X build environmentTo build the Android files in a Mac OS environment, you need an Intel/x86 machine running MacOS 10.6 (Snow Leopard).Android must be built on a case-sensitive file system because the sources contain files that differ only in case. We recommend that you build Android on a partition that has been formatted with the journaled file system HFS+. HFS+ is required to successfully OS applications such as the Android Emulator for OS X.Creating a case sensitive disk imageIf you want to avoid partitioning/formatting your hard drive, you can use a case-sensitive disk image instead. To create the image, launch Disk Utility and select "New Image". A size of 25GB is the minimum to complete the build, larger numbers are more future-Using sparse images saves space while allowing to grow later as the need arises. Be sure to select "case sensitive, journaled" as the volume format.You can also create it from a shell with the following command:# hdiutil create -type SPARSE -fs 'Case-sensitive Journaled HFS+' -size 40g ~/android.dmgThis will create a .dmg (or possibly a .dmg.sparsefile) file which, once mounted, acts as a drive with the required formatting for Android development. For a disk image named "android.dmg" stored in your home directory, you can add the following toyour ~/.bash_profile to mount the image when you execute "mountAndroid":# mount the android file imagefunction mountAndroid { hdiutil attach ~/android.dmg -mountpoint /Volumes/android; }Once mounted, you'll do all your work in the "android" volume. You can eject it (unmount it) just like you would with an external drive.Installing required packagesInstall XCode from the Apple developer site. We recommend version 3.1.4 or newer, i.e. gcc 4.2. Version 4.x could cause difficulties. If you are not already registered as an Apple developer, you will have to create an Apple ID in order to download.Install MacPorts from .Note: Make sure that /opt/local/bin appears in your path BEFORE /usr/bin. If not, addexport PATH=/opt/local/bin:$PATHto your ~/.bash_profile.Get make, git, and GPG packages from MacPorts:$ POSIXLY_CORRECT=1 sudo port install gmake libsdl git-core gnupgIf using Mac OS 10.4, also install bison:$ POSIXLY_CORRECT=1 sudo port install bisonReverting from make 3.82There is a bug in gmake 3.82 that prevents android from building. You can install version 3.81 using MacPorts by taking the following steps:Edit /opt/local/etc/macports/sources.conf and add a line that saysfile:///Users/Shared/dportsabove the rsync line. Then create this directory:$ mkdir /Users/Shared/dportsIn the new dports directory, run$ svn co --revision 50980 /repository/macports/trunk/dports/devel/gmake/ devel/gmake/Create a port index for your new local repository:$ portindex /Users/Shared/dportsFinally, install the old version of gmake with$*************************Setting a file descriptor limitOn MacOS the default limit on the number of simultaneous file descriptors open is too low and a highly parallel build process may exceed this limit.To increase the cap, add the following lines to your ~/.bash_profile:# set the number of open files to be 1024ulimit -S -n 1024Downloading the Source TreeInstalling RepoRepo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see Version Control.To install, initialize, and configure Repo, follow these steps:Make sure you have a bin/ directory in your home directory, and that it is included in your path:$ mkdir ~/bin$ PATH=~/bin:$PATHDownload the Repo script and ensure it is executable:$ curl https:///dl/googlesource/git-repo/repo > ~/bin/repo$ chmod a+x ~/bin/repoThe SHA-1 checksum for repo is e1fd3bef059d152edf4d0522590725d317bc637fInitializing a Repo clientAfter installing Repo, set up your client to access the android source repository:Create an empty directory to hold your working files. If you're using MacOS, this has to be on a case-sensitive filesystem. Give it any name you like:$ mkdir WORKING_DIRECTORY$ cd WORKING_DIRECTORYRun repo init to bring down the latest version of Repo with all its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source will be placed within your working directory.$ repo init -u https:///platform/manifestTo check out a branch other than "master", specify it with -b:$ repo init -u https:///platform/manifest -b android-4.0.1_r1When prompted, please configure Repo with your real name and email address. To use the Gerrit code-review tool, you will need an email address that is connected with a registered Google account. Make sure this is a live address at which you can receive mes The name that you provide here will show up in attributions for your code submissions.A successful initialization will end with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest will be kept.Getting the filesTo pull down files to your working directory from the repositories as specified in the default manifest, run$ repo syncThe Android source files will be located in your working directory under their project names. The initial sync operation will take an hour or more to complete. For more about repo sync and other Repo commands, see Version Control.Verifying Git TagsLoad the following public key into your GnuPG key database. The key is used to sign annotated tags that represent releases.$ gpg --importCopy and paste the key(s) below, then enter EOF (Ctrl-D) to end the input and process the keys.-----BEGIN PGP PUBLIC KEY BLOCK-----Version: GnuPG v1.4.2.2 (GNU/Linux)mQGiBEnnWD4RBACt9/h4v9xnnGDou13y3dvOx6/t43LPPIxeJ8eX9WB+8LLuROSVlFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw7lFhpHawsVAcFlmi7f7jdSRF+OvtZL9ShPKdLfwBJMNkU66/TZmPewS4m782ndtw78tR1cXb197Ob8kOfQB3A9yk2XZ4ei4ZC3i6wVdqHLRxABdncwu5hOF9KXwCgkxMDu4PVgChaAJzTYJ1EG+UYBIUEAJmfearb0qRAN7dEoff0FeXsEaUA6U90sEoVks0ZwNj96SA8BL+a1OoEUUfpMhiHyLuQSftxisJxTh+2QclzDviDyaTrkANjdYY7p2cq/HMdOY7LJlHaqtXmZxXjjtw5Uc2QG8UY8aziU3IE9nTjSwCXeJnuyvoizl9/I1S5jU5SA/9WwIps4SC84ielIXiGWEqq6i6/sk4I9q1YemZF2XVVKnmI1F4iCMtNKsR4MGSa1gA8s4iQbsKNWPgp7M3a51JCVCu6l/8zTpA+uUGapw4tWCp4o0dpIvDPBEa9b/aF/ygcR8mh5hgUfpF9IpXdknOsbKCvM9lSSfRciETykZc4wrRCVGhlIEFuZHJvaWQgT3BlbiBTb3VyY2UgUHJvamVjdCA8aW5pdGlhbC1jb250cmlidXRpb25AYW5kcm9pZC5jb20+iGAEExECACAFAknnWD4CGwMGCwkIBwMCBBUCCAMEFgIDAQIeAQIXgAAKCRDorT+BmrEOeNr+AJ42Xy6tEW7r3KzrJxnRX8mij9z8tgCdFfQYiHpYngkI2t09Ed+9Bm4gmEO5Ag0ESedYRBAIAKVW1JcMBWvV/0Bo9WiByJ9WJ5swMN36/vAlQN4mWRhfzDOk/Rosdb0csAO/l8Kz0gKQPOfObtyYjvI8JMC3rmi+LIvSUT9806UphisyEmmHv6U8gUb/xHLIanXGxwhYzjgeuAXVCsv+EvoPIHbY4L/KvP5x+oCJIDbkC2b1TvVk9PryzmE4BPIQL/NtgR1oLWm/uWR9zRUFtBnE411aMAN3qnAHBBMZzKMXLWBGWE0znfRrnczI5p49i2YZJAjyX1P2WzmScK49CV82dzLo71MnrF6fj+Udtb5+OgTg7Cow+8PRaTkJEW5Y2JIZpnRUq0CYxAmHYX79EMKHDSThf/8AAwUIAJPWsB/MpK+KMs/s3r6nJrnYLTfdZhtmQXimpoDMJg1zxmL8UfNUKiQZ6esoAWtDgpqt7Y7sKZ8laHRARonte394hidZzM5nb6hQvpPjt2OlPRsyqVxw4c/KsjADtAuKW9/d8phbN8bTyOJo856qg4oOEzKG9eeF7oaZTYBy33BTL0408sEBxiMior6b8LrZrAhkqDjAvUXRwm/fFKgpsOysxC6xi553CxBUCH2omNV6Ka1LNMwzSp9ILz8jEGqmUtkBszwoG1S8fXgE0Lq3cdDM/GJ4QXP/p6LiwNF99faDMTV3+2SAOGvytOX6KjKVzKOSsfJQhN0DlsIw8hqJc0WISQQYEQIACQUCSedYRAIbDAAKCRDorT+BmrEOeCUOAJ9qmR0lEXzeoxcdoafxqf6gZlJZlACgkWF7wi2YLW3Oa+jv2QSTlrx4KLM==Wi5D-----END PGP PUBLIC KEY BLOCK-----After importing the keys, you can verify any tag with$ git tag -v TAG_NAMEBuilding the SystemThe basic sequence of build commands is as follows:InitializeInitialize the environment with the envsetup.sh script. Note that replacing "source" with a single dot saves a few characters, and the short form is more commonly used in documentation.$ source build/envsetup.shor$ . build/envsetup.shChoose a TargetChoose which target to build with lunch. The exact configuration can be passed as an argument, e.g.$ lunch full-engThe example above refers to a complete build for the emulator, with all debugging enabled.If run with no arguments lunch will prompt you to choose a target from the menu.All build targets take the form BUILD-BUILDTYPE, where the BUILD is a codename referring to the particular feature combination:Build name Device Notesfull emulator fully configured with all languages, apps, input methodsfull_maguro maguro full build running on Galaxy Nexus GSM/HSPA+ ("maguro")full_panda panda full build running on PandaBoard ("panda")and the BUILDTYPE is one of the following:Buildtype Useuser limited access; suited for productionuserdebug like "user" but with root access and debuggability; preferred for debuggingeng development configuration with additional debugging toolsFor more information about building for and running on actual hardware, see Building for devicesBuild the CodeBuild everything with make. GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 mac CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32.$ make -j4Run It!You can either run your build on an emulator or flash it on a device. Please note that you have already selected your build target with lunch, and it is unlikely at best to run on a different target than it was built for.Flash a DeviceTo flash a device, you will need to use fastboot, which should be included in your path after a successful build. Place the device in fastboot mode either manually by holding the appropriate key combination at boot, or from the shell with$ adb reboot bootloaderOnce the device is in fastboot mode, run$ fastboot flashall -wThe -w option wipes the /data partition on the device; this is useful for your first time flashing a particular device, but is otherwise unnecessary.For more information about building for and running on actual hardware, see Building for devicesEmulate an Android DeviceThe emulator is added to your path automatically by the build process. To run the emulator, type$ emulatorUsing ccacheccache is a compiler cache for C and C++ that can help make builds faster. In the root of the source tree, do the following:$ export USE_CCACHE=1$ export CCACHE_DIR=/<path_of_your_choice>/.ccache$ prebuilt/linux-x86/ccache/ccache -M 20GYou can watch ccache being used by doing the following:$ watch -n1 -d prebuilt/linux-x86/ccache/ccache -sOn OSX, you should replace linux-x86 with darwin-x86.Troubleshooting Common Build ErrorsWrong Java VersionIf you are attempting to build froyo or earlier with Java 1.6, or gingerbread or later with Java 1.5, make will abort with a message such as************************************************************You are attempting to build with the incorrect versionof java.Your version is: WRONG_VERSION.The correct version is: RIGHT_VERSION.Please follow the machine setup instructions at/download************************************************************This may be caused byfailing to install the correct JDK as specified on the Initializing page. Building Android requires Sun JDK 5 or 6 depending on which release you are building.another JDK that you previously installed appearing in your path. You can remove the offending JDK from your path with:$ export PATH=${PATH/\/path\/to\/jdk\/dir:/}Python Version 3Repo is built on particular functionality from Python 2.x and is unfortunately incompatible with Python 3. In order to use repo, please install Python 2.x:$ apt-get install pythonGmake Version 3.82There is a bug in make version 3.82 on Mac OS that prevents building Android.TODO: what the error looks like with GNU make 3.82 on older builds that don't explicitly detect it.Follow the instructions on the Initializing page for reverting GNU make from 3.82 to 3.81.Case Insensitive FilesystemIf you are building on an HFS filesystem on Mac OS X, you may encounter an error such as************************************************************You are building on a case-insensitive filesystem.Please move your source tree to a case-sensitive filesystem.************************************************************Please follow the instructions on the Initializing page for creating a case-sensitive disk image.No USB PermissionOn most Linux systems, unprivileged users cannot access USB ports by default. If you see a permission denied error, follow the instructions on the Initializing page for configuring USB access.If adb was already running and cannot connect to the device after getting those rules set up, it can be killed with adb kill-server. That will cause adb to restart with the new configuration.Building for devicesThis page complements the main page about Building with information that is specific to individual devices.The only supported phone with the current release is the GSM/HSPA+ Galaxy Nexus, a.k.a. "maguro". GSM/HSPA+ Galaxy Nexus is currently the recommended device to use with the Android Open-Source Project.In addition, PandaBoard a.k.a. "panda" is supported in the master branch only, but is currently considered experimental. The specific details to use a PandaBoard with the Android Open-Source Project are in the file device/ti/panda/README in the source tree. Nexus S, a.k.a. "crespo", and Nexus S 4G, a.k.a. "crespo4g", are supported with gingerbread, but can't currently be used with newer versions of the Android Open-Source Project.Nexus One a.k.a. "passion" is obsolete, was experimental in gingerbread and unsupported, and can't be used with newer versions of the Android Open-Source Project.Android Developer Phones (ADP1 and ADP2, a.k.a. "dream" and "sapphire") are obsolete, were experimental and unsupported in froyo, and can't be used with newer versions of the Android Open-Source Project.Building fastboot and adbIf you don't already have those tools, fastboot and adb can be built with the regular build system. Follow the instructions on the page about building, and replace the main make command with$ make fastboot adbBooting into fastboot modeDuring a cold boot, the following key combinations can be used to boot into fastboot mode, which is a mode in the bootloader that can be used to flash the devices:Device Keysmaguro Press and hold both Volume Up and Volume Down, then press and hold Powercrespo Press and hold Volume Up, then press and hold Powercrespo4g Press and hold Volume Up, then press and hold Powerpassion Press and hold the trackball, then press Powersapphire Press and hold Back, then press Powerdream Press and hold Back, then press PowerAlso, on devices running froyo or later where adb is enabled, the command adb reboot bootloader can be used to reboot from Android directly into the bootloader with no key combinations.Unlocking the bootloaderIt's only possible to flash a custom system if the bootloader allows it.This is the default setup on ADP1 and ADP2.On Nexus One, Nexus S, Nexus S 4G, and Galaxy Nexus, the bootloader is locked by default. With the device in fastboot mode, the bootloader is unlocked with$ fastboot oem unlockThe procedure must be confirmed on-screen, and deletes the user data for privacy reasons. It only needs to be run once.On Nexus One, the operation voids the warranty and is irreversible.On Nexus S, Nexus S 4G, and Galaxy Nexus, the bootloader can be locked back with$ fastboot oem lockObtaining proprietary binariesStarting with IceCreamSandwich, the Android Open-Source Project can't be used from pure source code only, and requires additional hardware-related proprietary libraries to run, specifically for hardware graphics acceleration.Official binaries for Nexus S, Nexus S 4G, Galaxy Nexus, and PandaBoard can be downloaded from Google's Nexus driver page, which add access to additional hardware capabilities with non-Open-Source code.There are no official binaries for Nexus One, ADP2 or ADP1.Extracting the proprietary binariesEach set of binaries comes as a self-extracting script in a compressed archive. After uncompressing each archive, run the included self-extracting script from the root of the source tree, confirm that you agree to the terms of the enclosed license agreement, binaries and their matching makefiles will get installed in the vendor/ hierarchy of the source tree.There's an additional step on Nexus S 4G. Build the signapk tool with$ make signapkThen reassemble the proprietary applicatons with$ vendor/samsung/crespo4g/reassemble-apks.shCleaning up when adding proprietary binariesIn order to make sure that the newly installed binaries are properly taken into account after being extracted, the existing output of any previous build needs to be deleted with$ make clobberPicking and building the configuration that matches a deviceThe steps to configure and build the Android Open-Source Project are described in the page about Building.The recommended builds for the various devices are available through the lunch menu, accessed when running the lunch command with no arguments:Device Branch Build configurationmaguro android-4.0.1_r1full_maguro-userdebugpanda master full_panda-engcrespo android-2.3.6_r1full_crespo-userdebugcrespo4g android-2.3.7_r1full_crespo4g-userdebugpassion android-2.3.6_r1full_passion-userdebugsapphire android-2.2.2_r1full_sapphire-userdebugdream android-2.2.2_r1full_dream-userdebugFlashing a deviceSet the device in fastboot mode if necessary (see above).Because user data is typically incompatible between builds of Android, it's typically better to delete it when flashing a new system.$ fastboot erase cache$ fastboot erase userdataAn entire Android system can be flashed in a single command: this writes the boot, recovery and system partitions together after verifying that the system being flashed is compatible with the installed bootloader and radio, and reboots the system.$ fastboot flashallOn maguro, panda, crespo, crespo4g, sapphire and dream (but not on passion), the commands above can be replaced with a single command$ fastboot -w flashallNexus S, Nexus S 4G and Galaxy Nexus Bootloader and Cell Radio compatibilityOn Nexus S, Nexus S 4G, and Galaxy Nexus, each version of Android has only been thoroughly tested with on specific version of the underlying bootloader and cell radio software. However, no compatibility issues are expected when running newer systems with bootloaders and radio images according to the following tables.Nexus S (worldwide version "XX"):Android Version Preferred Bootloader Preferred Radio Also possible2.3 (GRH55)I9020XXJK1I9020XXJK82.3.1 (GRH78)I9020XXJK1I9020XXJK82.3.2 (GRH78C)I9020XXJK1I9020XXJK82.3.3 (GRI40)I9020XXKA3I9020XXKB1All previous versions2.3.4 (GRJ22)I9020XXKA3I9020XXKD1All previous versions2.3.5 (GRJ90)I9020XXKA3I9020XXKF1All previous versions2.3.6 (GRK39F)I9020XXKA3I9020XXKF1All previous versionsNexus S (850MHz version "UC"):Android Version Preferred Bootloader Preferred Radio Also possible2.3.3 (GRI54)I9020XXKA3I9020UCKB22.3.4 (GRJ22)I9020XXKA3I9020UCKD1All previous versions2.3.5 (GRJ90)I9020XXKA3I9020UCKF1All previous versions2.3.6 (GRK39C)I9020XXKA3I9020UCKF1All previous versions2.3.6 (GRK39F)I9020XXKA3I9020UCKF1All previous versionsNexus S (Korea version "KR"):Android Version Preferred Bootloader Preferred Radio Also possible2.3.3 (GRI54)I9020XXKA3I9020KRKB32.3.4 (GRJ22)I9020XXKA3M200KRKC1All previous versions2.3.5 (GRJ90)I9020XXKA3M200KRKC1All previous versions2.3.5 (GRJ90)I9020XXKA3M200KRKC1All previous versionsAndroid Version Preferred Bootloader Preferred Radio Also possible2.3.6 (GRK39F)I9020XXKA3M200KRKC1All previous versionsNexus S 4G:Android Version Preferred Bootloader Preferred Radio Also possible2.3.4 (GRJ06D)D720SPRKC5D720SPRKC92.3.4 (GRJ22)D720SPRKC5D720SPRKD8All previous versions2.3.5 (GRJ90)D720SPRKC5D720SPRKE5All previous versions2.3.7 (GWK74)D720SPRKE1D720SPRKH1 (*)All previous versionsGalaxy Nexus (GSM/HSPA+):Android Version Preferred Bootloader Preferred Radio Also possible4.0.1 (ITL41D)PRIMEKJ10I9250XXKK1If you're building a new version of Android, if your Nexus S, Nexus S 4G or Galaxy Nexus has an older bootloader and radio image that is marked as being also possible in the table above but is not recognized by fastboot, you can locally delete the bootloader and version-baseband lines in device/samsung/crespo/board-info.txt or device/samsung/crespo4g/board-info.txt ordevice/samsung/maguro/board-info.txt(*) As a note, radio version D720SPRKH1 for Nexus S 4G sometimes erroneously reports version D720SPRKE1. If this is the case for your Nexus S 4G, you can locally modify the version-baseband line in device/samsung/crespo4g/board-info.txt accordingly.⼀. 环境准备。
Android_4.2_源码下载和编译环境安装及Android_4.2_源码编译
Android 4.2源码的下载和编译环境的安装及源码的编译Google于2012.11.14发布了Android4.2的源码,下面把本人在ubuntu10.04 的64位系统上下载源码,和编译源码做个记录备份,也供有需要的人参考,若是在下载编译安装Android源代码遇到问题,可加QQ群交流: 217706590,难免有错,敬请见谅,还忘勿吝啬指出。
源代码下载、编译环境安装、源代码编译和运行模拟器的可能出现的一些错误在本文最后一章节,若出现类似错误,可以参考。
1、源码的下载源代码的下载,首先需要安装以下软件:curl 和git-core1.1安装curl:在终端中执行:sudo apt-get install curl1.2安装git-core1.2.1在用户目录下新建bin文件在终端中执行:mkdir ~/bin将~/bin添加环境变量,作用是:要将git软件下载安装在此目录,在别的目录运行可能会找不到此软件,所以要添加到环境变量中在终端中执行:PA TH=~/bin:$PATH1.2.2安装git-core在终端中执行:curl https:///dl/googlesource/git-repo/repo§> ~/bin/repo给repo执行权限:chmod a+x ~/bin/repo1.3 下载源代码1.3.1进入要源代码将要保存的目录如我的源代码保存在:、/opt/android/src在终端中执行:cd /opt/android/src 进入到src目录中1.3.2 获取repo最新的配置repo init -u https:///platform/manifest§若是执行错误则用以下命令:~/bin/repo init -u https:///platform/manifest§1.3.3 下载源代码对于下载不同版本的android,指定一个manifest分支(即只指明android对应的版本),使用-b参数(即下载某个版本的源代码),如:对于4.2的版本,将命令修改为repo init -u https:///platform/manifest§ -b android-4.2_r1若是执行错误则用以下命令:~/bin/repo init -u https:///platform/manifest§ -b android-4.2_r1 执行以上命令后,会在/opt/android/src目录中生成一个.repo的目录,此目录保存了将要下载的源代码的相关信息同步获取源码#~/bin/repo sync如果中间出现中断,这个很正常,你可以再次输入~/bin/repo sync 命令来进行下载。
编译并运行Android4.0模拟器
编译并运行Android4.0模拟器1. 编译Android模拟器在Ubuntu下,我们可以在源码里编译出自己的模拟器及SDK等编译工具,当然这个和在windows里下载的看起来没有什么区别。
编译Android模拟器的步骤和编译Android系统很相似:Ø source build/envsetup.shØ lunch sdk-engØ make sdk在每次执行make的时候,编译系统会自动的验证上次编译项和这次编译项,如果两次不一样,会删除所有的目标代码,其实现在./build/core/main.mk71 # This allows us to force a clean build - includedafter the config.make72 # environment setup is done, but before we generateany dependencies. This73 # file does the rm -rf inline so the deps which areall done below will74 # be generated correctly75 include $(BUILD_SYSTEM)/cleanbuild.mk我们将第75行注释掉,这样就不会每次都自动删除上次编译的中间代码重新编译了。
编译完之后效果如下图所示:sdk安装在了下面的目录里:*****_*****RY/out/host/linux-x86/sdk在该目录下有一个压缩包,里面就是我们从eclipse里更新下载指定Target的sdk包。
如果你做过app开发都会知道,我们只有下载了不同版本的sdk之后才能创建不同版本的模拟器。
当我们编译完sdk之后就可以创建并运行Android4.0的模拟器了。
$ cd *****_*****RY/out/host/linux-x86/sdk/android-sdk_eng.linux_linux-x86/tools首先,查看当前编译出来的sdk的id号,用于创建一个模拟器:$ ./android list targetsAvailable Android targets:----------id: 1 or “android-14“Name:Android 4.0Type:PlatformAPI level:14Revision: 2Skins:*****, *****0, *****, HVGA, *****, *****2, ***** (default), QVGA,WSVGAABIs : no ABIs.创建一个模拟器$ ./android create avd -n mydroid -t 1注:-n 表示指定模拟器的名字,-t表示指定创建模拟的版本id 启动模拟器$ ./emulator -avd mydroid由于模拟器要启动android系统,它要使用几个映像文件,分别是:kernel-qemu , system.img, userdata.img, ramdisk.img Ø kernel-qemu:内核映像文件,它是linux操作系统针对qemu 模拟器编译的内核文件,里面安装有qemu的仿真硬件驱动,如果将来在开发板或手机上移植android,那么,第一步就是要先make出一个支持开发板或手机的kernel来。
Ubuntu12.04下在Android4.0.4源码下载及其编译过程
Ubuntu12.04下在Android4.0.4源码下载及其编译过程一、下载源码1、下载工具repo:https:///tools/repo/在本地目录建个bin的文件夹,进入bin文件夹;通过git下载:1.git clone https:///tools/repo下载完成后,进入repo文件夹,切换到稳定分支:1.git checkout -b stable origin/stable将repo命令所在的目录,即/home/yourname/bin/repo添加到环境变量中:1.export PATH=$PATH:~/bin/repo在本地目录下新建目录:android4.0.4,并进入该文件夹:[html]view plaincopy1.cd ~;mkdir android4.0.4;cd android4.0.4;在文件夹下执行下面命令来下载Android源码:1.repo init -u https:///platform/manifest你也可以直接切换到你想要下的版本的分支,而不是“master”分支:1.repo init -u https:///platform/manifest -b android-4.0.4_r2关于到底是哪个分支,根据自己的情况而定,详情可参照:https:///platform/manifest/如你想下载最新的Android4.1代码,即可将分支名称更换成:android-4.1.1_r4你也可以参照官网的下载方式来下载:/source/downloading.html实验证明,我总是在下载那个repo工具的时候,无法连接到相应的地址。
下载是个漫长的过程,下载完成后的大小大概有14G,所以要提前准备好这么大的空间。
下载完成后的目录大概有这些:如图二、编译源码如果你的电脑的环境经常做开发,那么很多环境应该已经搭建好了,如果没有,可以参照官网:/source/initializing.html这里要提醒的是:用apt-get或者ubuntu软件中直接安装的jdk,jre的时候,编译Android是总是编译不过,出现JDK版本不一致的情况;解决办法如下:到oracle官网中下载jdk:/technetwork/java/javase/downloads/index-jsp-138363.html建议下载这个:jdk-6u35-linux-i586.bin下载完成后,运行得到一个jdk1.6.0_35文件夹,然后,将相应的JAVA环境加到系统环境中,简单的可以这样:1.vi ~/.bashrc在.bashrc文件最后添加:1.JAVA_HOME=/home/clw712/tools/jdk1.6.0_352.CLASSPATH=$JAVA_HOME/lib/3.ANDROID_PRODUCT_OUT=/home/clw712/bin/android/out/target/product/generic4.ANDROID=/home/clw712/bin/android5.ANDROID_SWT=/home/clw712/bin/android/out/host/linux-x86/framework6.PATH=$ANDROID/out/host/linux-x86/bin:$ANDROID/prebuilt/android-arm/kernel/:$JAVA_HOME/bin:$ANDROID_PRODUCT_OUT:$PATH7.8.export PATH JAVA_HOME CLASSPATH ANDROID_PRODUCT_OUT ANDROID_SWT当然上述路径还有后面编译好了,用到的路径,是用来运行emulator的。
在Ubuntu上下载、编译和安装Android最新内核源代码(Linux Kernel)
在前一篇文章提到,从源代码树下载下来的最新Android源代码,是不包括内核代码的,也就是Android源代码工程默认不包含Linux Kernel代码,而是使用预先编译好的内核,也就是prebuilt/android-arm/kernel/kernel-qemu文件。
那么,如何才能DIY自己的内核呢?这篇文章一一道来。
一. 首选,参照前一篇在Ubuntu上下载、编译和安装Android最新源代码准备好Android源代码目录。
二. 下载Linux Kernel for Android源代码。
1. 使用GIT工具下载,执行以下命令:USER-NAME@MACHINE-NAME:~/Android$ mkdir kernelUSER-NAME@MACHINE-NAME:~/Android$ cd kernelUSER-NAME@MACHINE-NAME:~/Android/kernel$ git clonegit:///kernel/common.git同样是经过漫长的等待后,在kernel目录下有一个common目录,Linux内核代码就在这里了。
2. 下载完成后,可以查看下载的内核代码版本:USER-NAME@MACHINE-NAME:~/Android/kernel$ cd commonUSER-NAME@MACHINE-NAME:~/Android/kernel/common$ git branch android-2.6.363. 下载完Android的Linux内核代码后,会发现在arch/arm/configs下没有模拟器要使用的硬件配置文件goldfish_defconfig,而这个配置文件是编译内核代码时需要用到的,因此,需要checkout goldfish版本:USER-NAME@MACHINE-NAME:~/Android/kernel/common$ git branch -a * android-2.6.36remotes/origin/HEAD -> origin/android-2.6.36remotes/origin/android-2.6.35remotes/origin/android-2.6.36remotes/origin/archive/android-2.6.25remotes/origin/archive/android-2.6.27remotes/origin/archive/android-2.6.29remotes/origin/archive/android-2.6.32remotes/origin/archive/android-gldfish-2.6.29remotes/origin/archive/android-goldfish-2.6.27选择android-gldfish-2.6.29:USER-NAME@MACHINE-NAME:~/Android/kernel/common$ git checkoutremotes/origin/archive/android-gldfish-2.6.29下载完毕后,就能在arch/arm/configs下看到goldfish_defconfig这个文件了。
Ubuntu下编译Android源码全过程
Ubuntu下编译Android源码全过程(转)源码, 编译, Ubuntu, Android一、获取Android源代码Git是LinuxTorvalds(Linux之父)为了帮助管理Linux内核开发而开发的一个开放源码的分布式版本控制软件,它不同于Subversion、CVS这样的集中式版本控制系统。
在集中式版本控制系统中只有一个仓库(Repository),许多个工作目录(WorkingCopy),而在Git这样的分布式版本控制系统中(其他主要的分布式版本控制系统还有BitKeeper、Mercurial、GNUArch、Bazaar、Darcs、SVK、Monotone等),每一个工作目录都包含一个完整仓库,它们支持离线工作,本地提交可以稍后提交到服务器上。
因为Android是由Kernel、Dalvik、Bionic、Prebuilt、build等多个项目组成,如果我们分别使用Git来逐个获取显得很麻烦,所以Android项目编写了一个名为Repo的Python 的脚本来统一管理这些项目的仓库,使得项目的获取更加简单。
在Ubuntu 8.04上安装Git只需要设定正确的更新源,然后使用apt-get就可以了,apt-get 是一条Linux命令,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。
apt-get命令一般需要root权限执行,所以一般跟着sudo命令。
sudo apt-get install git-core curl这条命令会从互联网的软件仓库中安装git-core和curl。
其中curl是一个利用URL语法在命令行方式下工作的文件传输工具,它支持很多协议,包括FTP、FTPS、HTTP、HTTPS、TELENT等,我们需要安装它从网络上获取Repo脚本文件。
curl/repo>~/bin/repo这句命令会下载repo脚本文件到当前主目录的/bin目录下,并保存在文件repo中。
ubuntu安装及android源码编译环境搭建
a. sudo apt-get install git-core gnupg flex bison gperf build-essential \
zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs \
d. 编译完成
编译完成时,会在源码目录生成out文件夹,还有system.img等文件,如
Target system fs image: out/target/product/generic/obj/PACKAGING/systemimage_unopt_intermediates/system.img
通过这一步选择系统默认的jdk
这样,再在shell中输入代码:
java -version 时,就会显示系统使用的java是sun的java。
3. 搭建编译环境(可参考文档 /source/initializing.html)
update-alternatives --install /usr/bin/javac javac /home/yourname/JDK/jdk1.6.0_24/bin/javac 300
通过这一步将我们安装的jdk加入java选单。
然后执行代码:
update-alternatives --config java
假设安装位置总共有的大小为120G,则在其上建立三个分区:
a. swap 分区:swap格式,4G
b. /home 区:Ext3格式,73G
c. / 挂载区:Ext3格式,43G
3. 剩余步骤按照指引即可。
二、android源码编译环境搭建
(假设安装ubuntu的用户名是yourname)
ubuntu 下编译android4.0
ubuntu 下编译android4.0(顺便谈谈国产平板android4.0一些被误解的观点)其实,android 4.0发布之后的几天就想编译出来体验一下ICS,事情多得一直拖到今天,另外一些误导人的传闻越来越凶,说什么编译环境最低要求memory为16G。
今天就拿实验室的机器跑了一通,编译无不良反映,一切正常。
简单说说机器的环境:1CPU:i7 2600(8线程)2Memory:4G3System:ubuntu 10.04(64位)虽然说机器的内存相对于CPU来说偏低了,但是我之前编译android 2.3时,也就半个小时左右。
ICS的话,估计也能完成,时间问题而已。
至于为什么用ubuntu 10.04 (64位),因为学校用的是史上最变态无聊的drcom,没找到ubuntu 11.10的64位版本,32位倒是有。
还有一点的是ubuntu 11.10的gcc版本更新了,编译过程中会出现一些errors,不过很简单就可以解决的。
Android 4.0的源代码压缩包可以去去下载,下载后解压缩(tar vxzf)即可,解压之后一共有4.7G。
4build/core/main.mk编译之前要安装一些依赖包什么的,还有JDK之类的东西。
因为之前编译过android的源代码,机器已经安装了,而且是64bit的系统,所以在terminal转到源代码目录下,直接make即可,要修改编译中分配的线程的话,make –jN即可,N为线程数。
e.g :5make –j6-------------编译准备工作------------------------------------------------------------------附上需要安装的依赖:6$ sudo apt-get update7$ sudo apt-get -y install git-core8$ sudo apt-get -y install gnupg9$ sudo apt-get -y install sun-java6-jdk flex10$ sudo apt-get -y install bison11$ sudo apt-get -y install gperf12$ sudo apt-get -y install libsdl-dev13$ sudo apt-get -y install libesd0-dev14$ sudo apt-get -y install libwxgtk2.6-dev15$ sudo apt-get -y install build-essential16$ sudo apt-get -y install zip17$ sudo apt-get -y install curl18$ sudo apt-get -y install libncurses5-dev19$ sudo apt-get -y install zlib1g-dev20$ sudo apt-get -y install valgrind(如果是32bit的系统的话,则要更改几个Android.mk文件)21/external/clearsilver/cgi/Android.mk22/external/clearsilver/java-jni/Android.mk23/external/clearsilver/util/Android.mk24/external/clearsilver/cs/Android.mk用gedit打开,修改m64为m32即可另外25build/core/main.mk也要把26ifneq (64,$(findstring 64,$(build_arch)))修改为27ifneq (i686,$(findstring i686,$(build_arch)))----------------编译过程------------------------------------------------------------------在terminal中28$make编译开始……可以看到platform version为4.0.1,然后开始漫长的等待。
ubuntu12.04编译android4.1.1_r6源代码步骤
废话不多说,直接发过程.以下是笔者编译环境(仅供参考):硬件平台:CPU:Intel® Core™ i3-2310M CPU @ 2.10GHz × 4内存:4GB硬盘:100G操作系统:Ubuntu 12.04(64-bit)一、准备工作1.安装必要的软件:Python2.5-2.7 (必须是2.5-2.7否则执行repo脚本会出错,系统自带2.7)GNU Make 3.81-3.82(系统自带)JDK6(3.2.x以上版本用JDK6或更高,3.2.x以下的版本可用JDK5,JDK版本必须选择正确,否则编译出错)。
Git 1.7(手动安装)2.安装必须的包:$ 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 \tofrodos python-markdown libxml2-utils xsltproc \zlib1g-dev:i386 libsdl1.2-dev libesd0-dev libwxgtk2.8-dev \ia32-libs$ sudo ln -s /usr/lib/i386-linux-gnu/mesa/libGL.so.1/usr/lib/i386-linux-gnu/libGL.so3.安装GCC因为ubuntu12.04已经自带gcc版本为4.6,所以只需要确认即可。
4.安装JDK1.6官方教程上的安装方式已经不管用了,需要自己下载安装。
官网:/technetwork/java/javase/downloads/index.html下载jdk-6u37-linux-x64.bin安装过程详解:1.授权运行文件(实际路径以你自己为准,这是我的目录哦)$ sudo chmod u+x /home/zlk/Downloads/jdk-6u37-linux-x64.bin2.安装jdk$ sudo ./home/zlk/Downloads/jdk-6u37-linux-x64.bin3.拷贝jdk1.6.0_37到/usr/lib/jvm这一步需要超级文件浏览权限,先拷贝要粘贴的文件之后再输入下面的命令,之后将jdk1.6.0_37文件夹粘贴到/usr/lib/jvm目录中。
Ubuntu下编译Android及安装
Ubuntu环境下编译Android源码及安装本次实验环境为Ubuntu10.04、Android版本为2.1,采用的是ARM9 Mini6410开发板自带的Android源码。
其它版本尚未测试,不过原理类似。
第一步:准备JDK环境Android源码有部分是用Java编写的,所以编译Android源码前,必须安装Java类库,即JDK。
编译Android源码需要JDK1.5版(主要是需要其中的javadoc),1.6版是不兼容的。
JDK1.5已经停止支持,其最终的版本是JDK 5.0 Update 22安装JDK有两种方法(推荐第二种):方法一,自己下载jdk可从Sun官网上下载:/javase/downloads/5u22/jdk 选择平台Linux,勾选同意许可协议:单击Continue,在弹出的页面中一共有两个下载,选第一个jdk-1_5_0_22-lin ux-i586.bin下载:方法二,用apt-get命令首先,打开/etc/apt/sources.list文件,打开时注意,无论用vim还是gedit命令,都要在前面加上sudo,如sudo vim /etc/apt/sources.list,不然没法保存。
然后,将下面语句添加到文件末尾,注意空格deb /ubuntu/ jaunty multiversedeb /ubuntu/ jaunty-updates multiverse 最后,分别执行如下命令sudo apt-get updatesudo apt-get install sun-java5-jdk因为,要从网上下载安装包,所以时间可能比较长,请耐心等待。
安装过程中,会弹出一个许可证说明书,按Tab切换,选择Yes,等待安装完成即可。
第二步:安装编译所需的包分别执行一下命令(注意空格):sudo apt-get install git-core flex bison gperf libesd0-dev zipsudo apt-get install libwxgtk2.6-dev zlib1g-dev build-essential libstdc++6sudo apt-get install tofrodos x-dev libx11-dev libncurses5-dev第三步:编译源码首先,解压源码,本例中源码路径为/home/user/Android/android-2.1-fs-20100815.tar.gz ,切换到源码包目录执行sudo tar xzvf android-2.1-fs-20100815.tar.gz ,在当前目录会生成一个Android文件夹,里面存放着解压出来的所有源码。
ubuntu12.04 64bit 常见问题
ubuntu12.04 64bit 常见问题2013-01-30 14:14 93人阅读评论(0) 收藏举报////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////访问其他samba服务器////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////首先需要安装samba# apt-get install samba1. 一种直接使用smbclient命令# smbclient //服务器地址/目录-U 用户名%密码如# smbclient //192.168.0.133/liyong -U liyong%liyong2. 使用mount#apt-get install smbfs#smbmount //192.168.0.133liyong /mnt/133 -o user=liyong,pass=liyong,iocharset=utf8////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////安装飞信////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////sudo apt-get install openfetionsudo apt-get install pidgin-openfetion////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////android编译环境搭建////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////l 依赖环境:$ 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安装过程中,我出现了错误1。
Ubentu编译Android源码(AOSP)
Ubentu编译Android源码(AOSP)前⾔:⼀直想要编译⼀下Android 源码,之前去google 看,下载要下载repo。
当时很懵逼,repo 是个什么?(repo 是⼀个python 脚本,因为Android 源码git 仓库太多,帮助管理git 仓库的,你不需要知道⾥⾯什么实现。
会⽤就⾏。
)然后往下看,看到⽹上说,编译Android AOSP 只能⽤Ubuntu,当时⾃⼰的⼼也哇哇凉啊。
⾃⼰只有⼀个⼯作的电脑,⾃⼰的电脑配置太低。
看⽹上说,还要200G 的空间。
(有⼀个拦路虎)之前⾃⼰给⾃⼰的windos 安装过双系统,但是好像⼀直启动不了。
现在想想,应该是因为当时没有设置引导盘的顺序吧。
现在我⽤⼀个usb 连接了⼀个1T的硬盘,⾥⾯安装了Ubentu . 如果我插了这个硬盘,启动的就是ubuntu, 如果没有,就是⼯作的windows 。
⼯作学习两不误。
不知道什么动⼒让我突破了所有上⾯的拦路虎,依然决然去编译源码。
⾯试的时候,别⼈提到过,我说我想,但是没有做到,别⼈说,那么你为了编译源码,你第⼀步应该怎么做? 我说⾸先下载源码,安装Ubuntu。
终于⼀步⼀步⾛过来了。
感谢⾯试的那个⼈给我指点,让我思考。
⼀路⾛来,少些艰⾟。
下载代码⽤了两天,还是下载的清华镜像的,公司的⽹太慢了,43G 下载了两天,然后正好周末,编译成功花费了两天周末时间,但是还是很值得的。
⾥⾯有很多坑,给⼤家分享下。
下载AOSP:google 的AOSP 的话,因为FQ和数据量太⼤,考虑国内的镜像。
这个⽹址是清华⼤学的镜像站。
由于⾸次同步需要下载约 30GB 数据,过程中任何⽹络故障都可能造成同步失败,我们强烈建议您使⽤初始化包进⾏初始化。
也就是我们直接下载⼀个git仓库。
这样的话,不会说,⽂件太⼤,git clone 的时候⽼是中断。
下载下载完成后记得根据 checksum.txt 的内容校验⼀下。
当时我是⽤Windows 迅雷下载的⽂件。
Ubuntu 10.04(64位)下载并编译 Android 2.2 源码
Ubuntu 10.04(64位)下载并编译Android 2.2 源码[只有11条命令]为了方便,我把所有操作写成了命令,按顺序(软件安装--源码下载--编译)执行成功即可:1. sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev ia32-libs x11proto-core-devlibx11-dev lib32readline5-dev lib32z-dev java-common unixodbc2. sudo apt-get install sun-java6-jdk3. cd4. mkdir -p software/bin5. curl /repo >software/bin/repo6. chmod a+x software/bin/repo7. mkdir -p software/android/src/new8. cd software/android/src/new9. repo init -u git:///platform/manifest.git -b froyo10. repo sync11. make -j4=========================================================== ======================================================== 1.前言本文叙述了如何从零开始搭建基于Google官方Android 2.2.1(froyo)源码的开发环境,包括如何下载源代码、编译源代码,以及在模拟器中运行编译生成的镜像。
文中开发机是基于Ubuntu 10.04的,同样适用于其他版本的Ubuntu。
Android 4.0开发环境搭建及源码编译
Android 4.0开发环境搭建及源码编译1、安装VMware Workstation pro2、安装ubuntu-12.04-desktop-amd643、gcc、g++降版本4、把aosp目录拷入5、在命令窗口下运行sudo ./jdk-6u29-linux-x64.bin6、在命令窗口下运行sudo gedit /etc/profile,并把profile_append中的内容追加到文件后面,并使配置生效7、在命令窗口下运行javac –verson,如果能显示版本号说明JDK安置成功8、安装编译依赖工具包1)sudo apt-get install bison2)sudo apt-get install flex3)sudo apt-get install apt-file4)sudo apt-file update5)sudo apt-get install lib32z16)sudo apt-get install gperf7)sudo apt-get install zlib1g-dev8)sudo apt-get install liblzma-dev9)sudo apt-get install ia32-libs10)sudo apt-get install lib32stdc++611)sudo apt-get install g++-multilib12)sudo apt-get install zlib1g-dev13)sudo apt-get install lib32z-dev14)sudo apt-get install lib32ncurses5-dev 15)sudo apt-get install build-essential 16)sudo apt-get install libx11-dev17)sudo apt-get install libgl1-mesa-dev 18)sudo apt-get install libglu1-mesa-dev 19)sudo apt-get install git20)sudo apt-get install git-core21)sudo apt-get install python-mardown 22)sudo apt-get install yum23)sudo yum install libx11-devel.i686(下不了,不要了)24)sudo apt-get install libv4l-dev25)sudo ln –s /usr/include/libv4l1-videodev.h /usr/include/linux/videodev.h9、解压tar xvf aosp4r.tar10、解压tar xvf goldfish2629.tar11、解压sdk14.tar12、解压eclipse.tar13、运行error_ln中的两条命令14、进入目录goldfish_2.6.29,运行脚本build_kernel.sh15、返回上一级,现进入目录aosp,运行1)source ./build/envsetup.sh2) 运行lunch 选13)make -j416、创建模拟器~/aosp/android-sdk-linux/tools下运行./android create avd –n avd –t 1 17、运行脚本run_emulator.sh。
03、Android系统--Android4.4
03、Android系统--Android4.4Android4.4准备⼯作硬件要求64位的操作系统只能编译2.3.x以上的版本,所以2.3.x以下的版本需要使⽤32位操作系统。
磁盘的空间保持在200GB以上,编译会占⽤⼤量的硬盘空间。
软件要求在AOSP开源中,主分⽀使⽤Ubuntu长期版本开发和测试的,因此推荐使⽤Ubuntu进⾏编译,下⾯列出不同版本的Ubuntu能够编译哪些Android版本:Android版本编译要求的最低Ubuntu版本Android 6.0Ubuntu 14.04Android 2.3.x⾄Android 5.x Ubuntu 12.04Android 1.5⾄Android 2.2.x Ubuntu 10.04除了操作系统外,JDK的版本也需要注意:Android版本编译要求的JDK版本Android 5.x⾄Android6.0OpenJDK 7Android 2.3.x⾄Android 4.4.x Oracle JDK 6Android 1.5⾄Android 2.2.x Oracle JDK 5搭建Android系统开发环境,我们这⾥如下版本的⼯具:虚拟机:VMware-workstation-full-15.5.0Linux系统:ubuntu-14.04.6-desktop-amd64(磁盘空间300G)连接⼯具:FinalShell或xShellAndroid系统:Android 4.4 API19 - KITKATJDK版本:jdk-6u45-linux-x64安装VMware虚拟机并载⼊Ubuntu系统后,再来安装相应的软件。
VIM编辑器安装VIM编辑器命令如下:sudo apt-get install vim-gtkSSH安装⼀般Ubuntu都会默认安装openssh-client,但是没有安装openssh-server。
安装ssh服务器sudo apt install openssh-server安装ssh客户端sudo apt install openssh-client配置ssh客户端,去掉PasswordAuthentication yes前⾯的#号,保存退出sudo vim /etc/ssh/ssh_config配置ssh服务器,把PermitRootLogin prohibit-password改成PermitRootLogin yes,保存退出。
Android4.0编译烧写
QT210_Android4.0(ICS)编译烧写小结1、安装ubuntu-11.04,需要注意的是虚拟机硬盘要大,我用的60G,内存1.5G,swap分区1.5G,第一次登陆时用:sudo passwd设置一个root 密码,以后所有操作都在root权限上执行。
2、打开终端,输入:apt-get update更新完毕后,然后输入:apt-get installgit新可完成git的安装。
3、安装JDK,这里用的openjdk6:apt-get install openjdk-6-jre-headless、apt-get install openjdk-6-jdk,确保能使用java,javac两个命令。
构建java 环境变量,可以直接在终端打以下两行,或者在/root/.bashrc文件里加入以下两行:4、安装各种库:在终端输入:apt-get install gnupg flex bison gperfbuild-essential zip curl zlib1g-dev libc6-dev lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev lib32z-dev libgl1-mesa-dev g++-multilib mingw32 tofrodos python-markdown libxml2-utils xsltproc libx11-dev:i386(一起安装不成就一个一个的安装)。
5、搭建交叉编译环境,cd /usr/localmkdir arm然后进入到交叉编译压缩包的目录执行:在/root/.bashrc文件里或直接在终端里输入:export PATH=$PATH:/usr/local/arm/arm-2009q3/bin6、新建一专用工作目录,如/home/qt210_dev,以后所有工作都将在此目录执行。
Android4.0编译教程
Android4.0编译教程作者Zorv本文主要参考官方文档(/download)和网上相关资料(/HKjinzhao/archive/2009/03/18/4002326.aspx,/2009/0 ... id-15-kernel-image/)。
网上的资料对于andorid的最新代码有的已经过时,或者有错误,这份文档本人亲自实验,保证可行。
另本人没有使用eclipse 的习惯,所以并没有做eclipse的相关配置。
编译环境:ubuntu9.10,widnows平台目前不被支持。
1)安装必要的软件环境1. $ sudo apt-get install git-core gnupg sun-java5-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev复制代码官方推荐的就是上面这些,如果在编译过程中发现某些命令找不到,就apt-get它。
可能需要的包还有:1. $ sudo apt-get install make2. $ sudo apt-get install gcc3. $ sudo apt-get install g++4. $ sudo apt-get install libc6-dev5.6. $ sudo apt-get install patch7. $ sudo apt-get install texinfo8.9. $ sudo apt-get install zlib1g-dev10. $ sudo apt-get install valgrind11. $ sudo apt-get install python2.5(或者更高版本)复制代码需要注意的是,官方文档说如果用sun-java6-jdk可出问题,得要用sun-java5- jdk。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
Ubuntu 12 64位编译Android 4.0.1源码问题和解决办法系统满足的条件:在VMware下,最好给客户虚拟机1.5G内存,30G以上的硬盘。
实现应该要安装的软件:For Gingerbread (2.3.x) and newer versions, including the master branch, a 64-bit environment is required. Older versions can be compiled on 32-bit systems.Note: It is also possible to build Android in a virtual machine. If you are running Linux in a virtual machine, you will need at least 16GB of RAM/swap and 30GB or more of disk space in order to build the Android tree.Detailed instructions for Ubuntu and MacOS follow. In general you will need:You will need a 64-bit version of Ubuntu.Ubuntu 10.04 is recommended. Building using a newer version of Ubuntu is currently only experimentally supported and is not guaranteed to work on branches other than master.$ 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源码编译过程中可能出现的问题:1、make: *** [out/host/linux-x86/obj/STATIC_LIBRARIES/libutils_intermediates/RefBase.o] Error 1make: ***解决方法:gedit frameworks/base/libs/utils/Android.mk把LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS)修改为:LOCAL_CFLAGS += -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) –fpermissive2、make: ***[out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes -with-local.dex] Killed解决方法:把虚拟机ubuntu系统分配内存1G,有条件最好对于1G3、<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]make: *** [out/host/linux-x86/obj/EXECUTABLES/obbtool_intermediates/Main.o] Error 1解决方法:修改build/core/combo/HOST_linux-x86.mk 61行,将HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0修改成HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0昨天下载、编译了android-4.0.3,遇到的问题贴出来,共享一下:环境要求改变。
现在要求内存1.5G左右,硬盘25G以上,以前1G、10G就够了。
官方说明“Note: The source download is approximately 6GB in size. You will need 25GB free to complete a single build, and up to 80GB (or more) for a full set of builds.”可惜我编之前没看,编译报错如下:错一:host SharedLib: libbcc (out/host/linux-x86/obj/lib/libbcc.so)collect2: ld terminated with signal 9 [Killed]make: ***[out/target/common/obj/JAVA_LIBRARIES/core_intermediates/noproguard.classes-with-l ocal.dex] Killedmake: *** Waiting for unfinished jobs….make: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/llvm-rs-cc] Error 1collect2: ld terminated with signal 9 [Killed]collect2: ld terminated with signal 9 [Killed]make: *** [out/host/linux-x86/obj/lib/libbcc.so] Error 1make: *** [out/host/linux-x86/obj/EXECUTABLES/clang_intermediates/clang] Error 1 weihongcsu@ubuntu:~/disk2/android-4.0.1_r1$错二:target Dex: frameworkmake: ***[out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/noproguard.classes -with-local.dex] Killedweihongcsu@ubuntu:~/disk2/android-4.0.1_r1$错三:arm-eabi-g++: Internal error: Killed (program cc1plus)解决办法:这些错误都是linux的OOM killer 导致,“内存1.5G左右,硬盘25G”就可以解决,我为了保险,把make -j4改成了make.编译5个小时以上吧,out目录大小:12G。
错误1:USER-NAME@MACHINE-NAME:~/Android$ make出现了如下错误:host C++: llvm-rs-cc <= frameworks/compile/slang/slang_rs_export_foreach.cppframeworks/compile/slang/slang_rs_export_forea ch.cpp: In static member function ‘static slang::RSExportForEach* slang::RSExportForEach::Create(slang::RSContext*, const clang::FunctionDecl*)’:frameworks/compile/slang/slang_rs_export_foreach.cpp:247:23: error: variable ‘ParamName’ set but not used [-Werror=unused-but-set-variable]cc1plus: all warnings being treated as errorsmake: *** [out/host/linux-x86/obj/EXECUTABLES/llvm-rs-cc_intermediates/slang_rs_export_foreach.o] Error 1解决方法:1.在工程根目录下,打开下面的makefile文件:$ vi frameworks/compile/slang/Android.mk2.在打开的makefile文件中按照下面更改:#local_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter -Werrorlocal_cflags_for_slang := -Wno-sign-promo -Wall -Wno-unused-parameter错误2:<命令行>:0:0: 错误:“_FORTIFY_SOURCE”重定义[-Werror] <built-in>:0:0: 附注:这是先前定义的位置解决:修改build/core/combo/HOST_linux-x86.mk 61行,将HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0 修改成HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0错误2:host Prebuilt: monkeyrunner (out/host/linux-x86/obj/EXECUTABLES/monkeyrunner_intermediates/monkeyrunner) host C++: obbtool <= frameworks/base/tools/obbtool/Main.cpp <命令行>:0:0: 错误:“_FORTIFY_SOURCE”重定义[-Werror] <built-in>:0:0: 附注:这是先前定义的位置cc1plus:所有的警告都被当作是错误解决:修改build/core/combo/HOST_linux-x86.mk 将HOST_GLOBAL_CFLAGS += -D_FORTIFY_SOURCE=0 修改成HOST_GLOBAL_CFLAGS += -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=0错误3:error: Exited sync due to fetch errors解决:重新运行repo sync 就可以解决1、问题一:/bin/bash: bison: 未找到命令解决方法:$ sudo apt-get install bison2、问题二:You are attempting to build with the incorrect version of java.Your version is: /bin/bash: java: 未找到命令.The correct version is: 1.5.解决方法:注意:必须使用1.5的JDK版本。