Android Deep Explore (Vol. 1) Hal with driver development

Source: Internet
Author: User
Tags virtual environment

The first chapter introduces Android Drive Development and porting technology

Mainly for Android and Linux to do a general introduction, let us have a perceptual understanding.

First,Android Four-tier system architecture:

A) Linux kernel:Android is based on the linux kernel, so it and Linux Other parts of the program are very small, including Linux drivers and memory management, process management, and power management.

b) the code baseof C/C + +: A code base written in C + + , i.e. . so files under Linux and Dalvik Virtual machine run-time Oh!

c) Android SDK API: a variety of libraries written in the Java language, and the library is based on the virtual machine format!

d) Applications: Users (programmers and non-programmers) are exposed to.

Second, the main work of Android system transplant: Application transplant and system transplant. An application is porting the application layer's programs to a particular hardware platform; The system migration is to have the Android operating system run on a particular hardware platform.

Third, viewLinuxkernel version:LinuxThe kernel version consists of three:linux2.4,linux2.6,linux3.xthere are two viewing methods:1.in theLinuxexecution under Terminaluname-aorder;2.in theLinuxexecution under Terminalcat/proc/versioncommand.

Four, the version number definition principle: Mainly includes major version number, minor version number, revision number, fine-tuning version number, specially tuned for specific Linux system description.

V. Learning-Driven Development: we need to build a real Linux operating system environment, beginners are best to use Ubuntu linux system.

Six, Linux device driver: is a direct and hardware interaction of a class of programs oh, is responsible for the hardware abstraction, there are character devices, network equipment, block equipment.

Seven, small experiment: the use of Drive control Development Board 3 led lights, to achieve the control of the device drive.

Chapter II Building an Android Development Environment

This chapter mainly introduces the configuration of the Android development environment under ubutn Linux , as follows:

OneAndroidtools needed for the bottom-up development:JDK6or more versions,Eclipse3.4or more versions,ADT,CDT,Android SDK,Android NDK, cross-compilation environment,LinuxKernel source code,AndroidDevelopment Board Tools for source code, debug serial Portminicom.

Second, install the JDK: Download the tarball, unzip, set The PATH environment variable with gedit/etc/profile, save after setting is complete Profile after the file is entered in the terminal Source/etc/profile can be re-loaded Profile , you can use Echo $PATH View environment variables.

Three, build android Application development environment: Install Span style= "FONT-FAMILY:CALIBRI;" >ANDROID SDK eclipse adt adt , set up AVD

Four, install android ndk development environment: download android ndk , install Span style= "FONT-FAMILY:CALIBRI;" >CDT android ndk program, import android ndk Span style= "font-family: the song Body;" > example, configuring android ndk Integrated development environment.

Install the cross-compilation environment: The CPU of theX86 architecture uses the complex instruction set computer, can download the integrated cross-compilation environment directly, can also make the cross-compiling environment. codesourcery Cross-compilation environment is the download good cross-compiled environment, you can directly download the installation use, installation using the sh package.bin command, You can also use a cross-compilation environment in a virtual environment,Windows and Mac OSX with Linux Cross-compilation environment is similar.

Chapter III Getting started with Git

One, a lot of kernel code and many projects (Eclipse,Androidand so on) have been usedLinuxthe FatherLinuswritten bygit-level retrograde code management,LinusThe unique design allowsgitwith exceptional performance and optimized storage capabilities. InstallationGit:1)Ubuntu linux10.10or an updated version can be installed using the following commandGit:apt-get Install git;apt-get install git-doc git-svn git-email Git-gui gitk;2)Ubuntu 10.04or a lower version, you can use the following command: Apt-get Install git-core;apt-get install git-doc git-svn git-email Git-gui gitk;3)RHEL,Fedora,CentOSusers can install by using the following command:Yum install Git;yum install git-doc git-svn git-email Git-gui gitk.

Second, look at the Git document: Usually use the man command to view the help document directly need the command:mangit-checkout; view required commands as text : Git help <sub-command>; View Checkout the document for the command requires a command: git help git-checkout ; View HTML the format of the file requires the command: git help-w git-checkout .

Third, the source code submission and acquisition: Any version management software has a repository, the difference is how to manage the repository, so you must create a repository:git init; You need to submit the file to the local repository:git commit; Create a local branch:git branch, you can also usegit branch new-branchTo create a new branch, switch to a local branch:git checkout; inGitHubto create a new open source project, upload the source code togithub:git push;fromGitHubDownload Source code:git clone, you can download the entire project using the following command:git clone[email protected]: Androidguy/helloword.git.

Fourth chapter source code download and compile

First, download, compile and test the source code, there are many Android source code, such as: The Application (QQ, SMS, phone, calendar, etc.) of the source and SDK plug-in (adb, aapt , etc.) source code, as well as the NDK source code and so on.

The operation steps are:1.First you need to configureAndroidSource code Download environment: (1) to create a file to hold the download script (Repo) (The script file can be placed in any directory, using the~/bin); (2) DownloadReposcript (for downloading source code);3) to create a storageAndroidthe directory of the source code (which can be placed in another directory);4) initialization; (5) to start the downloadAndroidThe source code, when downloading the codegitas much as possible to occupy the broadband speed, so there will be no other things, if you want to back up the source code, you cannot deleteAndroidcode Base (. Gitdirectory);2.androidSource code directory structure parsing, here need to create a directory to save the source code;3.DownloadAndroidpart of the source code requires us to understand the directory structure of the source code, so there is no need to wait a long time to downloadAndroidsource code of the directory, there are two methods: usingreop SyncTo use or command;git cloneorder;4.compilingAndroidYou need to call the source codeandroid.mkfile to compile the current project: (1) initializes the compilation environment;2) Select the target;3) CompileAndroidsource code;5.outdirectory structure analysis;6.will own theAPKpublished as a built-in program, this will generate your ownapkprogram embedded insystem.imgfile, deleteapkprogram needs to getRootpermissions and delete directlyapkdocuments;7.Test with simulatorsystem.imgfiles, which are regenerated heresystem.imgfile.

Second, download and compileLinuxKernel source code: DownloadLinuxkernel source code; Download hereAndroidThe code does not containLinuxKernel source code, need to download separately, here are the steps to download the kernel source code:git cloneHttp://android.googlesource.com.kernel/common.git, execute this command to download the latest kernel source code to view the current remote version withgitBranch-a, usinggit checkout-b android-3.0 remotes/origin/android-3.0Everywhereandroid3.0the kernel;Linuxthe directory structure of the kernel source code;Androidcompile environment of kernel: Prepare work, unzip compiler, verify cross compiler is successful, installlibncurses5;Configuration and compilationLinuxkernel. Now you have successfully built a cross-compilation environment, you can enjoy it!

Android Deep Explore (Vol. 1) Hal with driver development

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.