00. 目錄
文章目錄
00. 目錄01. 編譯核心02. 安裝dnw工具03. 安裝Android_tools04. 燒寫Android系統05. 問題解決06. 附錄
01. 編譯核心
1.1 解壓核心源碼
[root@itcast tools]# tar -xjvf linux-3.5_analyse.tar.bz2
1.2 配置核心
[root@itcast linux-3.5_analyse]# make clean
[root@itcast linux-3.5_analyse]# cp tiny4412_android_defconfig .config
[root@itcast linux-3.5_analyse]#
1.3 關閉TtrustZone
[root@itcast linux-3.5_analyse]# vim .config +485
注釋485行
485 #CONFIG_ARM_TRUSTZONE is not set #=y
1.4 編譯源碼
[root@itcast linux-3.5_analyse]# make -j4
.....
CC crypto/ansi_cprng.mod.o
CC drivers/scsi/scsi_wait_scan.mod.o
CC drivers/char/tiny4412_hello_module.mod.o
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head.o
GZIP arch/arm/boot/compressed/piggy.gzip
CC arch/arm/boot/compressed/misc.o
LD [M] drivers/char/tiny4412_hello_module.ko
LD [M] crypto/ansi_cprng.ko
CC arch/arm/boot/compressed/decompress.o
LD [M] drivers/scsi/scsi_wait_scan.ko
CC arch/arm/boot/compressed/string.o
SHIPPED arch/arm/boot/compressed/lib1funcs.S
SHIPPED arch/arm/boot/compressed/ashldi3.S
AS arch/arm/boot/compressed/lib1funcs.o
AS arch/arm/boot/compressed/ashldi3.o
AS arch/arm/boot/compressed/piggy.gzip.o
LD arch/arm/boot/compressed/vmlinux
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
02. 安裝dnw工具
2.1 解壓dnw工具
[root@itcast tools]# tar -xzvf dnw-linux.tar.gz
2.2 編譯
[root@itcast tools]# cd dnw-linux
[root@itcast dnw-linux]# make
2.3 安裝
[root@itcast dnw-linux]# make install
make -C /lib/modules/`uname -r`/build M=`pwd`/src/driver modules
make[1]: Entering directory `/usr/src/kernels/2.6.32-431.el6.x86_64'
Building modules, stage 2.
MODPOST 1 modules
make[1]: Leaving directory `/usr/src/kernels/2.6.32-431.el6.x86_64'
make -C src/dnw
make[1]: Entering directory `/home/tools/dnw-linux/src/dnw'
make[1]: “dnw”是最新的。
make[1]: Leaving directory `/home/tools/dnw-linux/src/dnw'
make -C src/dnw install
make[1]: Entering directory `/home/tools/dnw-linux/src/dnw'
cp dnw /usr/bin
make[1]: Leaving directory `/home/tools/dnw-linux/src/dnw'
make -C /lib/modules/`uname -r`/build M=`pwd`/src/driver modules_install
make[1]: Entering directory `/usr/src/kernels/2.6.32-431.el6.x86_64'
INSTALL /home/tools/dnw-linux/src/driver/secbulk.ko
DEPMOD 2.6.32-431.el6.x86_64
make[1]: Leaving directory `/usr/src/kernels/2.6.32-431.el6.x86_64'
cp dnw.rules /etc/udev/rules.d/
depmod
[root@itcast dnw-linux]#
2.4 測試
[root@itcast dnw-linux]# dnw
Usage: dwn [-a load_addr] <filename>
Default load address: 0x57e00000
[root@itcast dnw-linux]#
03. 安裝Android_tools
3.1 解壓
[root@itcast tools]# tar -xzvf android_tools.tgz
usr/local/bin/fastboot
usr/local/bin/adb
usr/local/bin/minigzip
usr/local/bin/mkbootfs
usr/local/bin/mkimage
[root@itcast tools]#
3.2 将可執行檔案拷貝到/usr/local/bin目錄中
[root@itcast tools]# cd usr/local/bin/
[root@itcast bin]# ls
adb fastboot minigzip mkbootfs mkimage
[root@itcast bin]# cp * /usr/local/bin/
[root@itcast bin]#
04. 燒寫Android系統
4.1 檢視分區
# minicom端
DengJin # fdisk -p 0
partion # size(MB) block start # block count partition_Id
DengJin #
4.2 分區
# minicom
DengJin # fdisk -c 0 320 806 518
fdisk is completed
partion # size(MB) block start # block count partition_Id
1 5788 3521760 11855580 0x0C
2 326 136620 667920 0x83
3 807 804540 1654620 0x83
4 518 2459160 1062600 0x83
DengJin #
4.3 格式化分區
# minicom
DengJin # fatformat mmc 0:1
Start format MMC&d partition&d ...
Partition1: Start Address(0x35bce0), Size(0xb4e6dc)
size checking ...
Under 8G
write FAT info: 32
Fat size : 0x2d39
Erase FAT region................................................................................
Partition1 format complete.
DengJin #
4.4 燒寫Android鏡像
images\Superboot4412.bin Bootloader
images\Android\zImage Android 核心
images\Android\ramdisk-u.img Android 根分區映象
images\Android\system.img Andorid 系統分區映象
image\Android\userdata.img Andorid Data 分區映象
images\FriendlyARM.ini 系統燒寫配置檔案
# 在minicom中:
DengJin #fastboot
燒寫核心
[root@itcast boot]# pwd
/home/tools/linux-3.5_analyse/arch/arm/boot
[root@itcast boot]# ls
bootp compressed dts Image install.sh Makefile zImage
[root@itcast boot]# fastboot flash kernel zImage
sending 'kernel' (4293 KB)...
OKAY [ 1.078s]
writing 'kernel'...
OKAY [ 0.376s]
finished. total time: 1.530s
[root@itcast boot]#
格式化data分區和cache分區
[root@itcast boot]# fastboot -w
erasing 'userdata'...
OKAY [ 9.364s]
formatting 'userdata' partition...
Erase successful, but not automatically formatting.
File system type not supported.
OKAY [ 0.006s]
erasing 'cache'...
OKAY [ 6.982s]
formatting 'cache' partition...
Erase successful, but not automatically formatting.
File system type not supported.
OKAY [ 0.006s]
finished. total time: 16.357s
[root@itcast boot]#
燒寫根分區映像
[root@itcast Android]# fastboot flash ramdisk ramdisk-u.img
sending 'ramdisk' (703 KB)...
OKAY [ 0.185s]
writing 'ramdisk'...
OKAY [ 0.055s]
finished. total time: 0.239s
[root@itcast Android]#
燒寫系統分區
[root@itcast Android]# fastboot flash system system.img
# 燒寫時間比較長,大約需要幾分鐘。
設定啟動參數
DengJin # set bootargs console=ttySAC0,115200n8 androidboot.console=ttySAC0 lcd=S70 ctp=2
DengJin # save
Saving Environment to SMDK bootable device...
done
DengJin # reset
uboot啟動設定參數顯示如下:
DengJin # printenv
baudrate=115200
bootargs=console=ttySAC0,115200n8 androidboot.console=ttySAC0 lcd=S70 ctp=2
bootcmd=movi read kernel 0 40008000;movi read rootfs 0 41000000 400000;
bootm 40008000 41000000
bootdelay=3
ethaddr=00:40:5c:26:0a:5b
gatewayip=192.168.0.1
ipaddr=192.168.0.20
netmask=255.255.255.0
serverip=192.168.0.10
Environment size: 705/16380 bytes
DengJin #
等會Android系統就啟動了。
05. 問題解決
6.1 問題一:fastboot執行失敗,動态庫找不到
[root@itcast bin]# fastboot
fastboot: error while loading shared libraries: libstdc++.so.6:
cannot open shared object file: No such file or directory
解決辦法
[root@itcast bin]# yum install libstdc++.i686
06. 附錄
6.1 Linux核心
下載下傳:linux-3.5_analyse.tar.bz2
6.2 dnw工具
下載下傳:dnw-linux.tar.bz2
6.3 Android Tools
下載下傳:android_tools.tgz
6.4 Android鏡像
下載下傳:Android.rar
6.5 Android4.2.2.rar(鏡像檔案)