Android Driver Development Fourth Chapter Caprice

Source: Internet
Author: User

This chapter explains the entire process of building an Android migration development environment, first of all to explain how to build an embedded cross-development environment, including cross-compilation environment, the installation and use of various service programs and applications:

1) Download of the GNU crossover tool chain
Download the www.arm.linux.org.uk from the arm's official website and you can download the 2.95.3 toolchain from the site:
ftp://ftp.arm.linux.org.uk/pub/armlinux/toolchain/cross-2.95.3.tar.bz2
2) Installation steps for CROSS-2.95.3.TAR.BZ2 Package a. #mkdir/usr/local/arm;b. #cpcross -2.95.3.tar.bz2/usr/local/arm;c.# tarjxvfcross-2.95.3.tar.bz2;
D. Adding environment variables: At the end of the file/ETC/BASHRC file, add:

Exportpath=/usr/local/arm/2.95.3/bin:$path;e. Tool chain installation is complete.

2.3  to configure NFS Services
The NFS service is to mount a host directory over the network to other computers, and as a directory for other computers, the purpose is to allow files to be shared between different machines and different operating systems. NFS uses a sub-server and a client where the server side provides the files to be shared, and the client accesses the shared file by mounting the "mount" action. The following main introduction to the GEC2410 Development Board Linux system and virtual machine Linux to achieve file sharing through NFS methods and steps:
1) in the Virtual Machine Linux configuration NFS Services, edit the NFS profile/etc/exports, set up a shared directory such as: vi/ Etc/exports, added:/root/nfs_share3 (Rw,sync,no_root_squash). RW indicates that the directory is allowed to read and write to the lower machine, and No_root_squash allows the slave to mount the root filesystem as the host root user.
2) Start the NFS service on the virtual machine Linux: (You need to restart the NFS service after modifying the configuration file) #/etc/init.d/nfsrestart or use the command: #servicenfsrestart.
3) The shutdown of the firewall. Select the security level, system settings, and change the security level to no firewall.
4) Connect the PC (virtual machine) and the Development Board with a crossover cable to allow two Linux to be in the same network. The IP address of the
Board is: 192.168.2.223, so configure the IP address that starts with the virtual machine IP 192.168.2, as available in the following command configuration: #ifconfigeth0192.168.2.23.
5) Mount the NFS shared directory of the virtual machine Linux on the board Linux system and execute the following command: #mkdir/tmp/nfs#mount-tnfs-onolock192.168.2.23:/root/nfs_share/tmp/ Nfs.

How to make a cross-debugger
1) Decompression source package: TARZXFGDB-6.0.TAR.GZ2) configuration: Cdgdb-6.0mkdirbuild2arm2linuxcdbuild2arm2linux
.. /CONFIGURE--TARGET=ARM2LINUX--PREFIX=/USR/LOCAL/ARM/2.95.3/3) Compile: Make
4) Installation: Makeinstall
Generate the Arm2linux2gdb tool in the/usr/local/arm/2.95.3/bin/directory
5) Compile and generate Gdbservera for ARM processors. Enter the Gdbserver directory Cdgdb-6.0cdgdb/gdbserverb in the GDB source package. Configure the Build Gdbserverchmodu+xconfigure
Cc=arm-linux-gcc./configure--host=arm2linux

Next is the compilation and porting of U-boot, and then explains the knowledge of the Linux kernel under the Android system, and finally the method of kernel compiling and porting.

(1) Install cross compiler
(a) Creation of folders in the/usr/local/directory arm
(b) to arm-linux-gcc-3.4. L.TAR.BZ2 Copy to arm folder (c) # tar JXVF arm-linux-gcc-3.4. l.tar.bz2
Unzip the compiler, where: J in jxvf means compress/unzip files with bzip2 (d) vi ~/.bash_profile//SET System environment variables
Add the ARM-LINUX-GCC path/usr/local/arm/3.4.1/bin to the path:
"Original": path= $PATH: $HOME/bin
"Modified to": Path= $PATH:/usr/local/arm/3.4.1/bin (2) Unzip the kernel code and configure the kernel
(a) # tar JXVF linux2.6.14.tar.gz//extract kernel, where: Z in ZXVF means compress/unzip files with gzip (b) # ls
(c) # CD linux2.6.14 third, modify the makefile file
The kernel is compiled according to the makefile file of the T, makefile file to organize the kernel of the module between the
Relationships and dependencies between each module.
We first modify the linux-2.6.14 root directory under the Makfile file, we need to change the major content is the target code
Type and specify a compiler for the compiled kernel. We commented out the following: #ARCH? =$ (Subarch) #CROSS compile?= Add the following: Arch:= arm
Cross COMPILE =/usr/local/arm/3.4.1/bin/arm-linux-

4.1 Set flash partition 4.1.1 indicate partition information
In the ARCH/ARM/MACH-S3C2410/DEVS.C file:
[[Email protected] linux-2.6.14]$ VI arch/arm/mach-s3c2410/devs.c (1) Add header file definition:
/***********add here***********/#include <linux/mtd/partitions.h> #include <linux/mtd/nand.h> #include <asm/arch/nand.h>
/**************end add********/
(2) Add NAND flash partition information definition (partition information and bootloader consistent can)/***********add here***********/
static struct mtd_partition partition_ info[]={[0]={//128k
Name: "Boot",//name: Represents the partition name
size:0x20000,//size: Represents the Flash partition size (in bytes)
offset:0,//offset: Represents the start address of the flash partition (offset relative to dry 0x0)},
[1]={//3m Name: "Kernel", size:0x300000, offset:0x20000,},
[2]={//5m Name: "Rootfs", size:0x500000, offset:0x320000,},
[3]={//1m Name: "etc",
Size:ox 100000, offset:0x820000. },
[4]=//11m Name:user
size:oxb00000, offset:ox920000,}
[5]={
Name: "QT",
size:ox2b00000, Offset:ox 1420000,}};

/**************end add********/(3) Add NAND flash partition
/***********add here***********/struct s3c2410_ nand_ set nandset={
Nr_partitions:6,/*the number of partitions*/partitions:partition_ info,/*partition table*/};
/**************end add********/
Nr_partitions: Indicates the number of partitions defined in Partition_ info partitions: partition information table
(4). Create NAND Flash chip support/***********add here***********/
struct S3c2410_platform_nand superlpplatform={
tacls:0,//tads, Twrph0, TWRPHL, see s3c2410 manual 6-3 twrph0:30, Twrph 1:0,
Sets: &nandset,//supported partition information set NR_SETS:1,//number of partition sets};
/**************end add********/
(5). Add NAND flash chip support to NAND flash drive
Also, modify the S3c_device_nand struct variable in this file to add an assignment to the Dev member
struct Platform_device s3c_device_nand={name= "S3c2410-nand",/*device name*/. Id=-1,/*device ID*/
. Num Resources=array_ SIZE (s3c_nand_resource),//There are several register areas. Resource=s3c_nand_resource,/*nand Flash Controller Register s*/Register Area First address
/***********add Here***********//*add the Nand Flash device*/. dev={
. Platform_data=&superlpplatform}
/**************end add********/};
4.1.2 Specifies initialization at startup
Kernel start-up based on our initial configuration changes to the partition's settings arch/arm/mach-s3c2410/mach-smdk2410.c file [[email protected] linux-2.6.14]$ VI
Arch/arm/mach-s3c2410/mach-smd1q410.c
Modify smdk2410_devices[]. Indicates that initialization includes the Flash partition information we set up earlier
static struct Platform-device *smd1q410_ devices[]_ initdata={&s3c_ device_ USB,

Android Driver Development Fourth Chapter Caprice

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.