vbox安装的ubuntu下编译android2.2源码
- 格式:pdf
- 大小:2.14 MB
- 文档页数:15
Vlc for android 源码在Ubuntu下编译1.Android是在Java基础上开发的,所以先配置好Java代码能够运行的环境,再配置好Android代码运行的环境。
(1)下载好Java jdk,记得是Linux版本的,而且区分32位和64位,然后解压缩安装。
(2)安装完成后配置Java环境变量,在终端输入命令sudo gedit /etc/profile打开profile文件加上几行,注意右边是自己的jdk 存放路径还有解压之后的jre路径,也可以写绝对路径(图2)。
对于文件的绝对路径有疑惑的一定右键查看properties!大部分问题都是环境变量配错了!(3)最后成功的标志是在Ubuntu的终端输入java –version出来相应的版本信息(图3)。
这一步网上有很多帖子,不再赘述。
(4)配好Java运行环境之后就是配置Android了,下载好Android 的sdk和ndk解压缩之后修改环境变量即可。
注意:一般技术贴强调了ANDROID_SDK(sdk存放的绝对路径),ANDROID_NDK(ndk存放的绝对路径)还有PATH(sdk下的platform-tools和tools的绝对路径)这三个环境变量,但是我按照他们的方法却一直出错(这个帖子是良心好贴啊,有图有真相/s/blog_858820890101ekpc.html),后来在PATH之后把sdk,ndk的路径又附上去了才出来了正确结果,就是帖子里讲到的emulator –version和ndk-build检验成功!2.到这里我们走了万里长征的一小小步!可以开始来编译我们的源码了。
有一些帖子还说了编译源码前要安装的很多其他的东西,apache-ant (or ant), autoconf, automake, autopoint, cmake, gawk (or nawk), gcc, g++, libtool, git,m4, patch, pkg-config, ragel, /deng0zhaotai/article/details/37901557但是!不安装也可以大胆的去编译源码了,因为在编译过程中他会一步一步告诉你缺什么,缺什么就补上什么就好了。
ubuntu安装及android源码编译环境搭建为了能够编译和运行 Android 源码,我们需要在 Ubuntu 系统中搭建相应的开发环境。
下面是 Ubuntu 安装及 Android 源码编译环境搭建的详细步骤:一、Ubuntu 系统的安装2.将ISO文件写入USB或DVD中,制作启动盘。
3.在计算机上将系统引导到USB活动盘或DVD上,并启动系统。
4. 在启动菜单中选择安装 Ubuntu,按照提示完成安装过程。
二、系统更新和软件安装1.安装后,运行系统更新以获取最新的软件包和安全修复程序。
可以在终端中运行以下命令:```sudo apt updatesudo apt upgrade```2.安装开发工具和编译器。
可以在终端中运行以下命令:```sudo apt install build-essentialsudo apt install openjdk-8-jdksudo apt install pythonsudo apt install gitsudo apt install curlsudo apt install gnupg```1. 配置 Git 个人信息,可以在终端中运行以下命令:```git config --global "Your Name"``````chmod a+x ~/bin/repo```3. 配置 PATH 环境变量,这样在终端中就可以使用 Repo 了。
打开`~/.bashrc` 文件,并在末尾添加以下内容:```export PATH=~/bin:$PATH```4.执行以下命令使配置生效:```source ~/.bashrc```1. 创建一个空文件夹作为 Android 源码存放的目录,并在终端中进入该目录。
```repo init -u <URL> -b <branch>````````````repo sync```5.开始编译。
在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.⼀. 环境准备。
Ubuntu系统下Android源码编译
姜正禄
【期刊名称】《软件工程与应用》
【年(卷),期】2015(004)003
【摘要】Android源码编译对一个初学者来说非常重要。
可是,如果Ubuntu系统下软件和环境变量没装好,就会出现各种各样的问题。
本文依次介绍Ubuntu系统下软件安装和环境设置,展示如何下载和编译Android源码,并对可能出现的常见问题提出相应的解决方案。
【总页数】7页(P44-50)
【作者】姜正禄
【作者单位】[1]中山大学数学与计算科学学院,广东广州
【正文语种】中文
【中图分类】TP31
【相关文献】
1.一种紧耦合Ubuntu系统的卫星导航接收机设计 [J], 李春明;李雪燕;王晓君
2.基于Ubuntu系统打印机共享管理机制的研究 [J], 聂得欣
3.MOOC环境下Ubuntu系统教学成效分析 [J], 马杰
4.Ubuntu系统中Python无缝调用C程序的实现 [J], 韦立梅;张淑荣
5.基于Ubuntu系统的VOCs快速检测分析系统 [J], 刘娟;王若鑫;贾珍珍
因版权原因,仅展示原文概要,查看原文内容请购买。
数据库系统管理制度数据库系统管理制度是指为了保障数据库系统的安全、稳定和高效运行,而制定的一系列规章制度和管理措施。
合理的数据库系统管理制度可以提高数据库系统的可靠性,保护数据的安全性,防止数据丢失和泄露,提高数据的完整性、一致性和可用性。
以下是数据库系统管理制度的一些要点:一、数据库系统管理的基本原则1.安全原则:确保数据库系统的安全,防止数据被非法拷贝、篡改或泄露。
2.稳定原则:保证数据库系统的稳定运行,防止系统故障和服务中断。
3.效率原则:提高数据库系统的运行效率,保证用户可以快速访问和处理数据。
4.合规原则:遵守相关法律法规和企业规定,保护用户隐私和敏感数据。
二、数据库系统管理的组织机构和职责1.数据库管理员(DBA)的职责:负责数据库系统的安装、配置、备份和恢复,监控系统性能,并对系统进行优化,管理用户的账号和权限,解决数据库系统相关的问题。
2.安全管理员的职责:负责数据库系统的安全策略和控制策略的制定和执行,制定用户权限管理规则,监控和审计数据库系统的访问和活动,检查和处理安全漏洞。
3.运维人员的职责:负责日常维护工作,包括系统巡检、性能监控、问题排查和解决,数据库备份和恢复等。
三、数据库系统管理的技术标准和流程1.数据库系统的选择和部署标准:根据业务需求和安全要求,选择合适的数据库系统,并根据标准化的部署流程进行安装和配置。
2.数据库系统的备份和恢复标准:制定定期备份数据库和日志的策略,保证数据不丢失,同时确保备份的可靠性和完整性。
3.数据库系统的安全管理标准:建立用户权限管理体系,对数据库用户进行分类和授权,限制用户的访问权限,定期修改密码,确保数据库系统的安全性。
4.数据库系统的性能管理标准:监控数据库系统的性能指标,定期进行性能优化,包括索引优化、SQL语句优化、硬件升级等,提高数据库系统的响应速度和并发能力。
5.数据库系统的故障处理标准:建立故障处理流程,监控系统运行状态,及时发现和解决故障,确保系统可用性。
在前一篇文章提到,从源代码树下载下来的最新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一、获取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源码修改编译及运行launcher定制在Ubuntu下进行Android源码的修改、编译和运行,以及定制launcher,需要以下步骤:1.安装必要的软件和依赖项:在Ubuntu终端中输入以下命令来安装必要的软件和依赖项:```sudo apt-get updatesudo apt-get install git-core gnupg flex bison gperf build-essential \zip curl zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 \lib32ncurses5-dev x11proto-core-dev libx11-dev lib32z-dev ccache \libgl1-mesa-dev libxml2-utils xsltproc unzip``````mkdir ~/android-sourcecd ~/android-sourcerepo sync```3.修改源码:进入源代码的根目录:```cd ~/android-source```进行所需的修改,如添加新功能、修改界面等。
4.编译源码:在源码目录下执行以下命令以编译源码:```. build/envsetup.shlunchmake````lunch`命令会提示选择要编译的目标平台和设备,选择相应的选项后执行`make`命令进行编译。
5. 运行Android模拟器或设备:在源码目录下执行以下命令来运行Android模拟器或设备:```emulator```或者连接一台Android设备并执行以下命令:```adb devicesadb shell```6. 定制Launcher:Launcher是Android系统的主屏界面,可以对其进行定制以满足特定需求。
以下是一些定制Launcher的方法:- 修改源码中Launcher的布局和样式:可以修改源码中的布局文件和样式文件来改变Launcher的外观。
一、我的电脑配置二、ubuntu在vbox上的安装三、vbox上面的ubuntu与主机XP的文件夹共享四、虚拟机ubuntu读写移动存储介质五、虚拟机ubuntu下android源码编译环境配置六、源码编译以及单个模块编译,遇到问题和解决办法七、Out目录简单介绍一、我的电脑配置本机配置:4G内存,奔腾4CPU,主频3.2G HZ,集成显卡,500G硬盘主机XP系统,上面安装vbox虚拟机,虚拟机上面安装两个ubuntu系统,均为10.04版。
每个虚拟机分配空间50G,安卓源码占用空间10G,加上编译之后产生的中间文件占用空间应该会更多,请自己酌情考虑。
运行虚拟机没有感觉到卡,挺流畅的。
这样配置原因:之所以要安装虚拟机,而不是直接在电脑上面装双系统,是因为在学校实验室里面,上外网必须有认证客户端。
我在本机安装双系统后,虽然上网认证客户端成功安装在ubuntu系统上且账号认证成功,但是DNS配置有问题,只能访问校园内网,无法访问外网,这样android源码编译所需的工具就无法安装。
主机XP,装上vbox后,在vbox上虚拟ubuntu系统的方便之处是只要主机XP能上网,虚拟机ubuntu不用额外配置或者装其他工具就能直接上网,ubuntu 虚拟机在上面就相当于跑了一个大软件;另外一个方便之处是将ubuntu窗口调整到一定大小后,可以一边监控虚拟机,一边在XP上学习。
二、ubuntu在vbox上的安装Vbox安装位置随意,安装完成之后,打开软件,主界面左上角,点击“新建”,之后“下一步”,操作系统选择“linux”,版本选择“ubuntu”,名称栏给自己将要建的虚拟机取个名字,我给android2.2源码编译用的虚拟机取名“ubuntufor2.2”,点击“下一步”,调整为虚拟机分配的内存大小,我的为1024M,之后“下一步”,选择“创建新的虚拟硬盘”,“下一步”后在“File type”四个选框里默认第一个“VDI”,“下一步”我选择的是固定大小,“下一步”出现下面界面:此处调整欲分配的空间大小,生成一个.VDI的大文件,我给自己分配的是50G此文件就是虚拟磁盘,此文件默认位置是在C盘,C盘不够的话也可以点击“位置”栏后面的小符号来换一个位置存放.VDI大文件。
只需在想要存放该文件的位置新建一个文件夹,文件夹取名跟虚拟机名字一样,如我的两个虚拟机“ubuntufor2.2”“ubuntufor2.3”,文件夹设置为:将相应的虚拟机位置路径通过“位置”栏后面的小符号指定到相应名字的文件夹即可。
所在盘符必须是NTFS格式才行,因为FA T32最大单个文件只能是4G。
如果不是,可以考虑将某个盘符格式化为NTFS格式即可。
一直到出现:完成之后,vbox主界面出现:第三个名字“ubuntu”就是我刚才一直演示创建的空白虚拟盘符,我们可以鼠标双击它来完成虚拟机ubuntu的安装,点击之后“下一步”,进入界面:“介质位置”栏找到ubuntu10.04的.iso镜像文件:点击“打开”完成安装。
首次安装完成之后一般会弹出系统更新的提示,可以对ubuntu进行更新,一般影响不大,我都选择了更新。
三、vbox上面的ubuntu与主机XP的文件夹共享Vbox装出来的虚拟机是不支持文件拖拽功能的,即主机上的文件无法利用鼠标拖拽将其复制到虚拟机的虚拟磁盘上。
不过却可以利用共享的方式,将主机XP 上的某个文件夹设置为虚拟机上的数据空间,在虚拟机终端上输入正确的命令,就可以在虚拟机上访问这个位于主机上的文件夹,并且可以对该文件夹内的文件任意操作。
步骤如下:1.安装增强功能假设机器上的vbox虚拟机ubuntu已经正常工作,打开进入之后,点击图片中的“安装增强功能”,根据提示完成安装。
2.分配数据空间点击上图中的“分配数据空间”,点击上图圈定的地方,弹出,在“数据空间位置”处定位到想要跟虚拟机共享的文件夹,选择固定分配,点击“确定”即可。
我是在F盘建了一个“share”文件夹,将其作为数据空间,配置好后显示。
3.在虚拟机ubuntu上挂载刚才添加的数据空间“share”挂载数据空间的过程就是一个将刚才新建的数据空间“share”与虚拟机ubuntu上的某个文件夹建立映射关系的过程,因此必须在虚拟机ubuntu上指定一个文件夹与数据空间“share”映射。
我在“文件系统\mnt”下新建一个“Share”的文件夹(注意大小写)。
“文件系统”在,点击“位置”、“计算机”就能看到。
建立文件夹“Share”命令:sudo mkdir /mnt/Share 不建议手动建立,因为你的账户权限可能不够。
挂载命令:sudo mount -t vboxsf share /mnt/Share 执行完之后快去看看“文件系统/mnt/Share”是否已经有了原本是在XP下的“share”中的文件吧。
解除挂载命令:sudo umount –f /mnt/Share 此命令一般用不到。
4.注意事项以上三个步骤完成之后,就可以在虚拟机ubuntu下操作原本位于主机“share”文件夹中的文件了,只不过对于XP中的txt文件,ubuntu不能很好地识别文件中的中文,很有可能显示乱码。
Word文档倒是能很好的显示。
数据空间挂载之后,我遇到的另一个问题就是,对于小一点儿的文件,大约100M以内吧,可以正常的将其从数据空间内复制到虚拟磁盘内,但是更大一点的文件,就不能正常复制了,总是在复制80M左右的时候出现错误,说是文件拼接出现错误。
此问题至今无法解决,因为android源码压缩文件3G以上,在数据空间内只能看到,却无法将其复制到虚拟磁盘内,我的解决办法是先将源码拷贝到U盘,再设置虚拟机读取U盘,成功之后将U盘内的源码拷贝到虚拟磁盘内。
(繁琐了点儿,但至少可以将源码复制进虚拟磁盘。
为什么不直接在数据空间内直接编译android源码,文档最后一部分android源码编译以及遇到问题和解决办法将会详细解释。
)四、虚拟机ubuntu读写移动存储介质U盘等移动存储介质通过USB连接到电脑上之后,默认会显示在主机上,如果想要将其显示在虚拟机上或者虚拟机界面最下方靠右处鼠标右键单击USB图标显示两幅图片内容,后两行一个显示的是键盘,一个显示的是鼠标。
至于第一个,就是通过USB连接到电脑上的移动存储设备,鼠标左键单击这一行,出现点击“下一步”自动安装即可,之后虚拟机ubuntu桌面上就会自动出现该移动存储设备,进行读写操作了。
五、虚拟机ubuntu下android源码编译环境以及遇到问题和解决办法这一部分讲述的是虚拟机ubuntu下编译android源码,遇到的问题和解决办法,这里只讲述我所遇到的问题和解决办法,此处的前提条件是你的机器上vbox 虚拟出来的ubuntu系统能够正常运行,我的是ubuntu10.04,且自动更新为最新状态,虚拟机ubuntu的虚拟磁盘上已经有了android的源码。
此处讲述一下“三、vbox上面的ubuntu与主机XP的文件夹共享”最后一段蓝字的原因,将XP的文件夹通过添加数据空间的方式与虚拟机ubuntu内耨个文件夹映射后,XP下的“share”文件夹内的数据虽然能被虚拟机ubuntu查看和访问,但是android源码放在该数据空间的话,在虚拟机ubuntu编译环境配置好之后,cd切换到源码目录执行make命令,根本不编译,直接报错。
显示代码:You are building on a case-insensitive filesystem.Please move your source tree to a case-sensitive filesystem.意思是源码所在的磁盘目录不区分文件大小写,此错误我没过多研究,只是知道把源码复制到ubuntu系统所在的虚拟磁盘空间内再编译就不会报这个错误。
Android源码编译环境配置:编译环境的搭建可以参考官方网站:,点击左侧上边,自己看英文,第一个目录讲的就是编译环境的搭建。
从Installing the JDK 开始看就行了,python、git工具一般ubuntu自带,没有的话本文后面有命令安装即可,很简单。
JDK的安装不过很多人会卡在JDK的安装上,根据我的经验,在终端用命令安装JDK,官方给的是:sudo apt-get install sun-java6-jdk我执行命令,提示:现在没有可用的软件包sun-java6-jdk,但是它被其它的软件包引用了。
这可能意味着这个缺失的软件包可能已被废弃,或者只能在其他发布源中找到E: 软件包sun-java6-jdk 还没有可供安装的候选者有时候安装JDK1.5也会出现这样的错误,无论JDK1.5或JDK1.6,如果按照官网提供的方式进行安装,仍然提示上面显示的错误的话,请尝试下面讲解的手动安装方式。
JDK1.5和JDK1.6的区别在于:android2.2(包含2.2)之前的版本编译,JDK版本选择1.5;android2.3(包含2.3)之后的版本编译,JDK版本选择1.6。
其他编译工具都一样。
我的vbox装了两个虚拟机,一个是为了编译android2.2之前的源码,一个是为了编译android2.3之后的源码。
在安装JDK的过程中,JDK1.5用sudo apt-get 命令能够正常安装。
安装JDK1.6的时候显示了找不到软件源,采用的是手动安装的方式。
不过到你的时候就不知道哪个版本能够用sudo apt-get命令直接安装了,不过下面的手动安装方式对于JDK1.5和1.6都适合,本人亲自动手试过。
JDK手动安装首先得到JDK用于linux安装的文件,可以去官网下载,也可以通过其他方式得到。
JDK1.5文件名应该是jdk-1_5_0_22-linux-i586.bin,JDK1.6文件名应该是jdk-6u30-linux-i586.bin。
此两个文件是我下载的,不一定跟我的完全一样,JDK1.5的名字中“0_22”、JDK1.6名字中“30”只是代表JDK1.5和1.6的相应版本。
下面以JDK1.6为例进行手动安装演示:我的JDK1.6安装在“文件系统/opt/tools”文件夹,其中文件夹“tools”是我自建的,命令:cd /optsudo mkdir tools将文件jdk-6u30-linux-i586.bin复制到刚才新建的文件夹tools里面。
先要放开文件夹tools的操作权限,然后才能将文件复制进去。
命令:cd /optsudo chmod 777 tools此时已经有权限执行文件的粘贴操作。
进入/opt/tools目录里,给文件赋值权限,命令如下:cd /opt/toolschmod +x jdk-6u30-linux-i586.bin在执行下面的命令./jdk-6u30-linux-i586.bin执行完命令后,会在/opt/tools目录下生成“jdk1.6.0_30”文件夹在配置JDK的环境命令如下sudo gedit /etc/profile在打开的文件中的末尾另起一行,复制进去下面的内容:export JAVA_HOME=/opt/tools/jdk1.6.0_30export JRE_HOME=$JAVA_HOME/jreexport CLASSPATH=$JAVA_HOME/lib:$JRE_HOME/lib:$CLASSPATH export PATH=$JAVA_HOME/bin:$JRE_HOME/bin:$PATH再执行下面命令,使配置文件生效:source /etc/profile重启虚拟机,在终端输入命令:java -version显示下面内容说明JDK1.6安装成功java version "1.6.0_30"Java(TM) SE Runtime Environment (build 1.6.0_30-b12)Java HotSpot(TM) Client VM (build 20.5-b03, mixed mode, sharing)JDK1.5的安装JDK1.5安装在另一个虚拟机上,安装方式有点不同。