————————————————————————————2440 上内核3.4.2移植————————————————————————
PS:因wifi项目中无wifi驱动,需新内核。
1.首先在内核中查找已有的默认配置文件
find -name "*defconfig"
[root@localhost arm]# cd arch/arm/
[root@localhost arm]# find -name "*defconfig"
找到一个s3c2410_defconfig。
./configs/at91rm9200_defconfig
./configs/omap1_defconfig
./configs/s3c2410_defconfig
然后就以s3c2410_defconfig为基础编译内核。
修改Makefile文件。
到顶层目录vi Makefile
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
修改为:
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
wq退出
make s3c2410_defconfig
HOSTLD scripts/kconfig/conf
#
# configuration written to .config
#
生成了一个.config文件。
vi .config
#
# Automatically generated file; DO NOT EDIT.
# Linux/arm 3.4.2 Kernel Configuration
#
CONFIG_ARM=y
CONFIG_HAVE_PWM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_ARCH_USES_GETTIMEOFFSET=y
CONFIG_KTIME_SCALAR=y
CONFIG_HAVE_PROC_CPU=y
CONFIG_NO_IOPORT=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_ARCH_HAS_CPUFREQ=y
CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
.config 文件里是前一个命令生成的一些配置项。
1.1将arch/arm/mach-s3c24xx/mach-smdk2440.c中的:s3c24xx_init_clocks(16934400);
修改为:
s3c24xx_init_clocks(12000000);
vi arch/arm/mach-s3c24xx/mach-smdk2440.c
2.现在试着make zImage 看看能不能支持开发板。
make zImage
arch/arm/mm/tlb-v4wbi.S: Assembler messages:
arch/arm/mm/tlb-v4wbi.S:64: Error: too many positional arguments
但出现了错误,编译没有通过。上网没有查到解决问题。
那试试换一下交叉编译连,是不是交叉编译连太老了?
[root@localhost linux-3.4.2]# arm-linux-gcc -v
Reading specs from /home/hyx/gcc-3.4.5-glibc-2.3.6/bin/../lib/gcc/arm-linux/3.4.5/specs
Configured with: /work/tools/create_crosstools/crosstool-0.43/build/arm-linux/gcc-3.4.5-glibc-2.3.6/gcc-3.4.5/configure --target=arm-linux --host=i686-host_pc-linux-gnu
--prefix=/work/tools/gcc-3.4.5-glibc-2.3.6 --with-float=soft --with-headers=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux/include --with-local-prefix=/work/tools/gcc-3.4.5-glibc-2.3.6/arm-linux --disable-nls --enable-threads=posix --enable-symvers=gnu --enable-__cxa_atexit
--enable-languages=c,c++ --enable-shared --enable-c99 --enable-long-long
Thread model: posix
gcc version 3.4.5
这个是原来的交叉编译版本。
在韦东山的资料D:\韦东山Linux视频驱动第2期\韦东Linux视频第1第2期所有源码文档图片芯片手册(1)\韦东Linux视频第1第2期所有源码文档图片芯片手册\毕业班_文档_图片_源码_bin\中找到了arm-linux-gcc-4.3.2.tar.bz2交叉编译工具
并复制到E:\ARM6410实验资料hyx\6410实验源码包hyx后上传到虚拟机。
2.1 解压、编译、安装交叉编译连arm-linux-gcc-4.3.2.tar.bz2
tar -vxf arm-linux-gcc-4.3.2.tar.bz2 但这个是解压到了/home/hyx/usr/local/arm/4.3.2下
现在将其解压到根目录下
tar -xjf arm-linux-gcc-4.3.2.tar.bz2 -C /
ps:查看现在命令的环境变量路径
[root@localhost hyx]# echo $PATH
/usr/lib/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/home/hyx/gcc-3.4.5-glibc-2.3.6/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
修改环境变量:
方法1:(强烈推荐)
[root@localhost bin]# export PATH=/usr/local/arm/4.3.2/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin
[root@localhost bin]# arm-linux-gcc -v
方法2:
vi /etc/profile
# Path manipulation
if [ "$EUID" = "0" ]; then
pathmunge /sbin
pathmunge /usr/sbin
pathmunge /usr/local/sbin
pathmunge /home/hyx/usr/local/arm/4.3.2/bin/
fi
wq 退出
source /etc/profile
arm-linux-gcc -v
显示:
Thread model: posix
gcc version 4.3.2 (Sourcery G++ Lite 2008q3-72)
2.2 ok到此为止,交叉编译连准备好了。开始再次编译新内核3.4.2。
make zImage
Kernel: arch/arm/boot/zImage is ready
/home/hyx/u-boot-1.1.6/tools/mkimage -A arm -O linux -C none -a 0x30008000 -e 0x30008000 -d arch/arm/boot/zImage arch/arm/boot/uImage
nfs 30000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage
OK2440_hyx_2.3#bootm
## Booting image at 30000000 ...
Image Name:
Created: 2014-07-29 9:16:01 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2399720 Bytes = 2.3 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
undefined instruction
pc : [<30192e0c>] lr : [<3010800c>]
sp : 307f7aa8 ip : 4000001c fp : 00000020
r10: 305ac524 r9 : 41129200 r8 : 30000100
r7 : 0000016a r6 : 307f6a88 r5 : 00000000 r4 : 30108000
r3 : 0000016a r2 : c05bf540 r1 : 4000001c r0 : 0000016a
Flags: nZCv IRQs on FIQs on Mode UK12_32
Resetting CPU ...
出现如上错误信息。
/**********************************************************/
2014/7/30 9:40:13
参考 http://blog.csdn.net/liangkaiming/article/details/5986680
http://blog.csdn.net/subfate/article/details/6228730
修改:
/home/hyx/u-boot-1.1.6/tools/mkimage -A arm -O linux -C none -a 0x30008000 -e 0x30008000 -d arch/arm/boot/zImage arch/arm/boot/uImage
nfs 30000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage
bootm
最终还是不可以正常启动!!!反复查阅源代码还是找不到问题出现的地方!!
猜测是uboot版本太低的缘故,接下来准备移植较新的uboot版本。
uboot移植过程请查阅《2014-arm-u-boot-2012.04.01移植for2440.txt》。
/****************************************************************************/
2014/8/6 16:15:39
u-boot-2012.04.01移植for2440已完成
接下来再看看打印信息:
nfs 30000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage
Bytes transferred = 2399784 (249e28 hex)
ok2440-hyx-uboot-v7.3# bootm
## Booting kernel from Legacy Image at 30000000 ...
Image Name:
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 2399720 Bytes = 2.3 MiB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
Loading Kernel Image ... OK
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
这里是什么错误信息没有提示,但没有进入内核而是重新启动。
分析uboot引导内核流程:
do_bootm
boot_fn = boot_os[images.os.os];
static boot_os_fn *boot_os[] = {
#ifdef CONFIG_BOOTM_LINUX
[IH_OS_LINUX] = do_bootm_linux,
do_bootm_linux
boot_jump_linux
unsigned long machid = gd->bd->bi_arch_number;
s = getenv("machid");
r2 = gd->bd->bi_boot_params;
kernel_entry(0, machid, r2); // void (*kernel_entry)(int zero, int arch, uint params);
/****************************************************************************/
2014/8/7 10:02:32
再重新试下载镜像
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage
bootm 32000000
结果还是不行!!
试重新制作uImag镜像:之前的镜像是用u-boot-1.1.6制作的。
cd /home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
还是不行啊~~~~
删除文件,重新重头开始编译。
1.0 解压tar xzvf linux-3.4.2.tar.gz -C ./linux-3.4.2-hyx/
chmod 777 linux-3.4.2/ -R
1.1 修改Makefile
cd linux-3.4.2/
修改:ARCH ?= $(SUBARCH)
CROSS_COMPILE ?= $(CONFIG_CROSS_COMPILE:"%"=%)
为ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
1.2 选择默认配置 : make s3c2410_defconfig
1.3 修改时钟;
arch\arm\mach-s3c24xx\mach-smdk2440.c
s3c24xx_init_clocks(16934400);
改为
s3c24xx_init_clocks(12000000);
1.4 制作镜像:
make zImage
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
cp arch/arm/boot/uImage arch/arm/boot/uImage-v1.0
1.5 nfs下载到开发板启动:
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v1.0
bootm 32000000
OK
Starting kernel ...
Uncompressing Linux... done, booting the kernel.
??噜?帱帱?噜????????帱?帱?噜?(有乱码)
可能是在uboot的启动参数里没有设置bootargs=console=ttySAC0 root=/dev/mtdblock3 波特率
修改:
set bootargs console=ttySAC0,115200 root=/dev/mtdblock3
save
再次nfs镜像后启动,可以正常启动,但有以下信息:
Scanning device for bad blocks
Creating 8 MTD partitions on "NAND":
0x000000000000-0x000000004000 : "Boot Agent"
mtd: partition "Boot Agent" doesn't end on an erase block -- force read-only
0x000000000000-0x000000200000 : "S3C2410 flash partition 1"
0x000000400000-0x000000800000 : "S3C2410 flash partition 2"
0x000000800000-0x000000a00000 : "S3C2410 flash partition 3"
0x000000a00000-0x000000e00000 : "S3C2410 flash partition 4"
0x000000e00000-0x000001800000 : "S3C2410 flash partition 5"
0x000001800000-0x000003000000 : "S3C2410 flash partition 6"
0x000003000000-0x000008000000 : "S3C2410 flash partition 7"
看来是没有正确分区,搜寻代码:
Boot Agent common-smdk.c (linux-3.4.2\arch\arm\mach-s3c24xx) 4482 2012/6/9
static struct mtd_partition smdk_default_nand_part[] = {
将分区分为
0x000000000000-0x000000040000 : "bootloader"
0x000000040000-0x000000060000 : "params"
0x000000060000-0x000000260000 : "kernel"
0x000000260000-0x000008000000 : "root"
修改为:
/* NAND parititon from 2.4.18-swl5 */
static struct mtd_partition smdk_default_nand_part[] = {
[0] = {
.name = "bootloader",
.size = SZ_256K,
.offset = 0,
},
[1] = {
.name = "params",
.offset = MTDPART_OFS_APPEND,
.size = SZ_128K,
},
[2] = {
.name = "kernel",
.offset = MTDPART_OFS_APPEND,
.size = SZ_2M,
},
[3] = {
.name = "root",
.offset = MTDPART_OFS_APPEND,
.size = MTDPART_SIZ_FULL,
},
};
编译:
make zImage
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
cp arch/arm/boot/uImage arch/arm/boot/uImage-v1.1
nfs下载到开发板启动:
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v1.1
bootm 32000000
NAND device: Manufacturer ID: 0xec, Chip ID: 0xf1 (Samsung NAND 128MiB 3,3V 8-bit)
Scanning device for bad blocks
Creating 4 MTD partitions on "NAND":
0x000000000000-0x000000040000 : "bootloader"
0x000000040000-0x000000060000 : "params"
0x000000060000-0x000000260000 : "kernel"
0x000000260000-0x000008000000 : "root"
现在识别了内核的分区了。
2. 修改内核支持yaffs文件
2.1 编译busybosx-1.20.0
2.1.1 下载源码http://www.busybox.net/downloads/到D:\ARM开发镜像文件\linux-3.4.2-hyx镜像文件
2.1.2 解压、配置、编译:
tar xjf busybox-1.20.0.tar.bz2
cd busybox-1.20.0
make menuconfig
修改交叉编译连:
Busybox Settings --->
Build Options --->
Cross Compiler prefix
arm-linux-
2.1.3 创建文件、安装
[root@localhost nfs_root_hyx]# mkdir fs_mini_mdev_new_hyx
make install CONFIG_PREFIX=/home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx
2.1.4 安装库
cd /home/hyx/usr/local/arm/4.3.2/bin/
find -name lib
cd ./arm-none-linux-gnueabi/libc/armv4t/lib
mkdir /home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx/lib
mkdir /home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx/usr/lib -p
cp /home/hyx/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/lib/*so* /home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx/lib -d
cp /home/hyx/usr/local/arm/4.3.2/arm-none-linux-gnueabi/libc/armv4t/usr/lib/*so* /home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx/usr/lib -d
2.1.5 构建etc目录、构建dev目录、其他空目录
拷贝已有的目录:
cp ../fs_mini_hyx/etc ./ -rf
[root@localhost etc]# cd ..
[root@localhost fs_mini_mdev_new_hyx]# ls
bin etc lib linuxrc sbin usr
[root@localhost fs_mini_mdev_new_hyx]# mkdir dev
[root@localhost fs_mini_mdev_new_hyx]# cd dev/
[root@localhost dev]# ls
[root@localhost dev]# mknod console c 5 1
[root@localhost dev]# mknod null c 1 3
[root@localhost fs_mini_mdev_new_hyx]# mkdir proc mnt tmp sys root
2.1.6 1.移植YAFFS文件系统,www.aleph1.co.uk/yaffs2
文件存在路径:D:\韦东山Linux视频驱动第2期\韦东Linux视频第1第2期所有源码文档图片芯片手册(1)
\韦东Linux视频第1第2期所有源码文档图片芯片手册\毕业班_文档_图片_源码_bin\毕业班第3课移植新内核_文档_图片_补丁_二进制程序
\用git下载的yaffs最新源码 yaffs2.tar.bz2
解压
tar xjvf yaffs2.tar.bz2
2. 打补丁
cd yaffs-dir
./patch-ker.sh c m /home/hyx/linux-3.4.2-hyx/linux-3.4.2
3. 配置内核支持YAFFS
File systems --->
[*] Miscellaneous filesystems --->
<*> yaffs2 file system support
4. 编译
make zImage
出现错误:
fs/yaffs2/yaffs_vfs.c:440: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:445: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c:447: warning: initialization from incompatible pointer type
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_mtd_put_super':
fs/yaffs2/yaffs_vfs.c:2514: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c:2515: error: 'struct mtd_info' has no member named 'sync'
fs/yaffs2/yaffs_vfs.c: In function 'yaffs_internal_read_super':
........
........
通过建立其source insight工程查询代码:
mtd->sync
struct mtd_info *mtd
void (*_sync) (struct mtd_info *mtd);
mtd_info结构体里是带下划线的_
后面的错误也是这样修改。
fs/yaffs2/yaffs_vfs.c:2967
root = d_make_root(inode); // d_alloc_root(inode);
编译:
make zImage
fs/yaffs2/yaffs_mtdif.c: In function 'nandmtd_erase_block':
fs/yaffs2/yaffs_mtdif.c:42: error: 'struct mtd_info' has no member named 'erase'
make[2]: *** [fs/yaffs2/yaffs_mtdif.o] Error 1
加下划线
编译:
make zImage
fs/yaffs2/yaffs_mtdif1.c: In function 'nandmtd1_write_chunk_tags':
fs/yaffs2/yaffs_mtdif1.c:138: error: 'struct mtd_info' has no member named 'write_oob'
fs/yaffs2/yaffs_mtdif1.c: In function 'nandmtd1_read_chunk_tags':
fs/yaffs2/yaffs_mtdif1.c:200: error: 'struct mtd_info' has no member named 'read_oob'
fs/yaffs2/yaffs_mtdif1.c:223: error: 'struct mtd_info' has no member named 'block_isbad'
fs/yaffs2/yaffs_mtdif1.c: In function 'nandmtd1_mark_block_bad':
fs/yaffs2/yaffs_mtdif1.c:291: error: 'struct mtd_info' has no member named 'block_markbad'
fs/yaffs2/yaffs_mtdif1.c: In function 'nandmtd1_query_block':
fs/yaffs2/yaffs_mtdif1.c:341: error: 'struct mtd_info' has no member named 'block_isbad'
make[2]: *** [fs/yaffs2/yaffs_mtdif1.o] Error 1
加下划线
编译:
make zImage
又出现如上错,同样修改方法。
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
cp arch/arm/boot/uImage arch/arm/boot/uImage-v2.0
5. 制作、烧写yaffs映象
[root@localhost nfs_root_hyx]# mkyaffs2image fs_mini_mdev_new_hyx fs_mini_new.yaffs2
uboot:
nfs 30000000 10.1.30.111:/home/hyx/nfs_root_hyx/fs_mini_new.yaffs2
nand erase.part rootfs
nand write.yaffs 30000000 260000 $filesize
启动:
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v2.0
bootm 32000000
错误:
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 172K
Kernel panic - not syncing: No init found. Try passing init= option to kernel. See Linux Documentation/init.txt for guidance.
Backtrace:
[] (dump_backtrace+0x0/0x10c) from [] (dump_stack+0x18/0x1c)
发现1.1.6的UBOOT没问题,所以就是我们移植的新UBOOT有BUG:
drivers\mtd\nand\Nand_util.c
if (!need_skip && !(flags & WITH_DROP_FFS)) {
改为
if (!need_skip && !(flags & WITH_DROP_FFS) && !(flags & WITH_YAFFS_OOB)) {
编译
make distclean
make smdk2440-hyx_config
make
cp u-boot.bin u-boot-v7.4.bin
再次烧录yaffs文件
nfs 30000000 10.1.30.111:/home/hyx/nfs_root_hyx/fs_mini_new.yaffs2
nand erase.part rootfs
nand write.yaffs 30000000 260000 $filesize
烧uImage镜像试启动:
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v2.0
bootm 32000000
错误:
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 172K
Kernel panic - not syncing: Attempted to kill init! exitcode=0x00000004
Backtrace:
[] (dump_backtrace+0x0/0x10c) from [] (dump_stack+0x18/0x1c)
r6:c3819d60 r5:c05a6b14 r4:c05a6b14
[] (dump_stack+0x0/0x1c) from [] (panic+0x7c/0x1d0)
解决办法:重新配置内核支持EABI
make menuconfig
Kernel Features --->
[*] Use the ARM EABI to compile the kernel
[*] Allow old ABI binaries to run with this kernel (EXPERIMENTAL)
编译:
make zImage
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
cp arch/arm/boot/uImage arch/arm/boot/uImage-v2.1
烧uImage镜像试启动:
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v2.1
bootm 32000000
启动成功!!!
drivers/rtc/hctosys.c: unable to open rtc device (rtc0)
ALSA device list:
No soundcards found.
yaffs: dev is 32505859 name is "mtdblock3" rw
yaffs: passed flags ""
VFS: Mounted root (yaffs filesystem) on device 31:3.
Freeing init memory: 164K
Please press Enter to activate this console.
ok,到现在位置内核的移植已基本完成,至于其裁剪可以后再说。
后续的实验只是将内核下载到内存中直接运行系统。所以其大小超过了2M无所谓。
3.制作补丁和保存当前配置文件
保存配置文件:
[root@localhost linux-3.4.2]# cp .config config-hyx-3.4.2
制作补丁:
[root@localhost linux-3.4.2]# make distclean
[root@localhost hyx]# tar xzf linux-3.4.2.tar.gz
diff -urNwB linux-3.4.2 linux-3.4.2-hyx/linux-3.4.2 > linux-3.4.2-hyx-v1.0.diff
试使用补丁:
[root@localhost linux-3.4.2]# patch -p1 < ../linux-3.4.2-hyx-v1.0.diff
[root@localhost linux-3.4.2]# cp ../config-hyx-3.4.2 .config
make zImage
试烧打补丁后的uImage镜像试启动:
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2/arch/arm/boot/uImage
bootm 32000000
启动成功!!!
4.移植网卡
修改:Mach-smdk2440.c (linux-3.4.2\arch\arm\mach-s3c24xx) 4283 2014/8/7
添加修改:
/*
* The DM9000 has no eeprom, and it's MAC address is set by
* the bootloader before starting the kernel.
*/
/* DM9000AEP 10/100 ethernet controller */
#define MACH_SMDK2440_DM9K_BASE (S3C2410_CS4 + 0x300)
static struct resource smdk2440_dm9k_resource[] = {
[0] = {
.start = MACH_SMDK2440_DM9K_BASE,
.end = MACH_SMDK2440_DM9K_BASE + 3,
.flags = IORESOURCE_MEM
},
[1] = {
.start = MACH_SMDK2440_DM9K_BASE + 4,
.end = MACH_SMDK2440_DM9K_BASE + 7,
.flags = IORESOURCE_MEM
},
[2] = {
.start = IRQ_EINT7,
.end = IRQ_EINT7,
.flags = IORESOURCE_IRQ | IORESOURCE_IRQ_HIGHEDGE,
}
};
static struct dm9000_plat_data smdk2440_dm9k_pdata = {
.flags = (DM9000_PLATF_16BITONLY | DM9000_PLATF_NO_EEPROM),
};
static struct platform_device smdk2440_device_eth = {
.name = "dm9000",
.id = -1,
.num_resources = ARRAY_SIZE(smdk2440_dm9k_resource),
.resource = smdk2440_dm9k_resource,
.dev = {
.platform_data = &smdk2440_dm9k_pdata,
},
};
static struct platform_device *smdk2440_devices[] __initdata = {
&s3c_device_ohci,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c0,
&s3c_device_iis,
&smdk2440_dm9k_pdata,
};
添加头文件#include
最后编译:
cp config-hyx .config
make zImage
/home/hyx/u-boot-2012.04.01-hyx/u-boot-2012.04.01/tools/mkimage -A arm -O linux -C none -a 0x30108000 -e 0x30108000 -d arch/arm/boot/zImage arch/arm/boot/uImage
cp arch/arm/boot/uImage arch/arm/boot/uImage-v3.0
nfs 32000000 10.1.30.111:/home/hyx/linux-3.4.2-hyx/linux-3.4.2/arch/arm/boot/uImage-v3.0
bootm 32000000
启动后配置eth0,mount
/ # ifconfig eth0 10.1.30.200
dm9000 dm9000: eth0: link down
/ # dm9000 dm9000: eth0: link up, 100Mbps, full-duplex, lpa 0xCDE1
/ #
/ # mount -t nfs -o nolock,vers=2 10.1.30.111:/home/hyx/nfs_root_hyx/fs_mini_mdev_new_hyx /mnt
成功的挂载上去。
最后制作补丁:
[root@localhost linux-3.4.2]# make distclean
[root@localhost hyx]# tar xzf linux-3.4.2.tar.gz
diff -urNwB linux-3.4.2 linux-3.4.2-hyx/linux-3.4.2 > linux-3.4.2-hyx-v2.0.diff
这次是真的结束了!!!!!
PS:发现在Dm9000.c (linux-3.4.2\drivers\net\ethernet\davicom) 39386 2012/6/9中
#define CARDNAME "dm9000"
#define DRV_VERSION "1.31"
此网卡驱动的版本较低!!
后面移植dm9000最新的网卡驱动。
详细请见《2014-arm-dm9000网卡驱动移植linux3.4.2.txt》
/****************************************************************************/