Linux Kernel Porting #2, 基本流程與方法
Copyright (c) 2005
Last date: 2005/01/17
在將 Linux kernel porting 到其它的 ARM 平臺之前, 必須先取得標準 Linux kernel,然後再做 ARM Linux patch。
下載以下檔案:
ftp://ftp.arm.linux.org.uk/pub/armlinux/source/kernel-patches/v2.4/patch-2.4.26-vrs1.gz
ftp://ftp.nsysu.edu.tw/Linux/Kernel/linux/kernel/v2.4/linux-2.4.26.tar.bz2
安裝 Linux kernel 與 patch:
# bzip2 -dc linux-2.4.26.tar.bz2 | tar xf -
# mv linux-2.4.26 linux-2.4.26-vrs1
# cd linux-2.4.26-vrs1
# gzip -dc ../patch-2.4.26-vrs1.gz | patch -p1 -
本文以 KS8695 板子為實例,說明如何將 kernel 2.4.26 (vrs1) porting 到其它的 ARM 平臺。對於所有的 ARM 平臺而言,我們可以歸納出 3 個基本的 porting 流程如下:
1. 登錄一個 Machine ID
2. 編輯 config.in 設定檔與 Makefile.
linux/arch/arm/config.in
arch/arm/Makefile
arch/arm/boot/Makefile
arch/arm/mach-XXX/Makefile
3. 修改原始檔如下.
arch/arm/kernel/entry-armv.S
arch/arm/kernel/debug-armv.S
arch/arm/mach-XXX/arch.c
arch/arm/mach-XXX/irq.c
arch/arm/mach-XXX/mm.c
include/asm/arch/dma.h
include/asm/arch/hardware.h
include/asm/arch/io.h
include/asm/arch/irq.h
include/asm/arch/irqs.h
include/asm/arch/keyboard.h
include/asm/arch/memory.h
include/asm/arch/param.h
include/asm/arch/system.h
include/asm/arch/timex.h
include/asm/arch/uncompress.h
include/asm/arch/vmalloc.h
以上是 porting Linux 到其它 ARM 平臺的大原則與方法。
--jollen