zoukankan      html  css  js  c++  java
  • 【系统移植】Android系统移植

    $ . ./build/envsetup.sh  // 每打开一个终端,就需要执行一次
    $ choosecombo  // 选择产品
    Build for the simulator or the device?  // 目标文件时运行在模拟上还是真实的开发板
         1. Device
         2. Simulator
    Which would you like? [1] 1

    Build type choices are:  // 编译目标文件的类型
         1. release
         2. debug
    Which would you like? [1] 1

    Which product would you like? [generic] fs100  // 产品的名字叫fs100

    Variant choices are: // 目标文件给谁用, 权限的管理
         1. user  // 用户, 产品
         2. userdebug // 用户调试, 
         3. eng // 工程师
    Which would you like? [eng]3
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.1-update1
    TARGET_PRODUCT=fs100
    TARGET_BUILD_VARIANT=eng
    TARGET_SIMULATOR=false
    TARGET_BUILD_TYPE=release
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=ERE27
    ============================================

    编译 make -j2

    编译完成之后

        eclair_2.1_farsight ===> rootfs


    制作根文件目录:

    out/target/product/fs10/root
    out/target/product/fs10/system
    mkdir myrootfs
    cp -raf out/target/product/fs100/root/* myrootfs/
    cp -raf out/target/product/fs100/system   myrootfs

    ===> 制作后的rootfs里面有什么内容:

    data   // apk安装目录      
    default.prop  
    system
       |
       app // 系统自带的apk
       bin  
       etc
       lib  
       usr  
       xbin
       build.prop   // 编译的属性信息: 编译时间,作者,平台 
       fonts   // 字体库
       framework  // android framework运行核心代码的二进制文件
     
    init   // 第一个用户进程 
    init.fs100.rc    
    init.rc   // 启动脚本, 规定了init进程会去启动哪些其他的进程, 类似etc/inittab
    init.goldfish.rc 
    sbin 
    dev
    proc     
    sys

    运行

    1, 烧录的方式:

    set bootcmd nand read 0x20008000  0x900000 0x300000 ; go 0x20008000
    set bootargs console=ttySAC0,115200  init=/init root=/dev/mtdblock3   rootfstype=yaffs2 ip=192.168.7.6 ethaddr=00:23:24:56:7e:8e
    或者:
     set bootargs console=ttySAC0,115200  init=/init root=1f03   rootfstype=yaffs2
    或者:
     set bootargs console=ttySAC0,115200  init=/init root=31:03   rootfstype=yaffs2

    因为烧录的jffs, yaffs扫描的时候出问题, 文件系统的分区部分擦擦出
    yaffs tragedy: no more erased blocks
    !!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!
    yaffs tragedy: no more erased blocks
    !!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!
    yaffs tragedy: no more erased blocks
    !!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!
    yaffs tragedy: no more erased blocks
    !!!!!!!!! Allocator out !!!!!!!!!!!!!!!!!
    yaffs tragedy: no more erased blocks

    解决:nand erase 0x9800000 0x6800000

    调试

    log系统
        / # ls /dev/log/*
        /dev/log/events(数据事件)  /dev/log/main(大部分的调试信息)    /dev/log/radio(针对无线通信)

    logcat  ==> main缓冲区的调试信息
    logcat -b main
    logcat -b radio
    logcat -b events

    I/ActivityManager( 1900): Start proc com.android.inputmethod.latin for service com.android.inputmethod.latin/.LatinIME: pid=1945 uid=10002 gids={3003, 1015}
    调试级别/标签tag(pid): 调试内容
    调试级别: 
    D   debug
    I   info
    W   warning
    E   error
    F   fatal
    标签tag: 区分调试信息是从哪个代码中打印出来

    过滤: 
    logcat -s "ActivityManager"
    //清空缓冲
    logcat -c

     

    android中如何用c写一个可执行代码--->编译出来-->运行

    Android.mk==> 改编后的Makefile

    目标文件名 : 依赖文件名
     编译规则
    目标文件的路径
    依赖文件的路径
    : 抄模板:hardware/ril/rild/Android.mk
    #获取源码目录
    LOCAL_PATH:= $(call my-dir)
    include $(CLEAR_VARS)
    #表示依赖文件
    LOCAL_SRC_FILES:= hello.c
    #表示目标文件
    LOCAL_MODULE:= hello_arm_elf
    #表示编译方法
    include $(BUILD_EXECUTABLE)

    ===> 编译:

    mmm mytest/c_test/
    ============================================
    PLATFORM_VERSION_CODENAME=REL
    PLATFORM_VERSION=2.1-update1
    TARGET_PRODUCT=fs100
    TARGET_BUILD_VARIANT=eng
    TARGET_SIMULATOR=false
    TARGET_BUILD_TYPE=release
    TARGET_ARCH=arm
    HOST_ARCH=x86
    HOST_OS=linux
    HOST_BUILD_TYPE=release
    BUILD_ID=ERE27
    ============================================
    make:进入目录'/home/ldswfun/src_s5pc/eclair_2.1_farsight'
    target thumb C: hello_arm_elf <= mytest/c_test/hello.c
    target Executable: hello_arm_elf (out/target/product/fs100/obj/EXECUTABLES/hello_arm_elf_intermediates/LINKED/hello_arm_elf)
    target Non-prelinked: hello_arm_elf (out/target/product/fs100/symbols/system/bin/hello_arm_elf)
    target Strip: hello_arm_elf (out/target/product/fs100/obj/EXECUTABLES/hello_arm_elf_intermediates/hello_arm_elf)
    Install: out/target/product/fs100/system/bin/hello_arm_elf
    make:离开目录“/home/ldswfun/src_s5pc/eclair_2.1_farsight

    ===> 运行:

        cp -raf  out/target/product/fs100/system/bin/hello_arm_elf   /opt/myrootfs/

     

      @成鹏致远

    (blogs:http://lcw.cnblogs.com

    (emailwwwlllll@126.com)

    (qq552158509





  • 相关阅读:
    The formatter threw an exception while trying to deserialize the message in WCF
    通过Web Deploy方式部署WCF
    The Managed Metadata Service or Connection is currently not available
    How to create Managed Metadata Column
    冒泡算法
    asp.net core 实战项目(一)——ef core的使用
    Vue学习笔记入门篇——安装及常用指令介绍
    Vue学习笔记入门篇——数据及DOM
    Vue学习笔记目录
    Chart.js在Laravel项目中的应用
  • 原文地址:https://www.cnblogs.com/lcw/p/3802652.html
Copyright © 2011-2022 走看看