u-boot在SkyEye上的移植是很简单的。由于我改了硬件配置,将Flash换成了Intel的32M Flash并挂载物理地址0x80000000上,将内存改成了256M,挂载0xc0000000上,所以需要做一些改动。具体移植如下:
1. 下载u-boot-1.1.6.tar.bz2,下载地址为 http://ncu.dl.sourceforge.net/project/u-boot/u-boot/U-Boot-1.1.6/u-boot-1.1.6.tar.bz2
2. 执行下面脚本:
tar jxvf u-boot-1.1.6.tar.bz2
cd u-boot-1.1.6/
mkdir board/s3c2410
cp board/smdk2410/* board/s3c2410/
mv board/s3c2410/smdk2410.c board/s3c2410/s3c2410.c
mv include/configs/smdk2410.h include/configs/s3c2410.h
3. gedit Makefile &
在:
smdk2410_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
的下面添加:
s3c2410_config : unconfig
@$(MKCONFIG) $(@:_config=) arm arm920t s3c2410 NULL s3c24x0
4. gedit common/cmd_boot.c &
将:
#if defined(CONFIG_I386)
DECLARE_GLOBAL_DATA_PTR;
#endif
改成:
DECLARE_GLOBAL_DATA_PTR;
在:
#if !defined(CONFIG_NIOS)
的下面添加:
if(argc==2)
rc = ((ulong (*)(int, char *[]))addr) (0, gd->bd->bi_arch_number);
else
5. gedit board/s3c2410/Makefile &
将其中的smdk2410.o为s3c2410.o
6. gedit board/s3c2410/s3c2410.c &
把:
gd->bd->bi_arch_number = MACH_TYPE_SMDK2410;
改成:
gd->bd->bi_arch_number = MACH_TYPE_S3C2410;
把:
gd->bd->bi_boot_params = 0x30000100;
改成:
gd->bd->bi_boot_params = 0xC0000100;
7. gedit board/s3c2410/flash.c &
将:
#define MAIN_SECT_SIZE 0x10000 /* 64 KB */
改成:
#define MAIN_SECT_SIZE 0x4000 /* 16 KB */
8. gedit board/s3c2410/config.mk &
把:
TEXT_BASE = 0x33F80000
改成:
TEXT_BASE = 0xC3F80000
9. gedit board/s3c2410/lowlevel_init.S &
在:
ldr r0, =SMRDATA
ldr r1, _TEXT_BASE
sub r0, r0, r1
的下面添加:
add r0, r0, #0x80000000
10. gedit include/configs/s3c2410.h &
将:
#define CFG_PROMPT "SMDK2410 # " /* Monitor Command Prompt */
改成:
#define CFG_PROMPT "S3C2410 # " /* Monitor Command Prompt */
将:
#define CFG_MEMTEST_START 0x30000000 /* memtest works on */
#define CFG_MEMTEST_END 0x33F00000 /* 63 MB in DRAM */
改成:
#define CFG_MEMTEST_START 0xC0000000 /* memtest works on */
#define CFG_MEMTEST_END 0xCFF00000 /* 256 MB in DRAM */
将:
#define CFG_LOAD_ADDR 0x33000000 /* default load address */
改成:
#define CFG_LOAD_ADDR 0xC3000000 /* default load address */
将:
#define PHYS_SDRAM_1 0x30000000 /* SDRAM Bank #1 */
#define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */
改成
#define PHYS_SDRAM_1 0xC0000000 /* SDRAM Bank #1 */
#define PHYS_SDRAM_1_SIZE 0x10000000 /* 256 MB */
将:
#define PHYS_FLASH_1 0x00000000 /* Flash Bank #1 */
改成:
#define PHYS_FLASH_1 0x80000000 /* Flash Bank #1 */
将:
#define PHYS_FLASH_SIZE 0x00080000 /* 512KB */
#define CFG_MAX_FLASH_SECT (11) /* max number of sectors on one chip */
改成:
#define PHYS_FLASH_SIZE 0x02000000 /* 32MB */
#define CFG_MAX_FLASH_SECT (2048) /* max number of sectors on one chip */
11. 编译安装ArmLinux 2.6.36(http://blog.csdn.net/Matrix_Designer/archive/2010/12/09/6066055.aspx ),注意对文件arch/arm/mach-s3c2410/Makefile.boot的修改(第九项)
12. 执行下列脚本:
make distclean
make s3c2410_config
make
至此,u-boot编译完成,成功得到镜像文件u-boot.bin。
如果想直接载入zImage运行linux镜像,可以使用下列镜像文件:
# skyeye config file for S3C2410X
arch: arm
cpu: arm920t
mach: s3c2410x
# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00000024
mem_bank: map=F, type=RW, addr=0x80000000, size=0x02000000, file=./u-boot.bin, boot=yes
# mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00008000
mem_bank: map=M, type=RW, addr=0xc0008000, size=0x007F8000, file=./zImage
mem_bank: map=M, type=RW, addr=0xc0800000, size=0x04000000, file=./initrd.img
mem_bank: map=M, type=RW, addr=0xc4800000, size=0x0B800000
# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
mem_bank: map=I, type=RW, addr=0x19100300, size=0x00000020
net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1, state=on
lcd: type=s3c2410x, mod=gtk
touchscreen: type=s3c2410x, mod=gtk
nandflash: type=s3c2410x, name=K9F1208U0B, dump=./nand.dump
flash: type=28F128J3A, base=0x80000000, size=0x02000000
sound: type=s3c2410x, mod=pcm, channels=2, bits_per_sample=16, samples_per_sec=22050
uart:mod=term
dbct:state=on
然后输入sudo /opt/skyeye/bin/skyeye启动skyeye,然后分别输入start、run启动u-boot。然后在u-boot中输入go 0xc0008000即可解压启动linux内核。
如果想使用uImage,可以使用:
tools/mkimage -A arm -O linux -T kernel -C none -a 0xc0008000 -e 0xc0008040 -n 'Linux 2.6.36 for SkyEye' -d zImage uImage
由zImage生成uImage。然后使用下列配置文件:
# skyeye config file for S3C2410X
arch: arm
cpu: arm920t
mach: s3c2410x
# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00000024
mem_bank: map=F, type=RW, addr=0x80000000, size=0x02000000, file=./u-boot.bin, boot=yes
# mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x00008000
mem_bank: map=M, type=RW, addr=0xc0008000, size=0x007F8000, file=./uImage
mem_bank: map=M, type=RW, addr=0xc0800000, size=0x04000000, file=./initrd.img
mem_bank: map=M, type=RW, addr=0xc4800000, size=0x0B800000
# all peripherals I/O mapping area
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, size=0x00000020
mem_bank: map=I, type=RW, addr=0x19100300, size=0x00000020
net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=0:4:3:2:1:f, ethmod=tuntap, hostip=10.0.0.1, state=on
lcd: type=s3c2410x, mod=gtk
touchscreen: type=s3c2410x, mod=gtk
nandflash: type=s3c2410x, name=K9F1208U0B, dump=./nand.dump
flash: type=28F128J3A, base=0x80000000, size=0x02000000
sound: type=s3c2410x, mod=pcm, channels=2, bits_per_sample=16, samples_per_sec=22050
uart:mod=term
dbct:state=on
然后输入sudo /opt/skyeye/bin/skyeye启动skyeye,然后分别输入start、run启动u-boot。然后在u-boot中输入bootm 0xc0008000即可解压启动linux内核。