uboot 용 헤더가 들어있는 이미지는 uImage, 커널컴파일을한 후의 바이너리는 zImage 입니다.
두 이미지에 따른 커널 loading이 다음과 같이 다릅니다.
1. uImage를 이용한 커널 이미지 올리기
* uImage = u-boot용 kernel header + kernel image
* mkImage uImage 참고
mkimage -A arm -O linux -T kernel -C none -a 0x8000 -e 0x8000 -n
"MontaVista Linux 2.6.10" -d arch/arm/boot/zImage uzImage.bin
-l = => list image header information
mkimage -A arch -O os -T type -C comp -a addr -e ep -n name
-d data_file[:data_file...] image
-A = => set architecture to 'arch'
-O = => set operating system to 'os'
-T = => set image type to 'type'
-C = => set compression type 'comp'
-a = => set load address to 'addr' (hex)
-e = => set entry point to 'ep' (hex)
-n = => set image name to 'name'
-d = => use image data from 'datafile'
-x = => set XIP (execute in place)
1-1. u-boot용 커널 헤더 구조
typedef struct image_header {
uint32_t ih_magic; /* Image Header Magic Number */
uint32_t ih_hcrc; /* Image Header CRC Checksum */
uint32_t ih_time; /* Image Creation Timestamp */
uint32_t ih_size; /* Image Data Size */
uint32_t ih_load; /* Data Load Address */
uint32_t ih_ep; /* Entry Point Address */
uint32_t ih_dcrc; /* Image Data CRC Checksum */
uint8_t ih_os; /* Operating System */
uint8_t ih_arch; /* CPU architecture */
uint8_t ih_type; /* Image Type */
uint8_t ih_comp; /* Compression Type */
uint8_t ih_name[IH_NMLEN]; /* Image Name */
} image_header_t;
1-2. 커널 loading 과정
->main_loop
...
->run_command
...기
->do_bootm
* 헤더정보(ih_comp)를 이용하여 커널 압축해제
* 헤더정보(ih_load)를 이용하여 압축해제후 RAM으로 올린다.
* 헤더정보(ih_os)를 이용하여 OS 별 함수로 분기한다. ->do_bootm_linux
->do_bootm_linux
* 헤더정보(ih_ep)를 이용하여 램에 올라간 커널 entrypoint로 제어 옮김
2-1. 커널 loading 과정 (tftp 이용)
# cp arch/arm/boot/zImage /tftpboot
->do_tftpb
# tftp 30008000 zImage (TARGET)
2-1. 램에 올라간 이미지의 entrypoint로 제어 옮김 (head.s)
->do_go
# go 30008000 (TARGET)
댓글 2
.
해당 내용 잘 읽어 봤습니다.
허나, 아주 기초적인 것이라고 언급할 수 있는데 (제가 커널 초짜이오니 양해 부탁 드립니다.)
기본은 flash든 SDcard든 boot loader(uboot)를 먼저 RAM load 후 kernel을 올리는것이 기본 sequence인데 작성한 글을 보면
이해가 잘 되지 않아 질문 드립니다.
1. uboot용 헤더가 들어가 있는 커널 이미지 즉, uImage = u-boot용 kernel header + kernel image 인데 관련내용은
uboot 소스를 보면 되는 것인지요?
본 소스내에 boot 및 kernel까지 모두 있는것인지요?
2. uboot로 로딩한 커널 이미지말고 커널 컴파일한 후 zImage의 boot loader는 뭔가요?
3. 현재 커널 관련해서는 계속 release되고 있는데 현재 linux 4.0 release되었습니다.
소스를 보면 uboot소스가 있고, kernel4.0 소스가 있습니다.
uboot소스는 uboot + kernel관련 소스가 있는 건가요?
이 글을 읽은 뒤로 혼돈스러워서 머리속을 정리하고자 하오니 선배님들의 답변 및 유경환님의 회신 부탁 드릴께요^^