How to enable the entry point (Entry address) to automatically offset 64 bytes during Linux kernel make uimage?

Source: Internet
Author: User

Original Works. reposted for the source!

 

 

During the two days during the transplantation of u-boot-1.3.4 to S3C2440, there are still a lot of things, first of all, U-boot mach_type and kernel mach_type inconsistent, resulting in the kernel after normal decompression, the terminal will not move, stopped there. After mach_type is changed, the kernel can copy and decompress normally.

Now, when the make uimage kernel is compiled to automatically generate a uimage, the entry point address and the load address are always the same, both load address: 30008000 and entry point: 30008000, after the kernel is decompressed, bootm will crash out, because the 64 bytes before uimage are the U-boot parameter and cannot be used as the kernel startup entry address. If you manually use the mkimage command to generate a uimage, you can start it normally:

Mkimage-N 'linux-2.6.32 '-A arm-O Linux-T kernel-C none-
0x30008000-E 0x30008040-n "my2440"-D zimage uimage

After all, this is troublesome. It is most convenient for make uimage to automatically generate the correct uimage.

Open ARCH/ARM/boot/makefile, 62 ~ Line 78 uses mkimage to generate uimage commands. Note 73 ~ Line 78 is the value assignment of the entry point address:

 

Ifeq ($ (config_thumb2_kernel), Y) <br/> # Set bit 0 to 1 so that "mov PC, RX "switches to thumb-2 mode <br/> $ (OBJ)/uimage: startaddr =$ (shell echo $ (loadaddr) | sed-e" s /. $/1/") <br/> else <br/> $ (OBJ)/uimage: startaddr = $ (loadaddr) <br/> endif 

2440 is ARM920T. Apparently, 78th rows are executed, and the load address is directly assigned to the entry address. For some reasons, you only need to improve the 77th rows. The modifications are as follows.

 

$ (OBJ)/uimage: startaddr =$ (shell echo $ (loadaddr) | sed-e "s/... $/40 /")

 

 

Here, sed-e "s /.. $/40/"means to delete the last two characters of the output string and supplement it with 40. It can also be understood, replace the last two characters of the string with 40. In this way, the original entry address 0x30008000 is changed to 0x30008040, And the entry address is 0x40, that is, 64 bytes.

 

Run make uimage to regenerate the U-boot image file. The kernel can be started normally!

 

 

Keywords:

How can I enable the entry point (Entry address) to automatically offset 64 bytes when the Linux kernel mkimage generates a uimage.

How to solve the problem that the entry point and load address are the same when the Linux kernel mkimage generates a uimage.

When you make uimage, the entry point automatically offsets 64 bytes.

When you make uimage, the entry point automatically adds 64 bytes.

When you make uimage, the entry point (Entry address) is automatically added with 0x40.

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.