Qemu로 ARM 시뮬레이션(3)

3173 단어
1. u-boot를 다운로드하고 교차 컴파일합니다.
새 버전의 u-boot는 내가 불러온 후에 항상 문제가 있고 2009.11 버전은 순조롭게 컴파일링과 테스트를 통과할 수 있다.
$ wget ftp://ftp.denx.de/pub/u-boot/u-boot-2009.11.tar.bz2
$ tar xjvf u-boot-2009.11.tar.bz2 
$ cd u-boot-2009.11
$ make versatilepb_config arch=ARM CROSS_COMPILE=arm-none-eabi-
$ make all arch=ARM CROSS_COMPILE=arm-none-eabi- 

컴파일이 완료되면 디렉토리에 u-boot가 생성됩니다.bin 및 u-boot 파일
2. u-boot. 실행bin:
$ qemu-system-arm -M versatilepb -kernel u-boot.bin -nographic

만약-nographic로qemu-system-arm을 운행한다면 터미널은 어떠한 시스템 입력도 응답할 수 없습니다. 예를 들어Ctrl+c/ctrl+d,qemu-system-arm을 종료하려면 프로세스 번호만 확인하고 킬을 할 수 있습니다.그래서 저는 보통 -nographic 옵션을 가지고 있지 않습니다. 시작한 후ctrl+alt+2는serial0 출력을 보고 터미널 창에서 직접ctrl+c로qemu-sytem-arm 프로세스를 죽일 권리를 보류합니다.
3. u-boot을 사용하여 대칭복사 파일을 부트합니다.
이전 글에서 시작 이미지를 구축하는 데 사용할linker를 변경합니다.ld 파일, u-boot.bin 파일 크기 때문에 시작 렌즈의 시작 주소를 전체적으로 위로 옮겨야 합니다.
$ ls -l -h u-boot.bin 
-rwxr-xr-x 1 dash root 85K Jul  8 15:57 u-boot.bin

linker.ld 파일에서 0x100000, 이 크기는 85K에 비해 충분합니다.
ENTRY(_Start)
SECTIONS
{
. = 0x100000;
startup : { startup.o(.text)}
.data : {*(.data)}
.bss : {*(.bss)}
. = . + 0x500;
sp_top = .;
}

이전 장의 컴파일 방법에 따라output를 생성합니다.bin, 다시 말하지 않습니다.
mkimage 도구를 사용하여 u-boot 인식 이미지 파일을 만들려면 다음과 같이 하십시오.
$ mkimage -A arm -C none -O linux -T kernel -d output.bin -a 0x00100000 -e 0x00100000 output.uimg
Image Name:   
Created:      Mon Jul  8 16:04:11 2013
Image Type:   ARM Linux Kernel Image (uncompressed)
Data Size:    152 Bytes = 0.15 kB = 0.00 MB
Load Address: 00100000
Entry Point:  00100000

$ file *.uimg
output.uimg: u-boot legacy uImage, , Linux/ARM, OS Kernel Image (Not \
compressed), 152 bytes, Mon Jul  8 16:04:11 2013, Load Address: 0x00100000,\
Entry Point: 0x00100000, Header CRC: 0x3C62F575, Data CRC: 0x69CE9647

u-boot.bin 및 output.uimg을 파일로 포장하기:
$ cat u-boot.bin output.uimg >flash.bin

다음 명령은 output을 계산하는 데 사용됩니다.img은 u-boot를 사용하여 flash를 로드합니다.bin 후 메모리에 있는 주소입니다. -kernel 옵션은qemu가 0x100000부터 렌즈를 불러오기 시작합니다. 즉 65536입니다.65536+u-boot.bin 뒤의 크기, 즉 output.img 메모리에 있는 주소입니다.printf는 불러오기 위해 16진 형식으로 출력됩니다.
$ printf "0x%X" $(expr $(stat -c%s u-boot.bin) + 65536)
0x2525C

qemu-system-arm을 시작하고 사용자 정의 미러를 실행합니다.
$ qemu-system-arm -M versatilepb -nographic -kernel flash.bin
# iminfo 0x2525c

## Checking Image at 0002525c ...
   Legacy image found
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    152 Bytes =  0.1 kB
   Load Address: 00100000
   Entry Point:  00100000
   Verifying Checksum ... OK

VersatilePB # bootm 0x2525c
## Booting kernel from Legacy Image at 0002525c ...
   Image Name:   
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    152 Bytes =  0.1 kB
   Load Address: 00100000
   Entry Point:  00100000
   Loading Kernel Image ... OK
OK

Starting kernel ...

Hello Open World

u-boot에서 지원할 수 있는 옵션은 NFS/TFTP 부팅 등을 포함하여 나중에 천천히 연구할 수 있습니다.
다음으로 이동:http://feipengy.no-ip.biz/blog/2013/07/08/yong-qemumo-ni-arm-3/

좋은 웹페이지 즐겨찾기