开发板:ok6410-A
注:1)、外网网卡用的NAT方式连接,用来在window客户端用putty连接虚拟机和更新工具连上网用;
2)、第二块儿网卡用的桥接方式,用来连接开发板;
3)、串口用来在虚拟机里使用minicom连接开发板。
交叉工具:arm-linux-4.4.1.tar.gz
Minicom连接开发板:
Putty连接好虚拟机:
结束后内核能正常启动并挂载NFS系统:
接下来开始。。哈哈 ,此过程痛并快乐着。。。准备好了么?gogogo。。。。
更新最新源代码,并创建新实验分支:
[root@localhost linux-2.6]# git fetch
remote: Counting objects: 270, done.
remote: Compressing objects: 100% (117/117), done.
remote: Total 120 (delta 87), reused 0 (delta 0)
Receiving objects: 100% (120/120), 26.10 KiB, done.
Resolving deltas: 100% (87/87), completed with 54 local objects.
From git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6
371de6e..89307ba master -> origin/master
[root@localhost linux-2.6]# git status
# On branch zkf
nothing to commit (working directory clean)
[root@localhost linux-2.6]# git checkout -b test
Switched to a new branch 'test'
[root@localhost linux-2.6]# ls
arch Documentation init lib README sound
block drivers ipc MAINTAINERS REPORTING-BUGS tools
COPYING firmware Kbuild Makefile samples usr
CREDITS fs Kconfig mm scripts virt
crypto include kernel net security
[root@localhost linux-2.6]#
新添加一个说明文件,说明一下修改源代码遵循GPL版权
[root@localhost linux-2.6]# vi ok6410_readme.txt
[root@localhost linux-2.6]# git add ok6410_readme.txt
[root@localhost linux-2.6]# git commit –a
[test 97a3a32] add note
1 files changed, 3 insertions(+), 0 deletions(-)
create mode 100644 ok6410_readme.txt
[root@localhost linux-2.6]#
注释掉默认的并新添加:
export KBUILD_BUILDHOST := $(SUBARCH)
#ARCH = $(SUBARCH)
ARCH = arm
#CROSS_COMPILE = $(CONFIG_CROSS_COMPILE:"%"=%)
CROSS_COMPILE = arm-linux
# Architecture as present in compile.h
(复制现有最相近的板子的)
[root@localhost mach-s3c64xx]# ls
clock.c Kconfig mach-smartq.c setup-i2c0.c
cpu.c mach-anw6410.c mach-smartq.h setup-i2c1.c
dev-audio.c mach-crag6410.c mach-smdk6400.c setup-ide.c
dev-spi.c mach-crag6410-module.c mach-smdk6410.c setup-keypad.c
dev-uart.c mach-hmt.c Makefile setup-sdhci.c
dma.c mach-mini6410.c Makefile.boot setup-sdhci-gpio.c
include mach-ncp.c pm.c sleep.S
irq.c mach-real6410.c s3c6400.c
irq-eint.c mach-smartq5.c s3c6410.c
irq-pm.c mach-smartq7.c setup-fb-24bpp.c
[root@localhost mach-s3c64xx]# pwd
/home/linux-2.6/arch/arm/mach-s3c64xx
其中的mach-mini6410.c 板子的配置与ok6410比较相似
[root@localhost mach-s3c64xx]# cp mach-mini6410.c mach-ok6410.c
修改mach-ok6410.c
/* linux/arch/arm/mach-s3c64xx/mach-ok6410.c
将文件中所有mini6410替换为ok6410
:%s/mini6410/ok6410/g
注意需要将大写的MINI6410也要替换掉(其中大部分都是输出信息,有一处与机器码有关的要更改)
MACHINE_START(MINI6410, "MINI6410")
/* Maintainer: Darius Augulis */
.atag_offset = 0x100,
.init_irq = s3c6410_init_irq,
.map_io = ok6410_map_io,
.init_machine = ok6410_machine_init,
.timer = &s3c24xx_timer,
此文件中包含NAND的分区信息可以根据自己的需求修改:
/*modify by zkf
//static struct mtd_partition ok6410_nand_part[] = {
// [0] = {
// .name = "uboot",
// .size = SZ_1M,
// .offset = 0,
// },
// [1] = {
//