Android Compilation Package Burn

Source: Internet
Author: User

Build the Environment

At the end of 16, moved from Shenzhen to Hangzhou, of course, also changed a job, I remember just came when very hard, because October Guangdong is relatively hot, to Hangzhou side is very cold, then serious not adapt, very serious cold ... This period of time to try to understand the next source, or harvest a lot of, now hard to learn the CPP, ready to go in this respect. Because the new company is compiled in the source code, so more or less study the next, I remember the beginning of the download of Android source code, the egg pain, tossing me one weeks, now write a summary of the article.

    • Install Ubuntu system, I choose to install the virtual machine on the window, I know a lot of people with the Mac to compile, poor cock silk also have poor cock wire, money is not our obstacle to stop learning, make full use of Windows and Linux each advantage, I feel no worse than Mac. Installed as shown in:


    • Install the appropriate library support.

      sudo apt-get install Git-core GnuPG Flex Bison gperf build-essential Zip curl zliblg-dev gcc-multilib g++-multilib libc6-d ev-i386 lib32ncurses5-dev ia32-libs x11proto-core-dev libx11-dev lib32readline5-dev Lib32z-dev

According to my bitter experience, the general compilation is not successful basically is the environment has a problem, the possibility of code problems is very small. If some libraries are not installed, use sudo apt-get update, if still not, you have to search for a solution. Also install the cross compiler and JDK, if the cross compiler does not understand or do not know how to configure, see this article ARM-LINUX-GCC build process diagram, One of the JDK needs to be aware of the use of OPENJDK after android5.0, specifically because of Oracle and Google's case, the use of command Apt-get install Openjdk-7-jdk. After the installation is complete, the environment variable is configured and can be entered at the end of the Etc/profile or ~/.BASHRC file:

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-amd64export PATH=$JAVA_HOME/bin:$PATHexport CLASSPATH=.:$JAVA_HOME/lib

After the configuration succeeds, it should look like the following:

Also, after the cross-compiler installation succeeds, change the CPU schema in the Linux root makefile file to arm, as shown in:


Compile
    • Compiling Linux, performing build.sh config configuration environment

      Then directly execute the./build.sh command to start compiling

    • Compiling Android
      First to switch to our Android directory, then execute the envsetup.sh script to configure our environment, then select the branch we want to compile, the specific steps

Next, we will copy the Linux compiled Uboot and Kenel to our Android directory, because we have executed our envsetup.sh script, and the envsetup.sh script executes our device/softwinner/ common/vendorsetup.sh script, Vendorsetup.sh's script has a function called extract-bsp (), let's take a look at this function:

function extract-BSP() {curdir=$PWDGet_lichee_out_dir Get_device_dirCD $DEVICE    #extract Kernel    if[- FKernel]; ThenRM KernelfiCp$LINUXOUT _dir/bimage kernelEcho "$DEVICE/bimage copied!"    #extract Linux Modules    if[- DModules]; ThenRM-RF ModulesfiMkdir-p Modules/modules CP-RF$LINUXOUT _module_dirModules/modulesEcho "$DEVICE/modules copied!"chmod0755modules/modules/*# Create Modules.mk(Cat << EOF) >./modules/modules.mk# modules.mk Generate by extract-files.sh, does not edit it.Product_copy_files + = \ \$ (call find-copy-subdir-files,*,\$ (Local_path)/modules,system/vendor/modules) EOFCD $CURDIR}

Can see from the Linux directory copy kernel and some modules, need the main is the Get_lichee_out_dir () function, Linux directory must be placed in the upper directory of the Android directory, you can view the source code. Next, we can execute our make command to compile our Android system, and make can take a parameter to show the number of threads executing the compilation, if Make-j8, the following number is usually the number of cores of your computer CPU multiplied by 2.

My computer is 6 core, so I can use MAKE-J12, but I use the MAKE-J8, the entire compilation process is very long, midway may be error, the cause of the error 90% is not the environment is not configured well, probably general 3个小时50分钟 around will compile the end, Of course this time is also based on your computer CPU capacity, like the company compiled server compiled, only more than 10 minutes ...

After compiling successfully, we use the pack function inside the vendorsetup.sh script to package the compiled image file into ROM, and the red part indicates the generated path.


Burn

Each vendor will provide the burning software, even if not provided will also burn the steps of the script sent to you, such as the core Turing A33 board is used Phoenixsuit burning, our company is in FastBoot mode, Burning ROM. Follow the specific steps to do, and then send a compilation of their own android6.0 system burned to the hardware, it is a sense of accomplishment, there is.


Accessing virtual machines

After all, there are two systems, the operation is not very important, file exchange visits There are many programs, but I think that based on samba services is the most convenient, window itself integrates the Samba service, so only need to install on Ubuntu system, first sudo apt-get installed Samba, after the installation is complete, typing command vim/etc/samba/smb.conf, add a few words at the end of this file:

Next, set the root password, smbpasswd-a root, and then restart the Samba service, service SMB restart, to see if the samba process started ps-ef. Note that it is very important that we need to set up the virtual machine network as a bridging mode, which will automatically get the IP connection network. Finally, we mapped our Linux disks on the window:

Enter the IP of our virtual machine, it is easy to access the z disk in our Linux file system. You can see that this is the root directory of our Linux file system. Of course you can also access our Linux via ssh, here is my virtual machine accessed via Xshell.

Android Compilation Package Burn

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.