You are not logged in.

#51 2018-10-17 22:08:03

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Linux Kernel version 4.19 should go stable at the beginning of next week. Find it Here:

https://www.kernel.org/

Here are a couple links for further information on new features and such:

https://www.phoronix.com/scan.php?page= … ures&num=1
https://www.phoronix.com/scan.php?page= … Linux+4.19

Offline

#52 2018-12-21 18:26:21

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Linux Kernel 4.20 should be released on Sunday.   https://www.kernel.org/

More information about the latest 4.20 kernel here: https://phoronix.com/scan.php?page=news … t-Features
and:
https://www.phoronix.com/scan.php?page= … ures&num=1

Offline

#53 2018-12-22 01:27:18

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,282
Website

Re: How To - Kernel Compile With Custom Options

Thanks for the update!


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#54 2019-03-03 21:50:42

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Linux Kernel version 5.0 should be out today. Get it Here: https://www.kernel.org/

Here is a list of interesting features: https://www.phoronix.com/scan.php?page= … ghts-Recap

It looks like 5.1 will have a few new features as well:  https://phoronix.com/scan.php?page=news … Kernel-Day

Last edited by sleekmason (2019-03-03 21:52:02)

Offline

#55 2019-05-03 12:39:33

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Linux Kernel 5.1 will be released on Sunday, May 5th.  Get it here: https://www.kernel.org/

For a bit more info on 5.1: https://www.phoronix.com/scan.php?page= … ures&num=1

Offline

#56 2019-05-04 02:15:21

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,329

Re: How To - Kernel Compile With Custom Options

sleekmason wrote:

Linux Kernel 5.1 will be released on Sunday, May 5th.  Get it here: https://www.kernel.org/

For a bit more info on 5.1: https://www.phoronix.com/scan.php?page= … ures&num=1

Should be able to build 5.1 on Stretch.


Real Men Use Linux

Offline

#57 2020-08-13 17:04:16

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

I am trying to use gcc 10.1 compiled from source to compile the 5.8 kernel. (this will allow for some patches I am interested in.:)

Looks like everything went well, and a folder was created in home for my new version:

~/GCC-10.1.0

I have tried to direct the new path from the kernel directory by:

sleekmason@ai:~/kernels/linux-5.8.1$ export PATH=$PATH:~/GCC-10.1.0/bin

but this doesn't seem to work when checked:

sleekmason@ai:~/kernels/linux-5.8.1$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0

Any advice here would be appreciated.

The other method is to use gcc from unstable (haven't checked version), and use: update-alternatives --config gcc , to change when needed.  This way seems a bit unnecessary if I can get this to work properly.

Offline

#58 2020-08-13 19:14:44

DeepDayze
Like sands through an hourglass...
From: In Linux Land
Registered: 2017-05-28
Posts: 1,329

Re: How To - Kernel Compile With Custom Options

Be warned: if you compile a kernel with a newer compiler than on Stable it most likely won't run on Stable.


Real Men Use Linux

Offline

#59 2020-08-13 19:28:35

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

DeepDayze wrote:

Be warned: if you compile a kernel with a newer compiler than on Stable it most likely won't run on Stable.

Why would it matter which version of GCC it was compiled with?  .config doesn't change.

Edit*  I have built a bunch of kernels for android on this computer.  Seems like that change would be even bigger:)  My understanding is that the GCC code gets optimized, in turn making for a better optimized kernel.  I don't understand how it could affect the actual setting of the kernel, as those are dictated by computer hardware, system calls, bios, etc . . .

Last edited by sleekmason (2020-08-13 20:01:46)

Offline

#60 2020-08-14 00:47:36

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,282
Website

Re: How To - Kernel Compile With Custom Options

sleekmason wrote:

I have tried to direct the new path from the kernel directory by:

sleekmason@ai:~/kernels/linux-5.8.1$ export PATH=$PATH:~/GCC-10.1.0/bin

but this doesn't seem to work when checked:

sleekmason@ai:~/kernels/linux-5.8.1$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0

Any advice here would be appreciated.

This is because you're appending the path to gcc to PATH. The system uses the first instance of a command that it finds, which will be the regular gcc in this case. Check with

which gcc

To give your custom path precedence it needs to come first in PATH, thus:

export PATH=~/GCC-10.1.0/bin:$PATH

...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#61 2020-08-14 01:26:44

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Thank you johnraff. Unfortunately, that doesn't do the trick either.

sleekmason@ai:~/kernels/linux-5.8.1$ export PATH=~/GCC-10.1.0/bin:$PATH
sleekmason@ai:~/kernels/linux-5.8.1$ gcc --version
gcc (Debian 8.3.0-6) 8.3.0
sleekmason@ai:~/kernels/linux-5.8.1$ which gcc
/usr/bin/gcc
sleekmason@ai:~$ ls GCC-10.1.0
bin  include  lib  libexec  share

Offline

#62 2020-08-14 02:25:44

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,282
Website

Re: How To - Kernel Compile With Custom Options

Is ~/GCC-10.1.0/bin/gcc executable?
And, try

hash gcc

after the export command, to make sure the new path has been picked up.

Test it with some other random executable, in some arbitary path.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#63 2020-08-14 03:22:24

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

All items in the folder are executable.No gcc, but gccgo. Tried linking directly to that as well. hash gcc showed nothing.  Maybe I didn't build in the right items?

sleekmason@ai:~/GCC-10.1.0$ ls bin
c++    gfortran                 x86_64-pc-linux-gnu-g++
g++    lto-dump                 x86_64-pc-linux-gnu-gccgo
gccgo  x86_64-pc-linux-gnu-c++  x86_64-pc-linux-gnu-gfortran

Test it with some other random executable, in some arbitary path.

I have executables in ~/bin I can move around, but don't understand how to test the path? will gladly do so if you tell me how sir:)

Offline

#64 2020-08-14 04:29:36

johnraff
nullglob
From: Nagoya, Japan
Registered: 2015-09-09
Posts: 8,282
Website

Re: How To - Kernel Compile With Custom Options

sleekmason wrote:

All items in the folder are executable. No gcc, but gccgo.

No gcc, then 'which gcc' will of course show the one in /usr/bin. What executable are you trying to override here?

'hash <executable>' shows nothing if the executable exists (else an error message) - it just caches the path. Sometimes I've found it necessary when adding a new executable to PATH, to prevent the stale cached path being used.

don't understand how to test the path?

I just meant to put an executable file in some non-standard location, add that path to PATH and see if the system can find it. Or make some executable testfile in ~/GCC-10.1.0/bin, run your export command again and see what 'which testfile' returns.

But I think the issue is that you haven't got anything called gcc in ~/GCC-10.1.0/bin.


...elevator in the Brain Hotel, broken down but just as well...
( a boring Japan blog (currently paused), idle Twitterings and GitStuff )

Introduction to the Bunsenlabs Lithium Desktop

Offline

#65 2020-08-14 12:30:33

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

johnraff wrote:

But I think the issue is that you haven't got anything called gcc in ~/GCC-10.1.0/bin.

Looks like I may have some further exploring to do:) Thank you for your suggestions. Hopefully I can get it figured out.

Offline

#66 2020-08-20 19:25:14

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Guide updated.

As a side note, linux-image-4.19.0-10-amd64 (currently installed with bl-welcome), has the BFQ scheduler enabled as a module.  This can be checked with:

sudo cat /sys/block/sda/queue/scheduler

You can try it for the existing session with:

sudo echo bfq > /sys/block/sda/queue/scheduler

Run cat again to check.

If you want to make BFQ default, look in the guide for instructions.  Just need to change a file, and add a file:)

Offline

#67 2020-08-30 19:24:46

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Thought I would share the difference in times between the kernel as is, and one that has been optimized to get rid of some of the debugging, and a few other easy optimizations.
The native configuration needs some tweaking.

Just after install:

sleekmason@ai:~$ systemd-analyze
Startup finished in 7.524s (kernel) + 49.303s (userspace) = 56.828s 
graphical.target reached after 49.282s in userspace

After customization:
sleekmason@ai:~$ systemd-analyze

Startup finished in 4.259s (kernel) + 28.872s (userspace) = 33.132s 
graphical.target reached after 28.847s in userspace

This translates to opening of apps, taskes, etc.

My computer is a 2009 Dell dual-core with 2 gigs ram.  Probably doesn't matter with a newer system, but sure makes these old boxes fly!

Offline

#68 2020-10-29 13:38:21

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

A look at what is coming down the pike:
510 Features
Expected Features

And my new favorite info tool for flags and such is cpuid.

Sudo apt install cpuid
cpuid | less

Gives readable info about everything. Wanna know what flags are supported? Here ya go.

Offline

#69 2020-11-12 13:32:08

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Quick note -

Rc Kernel 5.10 uses schedutil as the default governer, and shows no option in the configuration for on-demand.  No idea if it will be re-introduced or not, and probably isn't worth the bother.

This means if you are compiling by putting your old .config in the kernel folder to run the build, it will fail.

You must run "make oldconfig" first. The other fun way is to run a "make localmodconfig" if you have never done so.  Just make sure to have everything plugged in that you may need, or it will not be recognized, and will not function in the new kernel.

Offline

#70 2020-11-23 03:42:54

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

sleekmason wrote:

Quick note -

Rc Kernel 5.10 uses schedutil as the default governer, and shows no option in the configuration for on-demand.  No idea if it will be re-introduced or not, and probably isn't worth the bother.

Ondemand is back in 5.10rc4. Guess we'll just have to wait and see if they finally decide to do away with it or not.  I didn't really notice any issues running schedutil, so probably doesn't make much difference.  The 5.10 kernel in general seems to run quite smoothly.  Very scientific, I know.

Offline

#71 2021-04-01 14:20:36

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Kernel 5.12 has been out for a bit.  Currently on 5.12-rc5. 

Anyway, one of the new features in 5.12 is a whole subsection of Dell settings!  Maybe these were spread out into different areas before, but looks pretty cool. 

You will find them under /drivers - X86 Platform Specific Device Drivers in menuconfig. Still not activated by default . . .yet.

https://www.phoronix.com/scan.php?page= … Linux+5.12

Offline

#72 2021-04-08 22:30:56

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Just built kernel 5.11.12 without all of the debugging here: https://github.com/sleekmason/Kernel-Stable

If you have had difficulty getting a build using the Debian kernel for "oldconfig", try installing this kernel first, and then build with whatever options you like from here.

See my github "readme" for instructions, and the guide for any additional questions.

I've added a "march.patch" I am currently using from https://github.com/graysky2/kernel_gcc_patch) to the zip file as well for patching against 5.11 Sources  - provides all the possible processor family optimizations ("Ice Lake" "Sky Lake" "Atom" etc . . )

Also, the pesky "ath10 firmware" error warnings I was getting on boot are gone in 5.11. yay!

Be aware that this kernel is for Bullseye/Sid.

You may get firmware warnings on boot if used with Buster.

Last edited by sleekmason (2021-04-08 23:07:11)

Offline

#73 2021-08-11 16:47:57

Peregrino69
Member
Registered: 2016-03-11
Posts: 89

Re: How To - Kernel Compile With Custom Options

Tried this and ended up in a mess which prompted me to reinstall the whole system. Lucky it's vanilla, so nothing essential lost.

Problem came here:

sleekmason wrote:

Make oldconfig only needs to be done (and should be) at the change of the major kernel release number, i.e. from 4.15 to 4.16.

Accept all of the defaults by hitting enter repeatedly (just hold it down), or look through them if you want.

Now "Accept all etc." implies that at this point some kind of configuration window should have opened where options are chosen. Didn't happen. Make oldconfig spat out a few lines of text and apparently created a file in /somewhere/.config, but that was all.

Is there maybe something missing, or did I miss "open /somewhere/.config/foo in text editor"?

Offline

#74 2021-08-11 20:14:40

sleekmason
zoom
Registered: 2018-05-22
Posts: 608
Website

Re: How To - Kernel Compile With Custom Options

Peregrino69 wrote:

Tried this and ended up in a mess which prompted me to reinstall the whole system. Lucky it's vanilla, so nothing essential lost.

Problem came here:

sleekmason wrote:

Make oldconfig only needs to be done (and should be) at the change of the major kernel release number, i.e. from 4.15 to 4.16.

Accept all of the defaults by hitting enter repeatedly (just hold it down), or look through them if you want.

Now "Accept all etc." implies that at this point some kind of configuration window should have opened where options are chosen. Didn't happen. Make oldconfig spat out a few lines of text and apparently created a file in /somewhere/.config, but that was all.

Is there maybe something missing, or did I miss "open /somewhere/.config/foo in text editor"?


----------------------------------
Howdy, Sorry you had problems.  A few questions:)

Were you able to install 5.11.12 without issues?
Did you install the required packages to build a kernel?

sudo apt install build-essential libncurses5-dev libssl-dev libelf-dev bison flex bc fakeroot

Did you follow the guide to get started?

"Make oldconfig" uses the current configuration based on whichever kernel is active at the time.
You should never need to reinstall your system because of a faulty kernel.  You should have an option in your grub menu on boot to change into whichever kernel you want based on what you have installed. (several different kernels, several choices.)

The default choices during make oldconfig are what you would generally have in any kernel made for any distro, meaning, they are the standard choice for any new configuration, designed to not interfere with your system.

5.11.12 was directly built from https://www.kernel.org/  to allow for an easy build sans any Debian patches. It is possible that you require a package that Debian has added for some reason.

It is always possible this kernel simply won't work for you.

Basically, If you installed the 5.11.12 kernel and have zero issues, and have the required packages for building a kernel, you shouldn't have any issues with a new build. (In theory).

If the kernel doesn't work, simply reboot and change to your prior kernel through the grub screen within the options. Then remove the 5.11.12 kernel using "apt remove"

Hope you will give it another go:)  Once you have a working kernel to build against, there is no end to fun to be had changing the different settings.  You will still want to run "make menuconfig" after "make oldconfig" to get into the settings.  Hope this helps!

Last edited by sleekmason (2021-08-11 20:15:44)

Offline

#75 2021-08-12 15:28:14

Peregrino69
Member
Registered: 2016-03-11
Posts: 89

Re: How To - Kernel Compile With Custom Options

No probs mate :-)

sleekmason wrote:

Were you able to install 5.11.12 without issues?

I wasn't even actually trying that, just wanted to get a newer kernel than 4.19.0-13, as Virtualbox required the headers which weren't available with apt anymore. 0-17 got installed as well, but for some reason Ubuntu (the first installed Linux) didn't add that to the menu when I run sudo upgrade-grub for the first time (yes, under Ubuntu). Second time it decided to pick the installed 0-17 as well, and I'm now happily running that one smile

Now I'm trying to figure out how to promote BL as the master so I can scrap that Ubuntu altogether. Not a fan tongue

Did you install the required packages to build a kernel?

sudo apt install build-essential libncurses5-dev libssl-dev libelf-dev bison flex bc fakeroot

Did you follow the guide to get started?

Yes and yes, and everything went exactly as described. The stumbling block was "Accept all defaults" as it indicates that another window should have opened at that point. Noting was, hence I was wondering if there's just a piece of text missing at that specific point. 
I think I found the stumbling block... you say:

run "make menuconfig" after "make oldconfig" to get into the settings

So do I understand correctly that you will only get the settings-window after "make menuconfig", and nothing similar is actually even supposed to happen after "make oldconfig"?

At one point I actually just soldiered on and got the settings-window, but I didn't know whether there should've been another similar window after "make oldconfig". Anyway by then my system was already so messed up with missing dependencies and whatnot that it was easier just to reinstall big_smile

I'd suggest re-wording that part of the instruction, maybe even adding a screenshot, for clarity. I've been curious about kernel building for quite a while, but haven't managed to find a clear enough workflow to actually take a plunge. So thanks for an otherwise good job smile

Offline

Board footer

Powered by FluxBB