How to compile Linux kernel with-O0-g

Source: Internet
Author: User
To-O0-g to compile the Linux kernel-Linux general technology-Linux programming and kernel information, the following is a detailed reading. To study the slub distribution in linux. compiled um for debugging. however, because the Linux kernel uses-O2 by default, the minimum requirement is-O1. when optimization is enabled, the source code will jump. I spent a few minutes solving this problem. you can modify the configuration in three places.

The first include/linux/compiler-gcc.h In the inline _ inline after these definitions have aways_inline attribute, to delete this attribute

In menuconfig, "Force gcc to inline functions marked inline" is not selected in kernel hack"

Of course, in the end, the-O2 in The Makefile should be deleted, that is, no optimization is needed for compilation (it seems that this time is-O0)

Then you can use make ARCH = um to compile the program successfully. I have compiled the simplified um for about 15 MB. (compile the kernel with debug info is selected)

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.