Android kernel compilation notes

Source: Internet
Author: User

1. After the kernel is compiled, arch/arm/boot/compressed/vmlinux, arch/arm/boot/Image, arch/arm/boot/zImage can be generated.

Among them, vmlinux is an elf file. Image is the kernel Image file, while zImage is a kernel Image Compression file. The Image size is about 4 M, and zImage is less than 2 M. ZImage is a common compression image file used in ARM Linux. It adds a "Header" with a length of 0x40 before zImage ", specifies the type, loading location, generation time, size, and other information of the image file.

 

2. Relationships between them:

LD vmlinux
SYSMAP System. map
SYSMAP. tmp_System.map
OBJCOPY arch/arm/boot/Image
Kernel: arch/arm/boot/Image is ready
AS arch/arm/boot/compressed/head. o
GZIP arch/arm/boot/compressed/piggy.gz
AS arch/arm/boot/compressed/piggy. o
CC arch/arm/boot/compressed/misc. o
As ARCH/ARM/boot/compressed/head-xscale.o
Ld arch/ARM/boot/compressed/vmlinux
Objcopy ARCH/ARM/boot/zimage

 

3. objcopy is a GNU utility. objcopy is used to copy the content of a target file to another target file. This interface is used to copy part of the object to another object to convert the format.

 

 

Objcopy can be used to convert an object to the S-record or raw binary format.

For example,

XXXX-elf-objcopy-o srec test. O test. S19

Convert test. O to the S-record file. It usually involves text segments.

XXXX-elf-objcopy-O binary test. O test. Bin

Convert test. O to the raw binary file format.

When converting an object to a raw binary format, the symbols and relocation information are usually removed. During the generation of S-record, you sometimes need to use the Options "-s" and "-R" to remove the binary file, which is not required by the S-record file.


4. mkimage tool, which can be used to create a variety of startup image files without compression or compression.

When creating an image file, mkimage adds a 0x40 header before the original executable image file to record the information specified by the parameter, in this way, uboot can identify the CPU architecture, OS, type, memory location, the entry point, and image name of the image.
Root @ glym:/tftpboot #./mkimage
Usage:./mkimage-l Image
-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)
Parameter description:
-A: Specify the CPU architecture:
Architecture represented by values
Alpha Alpha
Arm A RM
X86 Intel x86
Ia64 IA64
Mips
Mips64 MIPS 64 Bit
Ppc PowerPC
S390 IBM S390
Sh SuperH
Type
Sparc64 iSCSI 64 Bit
M68k MC68000
-O: Specifies the operating system type. The following values can be used:
Openbsd, netbsd, freebsd, 4_4bsd, linux, svr4, esix, solaris, irix, sco, dell, ncr, lynxos, vxworks, psos, qnx, u-boot, rtems, artos
-T specifies the image type. The following values can be taken:
Standalone, kernel, ramdisk, multi, firmware, and filesystem
-C: Specifies the image compression method. The following values can be taken:
None
Gzip Compression Method
Bzip2 is compressed with bzip2
-A specifies the image loading address in the memory. When the image is downloaded to the memory, the image must be downloaded according to the address value specified by this parameter when the image is created using mkimage.
-E specifies the image running entry point address, which is the value specified by-a plus 0x40 (because there is a mkimage header with 0x40 bytes added)
-N indicates the image name.
-D specifies the source file for image creation.

 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.