LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 01-13-2020, 03:12 PM   #1
fulalas
LQ Newbie
 
Registered: Jun 2017
Posts: 10

Rep: Reputation: Disabled
Compiling kernel with aggressive flags


After reading this Phonorix article I decided to give it a try and compile the kernel with the following flags:

Code:
export CXXFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-signed-zeros -fno-trapping-math -fassociative-math -Wl,-sort-common -fvisibility-inlines-hidden"

export CFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wformat -Wformat-security -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -fno-semantic-interposition -ffat-lto-objects -fno-signed-zeros -fno-trapping-math -fassociative-math -Wl,-sort-common"

export FFLAGS="-g -O3 -feliminate-unused-debug-types -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=32 -Wl,--copy-dt-needed-entries -m64 -fasynchronous-unwind-tables -Wp,-D_REENTRANT -ftree-loop-distribute-patterns -Wl,-z -Wl,now -Wl,-z -Wl,relro -malign-data=abi -fno-semantic-interposition"

export KBUILD_KCONFIG="--build=x86_64-linux-gnu --disable-vtable-verify --disable-werror --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-gnu-unique-object --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --enable-libmpx --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-multiarch --enable-multilib --enable-nls --enable-objc-gc=auto --enable-offload-targets=nvptx-none --enable-plugin --enable-shared --enable-threads=posix --host=x86_64-linux-gnu --program-prefix=x86_64-linux-gnu- --target=x86_64-linux-gnu --with-abi=m64 --with-arch-32=i686 --with-default-libstdcxx-abi=new --with-gcc-major-version-only --with-multilib-list=m32,m64,mx32 --with-target-system-zlib --with-tune=generic --without-cuda-driver -v"
However is not clear if I should set these flags in my script before make oldconfig or before make -j4.

Also, if I want to compile in 32 bit, should I just change all KBUILD_KCONFIG flags from x86_64 to x86? Or should I also change all -m64 to -m32 and remove --with-multilib-list?

Thanks!

Last edited by fulalas; 01-13-2020 at 03:39 PM.
 
Old 01-14-2020, 05:03 AM   #2
business_kid
LQ Guru
 
Registered: Jan 2006
Location: Ireland
Distribution: Slackware & Android
Posts: 11,028

Rep: Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251Reputation: 1251
First thing I would say is that with all those flags, it's a wonder anything compiles at all
Put them in the Makefile or export $CFLAGS, etc.

export CFLAGS=<whatever>
export FFLAG=<whatever>
etc.

Then just make.
 
Old 01-14-2020, 02:37 PM   #3
fulalas
LQ Newbie
 
Registered: Jun 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Smile

Well, it's how Clear Linux compiles its kernel, and it was tested by Phonorix, so as much as it sounds too aggressive, it should work.

I tested and it compiles, but I'm not sure if it used all those flags. Is there a way to check?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Aggressive Low Memory Booster For The Linux Kernel LXer Syndicated Linux News 0 01-20-2013 09:51 PM
LXer: Ubuntu is NOT causing aggressive power management LXer Syndicated Linux News 0 10-31-2007 01:40 PM
Aptitude has crazy aggressive REMOVE policy sixerjman Linux - Software 3 09-20-2006 06:03 PM
LXer: Firefox 'not being aggressive enough' LXer Syndicated Linux News 0 08-07-2006 08:54 AM
LXer: SGI Signals New Era of Aggressive Innovation With Powerful New Server Solutions LXer Syndicated Linux News 0 06-27-2006 11:21 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 04:49 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration