Chinaunix首页 | 论坛 | 博客

OS

  • 博客访问: 2280651
  • 博文数量: 691
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 2660
  • 用 户 组: 普通用户
  • 注册时间: 2014-04-05 12:49
个人简介

不浮躁

文章分类

全部博文(691)

文章存档

2019年(1)

2017年(12)

2016年(99)

2015年(207)

2014年(372)

分类: Android平台

2015-11-10 08:49:48

SDK preparation

 

Set the system to have at least 1.5G RAM & large disk space.

 

1.      Download the SDK

 

yum/apt-get install curl

$ curl >~/bin/repo

$ chmod a+x ~/bin/repo

$ mkdir working-directory-name
$ cd working-directory-name
$ repo init -u git://android.git.kernel.org/platform/manifest.git (the latest), or

../bin/repo init -u git://android.git.kernel.org/platform/manifest.git -b android-1.5 => get certain branch

$ repo sync

 

2.      Install JDK and apache

 (JRE alone is not sufficient, download from Java Website)

 1.6.5 or later for Linux and Mac, 1.7 or later for Windows

 

revise ~/.bashrc

export JAVA_HOME=/home/xxx/Download/jdk1.5.0_14
export ANT_HOME=/home/xxx/ Download /apache-ant-1.7.0

export ANDROID_SDK=/home/xxx/android/xxx
export PATH=$ ANDROID_SDK/tools: $JAVA_HOME/bin:$ANT_HOME/bin:$PATH

 

Note: 1.6.0 JDK not supported in Android SDK compilation

 

3.      build

> make

The out folder include the output target file system

 

 

 Note: Set the Memory big enough. Otherwise, the src could not be compiled.

 

Kernel Preparation

 

1.      Get the kernel code

 

mkdir ~/android-kernel 
cd ~/android-kernel

> git clone git://android.git.kernel.org/kernel/common 
> cd common 
> git branch goldfish origin/android-goldfish-2.6.27 
> git checkout goldfish

 

Note: Goldfish platform emulates ARM926ejs, we only need to revise the .config for versatile purpose.

 

2.      Set up cross compiler

 

look into prebuilt folder for toolchain

$export PATH=$PATH:/home/vadmin/android-source/prebuilt/linux-x86/toolchain/arm-eabi-4.2.1/bin

$export CROSS_COMPILE=arm-eabi-

$export ARCH=arm

 

Note: some suggest arm2007q3 in .

 

3.      revise .config

 

> make menuconfig,

enable nfs, device drivers (serial driver, network driver, display etc.), networking for bootable kernel.

 

Following options are from others' blogs,

 

Must have:

 

CONFIG_AEABI=y   

        CONFIG_SHMEM=y   

        CONFIG_ASHMEM=y

        CONFIG_ARM_THUMB=y

        CONFIG_ANDROID_BINDER_IPC=y

        CONFIG_ANDROID_LOGGER=y

       

Options:

        CONFIG_ANDROID_POWER=y

        CONFIG_ANDROID_POWER_STAT=y

        CONFIG_ANDROID_POWER_ALARM=y

        CONFIG_ANDROID_RAM_CONSOLE=y

        CONFIG_ANDROID_TIMED_GPIO=y No such

        CONFIG_ANDROID_PARANOID_NETWORK=y

 

disable those with Goldfish:

 

Device Drivers  ---> Character devices  ---> < > Goldfish TTY Driver

Device Drivers  ---> Power supply class support  ---> < >   Goldfish battery driver (NEW)

Device Drivers  ---> Real Time Clock  ---> < >   GOLDFISH (NEW)

Device Drivers  ---> Graphics support  ---> Support for frame buffer devices  ---> < >   Goldfish Framebuffer

 

Select drivers related:

 

Device Drivers  ---> Graphics support  ---> Support for frame buffer devices  ---> <*>   LCD framebuffer support (ARM PL011)

Device Drivers  ---> Graphics support  ---> [*] Bootup logo  ---> [*]   Standard black and white Linux logo

Device Drivers  ---> Graphics support  ---> [*] Bootup logo  ---> [*]   Standard 16-color Linux logo

Device Drivers  ---> Graphics support  ---> [*] Bootup logo  ---> [*]   Standard 224-color Linux logo

 

Select Android Kernel options

Kernel Features  ---> [*] Use the ARM EABI to compile the kernel

General setup  ---> [*] Use full shmem filesystem

General setup  ---> [*] Enable Android's Shared Memory Subsystem

System Type  ---> [*] Support Thumb user binaries

Device Drivers  ---> Android  ---> [*] Android log driver

Device Drivers  ---> Android  ---> <*> Binder IPC Driver

 

Optionally select:

Device Drivers  ---> Android  ---> [*] RAM buffer console

Device Drivers  ---> Android  ---> [*] Android timed gpio driver

Device Drivers  ---> Android  ---> [*] Only allow certain groups to create sockets

其余CONFIG选项,如系统支持请一并选择

CONFIG_ANDROID_POWER =y

CONFIG_ANDROID_POWER_STAT =y

CONFIG_ANDROID_POWER_ALARM =y

(可以在Kconfig文件中查找ANDROID_POWER等字段进行选择,或者直接修改.config文件)

 

4.      Compile

 

- compile uboot

make clean; make versatile_config; make

 

- compile kernel

make uImage  

File System Preparation

 

 

1.      /dev add ‘null’ and ‘console’

mknod –m 660 null c 1 3

mknod –m 660 console c 5 1

 

 

2.      setenv bootargs ip=dhcp root=/dev/nfs nfsroot=x.x.x.x:/export/root console=ttyAMA0,115200 init=/init

 

if you want to get info from ramdisk.img: (no need actually)

#gunzip ramdisk.img.gz

#cpio -i -F ../ramdisk.img //add new folder and jump in

  

 

3.      删除nfs_root/init.rc,去掉除mount tmpfs tmpfs /sqlite_stmt_journals size=4m之外所有的mount命令

 

Some Problems:

·         NFS: can not open root device “nfs” or unknown-block(0, 255)

s: menuconfig enable “nfs root”

 

·         IP-Config: No network device available

enable smc-xxx network device driver

 

·         rpcbind:server xxx not responding, timed out

Server side: /etc/hosts.allow, > echo “ALL:  : ALLOW” >> /etc/hosts.allow

chmod u+x /etc/rc.d/rc.nfsd

 

0.      拷贝包中的system目录到nfs_root/system, data目录到nfs_root/data, root目录到nfs_root/

out/target/product/generic一些文件:
ramdisk.img、system.img、userdata.img、 system、 data、root

 

 

> make goldfish_defconfig



编译模拟器内核的时候要切换到gold fish分支

git branch goldfish origin/android-goldfish-2.6.27 

git checkout goldfish

make zImage


真实机器要切换到android-2.6.27分支,然后make uImage(用于uboot 直接goto...)

阅读(974) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~