【系統移植】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 ===> rootfslinux


製做根文件目錄:android

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裏面有什麼內容:
app

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(針對無線通訊)ui

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==> 改編後的Makefilespa

目標文件名 : 依賴文件名
 編譯規則
目標文件的路徑
依賴文件的路徑
: 抄模板 :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)

===> 編譯:debug

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/blog

 

  @成鵬致遠進程

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

(emailwwwlllll@126.com)

(qq552158509

 



相關文章
相關標籤/搜索