2015年11月30日 星期一

MPI Three-Group Pipeline

底下的MPI範例很有趣, 來自於5.6.3. Inter-Communication Examples
它主要是想要介紹建立三個節點, 彼此之間使用communicator串起來, 模擬成pipeline的運作方式.
希望產的效果如下圖:

程式碼我有動過, 如下
//http://www.mpi-forum.org/docs/mpi-1.1/mpi-11-html/node114.html
//Groups 0 and 1 communicate. Groups 1 and 2 communicate.
//Therefore, group 0 requires one inter-communicator, group 1 requires two inter-communicators,
//and group 2 requires 1 inter-communicator.

//int MPI_Comm_split(MPI_Comm comm, int color, int key, MPI_Comm *newcomm)
//int MPI_Intercomm_create(MPI_Comm local_comm, int local_leader, MPI_Comm peer_comm, int remote_leader, int tag, MPI_Comm *newintercomm)
#include <stdio.h>
#include <stdlib.h>
#include <mpi.h>
int main(int argc, char **argv){
        MPI_Comm   myComm;       /* intra-communicator of local sub-group */
        MPI_Comm   myFirstComm;  /* inter-communicator */
        MPI_Comm   mySecondComm; /* second inter-communicator (group 1 only) */
        int membershipKey = 0, rank =0, buffer = 0;
        MPI_Status status;
        double start_time, recive_time;

        MPI_Init(&argc, &argv);
        MPI_Comm_rank(MPI_COMM_WORLD, &rank);

        /* User code must generate membershipKey in the range [0, 1, 2] */
        membershipKey = rank % 3;
        start_time = MPI_Wtime();

        /* Build intra-communicator for local sub-group */
        MPI_Comm_split(MPI_COMM_WORLD, membershipKey, rank, &myComm);

        /* Build inter-communicators.  Tags are hard-coded. */
        if (membershipKey == 0){
                /* Group 0 communicates with group 1. */
                MPI_Intercomm_create( myComm, 0, MPI_COMM_WORLD, 1, 1, &myFirstComm);
        }
        else if (membershipKey == 1){
                /* Group 1 communicates with groups 0 and 2. */
                MPI_Intercomm_create( myComm, 0, MPI_COMM_WORLD, 0, 1, &myFirstComm);
                MPI_Intercomm_create( myComm, 0, MPI_COMM_WORLD, 2, 12, &mySecondComm);
        }
        else if (membershipKey == 2){
                /* Group 2 communicates with group 1. */
                MPI_Intercomm_create( myComm, 0, MPI_COMM_WORLD, 1, 12, &mySecondComm);
        }

        switch(membershipKey){
                case 0:
                        buffer = 100;
                        printf("[%d][%f]buffer=%d\n", rank, MPI_Wtime() - start_time, buffer);
                        MPI_Send(&buffer, 1, MPI_INT, 0, 0, myFirstComm);
                        MPI_Recv(&buffer, 1, MPI_INT, 0, 0, myFirstComm, &status);
                        printf("[%d][%f]buffer=%d\n", rank, MPI_Wtime() - start_time, buffer);
                        break;
                case 1:
                        printf("[%d][%f]buffer=%d\n", rank, MPI_Wtime() - start_time, buffer);
                        MPI_Recv(&buffer, 1, MPI_INT, 0, 0, myFirstComm, &status);
                        printf("[%d][%f]buffer=%d\n", rank, MPI_Wtime() - start_time, buffer);
                        buffer = 200;
                        MPI_Send(&buffer, 1, MPI_INT, 0, 0, myFirstComm);
                        MPI_Send(&buffer, 1, MPI_INT, 0, 0, mySecondComm);
                        break;
                case 2:
                        MPI_Recv(&buffer, 1, MPI_INT, 0, 0, mySecondComm, &status);
                        printf("[%d][%f]buffer=%d\n", rank, MPI_Wtime() - start_time, buffer);
                        break;
        }

        MPI_Comm_free(&myComm);
        switch(membershipKey){/* free communicators appropriately */
                case 1:
                        MPI_Comm_free(&mySecondComm);
                        MPI_Comm_free(&myFirstComm);
                        break;
                case 0:
                        MPI_Comm_free(&myFirstComm);
                        break;
                case 2:
                        MPI_Comm_free(&mySecondComm);
                        break;
        }
        MPI_Finalize();
}
執行的結果如下
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
[0] Ending MPI_Init
[0] Starting MPI_Comm_rank...
[0] Ending MPI_Comm_rank
[0] Starting MPI_Comm_split...
[0] Ending MPI_Comm_split
[0] Starting MPI_Intercomm_create...
[0] Ending MPI_Intercomm_create
[0][0.000326]buffer=100
[0] Starting MPI_Send with count = 1, dest = 0, tag = 0...
[0] Ending MPI_Send
[0] Starting MPI_Recv with count = 1, source = 0, tag = 0...
[0] Ending MPI_Recv from 0 with tag 0
[0][0.000408]buffer=200
[0] Starting MPI_Comm_free...
[1] Ending MPI_Init
[1] Starting MPI_Comm_rank...
[1] Ending MPI_Comm_rank
[1] Starting MPI_Comm_split...
[1] Ending MPI_Comm_split
[1] Starting MPI_Intercomm_create...
[1] Ending MPI_Intercomm_create
[1] Starting MPI_Intercomm_create...
[1] Ending MPI_Intercomm_create
[1][0.000166]buffer=0
[1] Starting MPI_Recv with count = 1, source = 0, tag = 0...
[1] Ending MPI_Recv from 0 with tag 0
[1][0.000214]buffer=100
[1] Starting MPI_Send with count = 1, dest = 0, tag = 0...
[1] Ending MPI_Send
[1] Starting MPI_Send with count = 1, dest = 0, tag = 0...
[1] Ending MPI_Send
[1] Starting MPI_Comm_free...
[1] Ending MPI_Comm_free
[1] Starting MPI_Comm_free...
[2] Ending MPI_Init
[2] Starting MPI_Comm_rank...
[2] Ending MPI_Comm_rank
[2] Starting MPI_Comm_split...
[2] Ending MPI_Comm_split
[2] Starting MPI_Intercomm_create...
[2] Ending MPI_Intercomm_create
[0] Ending MPI_Comm_free
[0] Starting MPI_Comm_free...
[0] Ending MPI_Comm_free
[0] Starting MPI_Finalize...
[0] Ending MPI_Finalize
[1] Ending MPI_Comm_free
[1] Starting MPI_Comm_free...
[1] Ending MPI_Comm_free
[1] Starting MPI_Finalize...
[2] Starting MPI_Recv with count = 1, source = 0, tag = 0...
[2] Ending MPI_Recv from 0 with tag 0
[2][0.000409]buffer=200
[2] Starting MPI_Comm_free...
[2] Ending MPI_Comm_free
[2] Starting MPI_Comm_free...
[2] Ending MPI_Comm_free
[2] Starting MPI_Finalize...
[1] Ending MPI_Finalize
[2] Ending MPI_Finalize

改變vim程式碼註解的顏色

vim裏面程式碼註解的顏色預設值為深藍色.每次看註解都看到眼睛快花掉了.
還是改一下換個顏色.
vim ~/.vimrc
加入底下的命令
hi Comment ctermfg=cyan

效果如下圖:

你也可以試其它的顏色:
*cterm-colors*

NR-16   NR-8    COLOR NAME 
0       0       Black
1       4       DarkBlue
2       2       DarkGreen
3       6       DarkCyan
4       1       DarkRed
5       5       DarkMagenta
6       3       Brown, DarkYellow
7       7       LightGray, LightGrey, Gray, Grey
8       0*      DarkGray, DarkGrey
9       4*      Blue, LightBlue
10      2*      Green, LightGreen
11      6*      Cyan, LightCyan
12      1*      Red, LightRed
13      5*      Magenta, LightMagenta
14      3*      Yellow, LightYellow
15      7*      White

2015年11月28日 星期六

sscanf in C language

這個是Jack給的一個有趣程式, 以底下的範例來說
輸入的字串可是是"
#include <string.h>
#include <stdio.h>
int main(int argc, char** argv){
        int b[5] = {0, 0, 0, 0, 0};
        int ret;

        if(argc == 2){
                ret = sscanf( argv[1], "%d,%d,%d,%d,%d\n", &b[0], &b[1], &b[2], &b[3], &b[4]);
                printf("ret = %d, b0=%d b1=%d b2=%d b3=%d b4=%d\n", ret, b[0], b[1], b[2], b[3], b[4] );
        }
}


執行狀況如下:
./test

./test 1
ret = 1, b0=1 b1=0 b2=0 b3=0 b4=0

./test 1,2
ret = 2, b0=1 b1=2 b2=0 b3=0 b4=0

./test 1,2,3
ret = 3, b0=1 b1=2 b2=3 b3=0 b4=0

./test 1,2,3,4
ret = 4, b0=1 b1=2 b2=3 b3=4 b4=0

./test 1,2,3,4,5
ret = 5, b0=1 b1=2 b2=3 b3=4 b4=5

./test 1,2,3,4,5,6
ret = 5, b0=1 b1=2 b2=3 b3=4 b4=5


sscanf的函式宣告型態如下
int sscanf(const char *str, const char *format, ...);
使用它時需要
#include <stdio.h>

MPI_Bcast

MPI_Bcast廣播函式, 這個是一個很有趣的功能. 將要變更的資料變數及內容傳送給其它的接收

/* C Example */
#include <mpi.h>
#include <stdio.h>

int main (int argc, char* argv[]){
        int rank, size;
        double t1;
        void *v;
        int flag;
        int mytable[1] = { 0 };

        MPI_Init (&argc, &argv);      /* starts MPI */
        MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
        MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
        t1 = MPI_Wtime();
        MPI_Attr_get( MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, &v, &flag );
        printf( "Hello world from process %d of %d, time = %f, global time = %d\n", rank, size, MPI_Wtime() - t1, flag);

        mytable[0] = rank + 100;
        MPI_Barrier(MPI_COMM_WORLD);
        MPI_Bcast(&mytable[0], 1, MPI_INT, atoi(argv[1]), MPI_COMM_WORLD);
        printf("%d/%d: mytable[0] = %d\n", rank, size, mytable[0]);
        MPI_Barrier(MPI_COMM_WORLD);

        MPI_Finalize();
        return 0;
}
mpirun -np 5 ./bcast 0執行結果1
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
[0] Ending MPI_Init
[0] Starting MPI_Comm_rank...
[0] Ending MPI_Comm_rank
[0] Starting MPI_Comm_size...
[0] Ending MPI_Comm_size
[0] Starting MPI_Attr_get...
[0] Ending MPI_Attr_get
Hello world from process 0 of 5, time = 0.000011, global time = 1
[0] Starting MPI_Barrier...
[0] Ending MPI_Barrier
[0] Starting MPI_Bcast...
[0] Starting MPI_Bcast with count = 1
[0] Ending MPI_Bcast
0/5: mytable[0] = 100
[0] Starting MPI_Barrier...
[0] Ending MPI_Barrier
[0] Starting MPI_Finalize...
[0] Ending MPI_Finalize
[1] Ending MPI_Init
[1] Starting MPI_Comm_rank...
[1] Ending MPI_Comm_rank
[1] Starting MPI_Comm_size...
[1] Ending MPI_Comm_size
[1] Starting MPI_Attr_get...
[1] Ending MPI_Attr_get
Hello world from process 1 of 5, time = 0.000012, global time = 1
[1] Starting MPI_Barrier...
[1] Ending MPI_Barrier
[1] Starting MPI_Bcast...
[1] Starting MPI_Bcast with count = 1
[1] Ending MPI_Bcast
1/5: mytable[0] = 100
[1] Starting MPI_Barrier...
[1] Ending MPI_Barrier
[1] Starting MPI_Finalize...
[1] Ending MPI_Finalize
[2] Ending MPI_Init
[2] Starting MPI_Comm_rank...
[2] Ending MPI_Comm_rank
[2] Starting MPI_Comm_size...
[2] Ending MPI_Comm_size
[2] Starting MPI_Attr_get...
[2] Ending MPI_Attr_get
Hello world from process 2 of 5, time = 0.000012, global time = 1
[2] Starting MPI_Barrier...
[2] Ending MPI_Barrier
[2] Starting MPI_Bcast...
[2] Starting MPI_Bcast with count = 1
[2] Ending MPI_Bcast
2/5: mytable[0] = 100
[2] Starting MPI_Barrier...
[2] Ending MPI_Barrier
[2] Starting MPI_Finalize...
[3] Ending MPI_Init
[3] Starting MPI_Comm_rank...
[3] Ending MPI_Comm_rank
[3] Starting MPI_Comm_size...
[3] Ending MPI_Comm_size
[3] Starting MPI_Attr_get...
[3] Ending MPI_Attr_get
Hello world from process 3 of 5, time = 0.000010, global time = 1
[3] Starting MPI_Barrier...
[3] Ending MPI_Barrier
[3] Starting MPI_Bcast...
[3] Starting MPI_Bcast with count = 1
[3] Ending MPI_Bcast
3/5: mytable[0] = 100
[3] Starting MPI_Barrier...
[3] Ending MPI_Barrier
[3] Starting MPI_Finalize...
[4] Ending MPI_Init
[4] Starting MPI_Comm_rank...
[4] Ending MPI_Comm_rank
[4] Starting MPI_Comm_size...
[4] Ending MPI_Comm_size
[4] Starting MPI_Attr_get...
[4] Ending MPI_Attr_get
Hello world from process 4 of 5, time = 0.000009, global time = 1
[4] Starting MPI_Barrier...
[4] Ending MPI_Barrier
[4] Starting MPI_Bcast...
[4] Starting MPI_Bcast with count = 1
[4] Ending MPI_Bcast
4/5: mytable[0] = 100
[4] Starting MPI_Barrier...
[4] Ending MPI_Barrier
[4] Starting MPI_Finalize...
[2] Ending MPI_Finalize
[3] Ending MPI_Finalize
[4] Ending MPI_Finalize
mpirun -np 5 ./bcast 1執行結果2
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
[0] Ending MPI_Init
[0] Starting MPI_Comm_rank...
[0] Ending MPI_Comm_rank
[0] Starting MPI_Comm_size...
[0] Ending MPI_Comm_size
[0] Starting MPI_Attr_get...
[0] Ending MPI_Attr_get
Hello world from process 0 of 5, time = 0.000017, global time = 1
[0] Starting MPI_Barrier...
[0] Ending MPI_Barrier
[0] Starting MPI_Bcast...
[0] Starting MPI_Bcast with count = 1
[0] Ending MPI_Bcast
0/5: mytable[0] = 101
[0] Starting MPI_Barrier...
[0] Ending MPI_Barrier
[0] Starting MPI_Finalize...
[1] Ending MPI_Init
[1] Starting MPI_Comm_rank...
[1] Ending MPI_Comm_rank
[1] Starting MPI_Comm_size...
[1] Ending MPI_Comm_size
[1] Starting MPI_Attr_get...
[1] Ending MPI_Attr_get
Hello world from process 1 of 5, time = 0.000010, global time = 1
[1] Starting MPI_Barrier...
[1] Ending MPI_Barrier
[1] Starting MPI_Bcast...
[1] Starting MPI_Bcast with count = 1
[1] Ending MPI_Bcast
1/5: mytable[0] = 101
[1] Starting MPI_Barrier...
[1] Ending MPI_Barrier
[1] Starting MPI_Finalize...
[1] Ending MPI_Finalize
[2] Ending MPI_Init
[2] Starting MPI_Comm_rank...
[2] Ending MPI_Comm_rank
[2] Starting MPI_Comm_size...
[2] Ending MPI_Comm_size
[2] Starting MPI_Attr_get...
[2] Ending MPI_Attr_get
Hello world from process 2 of 5, time = 0.000008, global time = 1
[2] Starting MPI_Barrier...
[2] Ending MPI_Barrier
[2] Starting MPI_Bcast...
[2] Starting MPI_Bcast with count = 1
[2] Ending MPI_Bcast
2/5: mytable[0] = 101
[2] Starting MPI_Barrier...
[2] Ending MPI_Barrier
[2] Starting MPI_Finalize...
[3] Ending MPI_Init
[3] Starting MPI_Comm_rank...
[3] Ending MPI_Comm_rank
[3] Starting MPI_Comm_size...
[3] Ending MPI_Comm_size
[3] Starting MPI_Attr_get...
[3] Ending MPI_Attr_get
Hello world from process 3 of 5, time = 0.000008, global time = 1
[3] Starting MPI_Barrier...
[3] Ending MPI_Barrier
[3] Starting MPI_Bcast...
[3] Starting MPI_Bcast with count = 1
[3] Ending MPI_Bcast
3/5: mytable[0] = 101
[3] Starting MPI_Barrier...
[3] Ending MPI_Barrier
[3] Starting MPI_Finalize...
[4] Ending MPI_Init
[4] Starting MPI_Comm_rank...
[4] Ending MPI_Comm_rank
[4] Starting MPI_Comm_size...
[4] Ending MPI_Comm_size
[4] Starting MPI_Attr_get...
[4] Ending MPI_Attr_get
Hello world from process 4 of 5, time = 0.000009, global time = 1
[4] Starting MPI_Barrier...
[4] Ending MPI_Barrier
[4] Starting MPI_Bcast...
[4] Starting MPI_Bcast with count = 1
[4] Ending MPI_Bcast
4/5: mytable[0] = 101
[4] Starting MPI_Barrier...
[4] Ending MPI_Barrier
[4] Starting MPI_Finalize...
[0] Ending MPI_Finalize
[2] Ending MPI_Finalize
[3] Ending MPI_Finalize
[4] Ending MPI_Finalize

MPI_Wtime

突然發現, 原來MPI有提供一個函式MPI_Wtime(), 可以用來計算運行過的時間, 單位是秒.
它的回傳值是double, 並且需要確定你的系統環境是MPI_WTIME_IS_GLOBAL是有被定義的.
/* C Example */
#include <mpi.h>
#include <stdio.h>

int main (int argc, char* argv[]){
        int rank, size;
        double t1;
        void *v;
        int flag;

        MPI_Init (&argc, &argv);      /* starts MPI */
        MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
        MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
        t1 = MPI_Wtime();
        MPI_Attr_get( MPI_COMM_WORLD, MPI_WTIME_IS_GLOBAL, &v, &flag );
        printf( "Hello world from process %d of %d, time = %f, global time = %d\n", rank, size, MPI_Wtime() - t1, flag);
        MPI_Finalize();
        return 0;
}

MPI & MPE Helloworld

這次來介紹MPI搭配MPE(MPI Parallel Environment)來tracing程式的運作
主程式hello.c跟先前的相同, 程式碼如下:
/* C Example */
#include <mpi.h>
#include <stdio.h>

int main (int argc, char* argv[])
{
  int rank, size;

  MPI_Init (&argc, &argv);      /* starts MPI */
  MPI_Comm_rank (MPI_COMM_WORLD, &rank);        /* get current process id */
  MPI_Comm_size (MPI_COMM_WORLD, &size);        /* get number of processes */
  printf( "Hello world from process %d of %d\n", rank, size );
  MPI_Finalize();
  return 0;
}
Makefile內容如下:
all:
        mpecc -mpitrace -o hello hello.c

mpirun -np 5 ./hello 執行的結果如下:
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
Starting MPI_Init...
[0] Ending MPI_Init
[0] Starting MPI_Comm_rank...
[0] Ending MPI_Comm_rank
[0] Starting MPI_Comm_size...
[0] Ending MPI_Comm_size
Hello world from process 0 of 5
[0] Starting MPI_Finalize...
[0] Ending MPI_Finalize
[1] Ending MPI_Init
[1] Starting MPI_Comm_rank...
[1] Ending MPI_Comm_rank
[1] Starting MPI_Comm_size...
[1] Ending MPI_Comm_size
Hello world from process 1 of 5
[1] Starting MPI_Finalize...
[1] Ending MPI_Finalize
[2] Ending MPI_Init
[2] Starting MPI_Comm_rank...
[2] Ending MPI_Comm_rank
[2] Starting MPI_Comm_size...
[2] Ending MPI_Comm_size
Hello world from process 2 of 5
[2] Starting MPI_Finalize...
[3] Ending MPI_Init
[3] Starting MPI_Comm_rank...
[3] Ending MPI_Comm_rank
[3] Starting MPI_Comm_size...
[3] Ending MPI_Comm_size
Hello world from process 3 of 5
[3] Starting MPI_Finalize...
[4] Ending MPI_Init
[4] Starting MPI_Comm_rank...
[4] Ending MPI_Comm_rank
[4] Starting MPI_Comm_size...
[4] Ending MPI_Comm_size
Hello world from process 4 of 5
[4] Starting MPI_Finalize...
[2] Ending MPI_Finalize
[3] Ending MPI_Finalize
[4] Ending MPI_Finalize

2015年11月26日 星期四

Brillo Toybox

大概瞄了一下, 突然發現, system/bin/裏面不是裝busybox也不是裝toolbox了.改成用toybox了.
原來AOSP已經改用toybox了, 看起來這轉換的過程也歷經了許多的故事.
有興趣的可以看一下Android gets a toybox.

底下這張圖是brillo裏/system/bin的檔案列表.
.
├── bin
│   ├── acpi -> toybox
│   ├── apmanager
│   ├── applypatch_static
│   ├── audio_hal_playback_test
│   ├── audio_hal_record_test
│   ├── avahi-browse
│   ├── avahi-daemon
│   ├── base64 -> toybox
│   ├── basename -> toybox
│   ├── bdt
│   ├── blockdev -> toybox
│   ├── bluetooth-cli
│   ├── bluetoothtbd
│   ├── bootctl
│   ├── brillo_audio_test
│   ├── bzcat -> toybox
│   ├── cal -> toybox
│   ├── cat -> toybox
│   ├── chcon -> toybox
│   ├── check_prereq
│   ├── chgrp -> toybox
│   ├── chmod -> toybox
│   ├── chown -> toybox
│   ├── chroot -> toybox
│   ├── cjpeg
│   ├── cksum -> toybox
│   ├── clear -> toybox
│   ├── cmp -> toybox
│   ├── comm -> toybox
│   ├── core2md
│   ├── cp -> toybox
│   ├── cpio -> toybox
│   ├── crash_reporter
│   ├── crash_sender
│   ├── curl
│   ├── cut -> toybox
│   ├── date -> toybox
│   ├── dbus-daemon
│   ├── dbus-example-client
│   ├── dbus-example-daemon
│   ├── dbus-send
│   ├── dd -> toolbox
│   ├── df -> toybox
│   ├── dhcpcd
│   ├── dhcpcd-6.8.2
│   ├── dhcptool
│   ├── dirname -> toybox
│   ├── djpeg
│   ├── dmesg -> toybox
│   ├── dnsmasq
│   ├── dos2unix -> toybox
│   ├── du -> toybox
│   ├── echo -> toybox
│   ├── egrep -> grep
│   ├── env -> toybox
│   ├── expand -> toybox
│   ├── expr -> toybox
│   ├── fallocate -> toybox
│   ├── false -> toybox
│   ├── ff_debug
│   ├── fgrep -> grep
│   ├── find -> toybox
│   ├── firewalld
│   ├── flash_image
│   ├── flock -> toybox
│   ├── free -> toybox
│   ├── gdbserver
│   ├── getenforce -> toybox
│   ├── getevent -> toolbox
│   ├── getprop -> toybox
│   ├── grep
│   ├── groups -> toybox
│   ├── head -> toybox
│   ├── hostapd
│   ├── hostapd_cli
│   ├── hostname -> toybox
│   ├── hwclock -> toybox
│   ├── id -> toybox
│   ├── ifconfig -> toybox
│   ├── iftop -> toolbox
│   ├── initnetwork.sh
│   ├── inotifyd -> toybox
│   ├── insmod -> toybox
│   ├── ioctl -> toolbox
│   ├── ionice -> toybox
│   ├── iorenice -> toybox
│   ├── iotop
│   ├── ip
│   ├── ip6tables
│   ├── ip6tables-restore -> ip6tables
│   ├── ip6tables-save -> ip6tables
│   ├── iptables
│   ├── iptables-restore -> iptables
│   ├── iptables-save -> iptables
│   ├── iw
│   ├── keystore
│   ├── keystore_cli
│   ├── keystore_cli_v2
│   ├── kill -> toybox
│   ├── killall -> toybox
│   ├── linker
│   ├── ln -> toybox
│   ├── load_policy -> toybox
│   ├── log -> toolbox
│   ├── logcat
│   ├── logd
│   ├── logname -> toybox
│   ├── logpersist.cat -> logpersist.start
│   ├── logpersist.start
│   ├── logpersist.stop -> logpersist.start
│   ├── losetup -> toybox
│   ├── ls -> toybox
│   ├── lsmod -> toybox
│   ├── lsof -> toybox
│   ├── lsusb -> toybox
│   ├── md5sum -> toybox
│   ├── mediaserver
│   ├── memory_replay32
│   ├── metrics_client
│   ├── metrics_daemon
│   ├── mkdir -> toybox
│   ├── mknod -> toybox
│   ├── mkswap -> toybox
│   ├── mktemp -> toybox
│   ├── modinfo -> toybox
│   ├── more -> toybox
│   ├── mount -> toybox
│   ├── mountpoint -> toybox
│   ├── mv -> toybox
│   ├── nandread -> toolbox
│   ├── nativepowerman
│   ├── netstat -> toybox
│   ├── newfs_msdos -> toolbox
│   ├── nice -> toybox
│   ├── nl -> toybox
│   ├── nohup -> toybox
│   ├── od -> toybox
│   ├── paste -> toybox
│   ├── patch -> toybox
│   ├── periodic_scheduler
│   ├── pgrep -> toybox
│   ├── pidof -> toybox
│   ├── ping
│   ├── pkill -> toybox
│   ├── pmap -> toybox
│   ├── postinst_example
│   ├── power_example
│   ├── printenv -> toybox
│   ├── printf -> toybox
│   ├── prlimit -> toolbox
│   ├── ps -> toolbox
│   ├── pwd -> toybox
│   ├── r
│   ├── readlink -> toybox
│   ├── realpath -> toybox
│   ├── reboot
│   ├── renice -> toybox
│   ├── restorecon -> toybox
│   ├── rm -> toybox
│   ├── rmdir -> toybox
│   ├── rmmod -> toybox
│   ├── rootdev
│   ├── route -> toybox
│   ├── runcon -> toybox
│   ├── sed -> toybox
│   ├── sendevent -> toolbox
│   ├── sensorservice
│   ├── sensors-hal-example-app
│   ├── sensors-ndk-example-app
│   ├── seq -> toybox
│   ├── servicemanager
│   ├── setenforce -> toybox
│   ├── setprop -> toybox
│   ├── setsid -> toybox
│   ├── sh
│   ├── sha1sum -> toybox
│   ├── shill
│   ├── showlease
│   ├── sleep -> toybox
│   ├── slesTest_playFdPath
│   ├── slesTest_recBuffQueue
│   ├── slesTest_sawtoothBufferQueue
│   ├── sort -> toybox
│   ├── split -> toybox
│   ├── start -> toolbox
│   ├── stat -> toybox
│   ├── stop -> toolbox
│   ├── strings -> toybox
│   ├── swapoff -> toybox
│   ├── swapon -> toybox
│   ├── sync -> toybox
│   ├── sysctl -> toybox
│   ├── tac -> toybox
│   ├── tail -> toybox
│   ├── tar -> toybox
│   ├── taskset -> toybox
│   ├── tee -> toybox
│   ├── time -> toybox
│   ├── timeout -> toybox
│   ├── tlsdate
│   ├── tlsdated
│   ├── tlsdate-helper
│   ├── toolbox
│   ├── top -> toolbox
│   ├── touch -> toybox
│   ├── toybox
│   ├── tr -> toybox
│   ├── tracepath
│   ├── tracepath6
│   ├── traceroute6
│   ├── true -> toybox
│   ├── truncate -> toybox
│   ├── tty -> toybox
│   ├── umount -> toybox
│   ├── uname -> toybox
│   ├── uniq -> toybox
│   ├── unix2dos -> toybox
│   ├── update_engine
│   ├── update_engine_client
│   ├── updater
│   ├── uptime -> toybox
│   ├── usleep -> toybox
│   ├── vmstat -> toybox
│   ├── wc -> toybox
│   ├── weaved
│   ├── webservd
│   ├── which -> toybox
│   ├── whoami -> toybox
│   ├── wifi_init
│   ├── wpa_cli
│   ├── wpa_debug
│   ├── wpa_supplicant
│   ├── xargs -> toybox
│   ├── xxd -> toybox
│   └── yes -> toybox

宅色夫大大的 - 你所不知道的C語言beta 11/23 指標篇

你所不知道的C語言 : 指標篇



Andrew Koenig - C Traps and Pitfalls
Interactive compiler - http://gcc.godbolt.org/ , 沒有MIPS有點可惜.

Ubuntu vs VNC

實驗室的Server一向都是裝沒有桌面環境的, 結果最近要跑的一個qemu居然會啟vnc起來.
只好隨便裝一下.
狀況真的有點慘烈, vncview連上去, 很醜. 只能將就點用了, 懶的再改了.
記錄一下目前的.vnc/xstartup裏面的設定.

 cat xstartup
#!/bin/sh
export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
底下是vncviewer連上去的畫面.
我原本的認知, 應該是要能直接用gnome-session跑window的環境的, 但居然報出底下的訊息.
也有用過gnome-session --session=ubuntu-2d去試過, 基本沒狀況相同.
 gnome-session
gnome-session-is-accelerated: No composite extension.
gnome-session-check-accelerated: Helper exited with code 256
gnome-session-is-accelerated: No composite extension.
gnome-session-check-accelerated: Helper exited with code 256
gnome-session[9150]: WARNING: software acceleration check failed: Child process exited with code 1
gnome-session[9150]: CRITICAL: We failed, but the fail whale is dead. Sorry....

1.GNOME Panel - 主要負責程式啟動清單以及工作列的功能.
2.gnome-settings-daemon - daemon handling the GNOME session settings
3.metacity - 視窗管理程式
4.nautilus - gnome的檔案瀏覽器
5.gnome-terminal - 就終端機程式

Google IoT Soluation - Brillo Project

如果不知道Google Brillo是什麼, 可以考慮看一下底下的兩段影片
(1)Google I/O 2015 Keynote 完整紀錄

(2)Brillo官網上的An Introduction to Brillo, the OS for IoT

根據TechOrange科技報橘 沈孟學 - 【年度祭典!Google I/O 現場報導】Google 物聯網平台 Brillo 來了,能讓物體「溝通」更智慧嗎? 裏面, 也是摘錄自Google I/O的簡介, 說了, 使用Brillo作業系統裝置的三大特性.
·智慧:不管使用者是從辦公室回家、或是周末悠閒待在家裡,運行 Brillo 作業系統的裝置都能做出準確的反應,讓使用者享有便捷、智慧的使用體驗。此外,輕鬆分享讓使用者可以提供客人一個專用的暫時性無線網路,或是暫停已啟用的 Smart Lock。

·簡單:Brillo 的啟用設定相當簡單,而且每一台 Android 裝置都有內建自動偵測。「Android On」應用程式可以協助使用者將所有裝置連線,在一個地方功能即可輕鬆、簡單地管理所有的裝置。

·同步:使用者不會被限制於某一品牌的裝置,只要是搭載「Android On」應用未來在例如 Nest 或 Homekit 等其他平台的裝置也將能運作程式的裝置皆可順暢運作。

另外還有一個名詞要注意: Weave - 簡單說就是Brillo Device之間溝通的protocol.

在官方的說法, Brillo的硬體需求為32MB的記憶體, 128M的系統儲存空間, 老實講這樣子的需求對IoT裝置來說, 太高了吧!

因為Brillo已經Release出來了, 當然就要抓下來看看長的是圓是扁囉!
底下的過程我也是參考How to Build Brillo Operating System from Source Code and Run Brillo Emulator


步驟1:
下載Brillo Source Code, 這裏是針對branch brillo-m7-release下載
repo init -u https://android.googlesource.com/brillo/manifest -b brillo-m7-release

步驟2:
設定編譯環境
source build/envsetup.sh
會看到底下的訊息
including device/generic/brillo/vendorsetup.sh
including device/generic/brillo/brilloemulator_arm64/base_product/devicesetup.sh
including device/generic/brillo/brilloemulator_arm/base_product/devicesetup.sh
including device/generic/brillo/brilloemulator_x86_64/base_product/devicesetup.s                                                       h
including device/generic/brillo/brilloemulator_x86/base_product/devicesetup.sh
including device/generic/mini-emulator-arm64/vendorsetup.sh
including device/generic/mini-emulator-armv7-a-neon/vendorsetup.sh
including device/generic/mini-emulator-x86_64/vendorsetup.sh
including device/generic/mini-emulator-x86/vendorsetup.sh
including product/google/common/brillo_gpios/vendorsetup.sh
including product/google/common/brillo_leds/vendorsetup.sh
including product/google/example-ledflasher/vendorsetup.sh
步驟3:
選擇編譯的目標平台
launch
會看到底下的訊息, 在which would you like的地方輸入10, 指定要編譯的目標平台為brilloemulator_x86-eng, 選9的話會編譯錯誤
You're building on Linux

Lunch menu... pick a combo:
     1. aosp_arm-eng
     2. aosp_arm64-eng
     3. aosp_mips-eng
     4. aosp_mips64-eng
     5. aosp_x86-eng
     6. aosp_x86_64-eng
     7. brilloemulator_arm64-eng
     8. brilloemulator_arm-eng
     9. brilloemulator_x86_64-eng
     10. brilloemulator_x86-eng
     11. mini_emulator_arm64-userdebug
     12. m_e_arm-userdebug
     13. mini_emulator_x86_64-userdebug
     14. mini_emulator_x86-userdebug
     15. brillo_gpios-userdebug
     16. brillo_leds-userdebug
     17. ledflasher-userdebug

Which would you like? [aosp_arm-eng] 10

============================================
PLATFORM_VERSION_CODENAME=REL
PLATFORM_VERSION=6.0.60
TARGET_PRODUCT=brilloemulator_x86
TARGET_BUILD_VARIANT=eng
TARGET_BUILD_TYPE=release
TARGET_BUILD_APPS=
TARGET_ARCH=x86
TARGET_ARCH_VARIANT=x86
TARGET_CPU_VARIANT=
TARGET_2ND_ARCH=
TARGET_2ND_ARCH_VARIANT=
TARGET_2ND_CPU_VARIANT=
HOST_ARCH=x86_64
HOST_OS=linux
HOST_OS_EXTRA=Linux-3.13.0-24-generic-x86_64-with-Ubuntu-14.04-trusty
HOST_CROSS_OS=windows
HOST_BUILD_TYPE=release
BUILD_ID=MASTER
OUT_DIR=out
============================================
步驟4:
開始編譯brillo
make -j20
如果你的編譯環境都是正常的話, 就會看到底下的結果
make_ext4fs -T -1 -S out/target/product/brilloemulator_x86/root/file_contexts.bin -L / -l 786432000 -a / out/target/product/brilloemulator_x86/obj/PACKAGING/systemimage_intermediates/system.img /tmp/tmpceM3H7 out/target/product/brilloemulator_x86/system
Creating filesystem with parameters:
    Size: 786432000
    Block size: 4096
    Blocks per group: 32768
    Inodes per group: 8000
    Inode size: 256
    Journal blocks: 3000
    Label: /
    Blocks: 192000
    Block groups: 6
    Reserved block group size: 47
Created filesystem with 691/48000 inodes and 30669/192000 blocks
[100% 8493/8493] Install system fs image: out/target/product/brilloemulator_x86/system.img
out/target/product/brilloemulator_x86/system.img+out/target/product/brilloemulator_x86/recovery.img maxsize=802897920 blocksize=2112 total=793747456 reserve=8110080

#### make completed successfully (04:31 (mm:ss)) ####

步驟5:
執行brillo的模擬器
./out/host/linux-x86/bin/brilloemulator-x86
接著它就會開始跑模擬器, 並且看到整個開機過程, 最後進入terminal的畫面
Starting Emulator with 1024MB Memory
pulseaudio: pa_context_connect() failed
pulseaudio: Reason: Connection refused
pulseaudio: Failed to initialize PA contextaudio: Could not init `pa' audio driver
adb_server_notify: Failed to establish connection to ADB server
console on port 5556, ADB on port 5557
[    0.000000] Initializing cgroup subsys cpuset
[    0.000000] Initializing cgroup subsys cpu
[    0.000000] Initializing cgroup subsys cpuacct
[    0.000000] Linux version 3.18.0+ (stanley@ubuntu-core40) (gcc version 4.9 20140827 (prerelease) (GCC) ) #1 SMP Tue Nov 24 21:27:40 CST 2015
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x000000003ffdffff] usable
[    0.000000] BIOS-e820: [mem 0x000000003ffe0000-0x000000003fffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fffc0000-0x00000000ffffffff] reserved
[    0.000000] Notice: NX (Execute Disable) protection missing in CPU!
[    0.000000] SMBIOS 2.8 present.
[    0.000000] e820: last_pfn = 0x3ffe0 max_arch_pfn = 0x1000000
[    0.000000] found SMP MP-table at [mem 0x000f0e90-0x000f0e9f] mapped at [c00f0e90]
[    0.000000] Scanning 1 areas for low memory corruption
[    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[    0.000000] init_memory_mapping: [mem 0x37400000-0x375fffff]
[    0.000000] init_memory_mapping: [mem 0x34000000-0x373fffff]
[    0.000000] init_memory_mapping: [mem 0x00100000-0x33ffffff]
[    0.000000] init_memory_mapping: [mem 0x37600000-0x377fdfff]
[    0.000000] ACPI: Early table checksum verification disabled
[    0.000000] ACPI: RSDP 0x000F0C90 000014 (v00 BOCHS )
[    0.000000] ACPI: RSDT 0x3FFE1A4A 000034 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACP 0x3FFE1033 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)
[    0.000000] ACPI: DSDT 0x3FFE0040 000FF3 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: FACS 0x3FFE0000 000040
[    0.000000] ACPI: SSDT 0x3FFE10A7 0008F3 (v01 BOCHS  BXPCSSDT 00000001 BXPC 00000001)
[    0.000000] ACPI: APIC 0x3FFE199A 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)
[    0.000000] ACPI: HPET 0x3FFE1A12 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)
[    0.000000] 135MB HIGHMEM available.
[    0.000000] 887MB LOWMEM available.
[    0.000000]   mapped low ram: 0 - 377fe000
[    0.000000]   low ram: 0 - 377fe000
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   Normal   [mem 0x01000000-0x377fdfff]
[    0.000000]   HighMem  [mem 0x377fe000-0x3ffdffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00001000-0x0009efff]
[    0.000000]   node   0: [mem 0x00100000-0x3ffdffff]
[    0.000000] Initmem setup node 0 [mem 0x00001000-0x3ffdffff]
[    0.000000] Using APIC driver default
[    0.000000] ACPI: PM-Timer IO Port: 0x608
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x00] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 1 CPUs, 0 hotplug CPUs
[    0.000000] e820: [mem 0x40000000-0xfffbffff] available for PCI devices
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:1 nr_node_ids:1
[    0.000000] PERCPU: Embedded 13 pages/cpu @f6fea000 s32768 r0 d20480 u53248
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 260238
[    0.000000] Kernel command line: console=ttyS0 root=/dev/vda androidboot.hardware=qemu qemu=1 rootwait noinitrd init=/init androidboot.selinux=enforcing
[    0.000000] PID hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Dentry cache hash table entries: 131072 (order: 7, 524288 bytes)
[    0.000000] Inode-cache hash table entries: 65536 (order: 6, 262144 bytes)
[    0.000000] Initializing CPU#0
[    0.000000] Initializing HighMem for node 0 (000377fe:0003ffe0)
[    0.000000] Initializing Movable for node 0 (00000000:00000000)
[    0.000000] Memory: 1027068K/1048056K available (7663K kernel code, 550K rwdata, 2340K rodata, 588K init, 580K bss, 20988K reserved, 139144K highmem)
[    0.000000] virtual kernel memory layout:
[    0.000000]     fixmap  : 0xfff16000 - 0xfffff000   ( 932 kB)
[    0.000000]     pkmap   : 0xff800000 - 0xffa00000   (2048 kB)
[    0.000000]     vmalloc : 0xf7ffe000 - 0xff7fe000   ( 120 MB)
[    0.000000]     lowmem  : 0xc0000000 - 0xf77fe000   ( 887 MB)
[    0.000000]       .init : 0xc1a52000 - 0xc1ae5000   ( 588 kB)
[    0.000000]       .data : 0xc177c0d0 - 0xc1a50a80   (2898 kB)
[    0.000000]       .text : 0xc1000000 - 0xc177c0d0   (7664 kB)
[    0.000000] Checking if this processor honours the WP bit even in supervisor mode...Ok.
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] Hierarchical RCU implementation.
[    0.000000]  RCU restricting CPUs from NR_CPUS=8 to nr_cpu_ids=1.
[    0.000000] RCU: Adjusting geometry for rcu_fanout_leaf=16, nr_cpu_ids=1
[    0.000000] NR_IRQS:2304 nr_irqs:256 0
[    0.000000] Console: colour *CGA 80x25
[    0.000000] console [ttyS0] enabled
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.000000] tsc: Detected 2297.288 MHz processor
[    0.005264] Calibrating delay loop (skipped), value calculated using timer frequency.. 4594.57 BogoMIPS (lpj=2297288)
[    0.007083] pid_max: default: 32768 minimum: 301
[    0.007737] ACPI: Core revision 20140926
[    0.027123] ACPI: All ACPI Tables successfully acquired
[    0.030033] Security Framework initialized
[    0.031165] SELinux:  Initializing.
[    0.032658] Mount-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.033073] Mountpoint-cache hash table entries: 2048 (order: 1, 8192 bytes)
[    0.044158] Initializing cgroup subsys freezer
[    0.046566] Last level iTLB entries: 4KB 0, 2MB 0, 4MB 0
[    0.046566] Last level dTLB entries: 4KB 0, 2MB 0, 4MB 0, 1GB 0
[    0.140138] Freeing SMP alternatives memory: 32K (c1ae5000 - c1aed000)
[    0.148491] Enabling APIC mode:  Flat.  Using 1 I/O APICs
[    0.152288] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.163090] smpboot: CPU0: Intel QEMU Virtual CPU version 2.2.0 (fam: 06, model: 06, stepping: 03)
[    0.165063] Performance Events: Broken PMU hardware detected, using software events only.
[    0.166000] Failed to access perfctr msr (MSR c1 is 0)
[    0.175662] x86: Booted up 1 node, 1 CPUs
[    0.176071] smpboot: Total of 1 processors activated (4594.57 BogoMIPS)
[    0.185807] devtmpfs: initialized
[    0.198634] RTC time: 13:30:44, date: 11/24/15
[    0.205720] kworker/u2:0 (15) used greatest stack depth: 7276 bytes left
[    0.207252] NET: Registered protocol family 16
[    0.214119] cpuidle: using governor ladder
[    0.214516] cpuidle: using governor menu
[    0.216196] ACPI: bus type PCI registered
[    0.218706] PCI: PCI BIOS revision 2.10 entry at 0xfd456, last bus=0
[    0.219033] PCI: Using configuration type 1 for base access
[    0.271241] kworker/u2:0 (46) used greatest stack depth: 7220 bytes left
[    0.274336] ACPI: Added _OSI(Module Device)
[    0.274642] ACPI: Added _OSI(Processor Device)
[    0.274931] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.275000] ACPI: Added _OSI(Processor Aggregator Device)
[    0.299149] ACPI: Interpreter enabled
[    0.299573] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S1_] (20140926/hwxface-580)
[    0.301070] ACPI Exception: AE_NOT_FOUND, While evaluating Sleep State [\_S2_] (20140926/hwxface-580)
[    0.302214] ACPI: (supports S0 S3 S5)
[    0.302495] ACPI: Using IOAPIC for interrupt routing
[    0.303653] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.356480] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
[    0.358000] acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
[    0.358000] acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
[    0.358000] acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.
[    0.358703] PCI host bridge to bus 0000:00
[    0.358974] pci_bus 0000:00: root bus resource [bus 00-ff]
[    0.359000] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7]
[    0.359000] pci_bus 0000:00: root bus resource [io  0x0d00-0xadff]
[    0.359000] pci_bus 0000:00: root bus resource [io  0xae0f-0xaeff]
[    0.359000] pci_bus 0000:00: root bus resource [io  0xaf20-0xafdf]
[    0.359000] pci_bus 0000:00: root bus resource [io  0xafe4-0xffff]
[    0.359000] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[    0.359000] pci_bus 0000:00: root bus resource [mem 0x40000000-0xfebfffff]
[    0.360285] kworker/u2:0 (95) used greatest stack depth: 7188 bytes left
[    0.372078] pci 0000:00:01.1: legacy IDE quirk: reg 0x10: [io  0x01f0-0x01f7]
[    0.373063] pci 0000:00:01.1: legacy IDE quirk: reg 0x14: [io  0x03f6]
[    0.374054] pci 0000:00:01.1: legacy IDE quirk: reg 0x18: [io  0x0170-0x0177]
[    0.375042] pci 0000:00:01.1: legacy IDE quirk: reg 0x1c: [io  0x0376]
[    0.378400] pci 0000:00:01.3: quirk: [io  0x0600-0x063f] claimed by PIIX4 ACPI
[    0.379076] pci 0000:00:01.3: quirk: [io  0x0700-0x070f] claimed by PIIX4 SMB
[    0.434543] ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
[    0.436964] ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
[    0.440210] ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
[    0.443534] ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
[    0.445618] ACPI: PCI Interrupt Link [LNKS] (IRQs *9)
[    0.447000] ACPI: Enabled 16 GPEs in block 00 to 0F
[    0.448000] vgaarb: loaded
[    0.449000] SCSI subsystem initialized
[    0.451690] ACPI: bus type USB registered
[    0.452484] usbcore: registered new interface driver usbfs
[    0.453298] usbcore: registered new interface driver hub
[    0.454693] usbcore: registered new device driver usb
[    0.456038] pps_core: LinuxPPS API ver. 1 registered
[    0.456184] pps_core: Software ver. 5.3.6 - Copyright 2005-2007 Rodolfo Giometti <giometti@linux.it>
[    0.456750] PTP clock support registered
[    0.458737] Advanced Linux Sound Architecture Driver Initialized.
[    0.459060] PCI: Using ACPI for IRQ routing
[    0.470120] NetLabel: Initializing
[    0.470368] NetLabel:  domain hash size = 128
[    0.470662] NetLabel:  protocols = UNLABELED CIPSOv4
[    0.471506] NetLabel:  unlabeled traffic allowed by default
[    0.472346] cfg80211: Calling CRDA to update world regulatory domain
[    0.474646] HPET: 3 timers in total, 0 timers will be used for per-cpu timer
[    0.475474] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 0
[    0.476258] hpet0: 3 comparators, 64-bit 100.000000 MHz counter
[    0.480573] Switched to clocksource hpet
[    0.579729] pnp: PnP ACPI init
[    0.590946] pnp: PnP ACPI: found 6 devices
[    0.662848] NET: Registered protocol family 2
[    0.669740] TCP established hash table entries: 8192 (order: 3, 32768 bytes)
[    0.673664] TCP bind hash table entries: 8192 (order: 4, 65536 bytes)
[    0.676460] TCP: Hash tables configured (established 8192 bind 8192)
[    0.680268] TCP: reno registered
[    0.681667] UDP hash table entries: 512 (order: 2, 16384 bytes)
[    0.683401] UDP-Lite hash table entries: 512 (order: 2, 16384 bytes)
[    0.688826] NET: Registered protocol family 1
[    0.693656] RPC: Registered named UNIX socket transport module.
[    0.695520] RPC: Registered udp transport module.
[    0.696997] RPC: Registered tcp transport module.
[    0.698456] RPC: Registered tcp NFSv4.1 backchannel transport module.
[    0.701019] pci 0000:00:00.0: Limiting direct PCI/PCI transfers
[    0.702903] pci 0000:00:01.0: PIIX3: Enabling Passive Release
[    0.704571] pci 0000:00:01.0: Activating ISA DMA hang workarounds
[    0.715672] microcode: CPU0 sig=0x663, pf=0x1, revision=0x0
[    0.719265] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[    0.724007] Scanning for low memory corruption every 60 seconds
[    0.732726] futex hash table entries: 256 (order: 2, 16384 bytes)
[    0.735653] audit: initializing netlink subsys (disabled)
[    0.738030] audit: type=2000 audit(1448371844.737:1): initialized
[    0.745488] HugeTLB registered 2 MB page size, pre-allocated 0 pages
[    0.762818] kworker/u2:0 (284) used greatest stack depth: 7132 bytes left
[    0.781558] VFS: Disk quotas dquot_6.5.2
[    0.784559] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)
[    0.797824] NFS: Registering the id_resolver key type
[    0.800738] Key type id_resolver registered
[    0.802599] Key type id_legacy registered
[    0.805468] msgmni has been set to 1734
[    0.815341] bounce: pool size: 64 pages
[    0.817598] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 251)
[    0.820866] io scheduler noop registered
[    0.822251] io scheduler deadline registered
[    0.824596] io scheduler cfq registered (default)
[    0.827991] pci_hotplug: PCI Hot Plug PCI Core version: 0.5
[    0.830255] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input0
[    0.830255] ACPI: Power Button [PWRF]
[    1.138002] ACPI: PCI Interrupt Link [LNKB] enabled at IRQ 10
[    1.428484] ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11
[    1.676846] ACPI: PCI Interrupt Link [LNKD] enabled at IRQ 11
[    1.679821] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled
[    1.716440] serial 00:05: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    1.717722] tsc: Refined TSC clocksource calibration: 2297.311 MHz
[    1.725757] Non-volatile memory driver v1.3
[    1.726431] Linux agpgart interface v0.103
[    1.728885] [drm] Initialized drm 1.1.0 20060810
[    1.741642] loop: module loaded
[    1.762598]  vda: unknown partition table
[    1.772617]  vdb: unknown partition table
[    1.786982] scsi host0: ata_piix
[    1.789413] scsi host1: ata_piix
[    1.790514] ata1: PATA max MWDMA2 cmd 0x1f0 ctl 0x3f6 bmdma 0xc0a0 irq 14
[    1.790987] ata2: PATA max MWDMA2 cmd 0x170 ctl 0x376 bmdma 0xc0a8 irq 15
[    1.796440] e100: Intel(R) PRO/100 Network Driver, 3.5.24-k2-NAPI
[    1.796841] e100: Copyright(c) 1999-2006 Intel Corporation
[    1.798604] e1000: Intel(R) PRO/1000 Network Driver - version 7.3.21-k8-NAPI
[    1.799260] e1000: Copyright (c) 1999-2006 Intel Corporation.
[    1.799847] e1000e: Intel(R) PRO/1000 Network Driver - 2.3.2-k
[    1.800497] e1000e: Copyright(c) 1999 - 2014 Intel Corporation.
[    1.801660] sky2: driver version 1.30
[    1.804387] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    1.804862] ehci-pci: EHCI PCI platform driver
[    1.805968] ohci_hcd: USB 1.1 'Open' Host Controller (OHCI) Driver
[    1.806769] ohci-pci: OHCI PCI platform driver
[    1.807755] uhci_hcd: USB Universal Host Controller Interface driver
[    1.808715] usbcore: registered new interface driver usblp
[    1.809623] usbcore: registered new interface driver usb-storage
[    1.811084] i8042: PNP: PS/2 Controller [PNP0303:KBD,PNP0f13:MOU] at 0x60,0x64 irq 1,12
[    1.814434] serio: i8042 KBD port at 0x60,0x64 irq 1
[    1.814935] serio: i8042 AUX port at 0x60,0x64 irq 12
[    1.818016] mousedev: PS/2 mouse device common for all mice
[    1.821849] input: AT Translated Set 2 keyboard as /devices/platform/i8042/serio0/input/input1
[    1.824899] rtc_cmos 00:00: RTC can wake from S4
[    1.829566] rtc_cmos 00:00: rtc core: registered rtc_cmos as rtc0
[    1.831068] rtc_cmos 00:00: alarms up to one day, 114 bytes nvram, hpet irqs
[    1.834502] device-mapper: ioctl: 4.28.0-ioctl (2014-09-17) initialised: dm-devel@redhat.com
[    1.835796] hidraw: raw HID events driver (C) Jiri Kosina
[    1.840713] usbcore: registered new interface driver usbhid
[    1.841325] usbhid: USB HID core driver
[    1.843296] ashmem: initialized
[    1.854023] Netfilter messages via NETLINK v0.30.
[    1.855663] nf_conntrack version 0.5.0 (16048 buckets, 64192 max)
[    1.859317] ctnetlink v0.93: registering with nfnetlink.
[    1.863908] ip_tables: (C) 2000-2006 Netfilter Core Team
[    1.867329] TCP: cubic registered
[    1.867600] Initializing XFRM netlink socket
[    1.870879] NET: Registered protocol family 10
[    1.878957] ip6_tables: (C) 2000-2006 Netfilter Core Team
[    1.881737] sit: IPv6 over IPv4 tunneling driver
[    1.885818] NET: Registered protocol family 17
[    1.887502] 9pnet: Installing 9P2000 support
[    1.888603] Key type dns_resolver registered
[    1.888982] mce: Unable to init device /dev/mcelog (rc: -5)
[    1.890751] Using IPI No-Shortcut mode
[    1.893559] registered taskstats version 1
[    1.898841]   Magic number: 7:690:534
[    1.899820] console [netcon0] enabled
[    1.900334] netconsole: network logging started
[    1.902459] ALSA device list:
[    1.902707]   No soundcards found.
[    1.909900] kworker/u2:0 (822) used greatest stack depth: 7060 bytes left
[    1.951710] ata2.00: ATAPI: QEMU DVD-ROM, 2.2.0, max UDMA/100
[    1.953775] ata2.00: configured for MWDMA2
[    1.963257] scsi 1:0:0:0: CD-ROM            QEMU     QEMU DVD-ROM     2.2. PQ: 0 ANSI: 5
[    1.979583] sr 1:0:0:0: [sr0] scsi3-mmc drive: 4x/4x cd/rw xa/form2 tray
[    1.980352] cdrom: Uniform CD-ROM driver Revision: 3.20
[    1.984871] sr 1:0:0:0: Attached scsi generic sg0 type 5
[    2.429521] input: ImExPS/2 Generic Explorer Mouse as /devices/platform/i8042/serio1/input/input3
[    2.431346] md: Waiting for all devices to be available before autodetect
[    2.432217] md: If you don't use raid, use raid=noautodetect
[    2.434205] md: Autodetecting RAID arrays.
[    2.434205] md: Scanned 0 and added 0 devices.
[    2.434205] md: autorun ...
[    2.434205] md: ... autorun DONE.
[    2.439351] EXT4-fs (vda): couldn't mount as ext3 due to feature incompatibilities
[    2.441356] EXT4-fs (vda): couldn't mount as ext2 due to feature incompatibilities
[    2.458722] EXT4-fs (vda): mounted filesystem with ordered data mode. Opts: (null)
[    2.459580] VFS: Mounted root (ext4 filesystem) readonly on device 253:0.
[    2.462292] devtmpfs: mounted
[    2.496824] Freeing unused kernel memory: 588K (c1a52000 - c1ae5000)
[    2.498431] Write protecting the kernel text: 7668k
[    2.499340] Write protecting the kernel read-only data: 2344k
[    2.595755] init: init first stage started!
[    2.658461] audit: type=1403 audit(1448371846.657:2): policy loaded auid=4294967295 ses=4294967295
[    2.668560] audit: type=1404 audit(1448371846.668:3): enforcing=1 old_enforcing=0 auid=4294967295 ses=4294967295
[    2.671516] init: (Initializing SELinux enforcing took 0.07s.)
[    2.711282] init: init second stage started!
[    2.722767] Switched to clocksource tsc
[    2.737542] init: Running restorecon...
[    2.792615] init: waitpid failed: No child processes
[    2.795002] init: (Loading properties from /default.prop took 0.00s.)
[    2.805479] init: property 'ro.zygote' doesn't exist while expanding '/init.${ro.zygote}.rc'
[    2.806433] init: /init.rc: 10: error while expanding import
[    2.819560] init: /init.environ.rc: 10: export requires 2 arguments
[    2.820265] init: /init.environ.rc: 11: export requires 2 arguments
[    2.821256] init: (Parsing /init.environ.rc took 0.00s.)
[    2.824274] init: (Parsing /init.usb.rc took 0.00s.)
[    2.826419] init: (Parsing /init.qemu.rc took 0.00s.)
[    2.826882] init: (Parsing /init.rc took 0.03s.)
[    2.835543] init: Starting service 'ueventd'...
[    2.839990] init: Waiting for /dev/.coldboot_done...
[    2.852393] ueventd: ueventd started!
[    3.330544] ueventd: Coldboot took 0.46s.
[    3.340376] init: Waiting for /dev/.coldboot_done took 0.50s.
[    3.341391] init: /dev/hw_random not found
[    3.375915] init: write_file: Unable to open '/proc/sys/kernel/hung_task_timeout_secs': No such file or directory
[    3.376868] init: write_file: Unable to open '/proc/cpu/alignment': No such file or directory
[    3.377873] init: write_file: Unable to open '/proc/sys/kernel/sched_latency_ns': No such file or directory
[    3.378822] init: write_file: Unable to open '/proc/sys/kernel/sched_wakeup_granularity_ns': No such file or directory
[    3.379867] init: write_file: Unable to open '/proc/sys/kernel/sched_compat_yield': No such file or directory
[    3.387761] init: write_file: Unable to write to '/dev/cpuctl/cpu.shares': Invalid argument
[    3.388652] init: write_file: Unable to open '/dev/cpuctl/cpu.rt_runtime_us': Permission denied
[    3.389535] init: write_file: Unable to open '/dev/cpuctl/cpu.rt_period_us': Permission denied
[    3.391996] init: write_file: Unable to open '/dev/cpuctl/bg_non_interactive/cpu.rt_runtime_us': Permission denied
[    3.393003] init: write_file: Unable to open '/dev/cpuctl/bg_non_interactive/cpu.rt_period_us': Permission denied
[    3.401957] init: write_file: Unable to open '/proc/sys/abi/swp': No such file or directory
[    3.403205] init: /dev/hw_random not found
[    3.412836] EXT4-fs (vdb): Ignoring removed nomblk_io_submit option
[    3.423081] EXT4-fs (vdb): mounted filesystem with ordered data mode. Opts: errors=remount-ro,nomblk_io_submit
[    3.424361] fs_mgr: check_fs(): mount(/dev/block/vdb,/data,ext4)=0: Success
[    3.436895] fs_mgr: check_fs(): unmount(/data) succeeded
[    3.439527] fs_mgr: Not running /system/bin/e2fsck on /dev/block/vdb (executable not in system image)
[    3.441267] EXT4-fs (vdb): Ignoring removed nomblk_io_submit option
[    3.447772] EXT4-fs (vdb): mounted filesystem with ordered data mode. Opts: nomblk_io_submit,errors=panic
[    3.448820] fs_mgr: __mount(source=/dev/block/vdb,target=/data,type=ext4)=0
[    3.451827] init (1168) used greatest stack depth: 6468 bytes left
[    3.459730] init: (Parsing /system/etc/init/apmanager.rc took 0.00s.)
[    3.461522] init: (Parsing /system/etc/init/avahi-daemon.rc took 0.00s.)
[    3.462869] init: (Parsing /system/etc/init/bluetoothtbd.rc took 0.00s.)
[    3.464715] init: (Parsing /system/etc/init/brillo.rc took 0.00s.)
[    3.466550] init: (Parsing /system/etc/init/crash_reporter.rc took 0.00s.)
[    3.467863] init: (Parsing /system/etc/init/firewalld.rc took 0.00s.)
[    3.469401] init: (Parsing /system/etc/init/keystore.rc took 0.00s.)
[    3.470621] init: (Parsing /system/etc/init/logcatd.rc took 0.00s.)
[    3.472005] init: (Parsing /system/etc/init/logd.rc took 0.00s.)
[    3.473511] init: (Parsing /system/etc/init/mediaserver.rc took 0.00s.)
[    3.474763] init: (Parsing /system/etc/init/metrics_daemon.rc took 0.00s.)
[    3.476417] init: (Parsing /system/etc/init/nativepowerman.rc took 0.00s.)
[    3.477567] init: (Parsing /system/etc/init/perfprofd.rc took 0.00s.)
[    3.478756] init: (Parsing /system/etc/init/sensorservice.rc took 0.00s.)
[    3.480315] init: (Parsing /system/etc/init/servicemanager.rc took 0.00s.)
[    3.481569] init: (Parsing /system/etc/init/shill.rc took 0.00s.)
[    3.482765] init: (Parsing /system/etc/init/tlsdated.rc took 0.00s.)
[    3.483928] init: (Parsing /system/etc/init/update_engine.rc took 0.00s.)
[    3.485368] init: (Parsing /system/etc/init/weaved.rc took 0.00s.)
[    3.486635] init: (Parsing /system/etc/init/webservd.rc took 0.00s.)
[    3.494926] init: Starting service 'logd'...
[    3.497878] EXT4-fs (vda): re-mounted. Opts: (null)
[    3.518603] init: do_start: Service vold not found
[    3.544280] init: Not bootcharting.
[    3.588744] random: logd urandom read with 10 bits of entropy available
[    3.738645] init: cannot find '/system/bin/tzdatacheck' (No such file or directory), disabling 'exec 1 (/system/bin/tzdatacheck)'
[    3.759213] init: (Loading properties from /system/build.prop took 0.00s.)
[    3.759798] init: (Loading properties from /vendor/build.prop took 0.00s.)
[    3.760603] init: (Loading properties from /factory/factory.prop took 0.00s.)
[    3.761525] init: (Loading properties from /data/local.prop took 0.00s.)
[    3.762787] fs_mgr: Cannot open file /fstab.qemu
[    3.764467] init: unable to read fstab /fstab.qemu: No such file or directory
[    3.765754] init: Starting service 'logd-reinit'...
[    3.804286] init: cannot find '/sbin/healthd' (No such file or directory), disabling 'healthd'
[    3.808783] init: Starting service 'wifi-setup'...
[    3.814465] init: Starting service 'dbus'...
[    3.824271] init: Starting service 'servicemanager'...
[    3.844729] init: Starting service 'initnetwork'...
[    3.862574] init: Starting service 'firewall-setup'...
[    3.873907] init: Starting service 'console'...
[    3.890840] init: Starting service 'adbd'...
[    3.912691] init: cannot find '/system/bin/install-recovery.sh' (No such file or directory), disabling 'flash_recovery'
[    3.945878] init: Starting service 'avahi-daemon'...
[    3.958817] init: Starting service 'bluetoothtbd'...
[    3.996929] init: Starting service 'wpa_supplicant'...
[    4.039000] init: Starting service 'keystore'...
[    4.084590] init: Starting service 'media'...
[    4.120796] init: Starting service 'nativepowerman'...
[    4.153992] init: Starting service 'sensorservice'...
[    4.224625] init: Starting service 'crash_reporter'...
[    4.279586] init: Starting service 'crash_sender'...
[    4.335429] init: Starting service 'metrics_daemon'...
[    4.378867] init: Starting service 'perfprofd'...
[    4.435754] init: Starting service 'shill'...
[    4.502127] init: Starting service 'tlsdated'...
[    4.566273] init: Starting service 'update_engine'...
[    4.638470] init: Starting service 'weaved'...
[    4.709987] init: Starting service 'webservd'...
[    4.843590] init: Service 'logd-reinit' (pid 1177) exited with status 145
[    5.047490] init: write_file: Unable to open '/sys/class/android_usb/android0/enable': No such file or directory
[    5.160479] init: write_file: Unable to open '/sys/class/android_usb/android0/idVendor': No such file or directory
[    5.254434] init: write_file: Unable to open '/sys/class/android_usb/android0/idProduct': No such file or directory
[    5.331494] init: write_file: Unable to open '/sys/class/android_usb/android0/functions': No such file or directory
[    5.435431] init: write_file: Unable to open '/sys/class/android_usb/android0/enable': No such file or directory
[    7.270465] init: Service 'crash_reporter' (pid 1192) exited with status 0
[    7.605414] iptables (1203) used greatest stack depth: 6268 bytes left
[    7.759352] audit: type=1400 audit(1448371851.757:4): avc:  denied  { sys_module } for  pid=1204 comm="ifconfig" capability=16  scontext=u:r:brillo_setup:s0 tcontext=u:r:brillo_setup:s0 tclass=capability permissive=0
[    9.131357] init: Starting service 'apmanager'...
[    9.284642] init.wifi-setup (1178) used greatest stack depth: 6240 bytes left
[    9.285892] init: Service 'wifi-setup' (pid 1178) exited with status 0
[   11.457417] audit: type=1400 audit(1448371853.965:5): avc:  denied  { dac_override } for  pid=1181 comm="initnetwork.sh" capability=1  scontext=u:r:brillo_setup:s0 tcontext=u:r:brillo_setup:s0 tclass=capability permissive=0
[   11.665465] init: Service 'initnetwork' (pid 1181) exited with status 126
[   13.158430] logd.auditd: start
[   13.361299] logd.klogd: 13158841665
[   13.697620] capability: warning: `wpa_supplicant' uses 32-bit capabilities (legacy support in use)
[   14.055736] tlsdate-helper (1231) used greatest stack depth: 6092 bytes left
[   21.170392] init: Starting service 'firewalld'...
[   21.192285] init: Service 'firewall-setup' (pid 1182) exited with status 0
底下是我在這個模擬器的Terminal裏面下的一些指令過程
$ su
# ls
acct         etc               init.usb.rc       sbin             sys
cache        file_contexts.bin lost+found        sdcard           system
config       fstab.device      mnt               seapp_contexts   ueventd.rc
d            init              oem               selinux_version
data         init.environ.rc   proc              sepolicy
default.prop init.qemu.rc      property_contexts service_contexts
dev          init.rc           root              storage
# df -h
Filesystem     Size  Used Avail Use% Mounted on
/dev/root      726M   96M  630M  14% /
tmpfs          502M   20K  502M   1% /dev
none           502M   12K  502M   1% /sys/fs/cgroup
tmpfs          502M     0  502M   0% /mnt
/dev/block/vdb 533M   31M  502M   6% /data
tmpfs          502M     0  502M   0% /storage
# free -m
                total        used        free      shared     buffers
Mem:             1003          76         927           0           1
-/+ buffers/cache:             75         928
Swap:               0           0           0
# ps
USER      PID   PPID  VSIZE  RSS   WCHAN            PC  NAME
root      1     0     3304   1560     ep_poll 08134545 S /init
root      2     0     0      0       kthreadd 00000000 S kthreadd
root      3     2     0      0     smpboot_th 00000000 S ksoftirqd/0
root      4     2     0      0     worker_thr 00000000 S kworker/0:0
root      5     2     0      0     worker_thr 00000000 S kworker/0:0H
root      6     2     0      0     worker_thr 00000000 S kworker/u2:0
root      7     2     0      0     rcu_gp_kth 00000000 S rcu_sched
root      8     2     0      0     rcu_gp_kth 00000000 S rcu_bh
root      9     2     0      0     smpboot_th 00000000 S migration/0
root      10    2     0      0     rescuer_th 00000000 S khelper
root      11    2     0      0      devtmpfsd 00000000 S kdevtmpfs
root      12    2     0      0     rescuer_th 00000000 S netns
root      13    2     0      0     worker_thr 00000000 S kworker/u2:1
root      14    2     0      0     rescuer_th 00000000 S perf
root      45    2     0      0     rescuer_th 00000000 S writeback
root      47    2     0      0     rescuer_th 00000000 S crypto
root      49    2     0      0     rescuer_th 00000000 S bioset
root      50    2     0      0     rescuer_th 00000000 S kblockd
root      134   2     0      0     rescuer_th 00000000 S ata_sff
root      138   2     0      0     rescuer_th 00000000 S md
root      145   2     0      0     worker_thr 00000000 S kworker/0:1
root      146   2     0      0     rescuer_th 00000000 S cfg80211
root      250   2     0      0     rescuer_th 00000000 S rpciod
root      275   2     0      0         kswapd 00000000 S kswapd0
root      293   2     0      0     fsnotify_m 00000000 S fsnotify_mark
root      302   2     0      0     rescuer_th 00000000 S nfsiod
root      337   2     0      0     rescuer_th 00000000 S acpi_thermal_pm
root      339   2     0      0     worker_thr 00000000 S kworker/u2:2
root      753   2     0      0     scsi_error 00000000 S scsi_eh_0
root      755   2     0      0     rescuer_th 00000000 S scsi_tmf_0
root      757   2     0      0     scsi_error 00000000 S scsi_eh_1
root      759   2     0      0     rescuer_th 00000000 S scsi_tmf_1
root      761   2     0      0     worker_thr 00000000 S kworker/u2:3
root      771   2     0      0     rescuer_th 00000000 S kpsmoused
root      780   2     0      0     rescuer_th 00000000 S binder
root      786   2     0      0     worker_thr 00000000 S kworker/0:2
root      798   2     0      0     rescuer_th 00000000 S ipv6_addrconf
root      810   2     0      0     rescuer_th 00000000 S deferwq
root      812   2     0      0     worker_thr 00000000 S kworker/u2:4
root      887   2     0      0     worker_thr 00000000 S kworker/0:3
root      898   2     0      0     kjournald2 00000000 S jbd2/vda-8
root      899   2     0      0     rescuer_th 00000000 S ext4-rsv-conver
root      902   1     3372   1476  poll_sched 08134650 S /sbin/ueventd
root      1172  2     0      0     worker_thr 00000000 S kworker/0:1H
root      1173  2     0      0     kjournald2 00000000 S jbd2/vdb-8
root      1174  2     0      0     rescuer_th 00000000 S ext4-rsv-conver
logd      1175  1     11332  2608  sigsuspend b7619ef1 S /system/bin/logd
dbus      1179  1     5676   2984  poll_sched b7538cd0 S /system/bin/dbus-daemon
system    1180  1     4604   2092  binder_thr b749dbd6 S /system/bin/servicemanager
shell     1183  1     4452   2280  sigsuspend b760bef1 S /system/bin/sh
root      1184  1     3640   692   poll_sched 0810f250 S /sbin/adbd
system    1185  1     5324   2552  poll_sched b7543cd0 S avahi-daemon: running [linux.local]
bluetooth 1186  1     38728  8756  futex_wait b73a48b2 S /system/bin/bluetoothtbd
system    1187  1     30356  9992  poll_sched b70cfd55 S /system/bin/wpa_supplicant
keystore  1188  1     28860  8636  binder_thr b7380bd6 S /system/bin/keystore
media     1189  1     71472  15108 binder_thr b65edbd6 S /system/bin/mediaserver
system    1190  1     28488  8728     ep_poll b5ccb9d5 S /system/bin/nativepowerman
root      1191  1     30168  8732  binder_thr b5dc5bd6 S /system/bin/sensorservice
root      1193  1     4452   2248  poll_sched b753ad55 S /system/bin/sh
system    1194  1     33164  12312    ep_poll b6fe49d5 S /system/bin/metrics_daemon
root      1195  1     4688   2096  hrtimer_na b7642e91 S /system/xbin/perfprofd
root      1196  1     10684  7308     ep_poll b722b9d5 S /system/bin/shill
tlsdate   1197  1     6200   3272     ep_poll b73959d5 S /system/bin/tlsdated
root      1198  1     11412  7352     ep_poll b6cb89d5 S /system/bin/update_engine
system    1200  1     34092  13348    ep_poll b6b209d5 S /system/bin/weaved
system    1201  1     32944  12784    ep_poll b586a9d5 S /system/bin/webservd
root      1206  1197  6200   356    pipe_wait b7397096 S /system/bin/tlsdated
system    1212  1     8720   5828     ep_poll b71479d5 S /system/bin/apmanager
root      1221  2     0      0     kauditd_th 00000000 S kauditd
system    1255  1     7524   5356     ep_poll b732c9d5 S /system/bin/firewalld
root      1267  1183  4452   2332  sigsuspend b75dbef1 S /system/bin/sh
root      1273  1267  4660   2184           0 b74e6096 R ps
# ifconfig -a
sit0      Link encap:IPv6-in-IPv4
          NOARP  MTU:1480  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:0 TX bytes:0

lo        Link encap:Local Loopback
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope: Host
          UP LOOPBACK RUNNING  MTU:65536  Metric:1
          RX packets:64 errors:0 dropped:0 overruns:0 frame:0
          TX packets:64 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:4480 TX bytes:4480
$ reboot -p
[ 1363.786815] SysRq : Emergency Remount R/O
[ 1363.797520] EXT4-fs (vdb): re-mounted. Opts: (null)
[ 1363.802681] Emergency Remount complete
[ 1364.902612] ACPI: Preparing to enter system sleep state S5
[ 1364.905890] reboot: Power down
過程中遇到過的問題
編譯Java相關程式必需使用1.7x版本以上, 否則會出現下面的訊息
Checking build tools versions...
************************************************************
You are attempting to build with the incorrect version
of java.

Your version is: java version "1.6.0_45" Java(TM) SE Runtime Environment (build 1.6.0_45-b06) Java HotSpot(TM) 64-Bit Server VM (build 20.45-b01, mixed mode).
The required version is: "1.7.x"

Please follow the machine setup instructions at
    https://source.android.com/source/initializing.html
************************************************************
build/core/main.mk:203: *** stop.
make: *** [out/build-brilloemulator_x86_64.ninja] Error 1
解決方法:
sudo apt-get install openjdk-7-jdk icedtea-7-plugin
sudo update-java-alternatives -s java-1.7.0-openjdk-amd64
底下有一份Dipak Shelke Patil的PowerPoint可以參考^^
可以看一下這個地方https://android.googlesource.com/brillo/manifest/

目前有的branch有底下幾個
(1)master
(2)brillo-m7-dev
(3)brillo-m7-mr-dev
(4)brillo-m7-release

一個小故事讓我們明白資金流通的意義

“又是炎熱小鎮慵懶的一天。太陽高掛,街道無人,每個人都債台高築,靠信用度日。這時,從外地來了一位有錢的旅客,他進了一家旅館,拿出一張1000 元鈔票放在櫃檯,說想先看看房間,挑一間合適的過夜,就在此人上樓的時候---- 店主抓了這張1000 元鈔,跑到隔壁屠戶那裡支付了他欠的肉錢...