To load the Linux kernel on the embedded device, I have to mark the kernel with a special header. The program used for marking the kernel is provided by manufacturing the device only in the form of 32-bit binary code. This is very annoying because I have to install hundreds of megabyte libraries on my 64-bit system in order to tag the kernel with several bytes. This is how the kernel is marked:
$./mkimage -f kernel.cfg -d zImage_without_header zImage
kernel.cfg:
MAGIC_NUMBER 0x27051956
OS_TYPE linux
CPU_ARCH arm
IMAGE_TYPE kernel
COMPRESS_TYPE gzip
DATALOAD_ADDRESS 0x00008000
ENTRY_ADDRESS 0x00008000
IMAGE_NAME kernel.img
MODEL_NAME DNS-313
VERSION 1.00b18
MAC_ADDRESS FF-FF-FF-FF-FF-FF
START_OFFSET 0x00
END_OFFSET 0xFF
OVERWRITE n
The mkimage binary is different from mkimage, which is available from, for example, the Debian repository, which will not work for my device. I tried to create a 1 MB file and mark it to display the header:
$dd if=/dev/zero bs=1k count=1024 of=zImage_without_header
$./mkimage -f kernel.cfg -d zImage_without_header zImage
output from the last command:
Magic Number: 27051956
Image Name: kernel.img
Created: Wed May 2 17:40:43 2012
Image Type: ARM Linux Kernel Image (gzip compressed)
Data Size: 1048576 Bytes = 1024.00 kB = 1.00 MB
Load Address: 0x00008000
Entry Point: 0x00008000
Model Name: DNS-313
Version : 1.00b18
Mac Address: ff:ff:ff:ff:ff:ff
$hexdump -C zImage
output from the last command:
00000000 27 05 19 56 [2c 83 53 d5] 4f a1 [55 7b 00 10 00 00] |'..V,.S.O.U{....|
00000010 00 00 80 00 00 00 80 00 [a7 38 ea 1c] 05 02 02 01 |.........8......|
00000020 6b 65 72 6e 65 6c 2e 69 6d 67 00 00 00 00 00 00 |kernel.img......|
00000030 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
00000040 44 4e 53 2d 33 31 33 00 00 00 00 00 00 00 00 00 |DNS-313.........|
00000050 31 2e 30 30 62 31 38 00 00 00 00 00 00 00 00 00 |1.00b18.........|
00000060 ff ff ff ff ff ff 00 00 00 00 00 00 00 00 00 00 |................|
00000070 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 |................|
*
00100060
, , . , [], , , , , .
, C, , ?
.