포럼 회원으로 등록하신분만 다운로드가 가능합니다. 최대 업로드 가능한 용량은 20MB 입니다.

고현철님의 4-startup-#1.txt 문서의 주석 내용을 6410으로 옮겼습니다.

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., 59 Temple Place, Suite 330, Boston,

 * MA 02111-1307 USA

 */

 

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 변수 선언 끝

}

List of Articles
번호 제목 글쓴이 날짜sort 조회 수
50 u-boot source tree 구조(aesop-6410) [3] 이세종 2009-04-09 12140
49 u-boot - config.mk 분석(aesop6410) [3] 이세종 2009-04-09 13129
» u-boot.lds 분석(aesop6410) 이세종 2009-04-13 16167
47 start.S 분석(aesop6410) [1] 이세종 2009-04-14 14519
46 Creating a Root File System for Linux on OMAP35x 장석원 2009-04-24 10114
45 GStreamer on TI DaVinci and OMAP 장석원 2009-04-25 10929
44 FATAL: kernel too oldKernel panic - not syncing: Attempt... 고현철 2009-04-28 11871
43 Hotplugging with udev file 고현철 2009-05-05 14329
42 리눅스 커널 소스 기본 구조 이세종 2009-05-06 15197
41 lowlevel_init.S 분석자료(aesop6410) [2] 이세종 2009-05-10 11900
40 범용 운영체제를 위한 리눅스 커널 완전분석 file [5] 김재훈 2009-05-17 16708
39 임베디드 시스템 포팅 가이드(PXA255 ) #1 file [7] 김재훈 2009-05-17 18027
38 임베디드 시스템 포팅 가이드(PXA255 ) #2 file 김재훈 2009-05-17 11018
37 임베디드 시스템 포팅 가이드(PXA255 ) #3 file 김재훈 2009-05-17 11880
36 임베디드 시스템 포팅 가이드(PXA255 ) #4 file 김재훈 2009-05-17 11826
35 임베디드 시스템 포팅 가이드(PXA255 ) #5 file 김재훈 2009-05-17 12505
34 임베디드 시스템 포팅 가이드(PXA255 ) #6 file [13] 김재훈 2009-05-17 12906
33 임베디드 엔지니어를 위한 리눅스 커널 file [9] 김재훈 2009-05-17 17400
32 nfs: server 192.168.xx.xx not responding, still trying 발생... 김재훈 2009-06-24 14216
31 MicroC/OS-II Porting to TMS320C31 김재훈 2009-08-25 11707

사용자 로그인