前言:
尽管linux-2.6.31直接提供了对mini2440的支持,但移植过程中发现存在的问题比较多,所以最后决定使用linux-2.6.30.4来完成这次移植过程!
0)、准备工作
交叉编译器使用codesourcery提供的符合EABI标准的交叉编译器arm-linux-gcc-4.3.3,下载地址:
安装交叉编译器:
# tar zxvf arm-linux-gcc-4.3.2.tgz -C /usr/local/arm
安装到了: /usr/local/arm/arm-2009q1/
因为" /usr/local/arm/arm-2009q1/bin "目录中的可执行文件均以不常用的" arm-none-linux-gnueabi- "开头,做几个arm-linux-xxx软链接以方便日后使用:
# cd /usr/local/arm/arm-2009q1/bin
ln -s arm-none-linux-gnueabi-gdbtui arm-linux-gdbtui ln -s arm-none-linux-gnueabi-addr2line arm-linux-addr2line ln -s arm-none-linux-gnueabi-gprof arm-linux-gprof ln -s arm-none-linux-gnueabi-ar arm-linux-ar ln -s arm-none-linux-gnueabi-as arm-linux-as ln -s arm-none-linux-gnueabi-nm arm-linux-nm ln -s arm-none-linux-gnueabi-ld arm-linux-ld ln -s arm-none-linux-gnueabi-c++ arm-linux-c++ ln -s arm-none-linux-gnueabi-objcopy arm-linux-objcopy ln -s arm-none-linux-gnueabi-c++filt arm-linux-c++filt ln -s arm-none-linux-gnueabi-cpp arm-linux-cpp ln -s arm-none-linux-gnueabi-ranlib arm-linux-ranlib ln -s arm-none-linux-gnueabi-objdump arm-linux-objdump ln -s arm-none-linux-gnueabi-readelf arm-linux-readelf ln -s arm-none-linux-gnueabi-size arm-linux-size ln -s arm-none-linux-gnueabi-gcov arm-linux-gcov ln -s arm-none-linux-gnueabi-strings arm-linux-strings ln -s arm-none-linux-gnueabi-gdb arm-linux-gdb ln -s arm-none-linux-gnueabi-strip arm-linux-strip ln -s arm-none-linux-gnueabi-sprite arm-linux-sprite |
同时在" /usr/local/arm/arm-2009q1/bin "目录建立如下三个脚本:
脚本arm-linux-g++的内容:
#!/bin/sh
arm-none-linux-gnueabi-g++ -march=armv4t $*
脚本arm-linux-gcc的内容:
#!/bin/sh
arm-none-linux-gnueabi-gcc -march=armv4t $*
脚本arm-linux-gcc-4.3.3的内容:
#!/bin/sh
arm-none-linux-gnueabi-gcc-4.3.3 -march=armv4t $*
为以上三个脚本加上可执行属性:
# chmod +x arm-linux-g++
# chmod +x arm-linux-gcc
# chmod +x arm-linux-gcc-4.3.3
执行命令:
# export PATH="/usr/local/arm/arm-2009q1/bin:"$PATH
以后要用到该交叉编译器时都应先执行上面一句!!!
再执行命令:
# arm-linux-gcc -v
应该可以看到:
Using built-in specs. Target: arm-none-linux-gnueabi Configured with: /scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/src/gcc-4.3/configure --build=i686-pc-linux-gnu --host=i686-pc-linux-gnu --target=arm-none-linux-gnueabi --enable-threads --disable-libmudflap --disable-libssp --disable-libstdcxx-pch --with-gnu-as --with-gnu-ld --with-specs='%{funwind-tables|fno-unwind-tables|mabi=*|ffreestanding|nostdlib:;:-funwind-tables}' --enable-languages=c,c++ --enable-shared --enable-symvers=gnu --enable-__cxa_atexit --with-pkgversion='Sourcery G++ Lite 2009q1-203' --with-bugurl= --disable-nls --prefix=/opt/codesourcery --with-sysroot=/opt/codesourcery/arm-none-linux-gnueabi/libc --with-build-sysroot=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/libc --with-gmp=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --with-mpfr=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/obj/host-libs-2009q1-203-arm-none-linux-gnueabi-i686-pc-linux-gnu/usr --disable-libgomp --enable-poison-system-directories --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin --with-build-time-tools=/scratch/mitchell/builds/4.3-arm-none-linux-gnueabi-respin/lite/install/arm-none-linux-gnueabi/bin Thread model: posix gcc version 4.3.3 (Sourcery G++ Lite 2009q1-203) |
说明安装成功!
linux-2.6.30.4的下载地址:
下载yaffs2:
点击“Download GNU tarball”,下载cvs-root.tar.gz,与linux-2.6.30.4.tar.bz2放在同一目录!!!
1)、解压并进入目录
# tar jxvf linux-2.6.30.4.tar.bz2
# cd linux-2.6.30.4
2)、修改顶层Makefile
# gedit Makefile
位于193行
ARCH ?= arm CROSS_COMPILE ?= /usr/local/arm/arm-2009q1/bin/arm-linux- |
3)、修改机器码
# gedit arch/arm/tools/mach-types
位于379行
s3c2440 ARCH_S3C2440 S3C2440 782 |
与supervivi传入的机器码一致即可
4)、修改时钟频率
# gedit arch/arm/mach-s3c2440/mach-smdk2440.c
位于160行
static void __init smdk2440_map_io(void) { s3c24xx_init_io(smdk2440_iodesc, ARRAY_SIZE(smdk2440_iodesc)); //s3c24xx_init_clocks(16934400); s3c24xx_init_clocks(12000000); s3c24xx_init_uarts(smdk2440_uartcfgs, ARRAY_SIZE(smdk2440_uartcfgs)); } |
5)、修改NAND Flash分区
# gedit arch/arm/plat-s3c24xx/common-smdk.c
位于109行
static struct mtd_partition smdk_default_nand_part[] = { [0] = { .name = "supervivi", .size = 0x00030000, .offset = 0, }, [1] = { .name = "Kernel", .offset = 0x00050000, .size = 0x00200000, }, [2] = { .name = "root", .offset = 0x00250000, .size = 0x03dac000, } }; |
6)、配置
# cp arch/arm/configs/s3c2410_defconfig .config
# make menuconfig
机器只选以下三项:
System Type ---> S3C2410 Machines ---> [*] SMDK2410/A9M2410 S3C2440 Machines ---> [*] SMDK2440 [*] SMDK2440 with S3C2440 CPU module |
内核特性选上以下两项:
Kernel Features ---> [*] Use the ARM EABI to compile the kernel [*] Allow old ABI binaries to run with this(EXPERIMENTA) kernel |
7)、编译
# make zImage
先用友善提供的yaffs2根文件系统镜像作测试!
启动后运行到这里:
List of all partitions: 1f00 192 mtdblock0 (driver?) 1f01 2048 mtdblock1 (driver?) 1f02 63152 mtdblock2 (driver?) No filesystem could mount root, tried: ext3 ext2 cramfs vfat msdos iso9660 roms Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(31,2) |
8)、加入对yaffs2文件系统的支持
1. 打上yaffs2文件系统补丁
# cd ..
# tar zxvf cvs-root.tar.gz
# cd cvs/yaffs2/
# ./patch-ker.sh c ../../linux-2.6.30.4/
Updating ../../linux-2.6.30.4//fs/Kconfig Updating ../../linux-2.6.30.4//fs/Makefile |
# cd ../../linux-2.6.30.4/
阅读(2475) | 评论(0) | 转发(0) |