Chinaunix首页 | 论坛 | 博客
  • 博客访问: 359416
  • 博文数量: 57
  • 博客积分: 2299
  • 博客等级: 大尉
  • 技术积分: 1109
  • 用 户 组: 普通用户
  • 注册时间: 2008-05-27 23:12
文章分类
文章存档

2011年(4)

2010年(53)

分类: 嵌入式

2010-07-31 01:49:56

上一次移植的没记录详细过程,觉得不放心,又抽空从头移植一次,记录详细过程!
1、下载源码
   本次移植u-boot-2009.08.tar.gz
2、修改Makefile
在这一行出添加$(obj)u-boot.dis 目的是为了可以看编译出来的u-boot.bin的汇编
ALL += $(obj)u-boot.srec $(obj)u-boot.bin $(obj)System.map $(obj)u-boot.dis $(U_BOOT_NAND) $(U_BOOT_ONENAND)

ifeq ($(HOSTARCH),$(ARCH)) CROSS_COMPILE ?= endif

后面添加CROSS_COMPILE =arm-linux-,即定义交叉编译工具链
搜索smdk2410_config,在他的下面添加自己的板子,如

s3c2440_config : unconfig
      @$(MKCONFIG) $(@:_config=) arm arm920t s3c2440 samsung s3c24x0

3、建立自己开发板的目录
把board/samsung/smdk2410这个文件夹复制在同级文件夹下,并重新命名为s3c2440,修改里面的文件,把smdk2410.c文件mv为s3c2440.c,修改s3cv2440下面的Makefile,把smdk2410.o改为s3c2440.o;cp include/configs/smdk2410.h 为s3c2440.h;make一下看能不能通过,修改直到可以编译通过。

4、修改include/configs/s3c2440.h为

#ifndef __CONFIG_H
#define __CONFIG_H

/*
 * High Level Configuration Options
 * (easy to change)
 */

#define CONFIG_ARM920T        1    /* This is an ARM920T Core    */
#define    CONFIG_S3C2410        1    /* in a SAMSUNG S3C2410 SoC */
#define CONFIG_SMDK2410        1    /* on a SAMSUNG SMDK2410 Board */

/* input clock of PLL */
#define CONFIG_SYS_CLK_FREQ    12000000/* the SMDK2410 has 12MHz input clock */


#define USE_920T_MMU        1
#undef CONFIG_USE_IRQ            /* we don't need IRQ/FIQ stuff */

/*
 * Size of malloc() pool
 */

#define CONFIG_SYS_MALLOC_LEN        (CONFIG_ENV_SIZE + 128*1024)
#define CONFIG_SYS_GBL_DATA_SIZE    128    /* size in bytes reserved for initial data */

/*
 * Hardware drivers
 */

#define CONFIG_DRIVER_CS8900    1    /* we have a CS8900 on-board */
#define CS8900_BASE        0x19000300
#define CS8900_BUS16        1 /* the Linux driver does accesses as shorts */

/*
 * select serial console configuration
 */

#define CONFIG_S3C24X0_SERIAL
#define CONFIG_SERIAL1 1    /* we use SERIAL 1 on SMDK2410 */

/************************************************************
 * RTC
 ************************************************************/

#define    CONFIG_RTC_S3C24X0    1

/* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE

#define CONFIG_BAUDRATE        115200


/*
 * BOOTP options
 */

#define CONFIG_BOOTP_BOOTFILESIZE
#define CONFIG_BOOTP_BOOTPATH
#define CONFIG_BOOTP_GATEWAY
#define CONFIG_BOOTP_HOSTNAME


/*
 * Command line configuration.
 */

#include <config_cmd_default.h>

#define CONFIG_CMD_CACHE
#define CONFIG_CMD_DATE
#define CONFIG_CMD_ELF


#define CONFIG_BOOTDELAY    3
/*#define CONFIG_BOOTARGS    "root=ramfs devfs=mount console=ttySA0,9600" */
/*#define CONFIG_ETHADDR    08:00:3e:26:0a:5b */
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR        10.0.0.110
#define CONFIG_SERVERIP        10.0.0.1
/*#define CONFIG_BOOTFILE    "elinos-lart" */
/*#define CONFIG_BOOTCOMMAND    "tftp; bootm" */

#if defined(CONFIG_CMD_KGDB)
#define CONFIG_KGDB_BAUDRATE    115200        /* speed to run kgdb serial port */
/* what's this ? it's not used anywhere */
#define CONFIG_KGDB_SER_INDEX    1        /* which serial port to use */
#endif

/*
 * Miscellaneous configurable options
 */

#define    CONFIG_SYS_LONGHELP                /* undef to save memory        */
#define    CONFIG_SYS_PROMPT        "S3C2440 # "    /* Monitor Command Prompt    */
#define    CONFIG_SYS_CBSIZE        256        /* Console I/O Buffer Size    */
#define    CONFIG_SYS_PBSIZE (CONFIG_SYS_CBSIZE+sizeof(CONFIG_SYS_PROMPT)+16) /* Print Buffer Size */
#define    CONFIG_SYS_MAXARGS        16        /* max number of command args    */
#define CONFIG_SYS_BARGSIZE        CONFIG_SYS_CBSIZE    /* Boot Argument Buffer Size    */

#define CONFIG_SYS_MEMTEST_START    0x30000000    /* memtest works on    */
#define CONFIG_SYS_MEMTEST_END        0x33F00000    /* 63 MB in DRAM    */

#define    CONFIG_SYS_LOAD_ADDR        0x33000000    /* default load address    */

/* the PWM TImer 4 uses a counter of 15625 for 10 ms, so we need */
/* it to wrap 100 times (total 1562500) to get 1 sec. */
#define    CONFIG_SYS_HZ            1562500

/* valid baudrates */
#define CONFIG_SYS_BAUDRATE_TABLE    { 9600, 19200, 38400, 57600, 115200 }

/*-----------------------------------------------------------------------
 * Stack sizes
 *
 * The stack sizes are set up in start.S using the settings below
 */

#define CONFIG_STACKSIZE    (128*1024)    /* regular stack */
#ifdef CONFIG_USE_IRQ
#define CONFIG_STACKSIZE_IRQ    (4*1024)    /* IRQ stack */
#define CONFIG_STACKSIZE_FIQ    (4*1024)    /* FIQ stack */
#endif

/*-----------------------------------------------------------------------
 * Physical Memory Map
 */

#define CONFIG_NR_DRAM_BANKS    1     /* we have 1 bank of DRAM */
#define PHYS_SDRAM_1        0x30000000 /* SDRAM Bank #1 */
#define PHYS_SDRAM_1_SIZE    0x04000000 /* 64 MB */

#define PHYS_FLASH_1        0x00000000 /* Flash Bank #1 */

#define CONFIG_SYS_FLASH_BASE        PHYS_FLASH_1

/*-----------------------------------------------------------------------
 * FLASH and environment organization
 */


//#define CONFIG_AMD_LV400    1    /* uncomment this if you have a LV400 flash yytt */

#if 1
#define CONFIG_AMD_LV800    1    /* uncomment this if you have a LV800 flash */
#endif
//#define CONFIG_EON_29LV160AB 1


#define CONFIG_SYS_MAX_FLASH_BANKS    1    /* max number of memory banks */

#ifdef CONFIG_EON_29LV160AB
#define PHYS_FLASH_SIZE 0x00200000 /* 2MB */
#define CONFIG_SYS_MAX_FLASH_SECT (35) /* max number of sectors on one chip */
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x1F0000) /* addr of environment */
#endif

#ifdef CONFIG_AMD_LV800
#define PHYS_FLASH_SIZE        0x00200000 /* 2MB */
#define CONFIG_SYS_MAX_FLASH_SECT    (35)    /* max number of sectors on one chip */
#define CONFIG_ENV_ADDR        (CONFIG_SYS_FLASH_BASE + 0x0F0000) /* addr of environment */
#endif
#ifdef CONFIG_AMD_LV400
#define PHYS_FLASH_SIZE        0x00080000 /* 512KB */
#define CONFIG_SYS_MAX_FLASH_SECT    (11)    /* max number of sectors on one chip */
#define CONFIG_ENV_ADDR        (CONFIG_SYS_FLASH_BASE + 0x070000) /* addr of environment */
#endif

/* timeout values are in ticks */
#define CONFIG_SYS_FLASH_ERASE_TOUT    (5*CONFIG_SYS_HZ) /* Timeout for Flash Erase */
#define CONFIG_SYS_FLASH_WRITE_TOUT    (5*CONFIG_SYS_HZ) /* Timeout for Flash Write */

#define    CONFIG_ENV_IS_IN_FLASH    1
#define CONFIG_ENV_SIZE        0x10000    /* Total Size of Environment Sector */

#define CFG_NAND_BASE 0
#define CFG_MAX_NAND_DEVICE 1
#define NAND_MAX_CHIPS 1

#endif    /* __CONFIG_H */


5、修改board/samsung/s3c2440/s3c2440.c为

#if FCLK_SPEED==0 /* Fout = 203MHz, Fin = 12MHz for Audio */
#define M_MDIV 0xC3
#define M_PDIV 0x4
#define M_SDIV 0x1
#elif FCLK_SPEED==1 /* Fout = 202.8MHz 75 MHz */
#define M_MDIV 0x44//42//0xA1
#define M_PDIV 0x1//0x3
#define M_SDIV 0x1//0x2//0x1
#endif

6、修改cpu/arm920t/s3c24x0/speed.c

// m = ((r & 0xFF000) >> 12) + 8;

        if (pllreg == MPLL)
                m = 2*(((r & 0xFF000) >> 12) + 8);
        else if (pllreg == UPLL)
                m = ((r & 0xFF000) >> 12) + 8;
        else
                hang();
    p = ((r & 0x003F0) >> 4) + 2;
    s = r & 0x3;

编译下载到nor flash重新启动就可以看到

U-Boot 2009.08 ( 7&aelig;&#339;&#710; 31 2010 - 01:08:31)
DRAM: 64 MB
Flash: 2 MB
In: serial
Out: serial
Err: serial
S3C2440 #

下一步设置NFS启动内核,方便为下面的内核移植调试……

阅读(2428) | 评论(1) | 转发(1) |
给主人留下些什么吧!~~

chinaunix网友2010-09-29 07:01:52

强人!跟着你学了!