'환경변수'에 해당되는 글 1건
- 2009.08.11 순대보드 u-boot - 3
2009. 8. 11. 20:43
순대보드 u-boot - 3
2009. 8. 11. 20:43 in 혼자서 놀기.../순대보드(AHAV9302)
순대보드의 u-boot를 올리기 위한 마지막 단계(?)로 순대보드에 특화된 동작을 하는 파일을 등록하는 부분이다.
먼저 "include/configs/ahav9302.h"를 생성하고 필요한 부분들을 등록하는 작업을 해야한다.
"순대보드 u-boot - 1"에서 순대보드와 그나마 비슷한 EP9301 패치파일을 사용해서 cs-e9301에 대한 패치를 한 적이 있다. 그리하여 "include/configs/cs-e9301.h"를 참고하여 ahav9302.h를 작성할 수 있다.
ahav9302.h는 순대보드의 u-boot에서 사용하게 될 여러 환경변수 같은 것을 등록하게되는 파일이다.
이 파일의 전체적인 구조는 다음과 같다.
#ifndef__CONFIG_H
#define__CONFIG_H
/*
1. 부트로더 변수의 초기값 및 모니터 설정 등록.
2. 아키텍쳐, 보드, 클럭, MMU 등의 설정.
3. 콘솔 접속을 위한 시리얼 설정 및 등록.
4. 네트웍 설정.
5. 메모리 맵 설정.
6. 플래쉬 메모리 설정.
7. 기타 등등.
*/
#endif
#define__CONFIG_H
/*
1. 부트로더 변수의 초기값 및 모니터 설정 등록.
2. 아키텍쳐, 보드, 클럭, MMU 등의 설정.
3. 콘솔 접속을 위한 시리얼 설정 및 등록.
4. 네트웍 설정.
5. 메모리 맵 설정.
6. 플래쉬 메모리 설정.
7. 기타 등등.
*/
#endif
위의 내용을 실제 구현한 ahav9302.h 파일이다.
#ifndef __CONFIG_H
#define __CONFIG_H
/* 1. 부트로더 변수의 초기값 및 모니터 설정 등록. */
#define CONFIG_ETHADDR 00:60:6E:F0:00:02
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.100.181
#define CONFIG_SERVERIP 192.168.100.250
#define CONFIG_GATEWAYIP 192.168.100.254
#define CONFIG_BOOTDELAY 3
#define CONFIG_CMDLINE_TAG 1
#define CONFIG_INITRD_TAG 1
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_BOOTARGS "console=ttyAM0,115200 root=/dev/ram0 rw init=/sbin/init initrd=0xc0800000"
#define CONFIG_BOOTFILE "ahav9302.img"
/* 2. 아키텍쳐, 보드, 클럭, MMU 등의 설정. */
#define CONFIG_ARM920T 1
#define CONFIG_EP93XX 1
#define CONFIG_EP9302 1
#define CONFIG_AHAV9302 1
#define CONFIG_SYS_CLK_FREQ 14745600 /* 14.7456 MHz */
#define CFG_HZ 2048
#undef CFG_CLKS_IN_HZ
#define USE_920T_MMU 1
#define CONFIG_USE_IRQ 1
/* Monitor Configuration. */
#if defined(USE_920T_MMU)
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
CFG_CMD_DIAG | \
CFG_CMD_SDRAM | \
CFG_CMD_JFFS2 | \
CFG_CMD_DHCP | \
CFG_CMD_PING | \
CFG_CMD_NET | \
CFG_CMD_MII)
#else
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
CFG_CMD_DIAG | \
CFG_CMD_SDRAM | \
CFG_CMD_JFFS2 | \
CFG_CMD_DHCP | \
CFG_CMD_PING | \
CFG_CMD_NET | \
CFG_CMD_MII & \
~CFG_CMD_CACHE)
#endif /* defined(USE_920T_MMU) */
#include <cmd_confdefs.h> /* Must be AFTER any CONFIG_COMMANDS */
#define CFG_PROMPT "AHAV9302> "
/* Enable "long" help in the monitor */
#define CFG_LONGHELP
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
#define CFG_MAXARGS 16 /* max number of command args */
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
#define CFG_LOAD_ADDR 0xC0008000 /* default load address */
/* 3. 콘솔 접속을 위한 시리얼 설정 및 등록. */
#define CONFIG_BAUDRATE 115200
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
#define CFG_SERIAL0 (0x808C0000)
#define CFG_SERIAL1 (0x808D0000)
#define CFG_PL010_SERIAL
#define CONFIG_PL01x_PORTS { (void *)CFG_SERIAL0, (void *)CFG_SERIAL1 }
#define CONFIG_CONS_INDEX 0
/* 4. 네트웍 설정. */
#define CONFIG_DRIVER_EP93XX_MAC
#define CONFIG_MII
#define CONFIG_MII_SUPPRESS_PREAMBLE
#define CONFIG_PHY_ADDR (0)
#define CFG_DIRECT_FLASH_TFTP
#undef CONFIG_NETCONSOLE
/* 5. 메모리 맵 설정. */
#define CONFIG_NR_DRAM_BANKS (8)
#define PHYS_SDRAM_1 (0xC0000000)
#define PHYS_SDRAM_1_SIZE (0x00800000)
#define PHYS_SDRAM_2 (0xC1000000)
#define PHYS_SDRAM_2_SIZE (0x00800000)
#define PHYS_SDRAM_3 (0xC2000000)
#define PHYS_SDRAM_3_SIZE (0x00800000)
#define PHYS_SDRAM_4 (0xC3000000)
#define PHYS_SDRAM_4_SIZE (0x00800000)
#define PHYS_SDRAM_5 (0xC4000000)
#define PHYS_SDRAM_5_SIZE (0x00800000)
#define PHYS_SDRAM_6 (0xC5000000)
#define PHYS_SDRAM_6_SIZE (0x00800000)
#define PHYS_SDRAM_7 (0xC6000000)
#define PHYS_SDRAM_7_SIZE (0x00800000)
#define PHYS_SDRAM_8 (0xC7000000)
#define PHYS_SDRAM_8_SIZE (0x00800000)
#define CFG_MEMTEST_START (0xC0000000)
#define CFG_MEMTEST_END (0x01000000)
#define CONFIG_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
/* -----------------------------------------------------------------------------
* Run-time memory allocations
*
* The global data area size (must be > sizeof(gd_t)), stack sizes, and heap
* size are set using the values below.
*/
#define CFG_GBL_DATA_SIZE (128)
#define CONFIG_STACKSIZE (128 * 1024)
#if defined(CONFIG_USE_IRQ)
#define CONFIG_STACKSIZE_IRQ (4 * 1024)
#define CONFIG_STACKSIZE_FIQ (4 * 1024)
#endif /* defined(CONFIG_USE_IRQ) */
#define CFG_MALLOC_LEN (512 * 1024)
/* 6. 플래쉬 메모리 설정. */
/* -----------------------------------------------------------------------------
* FLASH and environment organization
*
* 0x60000000 - 0x6003FFFF (256KB) u-boot
* 0x60040000 - 0x6005FFFF (128KB) environment #1
* 0x60060000 - 0x6007FFFF (128KB) environment #2
* 0x60080000 - 0x6009FFFF (128KB) unused
* 0x600A0000 - 0x600BFFFF (128KB) unused
* 0x600C0000 - 0x600FFFFF (256KB) unused
* 0x60100000 - 0x602FFFFF (2MB) uImage(kernel image)
* 0x60300000 - 0x606FFFFF (4MB) rImage(ramdisk image)
* 0x60700000 - 0x60FFFFFF (10MB) (JFFS2)
*/
#define CFG_FLASH_CFI
#define CFG_FLASH_CFI_DRIVER
#define CFG_MAX_FLASH_BANKS (1)
#define CFG_MAX_FLASH_SECT (128)
#define PHYS_FLASH_1 (0x60000000)
#define CFG_FLASH_BASE (PHYS_FLASH_1)
#define CFG_MONITOR_BASE (CFG_FLASH_BASE)
#define CFG_MONITOR_LEN (256 * 1024)
#define CONFIG_ENV_OVERWRITE /* Vendor parameters are unprotected */
#define CFG_ENV_IS_IN_FLASH
#define CFG_ENV_ADDR (0x60040000)
#define CFG_ENV_ADDR_REDUND (0x60060000)
#define CFG_ENV_SECT_SIZE (0x00020000)
#define CFG_ENV_SIZE (CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SECT_SIZE)
#define CFG_JFFS2_FIRST_BANK (0)
#define CFG_JFFS2_FIRST_SECTOR (28)
#define CFG_JFFS2_NUM_BANKS (1)
#endif /* __CONFIG_H */
#define __CONFIG_H
/* 1. 부트로더 변수의 초기값 및 모니터 설정 등록. */
#define CONFIG_ETHADDR 00:60:6E:F0:00:02
#define CONFIG_NETMASK 255.255.255.0
#define CONFIG_IPADDR 192.168.100.181
#define CONFIG_SERVERIP 192.168.100.250
#define CONFIG_GATEWAYIP 192.168.100.254
#define CONFIG_BOOTDELAY 3
#define CONFIG_CMDLINE_TAG 1
#define CONFIG_INITRD_TAG 1
#define CONFIG_SETUP_MEMORY_TAGS 1
#define CONFIG_BOOTARGS "console=ttyAM0,115200 root=/dev/ram0 rw init=/sbin/init initrd=0xc0800000"
#define CONFIG_BOOTFILE "ahav9302.img"
/* 2. 아키텍쳐, 보드, 클럭, MMU 등의 설정. */
#define CONFIG_ARM920T 1
#define CONFIG_EP93XX 1
#define CONFIG_EP9302 1
#define CONFIG_AHAV9302 1
#define CONFIG_SYS_CLK_FREQ 14745600 /* 14.7456 MHz */
#define CFG_HZ 2048
#undef CFG_CLKS_IN_HZ
#define USE_920T_MMU 1
#define CONFIG_USE_IRQ 1
/* Monitor Configuration. */
#if defined(USE_920T_MMU)
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
CFG_CMD_DIAG | \
CFG_CMD_SDRAM | \
CFG_CMD_JFFS2 | \
CFG_CMD_DHCP | \
CFG_CMD_PING | \
CFG_CMD_NET | \
CFG_CMD_MII)
#else
#define CONFIG_COMMANDS (CONFIG_CMD_DFL | \
CFG_CMD_DIAG | \
CFG_CMD_SDRAM | \
CFG_CMD_JFFS2 | \
CFG_CMD_DHCP | \
CFG_CMD_PING | \
CFG_CMD_NET | \
CFG_CMD_MII & \
~CFG_CMD_CACHE)
#endif /* defined(USE_920T_MMU) */
#include <cmd_confdefs.h> /* Must be AFTER any CONFIG_COMMANDS */
#define CFG_PROMPT "AHAV9302> "
/* Enable "long" help in the monitor */
#define CFG_LONGHELP
#define CFG_CBSIZE 1024 /* Console I/O Buffer Size */
#define CFG_PBSIZE (CFG_CBSIZE+sizeof(CFG_PROMPT)+16) /* Print Buffer Size */
#define CFG_MAXARGS 16 /* max number of command args */
#define CFG_BARGSIZE CFG_CBSIZE /* Boot Argument Buffer Size */
#define CFG_LOAD_ADDR 0xC0008000 /* default load address */
/* 3. 콘솔 접속을 위한 시리얼 설정 및 등록. */
#define CONFIG_BAUDRATE 115200
#define CFG_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200 }
#define CFG_SERIAL0 (0x808C0000)
#define CFG_SERIAL1 (0x808D0000)
#define CFG_PL010_SERIAL
#define CONFIG_PL01x_PORTS { (void *)CFG_SERIAL0, (void *)CFG_SERIAL1 }
#define CONFIG_CONS_INDEX 0
/* 4. 네트웍 설정. */
#define CONFIG_DRIVER_EP93XX_MAC
#define CONFIG_MII
#define CONFIG_MII_SUPPRESS_PREAMBLE
#define CONFIG_PHY_ADDR (0)
#define CFG_DIRECT_FLASH_TFTP
#undef CONFIG_NETCONSOLE
/* 5. 메모리 맵 설정. */
#define CONFIG_NR_DRAM_BANKS (8)
#define PHYS_SDRAM_1 (0xC0000000)
#define PHYS_SDRAM_1_SIZE (0x00800000)
#define PHYS_SDRAM_2 (0xC1000000)
#define PHYS_SDRAM_2_SIZE (0x00800000)
#define PHYS_SDRAM_3 (0xC2000000)
#define PHYS_SDRAM_3_SIZE (0x00800000)
#define PHYS_SDRAM_4 (0xC3000000)
#define PHYS_SDRAM_4_SIZE (0x00800000)
#define PHYS_SDRAM_5 (0xC4000000)
#define PHYS_SDRAM_5_SIZE (0x00800000)
#define PHYS_SDRAM_6 (0xC5000000)
#define PHYS_SDRAM_6_SIZE (0x00800000)
#define PHYS_SDRAM_7 (0xC6000000)
#define PHYS_SDRAM_7_SIZE (0x00800000)
#define PHYS_SDRAM_8 (0xC7000000)
#define PHYS_SDRAM_8_SIZE (0x00800000)
#define CFG_MEMTEST_START (0xC0000000)
#define CFG_MEMTEST_END (0x01000000)
#define CONFIG_BOOT_PARAM_ADDR (PHYS_SDRAM_1 + 0x100)
/* -----------------------------------------------------------------------------
* Run-time memory allocations
*
* The global data area size (must be > sizeof(gd_t)), stack sizes, and heap
* size are set using the values below.
*/
#define CFG_GBL_DATA_SIZE (128)
#define CONFIG_STACKSIZE (128 * 1024)
#if defined(CONFIG_USE_IRQ)
#define CONFIG_STACKSIZE_IRQ (4 * 1024)
#define CONFIG_STACKSIZE_FIQ (4 * 1024)
#endif /* defined(CONFIG_USE_IRQ) */
#define CFG_MALLOC_LEN (512 * 1024)
/* 6. 플래쉬 메모리 설정. */
/* -----------------------------------------------------------------------------
* FLASH and environment organization
*
* 0x60000000 - 0x6003FFFF (256KB) u-boot
* 0x60040000 - 0x6005FFFF (128KB) environment #1
* 0x60060000 - 0x6007FFFF (128KB) environment #2
* 0x60080000 - 0x6009FFFF (128KB) unused
* 0x600A0000 - 0x600BFFFF (128KB) unused
* 0x600C0000 - 0x600FFFFF (256KB) unused
* 0x60100000 - 0x602FFFFF (2MB) uImage(kernel image)
* 0x60300000 - 0x606FFFFF (4MB) rImage(ramdisk image)
* 0x60700000 - 0x60FFFFFF (10MB) (JFFS2)
*/
#define CFG_FLASH_CFI
#define CFG_FLASH_CFI_DRIVER
#define CFG_MAX_FLASH_BANKS (1)
#define CFG_MAX_FLASH_SECT (128)
#define PHYS_FLASH_1 (0x60000000)
#define CFG_FLASH_BASE (PHYS_FLASH_1)
#define CFG_MONITOR_BASE (CFG_FLASH_BASE)
#define CFG_MONITOR_LEN (256 * 1024)
#define CONFIG_ENV_OVERWRITE /* Vendor parameters are unprotected */
#define CFG_ENV_IS_IN_FLASH
#define CFG_ENV_ADDR (0x60040000)
#define CFG_ENV_ADDR_REDUND (0x60060000)
#define CFG_ENV_SECT_SIZE (0x00020000)
#define CFG_ENV_SIZE (CFG_ENV_SECT_SIZE)
#define CFG_ENV_SIZE_REDUND (CFG_ENV_SECT_SIZE)
#define CFG_JFFS2_FIRST_BANK (0)
#define CFG_JFFS2_FIRST_SECTOR (28)
#define CFG_JFFS2_NUM_BANKS (1)
#endif /* __CONFIG_H */
아직은 잘 모르겠다.
걍 u-boot README 파일을 참고해가며 보면 알 수 있다고 한다.
실제 cs-e9301.h파일과 비교해보면 몇 군데를 제외하고는 거의 같음을 알 수 있다. 조만간 시간을 내서 README 파일을 한번 읽어는 봐야 할것 같은데... -_-;;
'혼자서 놀기... > 순대보드(AHAV9302)' 카테고리의 다른 글
순대보드 Kernel Image (0) | 2009.09.02 |
---|---|
순대보드 u-boot - 4 (0) | 2009.09.02 |
순대보드 u-boot - 2 (0) | 2009.08.11 |
순대보드 u-boot - 1 (4) | 2009.04.02 |
순대보드 CrossCompile 환경 - 2 (0) | 2009.04.01 |