Chapter One compilation and porting examples of Android systems

Source: Internet
Author: User

Chapter One compilation and porting examples of Android systems

This chapter focuses on the Android system's compilation and porting technology, as built on the Linux kernel based on the Android operating system, Its compilation and porting are very similar to embedded Linux, both in terms of process and technology .

The first thing to do is to prepare a set of development versions that will run the Linux system properly, and it will need to be ported to Android and run properly.

The main procedures for porting are:

1. Download Android Linux kernel

2. Installing the cross-tool chain

3. Porting platforms supported by the Android Linux kernel

4. Install the Android SDK

5. Get Android root file system

6. Set up the system environment to complete Android normal boot

The steps are as follows:

7. (1)portingBoot-loaderand thelinux2.6kernel to the target platform, letLinuxThe kernel can start up, and the basic driver allows normal. This process is completely embeddedLinuxDevelopment, skip here directly. It is important to note that due to theAndroidhave beenLinuxofficially expelled, so fromOn the website(ashttp://www.kernel.org/)Download the latestLinuxThe kernel source code is no longer includedAndroidthe proprietary driver, so it is recommendedFromGoogleDownload OnlineLinuxKernel,AndroidThe source code browsing site is as follows:http://android.git.kernel.org/the kernel-related packages found on the site are as follows: Kernel/common.gitGeneralAndroidKernel ProjectKernel/experimental.gitExperimental Kernel projectKernel/linux-2.6.gitthis is standard.Linuxkernel, noAndroidthe driveKernel/lk.gitMicro-Kernel projectKernel/msm.gitthis is Qualcomm .msm7xxxcores used in the series ChipsKernel/omap.git kernel/tegra.git NVIDIA Tegracores used in the series ChipsHere's how to download the kernel code: git clone git://android.git.kernel.org/kernel/common.git after downloadgit branch-aView AllgitBranch,The results are as follows:android-2.6.27 origin/head origin/android-2.6.25 origin/android-2.6.27 origin/android-2.6.29 origin/android-2.6. origin/android-2.6.35 origin/android-2.6.36 origin/android-goldfish-2.6.27 origin/android-goldfish-2.6.29 then switch to Newest Branchgit checkout origin/android-2.6.36(2)Modify the kernel configuration file to openAndroidRequired Drive(Logs andBINDER)as follows:Config_android=y config_android_binder_ipc=y Config_android_logger=y This part of the code in the kerneldrivers/staging/androiddirectory. (3)to improve the start-up speed, useRAMDiskand WillAndroidpart of the file system is compressed into the kernel. First open the kernel driver: config_blk_dev_initrd=y config_initramfs_source= "root" config_initramfs_root_uid=0 config_initramfs_root _gid=0 then inAndroidThe source code compiles theOut/target/product/merlin/rootThe directory is copied to the kernel directory. (4)according toAndroidThe requirements of the file systemNAND Flashto repartition, for example, as follows:WillNAND Flashpartition below8a partitionNtim OBM u-boot Kernel System UserData Mass Storage BBT (5)Modify the kernel boot parameters according to the partition table as follows:Config_cmdline= "ubi.mtd=4 ubi.mtd=5 ubi.mtd=6 root=ubi0_0 rootfstype=ubifs console=ttys1,115200 uart_dma init=/init" Parameter means: The loaded File System section has3partitions, respectively, for aNAND Flashthe first4,5,6Partitioning(from0numbering), the file system usesubifsformat, the console device isttyS1,baud rate is115200The first application launched is/init(6)ensure that the console settings and hardware are consistent, such as: Hardware on the serial port isUART1, the kernel boot parameter is set toConsole=ttys1,andAndroidDuring the boot process set to set the correct, modifySection is locatedAndroidSource Codesystem/core/init/init.cfile, you willstatic char *console_name = "/dev/console"; Modify to static char *console_name = "/DEV/TTYS1"; (7)ModifyAndroidSource CodeSystem/core/rootdirunder the directoryinit.rcfile, make the following changes(AndroiddefaultYAFFS2File System):First theAndroidthe file system is modified to read and write,Mount Rootfs Rootfs/ro remount modified to mount Rootfs ROOTFS/RW Remount then modified mountsystemand theUserDatasection of the code that will     # Mount /system rw first to give the  Filesystem a chance to save a checkpoint     mount  Yaffs2 [email protected] /system     mount yaffs2 [email  Protected] /system ro remount     # we chown/chmod /data  again so because mount is run as root + defaults      mount yaffs2 [email protected] /data nosuid nodev      chown system system /data     chmod 0771 /data converted into      # mount /system rw first to give the filesystem  a chance to save a checkpoint     mount ubifs ubi0 _0 /system ro     # we chown/chmod /data again so because mount is  Run as root + defaults     mount ubifs ubi1_0 /data  nosuid nodev     chown system system /data      chmod 0771 /data (8)after completion of the kernel, you can start the file system, the console is available, but the boot is not displayedLog,and keep restarting. (9)The system restarts, so the console is already available, and it's natural to think about seeingLogcatlog, a look, discoverLogcatThe device actually didn't get up, the configuration file inside all definedDidn't get up and looked at the next kerneldrivers/staging/androiddirectory, no. Ofile that proves to be not compiled to, in the view of the kernel directory. configpapers, and found that there was noLogcatand theBinderDefinition of a macro, and the configuration file contains. configThere is no definition in the file, it must be relatedKconfigproblems with the file, through analysisdrivers/stagingunder the directoryKconfigfile discovery is becauseStaging_exclude_buildthe macro defaults toy,deny this macro in the configuration file, in the configuration fileconfig_stagingthe definition can be added as follows:Config_staging=y # Config_staging_exclude_build is not set modified after recompilation discovers system completes normal startup, starts during startupLogalso shows normal.

The first chapter introduces the typical process of porting Android to a set of EZ6410(s3c6410-based ) hardware systems, although the steps are relatively simple, However, the knowledge involved is much more, so should be a good review of the lessons learned during the school period.

http://www.cnblogs.com/Rain2017/

Chapter One compilation and porting examples of Android systems

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.