前面一章,我们说到了u-boot的仿真。作为现代的嵌入式系统来说,u-boot的主要作用其实就是两个,一个是对硬件做一些基本的检测,另外就是加载操作系统。在实际开发工程中,u-boot其实修改的工作很少,但是内核系统的相关修改工作确实非常频繁的。如果没有u-boot的帮助,我们很可能需要每次用特定的flash烧写工具进行处理,这是非常麻烦的。在u-boot下,我们完全可以用tftp进行相关的操作工作。
本篇文章,我们说到的其实是linux的仿真。只要对linux的代码稍微做一些修改,完全可以在skyeye上运行起来,主要的步骤如下,
(01)获取linux内核版本,目前我们测试的版本是linux-2.6.14.tar.bz2;
(02)解压, tar xjvf linux-2.6.14.tar.bz2;
(03)cd linux-2.6.14;
(04)修改Makefile, 在192、193行修改为如下所示,
ARCH ?= arm
CROSS_COMPILE ?= arm-linux-
(06)输入make menuconfig,注意下面的两个配置
"File systems" -> 选中 "Second extended fs support" , " Rom file system support ",
"Device Drivers" -> "Block devices" -> 选中 "Initial RAM disk(initrd) support", "Default RAM disk size (kbytes)"修改为 8192
(07)修改文件
include/asm-arm/arch-s3c2410/memory.h 中 33行修改为 #define PHYS_OFFSET (0xC0000000UL)
include/asm-arm/arch-s3c2410/map.h 中175行修改为 #define S3C2410_CS6 (0xC0000000)
(08)修改.config文件
生成调试信息,打开开关,即CONFIG_DEBUG_INFO=y
修改CONFIG_CMDLINE, CONFIG_CMDLINE="mem=32M console=ttySAC0 root=/dev/ram initrd=0xc0800000,0x00800000 ramdisk_size=8192 rw"
(09)完成了上面的修改,开始编译
输入make
(10) 准备skyeye.conf文件
#skyeye config file sample
cpu: arm920t
mach: s3c2410x
#physical memory
#mem_bank: map=M, type=RW, addr=0x20000000, size=0x01000000
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x30000000, size=0x10000000
mem_bank: map=M, type=RW, addr=0xc0000000, size=0x01000000
mem_bank: map=M, type=RW, addr=0xc1000000, size=0x00600000
mem_bank: map=M, type=RW, addr=0xc1600000, size=0x00a00000
#all peripherals I/O mapping area
#mem_bank: map=I, type=RW, addr=0xfefa0000, size=0x00060000
mem_bank: map=I, type=RW, addr=0x48000000, size=0x20000000
mem_bank: map=I, type=RW, addr=0x19000300, 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
lcd:type=s3c2410x,mod=gtk
#dbct:state=on
realsil@hp-6531s:~/Desktop/exer/arm_linux$ skyeye -e vmlinux
Your elf file is little endian.
arch: arm
cpu info: armv4, arm920t, 41009200, ff00fff0, 2
mach info: name s3c2410x, mach_init addr 0x806dc30
ethmod num=1, mac addr=0:4:3:2:1:f, hostip=10.0.0.1
failed to setup_module (name:net, type:cs8900a)
tapif_init: icotl TUNSETIFF erroruart_mod:0, desc_in:, desc_out:, converter:
SKYEYE: use arm920t mmu ops
start addr is set to 0xc0008000 by exec file.
Linux version 2.6.14 (realsil@hp-6531s) (gcc version 3.4.1) #1 Sun Jan 12 16:24:59 CST 2014
CPU: ARM920Tid(wb) [41009200] revision 0 (ARMvundefined/unknown)
Machine: SMDK2410
Warning: bad configuration page, trying to continue
Memory policy: ECC disabled, Data cache writeback
CPU S3C2410 (id 0x32410000)
S3C2410: core 62.400 MHz, memory 62.400 MHz, peripheral 62.400 MHz
S3C2410 Clocks, (c) 2004 Simtec Electronics
CLOCK: Slow mode (1.500 MHz), fast, MPLL on, UPLL on
CPU0: D VIVT write-back cache
CPU0: I cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
CPU0: D cache: 16384 bytes, associativity 64, 32 byte lines, 8 sets
Built 1 zonelists
Kernel command line: mem=32M console=ttySAC0 root=/dev/ram initrd=0xc0800000,0x00800000 ramdisk_size=8192 rw
PID hash table entries: 256 (order: 8, 4096 bytes)
timer tcon=00000000, tcnt cb1f, tcfg 00000200,00000000, usec 0000189e
Console: colour dummy device 80x30
Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
Memory: 32MB = 32MB total
Memory: 22320KB available (1469K code, 271K data, 92K init)
Mount-cache hash table entries: 512
CPU: Testing write buffer coherency: ok
checking if image is initramfs...