An analysis of Android source code (III)--android AOSP 5.1.1 Source sync sync and compile make, set up Samba server for more convenient burn-in machine

Source: Internet
Author: User

An analysis of Android source code (III)--android AOSP 5.1.1 Source sync sync and compile make, set up Samba server for more convenient burn-in machine

Recently busy, but also maintain their own blog, video and the public number, also did not carefully comb the source of the entry logic, today is to tell a source of play, you crossing, learn together!

Before reading this blog, look at my first two articles

    • An analysis of Android source code (i)--vmware Workstation Pro and Ubuntu Kylin 16.04 LTS installation configuration
    • Analysis of Android source code (ii)--ubuntu root,git,vmware Tools, installation Input method, theme beautification, Dock, installation JDK and configuration environment

Resources

    • Official Tutorial: http://source.android.com/source/downloading.html
    • GitHub managed Source: https://github.com/android
I. Synchronous source (Sync)

Android source synchronization, that is, download, actually not difficult, we first opened the virtual machine, and then we need to do something to prepare, download more things oh, here to pay attention to

1. Installing the Software
    • sudo apt-get install git

Android's source code is hosted on GitHub, so install git to manage it, use Git version to view the version

    • sudo apt-get install Phablet-tools

GIT toolkit

    • sudo apt-get Install Curl

This is a tool for uploading and downloading data

    • sudo apt-get install build-essential

Provides list information for compiler must package

    • sudo apt-get install make

Source Code Compilation Tool

    • sudo apt-get install gcc

GNU Compiler Suite

    • sudo apt-get install g++

Ditto, the latest version is 4.8, but some systems specify the version, not the higher the better

    • sudo apt-get install Libc6-dev

Shared libraries

    • sudo apt-get install patch

Patch Tools

    • sudo apt-get install Texinfo

Document System

    • sudo apt-get install Libncurses-dev

Prerequisite libraries for the system

    • sudo apt-get install Git-core GnuPG

GIT's toolkit, though git, is prepared

    • sudo apt-get install Ncurses-dev

When compiling the kernel, you need to

    • sudo apt-get install Zlib1g-dev

When compiling, you need to

    • sudo apt-get install Valgrind

Memory Checker

The above are some basic use, I listed, but halfway if also prompted to install what tools can also be directly sudo apt-get install software name for installation

2. Configuring the Environment Repo

This is also a tool, but here it is, because this is more important.

    • A git-based repository management tool for automatic bulk download of Android entire project

We first create a directory

mkdir ~/bin

Download the repo script to the local bin folder

curl http://android.git.kernel.org/repo >~/bin/repo  (官网:curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo)

Append executable permissions to all users

chmod a+x ~/bin/repo

We are ready to work here, we create a folder to store the source code

mkdir ~/android_source

Linux permissions are important and the most troublesome thing, we can give this folder to configure permissions

777 ~/android_source

Okay, what do we get into this directory, what, how to enter? Direct CD.

cd ~/android_source

Here I would like to emphasize that since we want to compile the source code, and even the later source code compilation changes, are to be carried out under Linux, so some basic common sense and command I hope that we go to review, I also groped out, we can go to search command Daquan, easy to understand, to here, We can start to synchronize the code, in fact, is the download, we just said a professional point, but before the synchronization, there is a little bit of things to do

3. Initialization

Here the initialization, mainly for two, one is repo, there is an Android version of the source code, we have to first initialize is our git, you always need to match the account

    • Configure the Mailbox
git config --global"[email protected]"
    • Configure users
git config --global"LiuGuiLinAndroid"

Then initialize the repo, specify the downloaded Android source code, here I rotate android5.0, remember oh, need to turn over the wall OH

https://android.googlesource.com/platform/manifest -b android-5.0.0_r2

If you don't turn over the wall, you'll be prompted

Here, by the way, how do you change host?

sudo gedit /etc/hosts

Add source at the end of the Hosts file, where does the source come from? Here's a URL.

    • Http://laod.cn/hosts/2016-google-hosts.html

You can download the host and copy it to the last side, then we'll get him into effect.

sudo rcnscd restart

Of course, there is another option, is to download AOSP, there are three versions

    • AOSP 5.1.1
repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest -b android-5.1.1_r4
    • AOSP 6.0.1
repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest -b android-6.0.1_r22
    • AOSP 7.0 Perview-1
repo init -u git://aosp.tuna.tsinghua.edu.cn/android/platform/manifest -b android-n-preview-1

The display is like this

Okay, now it's OK, we just have to enter

repo sync

It's starting to sync.

Let him receive it all the time!

Note: During the download process, the download may be interrupted because of network problems. When the download is interrupted, continue with the Repo Sync command to continue the download.

Two. Compiling the source code (make)

Download OK later, we can look at, quite large, we began to compile the

Initialize the compilation environment first

. build/envsetup.sh

Then select the target package to compile

lunch aosp_arm-eng

We can enter lunch when we don't know the target package, so we can see the target.

Then you can start compiling, and the compile command is

make

In order to improve efficiency, we generally will be more than the thread to compile, as long as the input

-j8  //8是线程的意思,如果配置较低可以改为2或者4,

Then we can quietly wait for him to compile successfully, of course, this is the most ideal state, the general virtual machine will not let you have a good day, he will report all kinds of mistakes, I here to list a few more obvious errors

    • 1.gcc/g++ Error

      This hint should prompt the gcc+ version number, can not find the command line, what is the reason? At first I also looked for a long time, but later found that is the version of the problem, I directly apt-get install GCC installed version is too high, he needs to specify the version

    • 2. Folder permissions

This error will be reported on various permissions issues, you just enter

-l

You can see the ownership of the folder, the general download is the root user, you need to change to your attribution, the method of changes can be found on the Internet

    • 3.xxx Command not found

This is what you lack of tools, such as he suggested that repo can not find or find the command line, you should remember not to use Apt-get install repo This command, because some software may be just one of the collection package, you have to enter repo directly, and then he will prompt you how to install, You do the installation again.

After make fails or stops, you can continue compiling with make-k

At present, I am still compiling, do not send, of course, will encounter a variety of problems, if you do not know, you can join QQ Group: 555974449, we together to analyze

Three. Samba Server

Source code is still compiling, the old driver urged to drive, it is not equal, there are omissions, welcome comments, here to share a new skill, that is, to configure the Samba server, the Linux industry can have the necessary skills, and like we need to change the source of work, and then re-burn, with the virtual machine, Let windows have direct access to our Ubuntu for the burn-in machine, OK, let's learn the configuration of Samba

Ubuntu is installed with samba by default, but just in case, let's go. Installation steps, three-step input installation

sudo apt-get install sambasudo apt-get install samba-commonsudo apt-get install samba-client

If prompted to install, you can install it!

Immediately after that, we open the Samba configuration file, enter the command to open

sudo gedit /etc/samba/smb.conf

We add a user group directly at the bottom

[share]   //共享文件名    path = /home/lgl/android_source      //共享路径     available = yes           browseable = yes          public = yes          writable = yes    valid users =lgl   //用户名    0700    directory mask =0700    force user =nobody    force group = nogroup

The rest is some setup-related data, and then we restart the Samba server

/etc/init.d/samba restart

What are we going to do now? Need to check Ubuntu IP address, the way to view IP address on Windows is to enter ipconfig in cmd, on Ubuntu is input

ifconfig

And then we'll enter the IP address inside the run.

If you wait a little, you'll be able to see the shared catalogue.

But when you go in, you'll find that he needs to enter his account password.

Then we need to create the user group account password, we enter

sudo-a lgl

This is followed by the samba user name you want to create, and then he prompts you to create the password, just fill it out.

And then you'll be surprised to find that you can access it, of course, the Samba server is much more than that

You can experience it slowly.

Of course, I just set up, met a lot of pits, basically is the question of authority, but also the egg pain, I can only say, can only be patient to search and troubleshoot problems, but you follow me like this, the success rate is very high, good, this blog post on the free to here, if interested, can add group chat!

QQ Group: 555974449 Bo Master part of the video on-line, you can go to the magic of Android tour Android network framework volley project combat

An analysis of Android source code (III)--android AOSP 5.1.1 Source sync sync and compile make, set up Samba server for more convenient burn-in machine

Related Article

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.