嵌入式系统移植三部曲 吴素芬

计算机与信息工程学院  09级嵌入式  吴素芬

嵌入式系统移植三部曲

一、BootLoader的移植

二、linux的移植

三、根文件系统的移植

一、准备工作

(1)、创建交叉编译环境

1、[[email protected] 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、[[email protected] 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、[[email protected] opt]# gedit /etc/profile

在文件profile中添加

PATH=$PATH:/usr/local/arm/2.95.3/bin

设置编译环境是2.95.3

4、[[email protected] opt]# source /etc/profile   //使/etc/profile中添加的一行生效

[[email protected] 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)

[[email protected] opt]#

(2)、skyeye的安装

1、[[email protected] opt]# tar -xjvf skyeye-1.2.6_rc1.tar.bz2 -C ./

2、[[email protected] opt]# cd skyeye-1.2.6_rc1

3、[[email protected] 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、[[email protected] skyeye-1.2.6_rc1]# ./configure   //配置

5、[[email protected] skyeye-1.2.6_rc1]# make          //编译

6、[[email protected] skyeye-1.2.6_rc1]# make install   //将skyeye安装到/usr/local/bin/

7、[[email protected] 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

[[email protected] opt]# tar  -xjvf  u-boot-1.1.4.tar.bz2  -C  ./

[[email protected] opt]# cd  u-boot-1.1.4

2.编辑u-boot根目录中的Makefile文件

[[email protected] 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头文件

[[email protected] u-boot-1.1.4]# mkdir board/sf2410

[[email protected] u-boot-1.1.4]# cp board/smdk2410/* board/sf2410

[[email protected] u-boot-1.1.4]# dir board/sf2410/

config.mk  flash.c  lowlevel_init.S  Makefile  smdk2410.c  u-boot.lds

[[email protected] u-boot-1.1.4]# mv board/sf2410/smdk2410.c board/sf2410/sf2410.c

[[email protected] u-boot-1.1.4]# cp include/configs/smdk2410.h include/configs/sf2410.h

[[email protected] 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文件

[[email protected] u-boot-1.1.4]# gedit board/sf2410/Makefile

OBJS        := smdk2410.o flash.o

改为

OBJS        := sf2410.o flash.o

5.配置u-boot

[[email protected] u-boot-1.1.4]# make sf2410_config

Configuring for sf2410 board...

(1)、修改cpu/arm920t/config.mk文件

[[email protected] 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文件

[[email protected] 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

[[email protected] u-boot-1.1.4]# make

[[email protected] 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文件

[[email protected] 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

[[email protected] 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

[[email protected] 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    */

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             */

add        r2, r0, r2                /* r2          */

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

[[email protected] 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文件

[[email protected] 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

}

/* 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

for(i=start_addr; i

/* 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

*buf = (NFDATA & 0xff);

buf++;

}

}

/* chip Disable */

NFCONF |= 0x800; /* chip disable */

return 0;

}

12、编辑include/configs/sf2410.h文件

[[email protected] 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启动

[[email protected] 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的点丢失了!:

[[email protected] 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会出现错误,所以先执行下边命令:

[[email protected] 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/下,然后执行下边命令

[[email protected] u-boot-1.1.4]# cp /opt/u-boot-1.1.4/mknandflashdump /bin

//把mknandflashdump放到自动搜索路径的文件夹下,再次执行mknandflashdump u-boot.bin nand.dump 0这条命令即可

[[email protected] u-boot-1.1.4]# mknandflashdump u-boot.bin nand.dump 0

finish

[[email protected] u-boot-1.1.4]# ll nand.dump

---------- 1 root root 69206016 06-14 18:16 nand.dump

[[email protected] u-boot-1.1.4]# ll nand.dump

-rw-rw-rw- 1 root root 69206016 06-14 18:16 nand.dump

[[email protected] 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文件

[[email protected] 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

#define NAND_DISABLE_CE(nand) {rNFCONF |= (1

#define NAND_ENABLE_CE(nand) {rNFCONF &= ~(1

/* 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文件

[[email protected] 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

break;

case NFCE_HIGH:

nand->NFCONF |= (1

break;

}

}

static inline void NF_WaitRB(void)

{

S3C2410_NAND * const nand = S3C2410_GetBase_NAND();

while (!(nand->NFSTAT & (1

}

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

}

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

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

/*nand->NFCONF
=
(1

/* 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文件

[[email protected] 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、编译、测试

[[email protected] u-boot-1.1.4]# make

[[email protected] 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

[[email protected] u-boot-1.1.4]# ./mknandflashdump u-boot.bin nand.dump 0

finish

[[email protected] 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

[[email protected] opt]# tar -xjvf arm-linux-gcc-3.4.1.tar.bz2 -C /usr/local/arm

1、解压linux-2.6.14.7.tar.bz2

[[email protected] opt]# tar -xjvf linux-2.6.14.7.tar.bz2 -C ./

[[email protected] opt]#  cd linux-2.6.14.7

[[email protected] linux-2.6.14.7]# dir

2、编辑Makefile文件

[[email protected] 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

[[email protected] linux-2.6.14.7]# cp ../cs8900/cs8900.c drivers/net/arm/

cp: 无法 stat “../cs8900/cs8900.c”: 没有那个文件或目录

在/opt/下建立一个文件夹,把cs8900.c和cs8900.h移到cs8900文件夹下即可

[[email protected] linux-2.6.14.7]# cp ../cs8900/cs8900.c drivers/net/arm/

[[email protected] linux-2.6.14.7]# cp ../cs8900/cs8900.h drivers/net/arm/

[[email protected] 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文件

[[email protected] 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文件,

[[email protected] linux-2.6.14.7]# gedit drivers/net/arm/Makefile

在文件最后添加如下内容:

obj-$(CONFIG_ARM_CS8900)        += cs8900.o

6、编辑arch/arm/mach-s3c2410/mach-smdk2410.c文件

[[email protected] linux-2.6.14.7]# ls arch/arm/mach-s3c2410/

[[email protected]]# 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文件

[[email protected]]#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文件,指明分区信息

[[email protected] 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启动时依据对分区的设置进行初始化。

[[email protected]]#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校验

[[email protected] 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文件

[[email protected] linux-2.6.14.7]# cp arch/arm/configs/smdk2410_defconfig .config

[[email protected] 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/)

[[email protected] 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

表示成功。

[[email protected] linux-2.6.14.7]# cp arch/arm/boot/compressed/vmlinux ../u-boot-1.1.4/tools/

[[email protected] linux-2.6.14.7]# cd ../u-boot-1.1.4/tools/

[[email protected] 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)进行转换

[[email protected] tools]#  cp uImage  ../

[[email protected] tools]# cp initrd.img  ../

cp: 无法 stat “initrd.img”: 没有那个文件或目录

出现错误。将initrd.img移到/opt/u-boot-1.1.4/tools/文件夹下即可

[[email protected] tools]# cp uImage /tftpboot/

cp: 无法创建一般文件“/tftpboot/”: 是一个目录

出现错误。在/下建立一个文件夹,名字为tftpboot

[[email protected] tools]# cp uImage /tftpboot/

[[email protected] tools]# cp initrd.img /tftpboot/

[[email protected] tools]# cp ../u-boot.bin /tftpboot/

[[email protected] 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

[[email protected] 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.

...           // 此处省略

重启计算机后会出现错误,执行如下命令即可:

[[email protected] opt]# service xinetd restart

[[email protected] opt]# iptables -F

四、根文件系统的移植

1、解压busybox-1.13.4.tar.bz2

[[email protected] opt]# tar -xjvf busybox-1.13.4.tar.bz2 -C ./

[[email protected] opt]# cd busybox-1.13.4

2、编辑Makefile文件

[[email protected] busybox-1.13.4]# gedit Makefile

CROSS_COMPILE ?=

改为

CROSS_COMPILE ?=/usr/local/arm/3.4.1/bin/arm-linux-

ARCH ?= $(SUBARCH)

改为

ARCH ?= arm

3、进行默认配置

[[email protected] busybox-1.13.4]# make defconfig                //恢复默认配置

4、对配置信息进行修改

[[email protected] 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、编译

[[email protected] 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文件的属性。

[[email protected] busybox-1.13.4]# make install

[[email protected] busybox-1.13.4]# ll _install/bin/busybox

-rwxr-xr-x 1 root root 1705032 06-14 21:25 _install/bin/busybox

[[email protected] busybox-1.13.4]# chmod 4755 ./_install/bin/busybox

[[email protected] busybox-1.13.4]# ll _install/bin/busybox

-rwsr-xr-x 1 root root 1705032 06-14 21:25 _install/bin/busybox

[[email protected] busybox-1.13.4]# ll _install/

[[email protected] busybox-1.13.4]#

[[email protected] busybox-1.13.4]#  cd _install/

[[email protected] _install]#  pwd

/opt/busybox-1.13.4/_install

7、对配置信息进行修改

[[email protected] _install]# cd /tmp/nfs

(1)在/tmp/nfs中创建所需的目录

[[email protected] 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

[[email protected] nfs]# chmod 1777 tmp

[[email protected] nfs]# chmod 1777 var/tmp

[[email protected] nfs]# cd dev/

[[email protected] dev]# pwd

/tmp/nfs/dev

[[email protected] dev]#  mknod -m 600 console c 5 1

[[email protected] dev]# mknod -m 666 null c 1 3

(2)复制文件到/tmp/nfs中

将/root/opt/busybox-1.13.4/_install中的内容复制到/tmp/nfs中。

[[email protected] dev]# cd /opt/busybox-1.13.4/_install

[[email protected] _install]# pwd

/opt/busybox-1.13.4/_install

[[email protected] _install]# cp -a bin /tmp/nfs/

[roo[email protected] _install]# cp -a sbin /tmp/nfs/

[[email protected] _install]# ll linuxrc

lrwxrwxrwx 1 root root 11 06-14 21:25 linuxrc -> bin/busybox

[[email protected] _install]# cp -a linuxrc /tmp/nfs/

[[email protected] _install]#  ll /tmp/nfs/linuxrc

lrwxrwxrwx 1 root root 11 06-14 21:35 /tmp/nfs/linuxrc -> bin/busybox

[[email protected] _install]# cd ..

[[email protected] busybox-1.13.4]# pwd

/opt/busybox-1.13.4

[[email protected] busybox-1.13.4]#  cp -a examples/bootfloppy/etc/* /tmp/nfs/etc/

[[email protected] busybox-1.13.4]# ls /tmp/nfs/etc/

fstab  init.d  inittab  profile

8、创建配置文件

(1)编写etc/inittab文件、修改其权限

[[email protected] busybox-1.13.4]# cd /tmp/nfs/

[[email protected] 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

[[email protected] nfs]# ll etc/inittab

-rw-r--r-- 1 root root 174 06-14 21:44 etc/inittab

[[email protected] nfs]# chmod 755 etc/inittab

(2)编写etc/init.d/rcS文件、修改其权限

[[email protected] 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 "******************************************************************"

//可更改,作为自己与别人的不同之处

[[email protected] nfs]# ll etc/init.d/rcS

-rwxr-xr-x 1 root root 621 06-14 21:49 etc/init.d/rcS

[[email protected] nfs]# chmod 755 etc/init.d/rcS

(3)编写etc/fstab文件、修改其权限

[[email protected] 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

[[email protected] nfs]# ll etc/fstab

-rw-r--r-- 1 root root 117 06-14 21:51 etc/fstab

[[email protected] nfs]# chmod 755 etc/fstab

(4)编写etc/proflie文件、修改其权限

[[email protected] 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=‘[\[email protected]\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帐号。

[[email protected] nfs]# cp /etc/passwd etc/ ;cp /etc/shadow etc/ ;cp /etc/group etc/

[[email protected] nfs]# chmod 600 etc/shadow

[[email protected] nfs]# gedit etc/passwd

内容是文件的第一行,把其他行删除,将bash改成sh

[[email protected] nfs]# gedit etc/shadow

内容是文件第一行

[[email protected] nfs]# gedit etc/group

内容是文件第一行

//这样设置在登录界面的密码是本机密码,如果在登录界面不知道密码,可将etc/passwd里的root用户中的x删除,在进入后,可以重新设置密码。

(6)为mdev创建配置文件

[[email protected] nfs]# gedit etc/mdev.conf

内容是:空

[[email protected] nfs]# ll etc/

(7)删除备份文件

[[email protected] nfs]# rm etc/*~ etc/init.d/*~

9、复制常用的库文件

编写脚本文件copy_lib.sh。

[[email protected] 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}

[[email protected] nfs]# ll copy_lib.sh

-rw-r--r-- 1 root root 274 06-14 21:58 copy_lib.sh

[[email protected] nfs]# chmod a+x copy_lib.sh

[[email protected] nfs]# cp copy_lib.sh /usr/local/arm/3.4.1/arm-linux/lib/

[[email protected] nfs]# cd /usr/local/arm/3.4.1/arm-linux/lib/

[[email protected] lib]# ./copy_lib.sh

[[email protected] lib]# cd -

/tmp/nfs

[[email protected] nfs]# ll lib

10、完整的启动过程(u-boot、内核、文件系统)

(1)编辑/etc/xinetd.d/tftp文件

[[email protected] opt]# gedit /etc/xinetd.d/tftp

(2)重启tftp服务器

[[email protected] opt]# service xinetd restart

停止 xinetd:                                              [确定]

启动 xinetd:                                              [确定]

(3)编辑/etc/exports文件

[[email protected] opt]# gedit /etc/exports

(4)重启NFS服务器

[[email protected] u-boot-1.1.4]# service nfs restart

关闭 NFS mountd:                                          [确定]

关闭 NFS 守护进程:                                        [确定]

关闭 NFS quotas:                                          [确定]

关闭 NFS 服务:                                            [确定]

启动 NFS 服务:                                            [确定]

关掉 NFS 配额:                                            [确定]

启动 NFS 守护进程:                                        [确定]

启动 NFS mountd:                                          [确定]

[[email protected] u-boot-1.1.4]# exportfs

/tmp/nfs

[[email protected] u-boot-1.1.4]#  exportfs -ra

(5)完整的启动过程(u-boot、内核、文件系统、用户程序),使用NFS文件系统

[[email protected] 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]:

[[email protected] /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;

}

[[email protected] /root]#gcc helloword

[[email protected] /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

解决办法:

[[email protected] /]# service nfs restart

关闭 NFS mountd:                                          [确定]

关闭 NFS 守护进程:                                        [确定]

关闭 NFS quotas:                                          [确定]

关闭 NFS 服务:                                            [确定]

启动 NFS 服务:                                            [确定]

关掉 NFS 配额:                                            [确定]

启动 NFS 守护进程:                                        [确定]

启动 NFS mountd:                                          [确定]

[[email protected] /]# iptables -F

[[email protected] /]# 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

阅读(490) | 评论(0) | 转发(0) |

0

上一篇:server( select)执行过程 吴素芬

下一篇:嵌入式系统移植三步曲 刘志卿

相关热门文章

  • SHTML是什么_SSI有什么用...
  • shell中字符串操作
  • 卡尔曼滤波的原理说明...
  • 关于java中的“错误:找不到或...
  • shell中的特殊字符

热门推荐

    -->

    给主人留下些什么吧!~~

    评论热议

    嵌入式系统移植三部曲 吴素芬

    时间: 2024-10-24 06:26:06

    嵌入式系统移植三部曲 吴素芬的相关文章

    嵌入式系统移植三部曲 李炎朔

    嵌入式系统移植三部曲                            李炎朔 09机应一班 学号0906041053 三部曲<bootloader的移植><linux的移植><根文件系统的移植> 一 bootloader的移植(1)安装skyeye-1.2.6_rc1 [[email protected] Desktop]# tar -xjvf skyeye-1.2.6_rc1.tar.bz2 -C ./[[email protected] Desktop]# c

    基于FS4412嵌入式系统移植(6) glib库的交叉编译与移植

    今天和大家分享一下glib库的交叉编译过程和如何对程序进行编译以及运行. glib库的移植资料比较少,比较零散,这里我就写一下亲自移植的过程,和大家分享一下.按照我的过程移植应该是不会有问题,如果遇到了问题可以留言联系我,一起讨论研究. 这里需要强调一下:libc.glibc.glib是不同的库! glibc和 libc 都是 Linux 下的 C 函数库,而glib是GTK+的基础库 libc 是 Linux 下的 ANSI C 函数库:glibc 是 Linux 下的 GUN C 函数库.

    基于FS4412嵌入式系统移植(8) linux内核调试之printk

    以下内容主要摘录自<Linux安全体系分析与编程> 1.基本原理 (1)在UBOOT里设置console=ttySAC0或者console=tty1 这里是设置控制终端,tySAC0 表示串口, tty1 表示lcd (2)内核用printk打印 内核就会根据命令行参数来找到对应的硬件操作函数,并将信息通过对应的硬件终端打印出来! 2.printk及控制台的日志级别 函数printk的使用方法和printf相似,用于内核打印消息.printk根据日志级别(loglevel)对消息进行分类. 相

    Beaglebone开发板的linux系统移植

    我是第一次接触嵌入式系统移植,说下我的学习历程吧.百度了很多beaglebone的资料后大概地了解了beaglebone的参数,交叉编译工具链,以及buildroot系统的移植等信息.这个buildroot系统真是...不知怎么形容了,下载耗费了好长时间,不过学到了很多.其实beaglebone很方便,系统那些全部都在microSD card上,拔插了好多遍.花了两三个星期百度.学习以上信息后基础的知识大概学到了.当然最后移植的系统千万不要用buildroot,还是用ubuntu方便点.下面附上

    关于嵌入式系统的学习路线图

    嵌入式系统方向 嵌入式系统无疑是当前最热门最有发展前途的IT应用领域之一.嵌入式系统用在一些特定专用设备上,通常这些设备的硬件资源(如处理器.存储器等)非常有限,并且对成本很敏感,有时对实时响应要求很高等.特别是随着消费家电的智能化,嵌入式更显重要.像我们平常常见到的手机.PDA.电子字典.可视电话.VCD/DVD/MP3 Player.数字相机(DC).数字摄像机(DV).U-Disk.机顶盒(Set Top Box).高清电视(HDTV).游戏机.智能玩具.交换机.路由器.数控设备或仪表.汽

    嵌入式 Linux 系统移植——BSP分析

    嵌入式 Linux 系统移植--BSP分析 一.BSP简介 嵌入式系统由硬件环境.嵌入式操作系统和应用程序组成,硬件环境是操作系统和应用程序运行的硬件平台,它随应用的不同而有不同的要求.硬件平台的多样性是嵌入式系统的主要特点,如何使嵌入式操作系统在不同的硬件平台上有效地运行,是嵌入式系统开发中需要解决的关键问题.解决的方法是在硬件平台和操作系统之间提供硬件相关层来屏蔽这些硬件的差异,给操作系统提供统一的运行环境,硬件相关层就是嵌入式系统中的板级支持包 BSP(Board Support Pack

    嵌入式linux系统移植开发视频教程

    深入浅出嵌入式linux系统移植开发(环境搭建.uboot的移植.嵌入式内核的配置与编译) 课程讲师:韩老师 课程分类:Linux 适合人群:中级 课时数量:56课时 用到技术:嵌入式Linux开发模式 涉及项目:基于tftp烧写系统 咨询qq:1840215592 课程介绍: 本课程重点是给大家讲解嵌入式linux系统移植的开发方法,采用理论与实践,硬件与软件相结合的方法. 1.在每节开始之前先简单回顾上一节所讲的主要内容,并对本节所讲的内容先进行概述,讲解概念.技术要点,设计实现思路等内容,

    【课程分享】深入浅出嵌入式linux系统移植开发 (环境搭建、uboot的移植、嵌入式内核的配置与编译)

    深入浅出嵌入式linux系统移植开发 (环境搭建.uboot的移植.嵌入式内核的配置与编译) 亲爱的网友,我这里有套课程想和大家分享,如果对这个课程有兴趣的,可以加我的QQ2059055336和我联系. 课程内容简介 本课程重点是给大家讲解嵌入式linux系统移植的开发方法,采用理论与实践,硬件与软件相结合的方法. 1.在每节开始之前先简单回顾上一节所讲的主要内容,并对本节所讲的内容先进行概述,讲解概念.技术要点,设计实现思路等内容,最后总结本次课程的要掌握的要点. 2.在讲课的过程中对关键技术

    嵌入式系统编程和调试技巧

    嵌入式系统的开发,软件的运行稳定可靠是非常重要的.在芯片中,软件是没有质量的,但软件的质量可以决定一颗芯片的成败.芯片设计中,性能能否满足设计要求,除了硬件设计.软硬件配合的设计技巧,对于软件来说,编程的一些技术和技巧同样重要. 本文讲述我在芯片固件开发过程中使用的一些编程调试技巧.针对在嵌入式系统开发中常见的问题,如实时系统下的同步问题,动态内存分配的内存泄漏问题,如何在编程阶段预防BUG出现,调试阶段如何及时发现问题和定位问题.总结下经验,目的是开发一个稳定运行的固件,提高开发效率,提高运行