【系统移植】Android系统移植

时间:2022-07-15 08:04:35
$ . .. Device
     . Simulator
Which would you like]

Build type choices are. release
     . debug
Which would you like]

Which product would you like. user  . userdebug . eng
.-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  init... ethaddr  init  init   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  ) uid gids, }
调试级别/标签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)

===> 编译:

.-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)