• Compile android source and kernel for emulator in Debian


      1、download the android source code

      Reference from

    http://source.android.com/source/downloading.html

      follow the reference:

      Create the dir and export the PATH

    $ mkdir ~/bin
    $ PATH=~/bin:$PATH

      Download the repo

    $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
    $ chmod 775 ~/bin/repo

      Repo init the code version you want 

    $ repo init -u https://android.googlesource.com/platform/manifest -b android-4.0.1_r1

      finally sync the codes

    $ repo sync
    // better way
    $ repo sync -j16

      if try to stop the repo, just try

    Ctrl + z   

      and continue the repo

    $ repo sync 
    // or 
    $ repo sync -j16

      after download, must enter "repo sync" to check the code again.

      2、download the kernel

      Reference from

    https://android.googlesource.com/

      click the kernel/common, there would be a instruction on the top:

    git clone https://android.googlesource.com/kernel/common

      the version for emulator

    git clone https://android.googlesource.com/kernel/goldfish

      3、Compile the source code

      1) check the build environment

    http://source.android.com/source/initializing.html

      2) compile

    $ cd ~/Android/source_code/
    $ make
    // or 
    $ make -j4

      3) there would be the files in the following dir

    $ ls out/host/linux-x86/bin/ | grep emulator
    emulator
    emulator64-arm
    emulator64-mips
    emulator64-x86
    emulator-arm
    emulator-mips
    emulator_renderer
    emulator-ui
    emulator-x86
    $ ls out/target/product/generic/ | grep img
    ramdisk.img
    system.img
    userdata.img

      4、 Compile the kernel

    $ cd goldfish/
    $ ls

      but there is no files now.

      checkout for the real codes.

    $ git checkout 
    android-goldfish-2.6.29          master                           origin/linux-goldfish-3.0-wip 
    android-goldfish-3.4             origin/android-goldfish-2.6.29   origin/master 
    HEAD                             origin/android-goldfish-3.4      
    linux-goldfish-3.0-wip           origin/HEAD           

      choose the version you want

    $ git checkout android-goldfish-2.6.29 
    Checking out files: 100% (26821/26821), done.
    Branch android-goldfish-2.6.29 set up to track remote branch android-goldfish-2.6.29 from origin.
    切换到一个新分支 'android-goldfish-2.6.29'

      then

    $ ls
    arch     CREDITS        drivers   include  Kbuild  MAINTAINERS  net             samples   sound
    block    crypto         firmware  init     kernel  Makefile     README          scripts   usr
    COPYING  Documentation  fs        ipc      lib     mm           REPORTING-BUGS  security  virt

      compile the kernel

      1) crrect the Mafile

    $ vim Makefile
    //correct the following messenge
    #ARCH           ?= $(SUBARCH)
    ARCH            ?= arm
    CROSS_COMPILE   ?= arm-none-linux-gnueabi-

      2) make menuconfig

    $ make menuconfig
    >> Save an Alternate Configuration File       

      3) make 

      TIPS : there would be error without libnucurses

    $ sudo apt-get install libncurses5 libncurses5-dev
    // in AMD64
    $ sudo apt-get install libncurses5 libncurses5-dev
    $ sudo apt-get install ia32-libs 
    $ sudo apt-get install lib32ncurses5 lib32ncurses5-dev

      

      

     

      

      

  • 相关阅读:
    代码块;继承;this与super关系;重载与重写对比;类的继承特点;final关键字 (Java Day08)
    变量访问;this关键字;静态;工具类;帮助文档;Math使用;Arrays使用(Java Day07)
    面向对象;类和对象;访问对象;创建对象在内存中的理解;匿名对象;封装和this (Java Day06)
    如何保证 RocketMQ 不丢失消息
    Java-String类型的参数传递问题
    图解前中后序遍历
    一文彻底理解ReentrantLock可重入锁的使用
    聊聊MySQL、HBase、ES的特点和区别
    MySQL vs Java 数据类型
    Multi-Tenancy多租户模式
  • 原文地址:https://www.cnblogs.com/plinx/p/3150993.html
Copyright © 2020-2023  润新知