计算机与信息工程学院 09级嵌入式 吴素芬
嵌入式系统移植三部曲
一、BootLoader的移植
二、linux的移植
三、根文件系统的移植
一、准备工作
(1)、创建交叉编译环境
1、[root@localhost opt]# ll arm-linux-*
-rwxr-xr-x 1 root root 36273634 06-13 12:21 arm-linux-gcc-2.95.3.tar.bz2
-rwxr-xr-x 1 root root 42745480 06-13 12:22 arm-linux-gcc-3.4.1.tar.bz2
2、[root@localhost opt]# tar -xjvf arm-linux-gcc-2.95.3.tar.bz2 -C /usr/local/arm
tar: /usr/local/arm:无法 chdir: 没有那个文件或目录
tar: 错误不可恢复:现在退出
要先在/usr/local下创建一个arm文件夹,再执行tar -xjvf arm-linux-gcc-2.95.3.tar.bz2 -C /usr/local/arm
3、[root@localhost opt]# gedit /etc/profile
在文件profile中添加
PATH=$PATH:/usr/local/arm/2.95.3/bin
设置编译环境是2.95.3
4、[root@localhost opt]# source /etc/profile //使/etc/profile中添加的一行生效
[root@localhost opt]# arm-linux-gcc -v //查看编译器
Reading specs from /usr/local/arm/2.95.3/lib/gcc-lib/arm-linux/2.95.3/specs
gcc version 2.95.3 20010315 (release)
[root@localhost opt]#
(2)、skyeye的安装
1、[root@localhost opt]# tar -xjvf skyeye-1.2.6_rc1.tar.bz2 -C ./
2、[root@localhost opt]# cd skyeye-1.2.6_rc1
3、[root@localhost skyeye-1.2.6_rc1]# ls
aclocal.m4 ChangeLog configure depcomp LICENSE misc REPORTING-BUGS
arch config.guess configure.in device MAINTAINERS missing TODO
AUTHORS config.h.in COPYING INSTALL Makefile.am NEWS utils
autom4te.cache config.sub dbct install-sh Makefile.in README
4、[root@localhost skyeye-1.2.6_rc1]# ./configure //配置
5、[root@localhost skyeye-1.2.6_rc1]# make //编译
6、[root@localhost skyeye-1.2.6_rc1]# make install //将skyeye安装到/usr/local/bin/
7、[root@localhost skyeye-1.2.6_rc1]# mv /usr/local/bin/skyeye /usr/local/bin/skye1.2.6
//将/usr/local/bin/skyeye改名为:/usr/local/bin/skye1.2.6
二、BootLoader的移植
1.解压u-boot-1.1.4.tar.bz2
[root@localhost opt]# tar -xjvf u-boot-1.1.4.tar.bz2 -C ./
[root@localhost opt]# cd u-boot-1.1.4
2.编辑u-boot根目录中的Makefile文件
[root@localhost u-boot-1.1.4]# gedit Makefile
将
ifeq ($(ARCH),arm)
CROSS_COMPILE = arm-linux-
endif
改为
ifeq ($(ARCH),arm)
CROSS_COMPILE=/usr/local/arm/2.95.3/bin/arm-linux-
endif
在
smdk2410_config : unconfig
@./mkconfig $(@:_config=) arm arm920t smdk2410 NULL s3c24x0
后面添加
sf2410_config : unconfig
@./mkconfig $(@:_config=) arm arm920t sf2410 NULL s3c24x0
3.复制必要的文件,编辑sf2410.h头文件
[root@localhost u-boot-1.1.4]# mkdir board/sf2410
[root@localhost u-boot-1.1.4]# cp board/smdk2410/* board/sf2410
[root@localhost u-boot-1.1.4]# dir board/sf2410/
config.mk flash.c lowlevel_init.S Makefile smdk2410.c u-boot.lds
[root@localhost u-boot-1.1.4]# mv board/sf2410/smdk2410.c board/sf2410/sf2410.c
[root@localhost u-boot-1.1.4]# cp include/configs/smdk2410.h include/configs/sf2410.h
[root@localhost u-boot-1.1.4]# gedit include/configs/sf2410.h
将
#define CFG_PROMPT "SMDK2410 # " /* Monitor Command Prompt */
改为
#define CFG_PROMPT "SF2410 # " /* Monitor Command Prompt */
4.编辑board/sf2410/Makefile文件
[root@localhost u-boot-1.1.4]# gedit board/sf2410/Makefile
将
OBJS := smdk2410.o flash.o
改为
OBJS := sf2410.o flash.o
5.配置u-boot
[root@localhost u-boot-1.1.4]# make sf2410_config
Configuring for sf2410 board...
(1)、修改cpu/arm920t/config.mk文件
[root@localhost u-boot-1.1.4]# gedit cpu/arm920t/config.mk
将
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,-mabi=apcs-gnu)
改成:
PLATFORM_CPPFLAGS +=$(call cc-option,-mapcs-32,$(call cc-option,-mabi=apcs-gnu,))
(2)、修改cpu/arm920t/config.mk文件
[root@localhost u-boot-1.1.4]# gedit cpu/arm920t/config.mk
将原文件的第58行开始的内容:
SREC = hello_world.srec
BIN = hello_world.bin hello_world
改为
SREC = hello_world.o
BIN = hello_world.o hello_world
6、编译u-boot
[root@localhost u-boot-1.1.4]# make
[root@localhost u-boot-1.1.4]# ll u-boot*
-rwxr-xr-x 1 root root 395773 06-14 17:49 u-boot
-rwxr-xr-x 1 root root 100156 06-14 17:49 u-boot.bin
-rw-r--r-- 1 root root 48690 06-14 17:49 u-boot.map
-rwxr-xr-x 1 root root 300538 06-14 17:49 u-boot.srec
7、编辑skyeye.conf文件
[root@localhost u-boot-1.1.4]# gedit skyeye.conf
内容如下:
# skyeye config file for S3C2410X
cpu: arm920t
mach: s3c2410x
# physical memory
mem_bank: map=M, type=RW, addr=0x00000000, size=0x00800000, file=./u-boot.bin ,boot=yes
mem_bank: map=M, type=RW, addr=0x30000000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x30800000, size=0x00800000
mem_bank: map=M, type=RW, addr=0x31000000, size=0x03000000
# 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
net: type=cs8900a, base=0x19000300, size=0x20,int=9, mac=08:00:3E:26:0A:5B, ethmod=tuntap, hostip=10.0.0.1
nandflash: type=s3c2410x,name=K9F1208U0B,dump=./nand.dump
#lcd:type=s3c2410x, mod=gtk
dbct:state=on
8、执行skyeye1.2.6
[root@localhost u-boot-1.1.4]# skyeye1.2.6
...
U-Boot code: 33F80000 -> 33F9873C BSS: -> 33F9C814
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
SF2410 #
9、开始移植nand
[root@localhost u-boot-1.1.4]# gedit cpu/arm920t/start.S
将从NOR Flash启动改成从NAND Flash启动。
将以下U-Boot的重定向语句段:
#ifndef CONFIG_SKIP_RELOCATE_UBOOT
relocate: /* relocate U-Boot to RAM */
adr r0, _start /* r0 <- current position of code */
ldr r1, _TEXT_BASE /* test if we run from flash or RAM */
cmp r0, r1 /* don't reloc during debug */
beq stack_setup
ldr r2, _armboot_start
ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */
copy_loop:
ldmia r0!, {r3-r10} /* copy from source address [r0] */
stmia r1!, {r3-r10} /* copy to target address [r1] */
cmp r0, r2 /* until source end addreee [r2] */
ble copy_loop
#endif /* CONFIG_SKIP_RELOCATE_UBOOT */
替换成:
#ifdef CONFIG_S3C2410_NAND_BOOT
@ reset NAND
mov r1, #NAND_CTL_BASE
ldr r2, =0xf830 @ initial value
str r2, [r1, #oNFCONF]
ldr r2, [r1, #oNFCONF]
bic r2, r2, #0x800 @ enable chip
str r2, [r1, #oNFCONF]
mov r2, #0xff @ RESET command
strb r2, [r1, #oNFCMD]
mov r3, #0 @ wait
nand1:
add r3, r3, #0x1
cmp r3, #0xa
blt nand1
nand2:
ldr r2, [r1, #oNFSTAT] @ wait ready
tst r2, #0x1
beq nand2
ldr r2, [r1, #oNFCONF]
orr r2, r2, #0x800 @ disable chip
str r2, [r1, #oNFCONF]
@ get read to call C functions (for nand_read())
ldr sp, DW_STACK_START @ setup stack pointer
mov fp, #0 @ no previous frame, so fp=0
@ copy U-Boot to RAM
ldr r0, =TEXT_BASE
mov r1, #0x0
mov r2, #0x20000
bl nand_read_ll
tst r0, #0x0
beq ok_nand_read
bad_nand_read:
loop2: b loop2 @ infinite loop
ok_nand_read:
@ verify
mov r0, #0
ldr r1, =TEXT_BASE
mov r2, #0x400 @ 4 bytes * 1024 = 4K-bytes
go_next:
ldr r3, [r0], #4
ldr r4, [r1], #4
teq r3, r4
bne notmatch
subs r2, r2, #4
beq stack_setup
bne go_next
notmatch:
loop3: b loop3 @ infinite loop
#endif /* CONFIG_S3C2410_NAND_BOOT */
在
_start_armboot: .word start_armboot
后面加入
.align 2
DW_STACK_START: .word STACK_BASE+STACK_SIZE-4
10、修改board/sf2410/Makefile
[root@localhost u-boot-1.1.4]# gedit board/sf2410/Makefile
将
OBJS := sf2410.o flash.o
改为
OBJS := sf2410.o flash.o nand_read.o
11、创建board/sf2410/nand_read.c文件
[root@localhost u-boot-1.1.4]# gedit board/sf2410/nand_read.c
内容是:
#include
#define __REGb(x) (*(volatile unsigned char *)(x))
#define __REGi(x) (*(volatile unsigned int *)(x))
#define NF_BASE 0x4e000000
#define NFCONF __REGi(NF_BASE + 0x0)
#define NFCMD __REGb(NF_BASE + 0x4)
#define NFADDR __REGb(NF_BASE + 0x8)
#define NFDATA __REGb(NF_BASE + 0xc)
#define NFSTAT __REGb(NF_BASE + 0x10)
#define BUSY 1
#ifndef NAND_SECTOR_SIZE
#define NAND_SECTOR_SIZE 512
#endif
#ifndef NAND_BLOCK_MASK
#define NAND_BLOCK_MASK 511
#endif
inline void wait_idle(void) {
int i;
while(!(NFSTAT & BUSY))
for(i=0; i<10; i++);
}
/* low level nand read function */
int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
{
int i, j;
if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) {
return -1; /* invalid alignment */
}
/* chip Enable */
NFCONF &= ~0x800;
for(i=0; i<10; i++);
for(i=start_addr; i < (start_addr + size);) {
/* READ0 */
NFCMD = 0;
/* Write Address */
NFADDR = i & 0xff;
NFADDR = (i >> 9) & 0xff;
NFADDR = (i >> 17) & 0xff;
NFADDR = (i >> 25) & 0xff;
wait_idle();
for(j=0; j < NAND_SECTOR_SIZE; j++, i++) {
*buf = (NFDATA & 0xff);
buf++;
}
}
/* chip Disable */
NFCONF |= 0x800; /* chip disable */
return 0;
}
12、编辑include/configs/sf2410.h文件
[root@localhost u-boot-1.1.4]# gedit include/configs/sf2410.h
在文件的后部添加
/****************** me add begin *******************/
/*
* Nandflash Boot
*/
#define CONFIG_S3C2410_NAND_BOOT 1
#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x8000
//#define UBOOT_RAM_BASE 0x33f80000
/* NAND Flash Controller */
#define NAND_CTL_BASE 0x4E000000
#define bINT_CTL(Nb) __REG(INT_CTL_BASE + (Nb))
/* Offset */
#define oNFCONF 0x00
#define oNFCMD 0x04
#define oNFADDR 0x08
#define oNFDATA 0x0c
#define oNFSTAT 0x10
#define oNFECC 0x14
/****************** me add end *******************/
13、编译u-boot,然后测试u-boot是否可以从nand启动
[root@localhost u-boot-1.1.4]# make
...
/opt/u-boot-1.1.4/cpu/arm920t/start.S
/opt/u-boot-1.1.4/cpu/arm920t/start.S: Assembler messages:
/opt/u-boot-1.1.4/cpu/arm920t/start.S:285: Error: bad instruction `align 2'
make: *** [cpu/arm920t/start.o] 错误 1
出现错误。是因为在修改/opt/u-boot-1.1.4/cpu/arm920t/start.S文件时,.align 2的点丢失了!:
[root@localhost u-boot-1.1.4]# ll u-boot*
-rwxr-xr-x 1 root root 397852 06-14 18:11 u-boot
-rwxr-xr-x 1 root root 100564 06-14 18:11 u-boot.bin
-rw-r--r-- 1 root root 49189 06-14 18:11 u-boot.map
-rwxr-xr-x 1 root root 301770 06-14 18:11 u-boot.srec
14、执行如下命令:
此时如果直接执行skyeye1.2.6会出现错误,所以先执行下边命令:
[root@localhost u-boot-1.1.4]# mknandflashdump u-boot.bin nand.dump 0
出现如下错误:
bash: mknandflashdump: command not found
把mknandflashdump和mknandflashdump.c移到/opt/u-boot-1.1.4/下,然后执行下边命令
[root@localhost u-boot-1.1.4]# cp /opt/u-boot-1.1.4/mknandflashdump /bin
//把mknandflashdump放到自动搜索路径的文件夹下,再次执行mknandflashdump u-boot.bin nand.dump 0这条命令即可
[root@localhost u-boot-1.1.4]# mknandflashdump u-boot.bin nand.dump 0
finish
[root@localhost u-boot-1.1.4]# ll nand.dump
---------- 1 root root 69206016 06-14 18:16 nand.dump
[root@localhost u-boot-1.1.4]# ll nand.dump
-rw-rw-rw- 1 root root 69206016 06-14 18:16 nand.dump
[root@localhost u-boot-1.1.4]# skyeye1.2.6 //执行skyeye1.2.6
...
Bank #0: 30000000 64 MB
Flash: 512 kB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
SF2410 #
15、编辑include/configs/sf2410.h文件
[root@localhost u-boot-1.1.4]# gedit include/configs/sf2410.h
修改内容:
在
#define CONFIG_BAUDRATE 115200
后面添加
/*********************** me add begin *************************************/
/* enable passing of ATAGs */
#define CONFIG_CMDLINE_TAG 1
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_INITRD_TAG 1
/*********************** me add end *************************************/
将
/*CFG_CMD_NAND |*/ \
改为
CFG_CMD_NAND | \
将
/*#define CONFIG_BOOTARGS "root=ramfs devfs=mount console=ttySA0,9600" */
改为
#define CONFIG_BOOTARGS "noinitrd root=/dev/nfs rw nfsroot=10.0.0.1:/tmp/nfs ip=10.0.0.110:10.0.0.1:10.0.0.1:255.255.255.0 init=linuxrc console=ttySAC0,115200 mem=64M"
将
/*#define CONFIG_BOOTCOMMAND "tftp; bootm" */
改为
#define CONFIG_BOOTCOMMAND "tftp 0x31000000 uImage;bootm 0x31000000"
将第十一步在文件尾添加的内容替换成下边内容:
/****************** me add begin *******************/
// #define CFG_ENV_IS_IN_FLASH 1 /*将该行注释,添加下面一行*/
#define CFG_ENV_IS_IN_NAND 1 /*该行很重要,没有该行,saveenv命令将失效*/
#define CFG_ENV_SIZE 0x10000 /* Total Size of Environment Sector */
#define CFG_NAND_LEGACY 1
#define CFG_ENV_OFFSET 0X20000 /*环境变量在Nand Flash的0x20000处*/
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
#define CFG_NAND_BASE 0x4E000000 /* physical address to access nand at CS0*/
/* Nand Flash控制器在SFR区起始寄存器地址 */
#define CFG_MAX_NAND_DEVICE 1 /*支持Nand Flash设备的最大个数*/
#define SECTORSIZE 512
#define NAND_SECTOR_SIZE SECTORSIZE
#define NAND_BLOCK_MASK 511
#define ADDR_COLUMN 1
#define ADDR_PAGE 3
#define ADDR_COLUMN_PAGE 4
#define NAND_ChipID_UNKNOWN 0x00 /* 未知芯片的ID号 */
#define NAND_MAX_FLOORS 1
#define NAND_MAX_CHIPS 1 /* 板子上NAND Flash芯片的最大个数 */
/*下面7行是Nand Flash命令层底层的接口函数 */
#define WRITE_NAND_COMMAND(d, adr) {rNFCMD = d;}
#define WRITE_NAND_ADDRESS(d, adr) {rNFADDR = d;}
#define WRITE_NAND(d, adr) {rNFDATA = d;}
#define READ_NAND(adr) (rNFDATA)
#define NAND_WAIT_READY(nand) {while(!(rNFSTAT&(1<<0)));}
#define NAND_DISABLE_CE(nand) {rNFCONF |= (1<<11);}
#define NAND_ENABLE_CE(nand) {rNFCONF &= ~(1<<11);}
/* the following functions are NOP's because S3C24X0 handles this in hardware */
#define NAND_CTL_CLRALE(nandptr)
#define NAND_CTL_SETALE(nandptr)
#define NAND_CTL_CLRCLE(nandptr)
#define NAND_CTL_SETCLE(nandptr)
#define CONFIG_MTD_NAND_VERIFY_WRITE 1 /* 允许Nand Flash写校验 */
/*
* Nandflash Boot
*/
#define CONFIG_S3C2410_NAND_BOOT 1
#define STACK_BASE 0x33f00000
#define STACK_SIZE 0x8000
//#define UBOOT_RAM_BASE 0x33f80000
/* NAND Flash Controller */
#define NAND_CTL_BASE 0x4E000000
#define bINT_CTL(Nb) __REG(INT_CTL_BASE + (Nb))
/* Offset */
#define oNFCONF 0x00
#define oNFCMD 0x04
#define oNFADDR 0x08
#define oNFDATA 0x0c
#define oNFSTAT 0x10
#define oNFECC 0x14
#define rNFCONF (*(volatile unsigned int *)0x4e000000)
#define rNFCMD (*(volatile unsigned char *)0x4e000004)
#define rNFADDR (*(volatile unsigned char *)0x4e000008)
#define rNFDATA (*(volatile unsigned char *)0x4e00000c)
#define rNFSTAT (*(volatile unsigned int *)0x4e000010)
#define rNFECC (*(volatile unsigned int *)0x4e000014)
#define rNFECC0 (*(volatile unsigned char *)0x4e000014)
#define rNFECC1 (*(volatile unsigned char *)0x4e000015)
#define rNFECC2 (*(volatile unsigned char *)0x4e000016)
#endif /* CONFIG_COMMANDS & CFG_CMD_NAND*/
/****************** me add end *******************/
16、编辑board/sf2410/sf2410.c文件
[root@localhost u-boot-1.1.4]# gedit board/sf2410/sf2410.c
在文件的尾部添加如下内容:
/****************** me add begin *******************/
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
typedef enum {
NFCE_LOW,
NFCE_HIGH
} NFCE_STATE;
static inline void NF_Conf(u16 conf)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
nand->NFCONF = conf;
}
static inline void NF_Cmd(u8 cmd)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
nand->NFCMD = cmd;
}
static inline void NF_CmdW(u8 cmd)
{
NF_Cmd(cmd);
udelay(1);
}
static inline void NF_Addr(u8 addr)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
nand->NFADDR = addr;
}
static inline void NF_SetCE(NFCE_STATE s)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
switch (s) {
case NFCE_LOW:
nand->NFCONF &= ~(1<<11);
break;
case NFCE_HIGH:
nand->NFCONF |= (1<<11);
break;
}
}
static inline void NF_WaitRB(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
while (!(nand->NFSTAT & (1<<0)));
}
static inline void NF_Write(u8 data)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
nand->NFDATA = data;
}
static inline u8 NF_Read(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
return(nand->NFDATA);
}
static inline void NF_Init_ECC(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
nand->NFCONF |= (1<<12);
}
static inline u32 NF_Read_ECC(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
return(nand->NFECC);
}
#endif
/*
* NAND flash initialization.
*/
#if (CONFIG_COMMANDS & CFG_CMD_NAND)
extern ulong nand_probe(ulong physadr);
static inline void NF_Reset(void)
{
int i;
NF_SetCE(NFCE_LOW);
NF_Cmd(0xFF); /* reset command */
for(i = 0; i < 10; i++); /* tWB = 100ns. */
NF_WaitRB(); /* wait 200~500us; */
NF_SetCE(NFCE_HIGH);
}
static inline void NF_Init(void)
{
#if 0 /* a little bit too optimistic */
#define TACLS 0
#define TWRPH0 3
#define TWRPH1 0
#else
#define TACLS 0
#define TWRPH0 4
#define TWRPH1 2
#endif
NF_Conf((1<<15)|(0<<14)|(0<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0));
/*nand->NFCONF = (1<<15)|(1<<14)|(1<<13)|(1<<12)|(1<<11)|(TACLS<<8)|(TWRPH0<<4)|(TWRPH1<<0); */
/* 1 1 1 1, 1 xxx, r xxx, r xxx */
/* En 512B 4step ECCR nFCE=H tACLS tWRPH0 tWRPH1 */
NF_Reset();
}
void nand_init(void)
{
S3C2410_NAND * const nand = S3C2410_GetBase_NAND();
NF_Init();
#ifdef DEBUG
printf("NAND flash probing at 0x%.8lX\n", (ulong)nand);
#endif
printf ("%4lu MB\n", nand_probe((ulong)nand) >> 20);
}
#endif
/****************** me add end *******************/
17、修改 common/cmd_nand.c文件
[root@localhost u-boot-1.1.4]# gedit common/cmd_nand.c
将NanD_ReadBuf函数中的
NanD_Command (nand, NAND_CMD_READ0);
改为
//NanD_Command (nand, NAND_CMD_READ0);
18、编译、测试
[root@localhost u-boot-1.1.4]# make
[root@localhost u-boot-1.1.4]# ll u-boot*
-rwxr-xr-x 1 root root 440745 06-14 18:46 u-boot
-rwxr-xr-x 1 root root 115460 06-14 18:46 u-boot.bin
-rw-r--r-- 1 root root 50542 06-14 18:46 u-boot.map
-rwxr-xr-x 1 root root 346442 06-14 18:46 u-boot.srec
[root@localhost u-boot-1.1.4]# ./mknandflashdump u-boot.bin nand.dump 0
finish
[root@localhost u-boot-1.1.4]# skyeye1.2.6
...
U-Boot code: 33F80000 -> 33F9C304 BSS: -> 33FA03E0
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
NAND: 64 MB
*** Warning - bad CRC or NAND, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
TFTP from server 10.0.0.1; our IP address is 10.0.0.110
Filename 'uImage'.
Load address: 0x31000000
Loading: checksum bad
checksum bad
T T T T T .................
出现
Flash: 512 kB
NAND: 64 MB
表示实验成功,T代表try尝试去连接服务器,因为没有建立服务器所以不能连接成功。
三、linux移植
因为linux2.6.14的交叉编译器为gcc-3.4.1,所以要先创建交叉编译环境
解压arm-linux-gcc-3.4.1.tar.bz2
[root@localhost opt]# tar -xjvf arm-linux-gcc-3.4.1.tar.bz2 -C /usr/local/arm
1、解压linux-2.6.14.7.tar.bz2
[root@localhost opt]# tar -xjvf linux-2.6.14.7.tar.bz2 -C ./
[root@localhost opt]# cd linux-2.6.14.7
[root@localhost linux-2.6.14.7]# dir
2、编辑Makefile文件
[root@localhost linux-2.6.14.7]# gedit Makefile
将
ARCH ?= $(SUBARCH)
CROSS_COMPILE ?=
改为
ARCH ?= arm
CROSS_COMPILE ?= /usr/local/arm/3.4.1/bin/arm-linux- // linux2.6.14的交叉编译器为gcc-3.4.1
3、复制cs8900
[root@localhost linux-2.6.14.7]# cp ../cs8900/cs8900.c drivers/net/arm/
cp: 无法 stat “../cs8900/cs8900.c”: 没有那个文件或目录
在/opt/下建立一个文件夹,把cs8900.c和cs8900.h移到cs8900文件夹下即可
[root@localhost linux-2.6.14.7]# cp ../cs8900/cs8900.c drivers/net/arm/
[root@localhost linux-2.6.14.7]# cp ../cs8900/cs8900.h drivers/net/arm/
[root@localhost linux-2.6.14.7]# ls drivers/net/arm
am79c961a.c cs8900.c ether00.c ether1.h ether3.h Kconfig
am79c961a.h cs8900.h ether1.c ether3.c etherh.c Makefile
4、修改drivers/net/arm/目录下的Kconfig文件
[root@localhost linux-2.6.14.7]# gedit drivers/net/arm/Kconfig
在最后添加如下内容:
config ARM_CS8900
tristate "CS8900 support"
depends on NET_ETHERNET && ARM && ARCH_SMDK2410
help
Support for CS8900A chipset based Ethernet cards. If you have a network
(Ethernet) card of this type, say Y and read the Ethernet-HOWTO, available
from as well as .To compile this driver as a module, choose M here and read.
The module will be called cs8900.o.
5、修改drivers/net/arm/目录下的Makefile文件,
[root@localhost linux-2.6.14.7]# gedit drivers/net/arm/Makefile
在文件最后添加如下内容:
obj-$(CONFIG_ARM_CS8900) += cs8900.o
6、编辑arch/arm/mach-s3c2410/mach-smdk2410.c文件
[root@localhost linux-2.6.14.7]# ls arch/arm/mach-s3c2410/
[root@localhostlinux-2.6.14.7]# gedit arch/arm/mach-s3c2410/mach-smdk2410.c
添加一个头文件
#include
将
static struct map_desc smdk2410_iodesc[] __initdata = {
/* nothing here yet */
};
改为
static struct map_desc smdk2410_iodesc[] __initdata = {
/* nothing here yet */
/* Map the ethernet controller CS8900A */
{ vSMDK2410_ETH_IO, pSMDK2410_ETH_IO, SZ_1M, MT_DEVICE }
};
7、在include/asm-arm/arch-s3c2410/目录下创建smdk2410.h文件
[root@localhostlinux-2.6.14.7]#gedit include/asm-arm/arch-s3c2410/smdk2410.h
文件的内容如下:
#ifndef _INCLUDE_SMDK2410_H_
#define _INCLUDE_SMDK2410_H_
#include
#define pSMDK2410_ETH_IO 0x19000000
#define vSMDK2410_ETH_IO 0xE0000000
#define SMDK2410_ETH_IRQ IRQ_EINT9
#endif // _INCLUDE_SMDK2410_H_
8、设置Flash分区
在此要编辑3个文件:devs.c、mach-smdk2410.c、s3c2410.c。
(1)编辑devs.c文件,指明分区信息
[root@localhost linux-2.6.14.7]# gedit arch/arm/mach-s3c2410/devs.c
在文件的前面添加如下内容:
/*nand */
#include
#include
#include
/* NAND Controller */
/************************ 建立Nand Flash分区表 ************************/
/* 一个Nand Flash总共64MB, 按如下大小进行分区 */
/*
name:代表分区名字
size:代表Flash分区大小(单位:字节)
offset:代表Flash分区的起始地址(相对于0x0的偏移)
*/
static struct mtd_partition partition_info[] =
{
{ /* 1MB */
name: "bootloader",
size: 0x00100000,
offset: 0x0,
},
{ /* 3MB */
name: "kernel",
size: 0x00300000,
offset: 0x00100000,
},
{ /* 40MB */
name: "root",
size: 0x02800000,
offset: 0x00400000,
},
{ /* 20MB */
name: "user",
size: 0x00f00000,
offset: 0x02d00000,
}
};
/************************ 加入Nand Flash分区 ************************/
/*
nr_partitions:指明partition_info中定义的分区数目
partitions:分区信息表
*/
struct s3c2410_nand_set nandset =
{
nr_partitions: 4, /* the number of partitions */
partitions: partition_info, /* partition table */
};
/************************ 建立Nand Flash芯片支持 ************************/
/*
*/
struct s3c2410_platform_nand superlpplatform=
{
tacls:0,
twrph0:30,
twrph1:0,
sets: &nandset,
nr_sets: 1,
};
另外,还要修改该文件中s3c_device_nand结构体变量,添加对dev成员的赋值。
struct platform_device s3c_device_nand = {
.name = "s3c2410-nand", /* device name */
.id = -1, /* device id */
.num_resources = ARRAY_SIZE(s3c_nand_resource),
.resource = s3c_nand_resource, /* Nand Flash Controller Registers */
.dev = /* Add the Nand Flash device */
{
.platform_data = &superlpplatform
}
};
(2)编辑mach-smdk2410.c文件,指定启动时初始化kernel启动时依据对分区的设置进行初始化。
[root@localhostlinux-2.6.14.7]#gedit arch/arm/mach-s3c2410/mach-smdk2410.c
修改smdk2410_devices[],指明初始化时,包括前面设置的Flash分区信息。
static struct platform_device *smdk2410_devices[] __initdata = {
&s3c_device_usb,
&s3c_device_lcd,
&s3c_device_wdt,
&s3c_device_i2c,
&s3c_device_iis,
/* 添加如下语句 */
&s3c_device_nand,
};
(3)编辑s3c2410.c文件,禁止Flash ECC校验
[root@localhost linux-2.6.14.7]# gedit drivers/mtd/nand/s3c2410.c
在s3c2410_nand_init_chip()函数中。
将
chip->eccmode = NAND_ECC_SOFT;
改为
chip->eccmode = NAND_ECC_NONE;
9、配置内核
(1)支持启动时挂载devfs
找到menu "Pseudo filesystems"在其后边添加如下语句:
config DEVFS_FS
bool "/dev file system support (OBSOLETE)"
default y
config DEVFS_MOUNT
bool "Automatically mount at boot"
default y
depends on DEVFS_FS
(2)配置内核,产生.config文件
[root@localhost linux-2.6.14.7]# cp arch/arm/configs/smdk2410_defconfig .config
[root@localhost linux-2.6.14.7]# make menuconfig //开始配置内核
Loadable module support --->
[*] Enable loadable module support
# 设置内核启动参数
Boot options >
将
(root=1f04 mem=32M) Default kernel command string
改为
noinitrd mem=64M root=/dev/mtdblock2 init=/linuxrc console=ttySAC0,115200
Floating point emulation --->
[*] NWFPE math emulation
//This is necessary to run most binaries!!!
#接下来要做的是对内核MTD子系统的设置
Device Drivers --->
Memory Technology Devices (MTD) --->
<*> Memory Technology Device (MTD) support
[*] MTD partitioning support
#支持MTD分区,这样我们在前面设置的分区才有意义
[*] Command line partition table parsing
#支持从命令行设置flash分区信息,灵活
RAM/ROM/Flash chip drivers --->
<*> Detect flash chips by Common Flash Interface (CFI) probe
<*> Detect non-CFI AMD/JEDEC-compatible flash chips
[ ] Flash chip driver advanced configuration options
<*> Support for Intel/Sharp flash chips
<*> Support for AMD/Fujitsu flash chips
(0) Retry failed commands (erase/program) (NEW)
< > Support for ST (Advanced Architecture) flash chips
< > Support for RAM chips in bus mapping
<*> Support for ROM chips in bus mapping
< > Support for absent chips in bus mapping
< > XIP aware MTD support
NAND Flash Device Drivers --->
<*> NAND Device Support
<*> NAND Flash support for S3C2410/S3C2440 SoC
# 内核支持从Ramdisk启动
Device Drivers --->
Block devices --->
<*> Loopback device support
<*> Network block device support
<*> RAM disk support
(16) Default number of RAM disks
(4096) Default RAM disk size (kbytes)
[*] Initial RAM disk (initrd) support
# 设置CS8900的支持, 将前面添加的网卡驱动程序,以静态的方式添加到内核中
Device Drivers --->
Network device support --->
Ethernet (10 or 100Mbit) --->
[*] Ethernet (10 or 100Mbit)
<*> CS8900 support
#接下来要做的是对串口的设置
Device Drivers --->
Character devices --->
[*] Non-standard serial port support
[*] S3C2410 RTC Driver
#接下来要做的是针对文件系统的设置
File systems --->
<*> Second extended fs support
<*> ROM file system support #支持romfs
Pseudo filesystems --->
[*] /dev file system support (OBSOLETE)
[*] Automatically mount at boot (NEW)
[*] /proc file system support
[*] Virtual memory file system support (former shm fs)
Miscellaneous filesystems --->
<*> Journalling Flash File System (JFFS) support #支持JFFS
(0) JFFS debugging verbosity (0 = quiet, 3 = noisy) (NEW)
[*] JFFS stats available in /proc filesystem
<*> Journalling Flash File System v2 (JFFS2) support #支持JFFS2
(0) JFFS2 debugging verbosity (0 = quiet, 2 = noisy) (NEW)
[*] JFFS2 write-buffering support (NEW)
[ ] Advanced compression options for JFFS2 (NEW)
<*> Compressed ROM file system support (cramfs) #支持cramfs
Network File Systems --->
<*> NFS file system support
[*] Provide NFSv3 client support
[*] Root file system on NFS
保存退出,产生.config文件。
10、编译内核,创建uImage,将uImage复制到tftp服务器的根目录(/tftpboot/)
[root@localhost linux-2.6.14.7]# make
...
/bin/sh: /usr/local/arm/3.4.1/bin/arm-linux-: 没有那个文件或目录
make[1]: *** [arch/arm/kernel/asm-offsets.s] 错误 1
make: *** [prepare0] 错误 2
出现错误。
将Makefile文件中的$(CROSS_COMPILE)改成绝对路径 /usr/local/arm/3.4.1/bin/arm-linux-
把解压后的文件夹/usr/local/arm/usr/local/arm/3.4.1/中的3.4.1文件夹移到/usr/local/arm/下
再次执行make命令。
...
OBJCOPY arch/arm/boot/zImage
Kernel: arch/arm/boot/zImage is ready
Building modules, stage 2.
MODPOST
表示成功。
[root@localhost linux-2.6.14.7]# cp arch/arm/boot/compressed/vmlinux ../u-boot-1.1.4/tools/
[root@localhost linux-2.6.14.7]# cd ../u-boot-1.1.4/tools/
[root@localhost tools]# ./mkimage -A arm -O linux -T kernel -C none -a 30008000 -e 30008000 -n linux-2.6.14.7 -d vmlinux uImage //用mkimage将内核映像(vmlinux)进行转换
[root@localhost tools]# cp uImage ../
[root@localhost tools]# cp initrd.img ../
cp: 无法 stat “initrd.img”: 没有那个文件或目录
出现错误。将initrd.img移到/opt/u-boot-1.1.4/tools/文件夹下即可
[root@localhost tools]# cp uImage /tftpboot/
cp: 无法创建一般文件“/tftpboot/”: 是一个目录
出现错误。在/下建立一个文件夹,名字为tftpboot
[root@localhost tools]# cp uImage /tftpboot/
[root@localhost tools]# cp initrd.img /tftpboot/
[root@localhost tools]# cp ../u-boot.bin /tftpboot/
[root@localhost tools]# cp initrd.img /tmp/nfs/
cp: 无法创建一般文件“/tmp/nfs/”: 是一个目录
出现错误。在/tmp/下建立一个文件夹,名字为nfs
11、执行skyeye1.2.6,通过u-boot-1.1.4引导linux-2.6.14.7
[root@localhost u-boot-1.1.4]# skye1.2.6
要先搭建tftp服务器,才会出现如下信息
**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************
Your elf file is little endian.
arch: arm
... // 此处省略
U-Boot 1.1.4 (Jun 14 2011 - 09:30:43)
U-Boot code: 33F80000 -> 33F9C304 BSS: -> 33FA03E0
RAM Configuration:
Bank #0: 30000000 64 MB
Flash: 512 kB
NAND: 64 MB
*** Warning - bad CRC or NAND, using default environment
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0
TFTP from server 10.0.0.1; our IP address is 10.0.0.110
Filename 'uImage'.
Load address: 0x31000000
Loading: checksum bad
#################################################################
#################################################################
#################################################################
######
done
... // 此处省略
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux................................................................. done, booting the kernel.
... // 此处省略
重启计算机后会出现错误,执行如下命令即可:
[root@localhost opt]# service xinetd restart
[root@localhost opt]# iptables -F
四、根文件系统的移植
1、解压busybox-1.13.4.tar.bz2
[root@localhost opt]# tar -xjvf busybox-1.13.4.tar.bz2 -C ./
[root@localhost opt]# cd busybox-1.13.4
2、编辑Makefile文件
[root@localhost busybox-1.13.4]# gedit Makefile
将
CROSS_COMPILE ?=
改为
CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux-
将
ARCH ?= $(SUBARCH)
改为
ARCH ?= arm
3、进行默认配置
[root@localhost busybox-1.13.4]# make defconfig //恢复默认配置
4、对配置信息进行修改
[root@localhost busybox-1.13.4]# make menuconfig
在弹出的TUI界面中进行如下配置:
检查Miscellaneous Utilities--->
taskset 是否去除
同时设置如下:
Busybox Settings --->
Build Options --->
[*]Build BusyBox as a static binry (no shared libs) //选用静态连接
[*]Build with Large File Support (for accessing files > 2 GB)
(/usr/local/arm/3.4.1/bin/arm-linux-) Cross Compiler prefix
Installation Options --->
[*] Don't use /usr
(./_install) BusyBox installation prefix //安装路径
Busybox Library Tuning --->
(6) Minimum password length
(2) MD5: Trade Bytes for Speed
[*] Faster /proc scanning code (+100 bytes)
[ ] Support for /etc/networks
[*] Command line editing
(1024) Maximum length of input
[*] vi-style line editing commands
(15) History size
[*] History saving
[*] Tab completion
[*] Username completion
[*] Fancy shell prompts //Setting this option allows for prompts to use things like \w and
// \$ and escape codes.
[ ] Give more precise messages when copy fails (cp, mv etc)
(4) Copy buffer size, in kilobytes
[ ] Use clock_gettime(CLOCK_MONOTONIC) syscall
[*] Use ioctl names rather than hex values in error messages
[*] Support infiniband HW
设置完毕后,保存、退出。
5、编译
[root@localhost busybox-1.13.4]# make
此时编译会出错,networking/interface.c:818: error: `ARPHRD_INFINIBAND' undeclared here (not in a function)
networking/interface.c:818: error: initializer element is not constant
networking/interface.c:818: error: (near initialization for `ib_hwtype.type')
make[1]: *** [networking/interface.o] 错误 1
make: *** [networking] 错误 2
需要编辑networking/interface.c文件。
将第818行的.type = ARPHRD_INFINIBAND,改为 .type = -1,再次执行make命令
如果成功,会出现如下信息:
--------------------------------------------------
You will probably need to make your busybox binary
setuid root to ensure all configured applets will
work properly.
--------------------------------------------------
6、修改_install/bin/busybox文件的属性。
[root@localhost busybox-1.13.4]# make install
[root@localhost busybox-1.13.4]# ll _install/bin/busybox
-rwxr-xr-x 1 root root 1705032 06-14 21:25 _install/bin/busybox
[root@localhost busybox-1.13.4]# chmod 4755 ./_install/bin/busybox
[root@localhost busybox-1.13.4]# ll _install/bin/busybox
-rwsr-xr-x 1 root root 1705032 06-14 21:25 _install/bin/busybox
[root@localhost busybox-1.13.4]# ll _install/
[root@localhost busybox-1.13.4]#
[root@localhost busybox-1.13.4]# cd _install/
[root@localhost _install]# pwd
/opt/busybox-1.13.4/_install
7、对配置信息进行修改
[root@localhost _install]# cd /tmp/nfs
(1)在/tmp/nfs中创建所需的目录
[root@localhost nfs]# mkdir -p bin sbin lib/modules etc/init.d dev usr/bin usr/sbin usr/lib proc sys home root boot mnt/etc mnt/jffs2 mnt/yaffs mnt/data mnt/temp var/lib var/lock var/log var/run var/tmp tmp
[root@localhost nfs]# chmod 1777 tmp
[root@localhost nfs]# chmod 1777 var/tmp
[root@localhost nfs]# cd dev/
[root@localhost dev]# pwd
/tmp/nfs/dev
[root@localhost dev]# mknod -m 600 console c 5 1
[root@localhost dev]# mknod -m 666 null c 1 3
(2)复制文件到/tmp/nfs中
将/root/opt/busybox-1.13.4/_install中的内容复制到/tmp/nfs中。
[root@localhost dev]# cd /opt/busybox-1.13.4/_install
[root@localhost _install]# pwd
/opt/busybox-1.13.4/_install
[root@localhost _install]# cp -a bin /tmp/nfs/
[root@localhost _install]# cp -a sbin /tmp/nfs/
[root@localhost _install]# ll linuxrc
lrwxrwxrwx 1 root root 11 06-14 21:25 linuxrc -> bin/busybox
[root@localhost _install]# cp -a linuxrc /tmp/nfs/
[root@localhost _install]# ll /tmp/nfs/linuxrc
lrwxrwxrwx 1 root root 11 06-14 21:35 /tmp/nfs/linuxrc -> bin/busybox
[root@localhost _install]# cd ..
[root@localhost busybox-1.13.4]# pwd
/opt/busybox-1.13.4
[root@localhost busybox-1.13.4]# cp -a examples/bootfloppy/etc/* /tmp/nfs/etc/
[root@localhost busybox-1.13.4]# ls /tmp/nfs/etc/
fstab init.d inittab profile
8、创建配置文件
(1)编写etc/inittab文件、修改其权限
[root@localhost busybox-1.13.4]# cd /tmp/nfs/
[root@localhost nfs]# gedit etc/inittab
文件内容如下:
::sysinit:/etc/init.d/rcS #指定系统初始化脚本文件
::respawn:-/bin/login #加上-语句会在登陆终端之后调用/etc/目录下的profile文件
::restart:/sbin/init #指定系统重启时执行的初始化程序
tty0::respawn:-/bin/login
::shutdown:/bin/umount -a -r #指定关机时执行的操
::shutdown:/sbin/swapoff -a
[root@localhost nfs]# ll etc/inittab
-rw-r--r-- 1 root root 174 06-14 21:44 etc/inittab
[root@localhost nfs]# chmod 755 etc/inittab
(2)编写etc/init.d/rcS文件、修改其权限
[root@localhost nfs]# gedit etc/init.d/rcS
文件内容如下:
#!/bin/sh
# mount all filesystem defined in "fstab"
echo "#mount all......."
/bin/mount -a
/bin/mknod -m 600 /dev/console c 5 1
/bin/mknod -m 666 /dev/null c 1 3
/bin/mknod -m 666 /dev/tty0 c 4 0
/bin/mknod -m 666 /dev/mtdblock0 b 31 0
/bin/mknod -m 666 /dev/mtdblock1 b 31 1
/bin/mknod -m 666 /dev/mtdblock2 b 31 2
/bin/mknod -m 666 /dev/mtdblock3 b 31 3
#/bin/mount -t ext2 /dev/mtdblock3 /mnt/temp/
echo "******************************************************************"
echo " SF 2410 Rootfs made by wsf, 2011.06
echo "******************************************************************"
//可更改,作为自己与别人的不同之处
[root@localhost nfs]# ll etc/init.d/rcS
-rwxr-xr-x 1 root root 621 06-14 21:49 etc/init.d/rcS
[root@localhost nfs]# chmod 755 etc/init.d/rcS
(3)编写etc/fstab文件、修改其权限
[root@localhost nfs]# gedit etc/fstab
文件内容如下:
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
none /tmp ramfs defaults 0 0
mdev /dev ramfs defaults 0 0
[root@localhost nfs]# ll etc/fstab
-rw-r--r-- 1 root root 117 06-14 21:51 etc/fstab
[root@localhost nfs]# chmod 755 etc/fstab
(4)编写etc/proflie文件、修改其权限
[root@localhost nfs]# gedit etc/proflie
文件内容如下:
# /etc/profile: system-wide .profile file for the Bourne shells
echo
echo -n "Processing /etc/profile... "
# no-op
# Set search library path
echo "Set search library path in /etc/profile"
export LD_LIBRARY_PATH=/lib:/usr/lib
# Set user path
echo "Set user path in /etc/profile"
export PATH=/bin:/sbin:/usr/bin:/usr/sbin #设置命令搜索路径
export HISTSIZE=100
export PS1='[\u@\h \W]\$ '
alias ll='ls -l'
#/sbin/ifconfig eth0 192.168.1.22 netmask 255.255.255.0
/sbin/ifconfig lo 127.0.0.1
echo "Configure net done"
echo "All Done"
echo
(5)创建密码文件、修改其权限
下面3个文件可以从宿主机中复制,只留下root帐号。
[root@localhost nfs]# cp /etc/passwd etc/ ;cp /etc/shadow etc/ ;cp /etc/group etc/
[root@localhost nfs]# chmod 600 etc/shadow
[root@localhost nfs]# gedit etc/passwd
内容是文件的第一行,把其他行删除,将bash改成sh
[root@localhost nfs]# gedit etc/shadow
内容是文件第一行
[root@localhost nfs]# gedit etc/group
内容是文件第一行
//这样设置在登录界面的密码是本机密码,如果在登录界面不知道密码,可将etc/passwd里的root用户中的x删除,在进入后,可以重新设置密码。
(6)为mdev创建配置文件
[root@localhost nfs]# gedit etc/mdev.conf
内容是:空
[root@localhost nfs]# ll etc/
(7)删除备份文件
[root@localhost nfs]# rm etc/*~ etc/init.d/*~
9、复制常用的库文件
编写脚本文件copy_lib.sh。
[root@localhost nfs]# gedit copy_lib.sh
文件内容如下:
#!/bin/bash
#You should put this file cp.sh in /usr/local/arm/3.4.1/arm-linux/lib/
ROOTFS_LIB=/tmp/nfs/lib/
for file in libc libcrypt libdl libm libpthread libresolv libutil
do
cp $file-*.so ${ROOTFS_LIB}
cp -d $file.so.[*0-9] ${ROOTFS_LIB}
done
cp -d ld*.so* ${ROOTFS_LIB}
[root@localhost nfs]# ll copy_lib.sh
-rw-r--r-- 1 root root 274 06-14 21:58 copy_lib.sh
[root@localhost nfs]# chmod a+x copy_lib.sh
[root@localhost nfs]# cp copy_lib.sh /usr/local/arm/3.4.1/arm-linux/lib/
[root@localhost nfs]# cd /usr/local/arm/3.4.1/arm-linux/lib/
[root@localhost lib]# ./copy_lib.sh
[root@localhost lib]# cd -
/tmp/nfs
[root@localhost nfs]# ll lib
10、完整的启动过程(u-boot、内核、文件系统)
(1)编辑/etc/xinetd.d/tftp文件
[root@localhost opt]# gedit /etc/xinetd.d/tftp
(2)重启tftp服务器
[root@localhost opt]# service xinetd restart
停止 xinetd: [确定]
启动 xinetd: [确定]
(3)编辑/etc/exports文件
[root@localhost opt]# gedit /etc/exports
(4)重启NFS服务器
[root@localhost u-boot-1.1.4]# service nfs restart
关闭 NFS mountd: [确定]
关闭 NFS 守护进程: [确定]
关闭 NFS quotas: [确定]
关闭 NFS 服务: [确定]
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS 守护进程: [确定]
启动 NFS mountd: [确定]
[root@localhost u-boot-1.1.4]# exportfs
/tmp/nfs
[root@localhost u-boot-1.1.4]# exportfs -ra
(5)完整的启动过程(u-boot、内核、文件系统、用户程序),使用NFS文件系统
[root@localhost u-boot-1.1.4]# skyeye1.2.6
**************************** WARNING **********************************
If you want to run ELF image, you should use -e option to indicate
your elf-format image filename. Or you only want to run binary image,
you need to set the filename of the image and its entry in skyeye.conf.
***********************************************************************
……
Hit any key to stop autoboot: 0
SF2410 # run bootcmd
TFTP from server 10.0.0.1; our IP address is 10.0.0.110
Filename 'uImage'.
Load address: 0x31000000
Loading: checksum bad
checksum bad
#################################################################
#################################################################
#################################################################
################################
done
Bytes transferred = 1161416 (11b8c8 hex)
## Booting image at 31000000 ...
Image Name: linux-2.6.14.7
Created: 2009-05-24 11:22:39 UTC
Image Type: ARM Linux Kernel Image (uncompressed)
Data Size: 1161352 Bytes = 1.1 MB
Load Address: 30008000
Entry Point: 30008000
Verifying Checksum ... OK
OK
Starting kernel ...
Uncompressing Linux.......................................................................... done, booting the kernel.
... //省略
VFS: Mounted root (nfs filesystem).
Mounted devfs on /dev
Freeing init memory: 92K
#mount all.......
****************************************************************************************************************
SF 2410 Rootfs made by wsf, 2011.06
****************************************************************************************************************
wsflogin: root
login[25]:
[root@wsf /root]# less test.c //查看文件内容
#include
#include
int main (int argc,char* argv[])
{
int i;
printf("===== main =====\n");
printf ("Hello world!\n");
for(i=0;i
{
printf("argv[%d]=%s\n",i,argv[i]);
}
printf("==== exit main ====\n");
return 0;
}
[root@wsf /root]#gcc helloword
[root@wsf /root]#./a.out
如果出现如下情况
...
Irq: clearing subpending status 00000092
PID hash table entries: 512 (order: 9, 8192 bytes)
timer tcon=00500000, tcnt a509, tcfg 00000200,00000000, usec 00001e4c
Console: colour dummy device 80x30
解决办法:
[root@localhost /]# service nfs restart
关闭 NFS mountd: [确定]
关闭 NFS 守护进程: [确定]
关闭 NFS quotas: [确定]
关闭 NFS 服务: [确定]
启动 NFS 服务: [确定]
关掉 NFS 配额: [确定]
启动 NFS 守护进程: [确定]
启动 NFS mountd: [确定]
[root@localhost /]# iptables -F
[root@localhost /]# service xinetd restart
停止 xinetd: [确定]
启动 xinetd: [确定]
或者是当启动到
In: serial
Out: serial
Err: serial
Hit any key to stop autoboot: 0 回车
OK2410 # 在此输入”run bootcmd“
http://blog.chinaunix.net/space.php?uid=14735472&do=blog&id=110947