作者:Sam(甄峰) sam_code@hotmail.com
Sam最近需要在TCC8900 Kernel上添加一个模块,且需要以builtin方式加入。过程记录如下:
1. Kernel 打补丁:
Telechips提供了Linux Kernel source 以及补丁。
其中Kernel source code是www.kernel.org上标准版本(for x86). 所以需要打上ARM补丁。
Sam先查看patch文件,其中包含如下语句:
diff -uNr linux-2.6.28/Makefile linux-2.6.28-tcc/Makefile
判断出如果使用-p0的话,linux-2.6.28与patchFile应该是同级目录。
#patch -p0 < patch-linux-2.6.28-100305-R0180B2882
patching file linux-2.6.28/Makefile
patching file linux-2.6.28/arch/arm/Kconfig
patching file linux-2.6.28/arch/arm/Makefile
patching file linux-2.6.28/arch/arm/configs/tcc8900_defconfig
patching file linux-2.6.28/arch/arm/configs/tcc8900_wifi_defconfig
patching file linux-2.6.28/arch/arm/include/asm/mach/map.h
patching file linux-2.6.28/arch/arm/include/asm/mach/time.h
patching file linux-2.6.28/arch/arm/kernel/head.S
patching file linux-2.6.28/arch/arm/kernel/irq.c
patching file linux-2.6.28/arch/arm/kernel/setup.c
patching file linux-2.6.28/arch/arm/kernel/time.c
.....
以上则是已经打好的patch.
另外,Telechips要求覆盖USB下2个文件。
#cp tcc_usb_phy.c /home/sam/work1/current/TCC8900/Kernel/Kernel_Patch_Sam/current_Kernel/linux-2.6.28/drivers/usb/dwc_otg/
#cp ohci-tcc.c /home/sam/work1/current/TCC8900/Kernel/Kernel_Patch_Sam/current_Kernel/linux-2.6.28/drivers/usb/host/
Sam打开Makefile。发现Cross_compile已经设置完毕。
此时Kernel已经全部准备好了。Sam 编译之。
2. 编译Kernel:
#make clean
#make tcc8900_defconfig
使用./arch/arm/configs/tcc8900_defconfig
#make menuconfig
#make
3. 处理Kernel Image.
首先将Telechips提供的util目录放置到对应目录下。
之后运行Kernel根目录下的./tcc_mkrd.sh
#./tcc_mkrd.sh
======================================================
[Telechips TCC8900]
[MAKE] linux.rom
0+1 records in
1+0 records out
4194304 bytes (4.2 MB) copied, 0.0143234 s, 293 MB/s
[MARK] CRC & ramdisk size 16 Mbyte
image length: [0x00400000] (4194304 byte)
second crc: [0xCDDEB1DE]
first crc: [0x5DA398EB]
======================================================
表示成功。在kernel根目录下生成linux.rom 。
4. 烧入Kernel;
将生成的linux.rom与tccbox放在同一目录下。mount 到板子上。
#./tccbox firmware_update -f linux.rom -t kernel