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
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]#
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]#
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系统就启动了。
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
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(镜像文件)
下载:Android4.2.2.rar