포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 20MB 입니다.
board/aesop6410/u-boot.lds
http://kelp.or.kr/korweblog/upload/15/20070407092902/U_BOOT.pdf
Linker Script 관련 사이트
http://korea.gnu.org/manual/release/ld/ld-mahajjh/ld_3.html
u-boot.lds 파일은 링커에게 코드 배치를 이렇게 하라고 설명하는 파일입니다.
==========================================
/*
* (C) Copyright 2002
* Gary Jennejohn, DENX Software Engineering, <[email protected]>
*
* See file CREDITS for list of people who contributed to this
* project.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc.,
* MA 02111-1307
*/
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm") little endian으로 코드를 생성하겠다는 말.
/*OUTPUT_FORMAT("elf32-arm", "elf32-arm", "elf32-arm")*/
OUTPUT_ARCH(arm) binary를 실행할 수 있는 CPU architecture로 ARM을 쓰겠다는 뜻.
ENTRY(_start) Program의 시작을 가리키며, 시작되는 함수의 이름은 _start이다. u-boot binary의 시작을 _start 부터 시작하겠다는 의미. C에서의 main()과 비슷
SECTIONS의 정의를 보면, text, rodata, data, got , bss라는 section들이 정의되어 있다.
.text : 실행할 프로그램 코드 영역
.rodata : read-only data 영역 (const 등으로 지정된 데이터)
.data : initialized data 영역
.got : global offset table 영역
.bss : uninitialized data 영역
특수한 링커 변수 dot '.'는 항상 현재 출력 address point를 담고 있다.
address point는 출력 섹션의 크기만큼 증가한다.
u-boot의 시작은 Entry point에 선언된 _start부터 시작된다.
_start는 /cpu/s3c64xx/start.S에 선언되어 있다.
SECTIONS 배치, SECTIONS를 이용해서 각 섹션의 위치와 정렬을 지정하는데, .으로 시작하는 것들이 각 section에 대한 내용입니다. 이 부분은 코드의 배치를 어떻게 하라는 설명입니다. text section은 실행코드란 의미입니다.
{
. = 0x00000000; section의 시작을 0번지부터 시작하라는 의미
. = ALIGN(4); 4bytes 정렬을 하라는 말
.text : text section
{
cpu/s3c64xx/start.o (.text) startup 코드 , text section의 맨 앞에 start.o를 배열하라는 의미,
cpu/s3c64xx/s3c6410/cpu_init.o (.text)
cpu/s3c64xx/onenand_cp.o (.text)
cpu/s3c64xx/nand_cp.o (.text)
cpu/s3c64xx/movi.o (.text)
*(.text)
lib_arm/div0.o
}
. = ALIGN(4);
.rodata : { *(.rodata) }
. = ALIGN(4);
.data : { *(.data) }
. = ALIGN(4);
.got : { *(.got) }
__u_boot_cmd_start = .; global 변수 선언 시작, 나중에 C코드, startup코드에서 이것을 가지고 위치계산을 합니다
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; global 변수 선언 끝
. = ALIGN(4);
.mmudata : { *(.mmudata) }
. = ALIGN(4);
__bss_start = .; global 변수 선언 시작, 나중에 C코드, startup코드에서 이것을 가지고 위치계산을 합니다
.bss : { *(.bss) }
_end = .; global 변수 선언 끝
}