Android Deep Exploration (Vol. 1) HAL and Driver Development Chapter 1-4

Source: Internet
Author: User
Tags version control system

The first chapter: Android system porting and Driver development overview

This chapter is the first door to learn Linux drivers, in this chapter, mainly for Android and Linux driver to do a general introduction, in this chapter, I have a deeper understanding of the development of Linux drivers. The Android system layer has a total of 4 layers: The Linux kernel, the C + + code base, the Android SDK API, the application. This chapter has learned the Android system transplant, the android transplant is divided into 2 parts, one is the application transplant, one is the system transplant. Android system porting refers to having the Android operating system run on a particular hardware platform. This chapter describes how to query the kernel version of a Linux system by performing uname-a or Cat/proc/version two methods under the terminal. If you want to learn the Linux drive must master a technology is GNU C, this technology is the extension of the standard C. The Linux device driver is also described in this chapter, and the hardware of the computer system is mainly composed of CPU, memory and peripherals.

The 7th section of this chapter learns a small example of a Linux driver: Led driver. With this example, I know that any Linux driver has a load function and an unload function. The load function and unload function are specified by Module-init and module-exit macros, respectively. In fact, learning Android driver Development, is actually learning Linux drive development, but not the same is Android added a HAL, this is unique to Android. The role of HAL is to represent the rest of the operating system as an abstract hardware device, especially to remove the flaws and qualities that real hardware is rich in.

Chapter II: Building an Android development environment

This chapter mainly describes how to build an environment for Android's bottom-up development, including the Android application development environment, the Android NDK development environment, and the build-up of a cross-compilation environment.

The first is to install the JDK, download the package of the JDK directly, and unzip it, and then open the profile file in Linux terminal input #gedit/etc/profile to set the PATH environment variable, open the profile file, enter export at the end of the file. Path=.:/developer/jdk6/bin$path. Then you build an Android application development environment, first install the Android SDK, then install Eclipse, install ADT (ADT is the Eclipse plug-in for developing Android apps), and ADT will need to configure ADT after installation. Configure ADT so that ADT can find the Android SDK, and finally create an AVD.

To install the Android NDK development environment: Download the Android NDK, install the CDT (CDT is the plug-in for developing a/C + + program in Eclipse), command-line compile the Android ndk program, pour into the Android NDK example, Configure the Android NDK integrated development environment.

Install a cross-compilation environment, usually cross-compiler and related tools contain many executables and a large number of shared libraries and header files and other resources, the collection of these resources is called the cross-compilation environment.

This chapter mainly introduces the configuration of the Android development environment in Ubuntu Linux environment, the configuration process under Windows and Mac OS X system is similar to that in Linux environment, we can refer to the configuration of Windows or Mac OS Android development environment under the X system.

Chapter III: Getting Started with Git

Git is a free, open source distributed version control system for agile and efficient processing of any or small or large project. Git is an open source distributed version control system for efficient, high-speed processing of project versioning from very small to very large. Git is an open source version control software developed by Linus Torvalds to help manage the development of the Linux kernel. Git is a version control tool for Linux kernel development. Unlike the commonly used version control tool, CVS, Subversion, which uses a distributed repository, does not need server-side software support (Wingeddevil Note: This score is based on the service side, using the HTTP protocol or the GIT protocol is not the same. And at the time of push and pull, there is still interaction with the server side. ), so that the release and communication of the source code is extremely convenient. Git is fast, and it's naturally important for big projects like Linux kernel. The best of Git is its combined tracking (merge tracing) capability.

Install git command: # apt-get install git and # apt-get install Git-doc git-svn git-email Git-gui gitk.

This chapter shows you how to create a repository, submit source code, create a branch, upload source code to a remote server, and get source code from a remote server. Create repository: Git init; commit text to local repository: git commit; Create local branch: GIT branch; switch local branch: git checkout; Create open source project on GitHub; upload source to github:git push; Download source code from github: Git clone.

This chapter mainly introduces the basic usage of git, which is an essential tool in our learning process.

The Fourth chapter: download and compile the source code

Android source code contains a lot of things, there are embedded in the Android system of the application source code, the Android SDK with the various tools of the source code; The source of the Android NDK; and the HAL source.

Configure the download environment for Android source code: 1. Create a directory to hold the download script file. 2. Download the repo script file (for downloading Android source code). 3. Create a directory to hold the Android source code. 4. Initialize. 5. Start downloading the Android source code.

Compiling Android Source code: 1. Initialize the compilation environment (Terminal execution Command: # source build/envsetup.sh or #. build/envsetup.sh); 2. Select the target; 3. Compile the Android source code (Execute command: # make).

The Out directory is the default directory that holds the target files that the Android source code claims to be compiled. There are only 2 direct subdirectories in the Out directory: Host and target.

A cross compiler is a program that is compiled on the CPU of a architecture to run on a B-schema CPU. To install the cross-compiler: 1. Preparation; 2. Unzip the compiler; 3. Verify that the cross compiler was installed successfully; 4. Install the libncurses (the main party committee installed the configuration kernel).

Android porting is primarily the porting of the Linux kernel, and the Linux kernel porting is primarily a Linux-driven migration, so in order to develop and test the Linux drive needs to be in Ubuntu Two sets of development environments are built under Linux: the Android application development environment and the Linux kernel development environment.

This chapter has learned how to build the two development environments mentioned above.

http://www.cnblogs.com/wang1312/

Android Deep Exploration (Vol. 1) HAL and Driver Development Chapter 1-4

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.