1. 程式人生 > >ANDROID Porting系列六、Bring Up

ANDROID Porting系列六、Bring Up

    一旦你的程式碼是建立和您確認所有必要的目錄存在,如下所述實現上電測試您的裝置。Bring up tests通常強調你的系統某個方面,讓你來描述裝置的測試行為。

1。確認了一個基本的Linux核心全新安裝, 然後才考慮Android-specific修改Linux核心,驗證您可以構建,部署和目標硬體上啟動Linux kernel

2。修改你的核心配置,以適應Android的驅動程式, 你的核心配置檔案應包括以下內容:

#
# Android
#
# CONFIG_ANDROID_GADGET is not set
# CONFIG_ANDROID_RAM_CONSOLE is not set
CONFIG_ANDROID_POWER=y
CONFIG_ANDROID_POWER_STAT=y
CONFIG_ANDROID_LOGGER=y
# CONFIG_ANDROID_TIMED_GPIO is not set
CONFIG_ANDROID_BINDER_IPC=y

3。寫驅動程式

Android附帶所有基本功能預設驅動程式,但你可能會希望編寫您自己的裝置取決於您的硬體配置您自己的驅動程式(或至少定製的預設驅動程式)。見下面的例子主題如何編寫自己的驅動程式。

·•音訊

·•鍵盤和鍵盤

·•顯示

4。燒ImageFlash

一個 image 代表了一個系統狀態或在non-volatile memory

的系統的一部分狀態。在 build過程應產生以下系統images

bootloader:引導載入程式是一個小程式的啟動作業系統的載入負責。

boot

recovery

system:該系統圖像儲存的機器人作業系統的快照。

data:影象資料儲存使用者資料。凡是不儲存到/資料目錄將在重新啟動時丟失的裝置。

kernel:核心代表了一個作業系統最基本的要素。 AndroidLinux核心負責管理本系統的資源,作為硬體和系統之間的應用軟體抽象層的行為負責。

ramdiskRAMDisk的定義了一組隨機存取儲存器(RAM的部分)的被使用,就好像它是一個硬碟驅動器。

在啟動時, 配置

bootloader載入核心到RAM中與ramdisk並傳遞RAMDisk的地址到核心。

5. 啟動核心並安裝RAMDisk.

6. 除錯Android-specificRAMDisk的初始方案

Android-specific初始化方案可以在device/system/init。新增日誌資訊,以幫助您除錯定義device/system/init/init.c.LOG巨集潛在的問題。

init程式直接安裝所有檔案系統和裝置的使用或硬編碼的檔名稱或探測的sysfs檔案系統(從而消除了一個/ etc / fstab檔案中的機器人需要生成的裝置名稱)。經過裝置/系統檔案被安裝後,init讀取的/ etc / init.rc並呼叫那裡的listed方案(其中第一個是console shell)。

7 驗證應用程式已開始

一旦殼可用時,執行%ps 確認下列正在執行的應用程式:

·/system/bin/logd

·/sbin/adbd

·/system/bin/usbd

·/system/bin/debuggerd

·/system/bin/rild

·/system/bin/app_process

·/system/bin/runtime

·/system/bin/dbus-daemon

·system_server

這些應用程式的每一個嵌入式LinuxC / C + +,你可以使用任何標準的Linux除錯工具來解決應用程式沒有執行。% make的情況,以確定確切showcommands build命令。 gdbserver的(GNU偵錯程式),可在該系統分割槽(請seehttp bin目錄:/ / sourceware.org / / GDB中獲取更多資訊)。

8pulling it all together

如果bring up成功,你應該看到下面的Java應用程式的圖示()上看到的液晶面板:

com.google.android.phone:與Android應用相關。

com.google.android.home

android.process.google.content

如果他們不可見或不響應鍵盤控制,執行framebuffer/keypad測試。

And Android Language初始化

AndroidInit語言包括四個報表廣泛的類:

Actionn

Commands

Services

Options

該語言的語法包括以下公約:

•所有的類都行的,並用空格分隔標記組成。 C風格的反斜槓轉義可用於插入空白把一個記號。雙引號也可以用於防止分裂成多個標記文字的空白。一個反斜槓作為一個行的最後一個字元出現的用於分行。

•#表示行註釋,(允許空格)。

•隱式宣告的Actions and Services的新sections。所有的命令或選項屬於最近宣告部分。命令或之前第一部分將被忽略。

Actions and Services 有唯一的名稱。如果第二個操作或服務是與作為一個現有的同名宣告,它將作為被忽略的一個錯誤。

Actions

Actions被命名的命令序列。用Actions來決定何時行動應該發生一個觸發器。當一個事件發生,以配合行動的觸發,該操作被新增到一個要被執行的佇列尾部(除非它已在佇列)。

佇列中的每個Action作出佇列順序。Actions中的每個命令按順序執行。Init 處理其他activitiesdevice creation/destruction, property setting, process restarting)“與”在activities中的命令執行。

Actions採取下列形式:

on <trigger>
  <command>
  <command>
  <command>

Services

Services init中啟動並(可配置)退出時重新啟動。

Services採取下列形式:

service <name> <pathname> [ <argument> ]*
  <option>
  <option>
  ...

Options

Options會影響執行時初始化service

引數的說明如下表:

Option

Description

disabled

This service will not automatically start with its class. It must be explicitly started by name.

socket <type> <name> <perm> [ <user> [ <group> ] ]

Create a unix domain socket named/dev/socket/<name>and pass its fd to the launched process. Valid<type>values includedgramandstream.userandgroupdefault to 0.

user <username>

Change to username before exec'ing this service. Currently defaults to root.

group <groupname> [ <groupname> ]*

Change to groupname before exec'ing this service.  Additional  groupnames beyond the first, which is required, are used to set additional groups of the process (withsetgroups()). Currently defaults to root.

capability [ <capability> ]+

Set linux capability before exec'ing this service

oneshot

Do not restart the service when it exits.

class <name>

Specify a class name for the service.  All services in a named class must start and stop together. A service is considered of class "default" if one is not specified via the class option.

Triggers

Triggers是用於匹配的事件字串,促發某種action發生。

Trigger

Description

boot

This is the first trigger that occurs when init starts (after/init.confis loaded).

<name>=<value>

Triggers of this form occur when the property<name>is set to the specific value<value>.

device-added-<path>device-removed-<path>

Triggers of these forms occur when a device node is added or removed.

service-exited-<name>

Triggers of this form occur when the specified service exits.


Commands

Command

Description

exec <path> [ <argument> ]*

Fork and execute a program (<path>). This will block until the program completes execution. Try to avoid exec. Unlike thebuiltincommands, it runs the risk of getting init "stuck".

export <name> <value>

Set the environment variable<name>equal to<value>in the global environment (which will be inherited by all processes started after this command is executed).

ifup <interface>

Bring the network interface<interface>online.

import <filename>

Parse an init config file, extending the current configuration.

hostname <name>

Set the host name.

class_start <serviceclass>

Start all services of the specified class if they are not already running.

class_stop <serviceclass>

Stop all services of the specified class if they are currently running.

domainname <name>

Set the domain name.

insmod <path>

Install the module at<path>.

mkdir <path>

Make a directory at<path>.

mount <type> <device> <dir> [ <mountoption> ]*

Attempt to mount the named device at the directory<dir><device>. This may be of the form [email protected] to specify a mtd block device by name.

setkey

- currenlty undefined -

setprop <name> <value>

Set system property<name>to<value>.

setrlimit <resource> <cur> <max>

Set the rlimit for a resource.

start <service>

Start a service running if it is not already running.

stop <service>

Stop a service from running if it is currently running.

symlink <target> <path>

Create a symbolic link at<path>with the value<target>.

write <path> <string> [ <string> ]*

Open the file at<path>and write one or more strings to it with write(2).

Properties

Init更新一些系統屬性,以提供一些系統活動資訊::

Property

Description

init.action

Equal to the name of the action currently being executed or "" if none.

init.command

Equal to the command being executed or "" if none.

init.svc.<name>

State of a named service ("stopped", "running", or "restarting").

例如init.conf

下面的程式碼段是一個不完整的init.conf檔案的例子,便是為了讓您瞭解什麼是正確的配置類似的想法.

on boot
export PATH /sbin:/system/sbin:/system/bin
export LD_LIBRARY_PATH /system/lib
mkdir /dev
mkdir /proc
mkdir /sys
mount tmpfs tmpfs /dev
mkdir /dev/pts
mkdir /dev/socket
mount devpts devpts /dev/pts
mount proc proc /proc
mount sysfs sysfs /sys
write /proc/cpu/alignment 4
ifup lo
hostname localhost
domainname localhost
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /data
import /system/etc/init.conf
class_start default
service adbd /sbin/adbd
user adb
group adb
service usbd /system/bin/usbd -r
user usbd
group usbd
socket usbd 666
service zygote /system/bin/app_process -Xzygote /system/bin --zygote
socket zygote 666
service runtime /system/bin/runtime
user system
group system
on device-added-/dev/compass
start akmd
on device-removed-/dev/compass
stop akmd
service akmd /sbin/akmd
disabled
user akmd
group akmd

相關推薦

ANDROID Porting系列Bring Up

    一旦你的程式碼是建立和您確認所有必要的目錄存在,如下所述實現上電測試您的裝置。Bring up tests通常強調你的系統某個方面,讓你來描述裝置的測試行為。 1。確認了一個基本的Linux核心全新安裝, 然後才考慮Android-specific修改Lin

dubbo系列SPI擴展Filter隱式傳參

address style 分享圖片 github efi over tps com invoke 一、實現Filter接口 1、消費者過濾器:ConsumerTraceFilter.java package com.dubbo.demo.Filter; im

spring系列springboot配置錯誤頁面及全域性異常

一、spring1.x中處理方式 @Bean public EmbeddedServletContainerCustomizer containerCustomizer() { return new EmbeddedServletContainerCustomize

Android車載camera的除錯-Bring up(1)

來到新公司,各種不適應。跟老大和hr溝通後,最終決定留下。裡邊各中原因就不說了,留下後就得開始幹活啦:拿到的第一個case是車載環視camera的點亮,算是入門後的第一個小考驗吧: 我們認識實物的一個過程通常是從現象到本質,那第一個問題來了: 什麼是車載環視

Redis系列redis的五種資料結構和相關指令之Sorted Set

本節中將介紹Redis支援的主要資料結構,以及相關的常用Redis命令。redis是一種基於鍵值對(key-value)的記憶體資料庫,redis資料結構可以分為string、hash、list、set、sorted set。 redis的五種資料結構和相關指令

Android Studio安裝部署系列】三十Android Studio3.1.4升級到Android studio3.2【以及創建android p模擬器(未成功)】

tps min 比較 安裝 bsp mda 下載 initial uil 版權聲明:本文為HaiyuKing原創文章,轉載請註明出處! 概述 因為想要使用Android P模擬器,所以需要將Android Studio升級到3.2版本以上。 按照官網的說法:參考《ht

ANDROID STUDIO系列教程--GRADLE多渠道打包

tor 等待 time() utf 腳本 manifest file resource 一個 由於國內Android市場眾多渠道,為了統計每個渠道的下載及其它數據統計,就需要我們針對每個渠道單獨打包,如果讓你打幾十個市場的包豈不煩死了,不過有了Gradle,這再也不是事了。

Silverlight & Blend動畫設計系列:動畫技巧(Animation Techniques)之對象與路徑轉化波感特效

繪制 name sof 圖形 基本 默認 nbsp getprop 都在 當我們在進行Silverlight & Blend進行動畫設計的過程中,可能需要設計出很多效果不一的圖形圖像出來作為動畫的基本組成元素。然而在設計過程中可能會出現許多的問題,比如當前繪制了一個

java內功系列(泛型異常註解)

泛型: 1.泛型的出現主要解決了容器中元素放進去後直接變成了object型別。在編譯的時候如果傳入錯誤的元素將會出錯。 2.每次傳給泛型類、介面的型別引數不一樣相當於建立了一個新的類。list<string>和list以及list<int>是不一樣的型別。(邏輯上存在物理

[Android Framework] 8.1 Battery系列() 上次充滿電計算

Settings中獲取”上次充滿電”時間的程式碼如下: packages/apps/Settings/src/com/android/settings/fuelgauge/BatteryUtils.java public long calculateLastFullCha

C#遊戲程式設計:《控制檯小遊戲系列》之《貪吃蛇例項》

[csharp] view plaincopyprint? using System;   using CEngine;   using CGraphics;   namespace Snake   {       /// <summary>

Android安全機制之NDK實現防鉤子簽名校驗

//對公鑰MD5後進行比對驗證 void MD5_Check(char *src) { char buff[3] = {'\0'}; char hex[33] = {'\0'}; unsigned char digest[MD5_DIGEST_LENGTH]; MD5_CTX ctx; MD5_Ini

[Android Studio系列(三)]Android Studio 編譯同步慢的解決方法

1 問題 (1) 當專案中引用的第三方模組太多,開啟Android Studio的時候就會非常慢,提示一直在解決模組依賴,點選sync按鈕同步第三方程式碼的時候也是巨慢,慢的原因是: 在gradle中引用第三方模組時採用maven方式依賴,每次開啟An

Android開發系列(十一):對手機通訊錄的讀取新增刪除查詢

一、通訊錄介紹 通訊錄是Android手機自帶的一個應用,它是一個ContentProvider應用,其它應用可以對通訊錄進行訪問,進行對聯絡人的CRUD操作。 二、通訊錄資料庫結構的介紹 首先,我們可以在File Explorer檢視下找到contacts2.db檔案,

經典演算法研究系列教你初步瞭解KMP演算法updated

教你初步瞭解KMP演算法作者: July 、saturnma、上善若水。     時間; 二零一一年一月一日-----------------------本文參考:資料結構(c語言版) 李雲清等編著、演算法導論引言:在文字編輯中,我們經常要在一段文字中某個特定的位置找出 某個

走近Flex元件系列():使用FormFormHeadingFormItem佈局表單

轉自http://www.csharpwin.com/dotnetspace/3166.shtml 本篇主要介紹使用Form、FormHeading、FormItem這三個元件進行佈局表單介面,這三個元件使用非常簡單。本篇以佈局一個使用者登入介面為示例,如下程式碼片段:

Android常見錯誤 (持續更新中……)

1、Unable to resolve target 'android-2' 安裝低版本的api,再default.properties這個檔案中把target=android-2改成 target=android-7終於就沒有問題了。 2、Invalid start tag LinearLayout

elasticsearch系列:聚合分析(聚合分析簡介指標聚合桶聚合)

{  "took": 2059,  "timed_out": false,  "_shards": {    "total": 58,    "successful": 58,    "skipped": 0,    "failed": 0  },  "hits": {    "total": 1015, 

Android進階:在子線程中直接使用 Toast 及其原理

我的文章 public str toast 技術交流群 ui控件 及其 handle android進階 一般我們都把Toast當做一個UI控件在主線程顯示。但是有時候非想在子線程中顯示Toast,就會使用Handler切換到主線程顯示。 但是子線程中真的不能直接顯示Toa

regularized logisitic regssion練習(轉載)

method open lose hold on update import 等高線 algo 2個 轉載鏈接:http://www.cnblogs.com/tornadomeet/archive/2013/03/17/2964858.html 在上一講Deep learn