LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
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 12-21-2020, 10:10 PM   #1
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Building your own kernel LQ wiki working thread


I think a good start is probably to work out what kind of content and structure the new wiki article should have.

A rough draft structure could be something like this:
[*]intro/description

...
[*]preparing your system for building/prerequisites

-development tools
-development packages for kernel build
-etc

*do we have a separate section for building with LLVM/Clang?*

...
[*]configuring the kernel for building

-answering all questions from the kernel build system
-copying current kernel config over to new kernel

...
[*]steps to build new kernel

...
[*]installing the built kernel modules and kernel

...
[*]configuring the newly built kernel for use with your system

...
[*]problems/issues that might arise

*or should that be incorporated into a section above?*

...

===================

What do you think about that example structure of the new wiki article Hazel?
 
Old 12-22-2020, 05:49 AM   #2
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
The biggest section would probably be configuration, because there are different ways to achieve this and also different starting points.

You can start with:
a) the existing configuration for your distro's kernel. But this is a stock configuration designed to run on any hardware and containing loads of drivers that you don't actually need. You will need to remove a lot of this if you don't want a long compilation time.
b) the output of make defconfig. This gives you a kernel with sensible defaults which you can then customise.
c) a kernel seed from a website. The best known are Pappy's seeds. You answer a few simple questions about your hardware and get a sensible default kernel configuration that you can adapt further.
d) The configuration file for the last kernel you built. This is ideal but obviously not available for your first build.

The actual configuration can be done with:
1) make config. You answer a long string of questions. If you make a mistake, you have to go back to the beginning. This is how kernels used to be built in the bad old days.
2) make menuconfig or make nconfig. This gives you a pseudo-graphical set of menus that you can navigate with your arrow and tab keys. If you make a mistake anywhere, you can go back and fix it. Disadvantages: it's ugly and you need to learn the navigation key bindings.
3) make xconfig or make gconfig. These give you a fully graphical menu which you can navigate with your mouse. Disadvantage: it needs a graphical desktop so you can't do it from the console.

Something should be said at this point about the wonderful kernel help system. Most online help only tells you what an option is for. Kernel help often tells you whether you need it or not. Novices should be encouraged to press H for any option they don't understand.

Also of course the fundamental rule: don't change anything unless you know what you are doing, or you'll get a kernel that can't boot.

Something should be said about building things as modules versus building them in. For example, if you don't want to use an initrd, you must build in your disk controllers and root filesystem driver.

Building with clang is a specialist topic, so if you include it, it should go in an appendix.

Last edited by hazel; 12-22-2020 at 05:55 AM.
 
1 members found this post helpful.
Old 12-22-2020, 06:25 AM   #3
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by hazel View Post
The biggest section would probably be configuration, because there are different ways to achieve this and also different starting points.
...
c) a kernel seed from a website. The best known are Pappy's seeds. You answer a few simple questions about your hardware and get a sensible default kernel configuration that you can adapt further.
While I knew about the rest of what you said, I've never heard of a "kernel seed" before. What exactly is that?

Quote:
Building with clang is a specialist topic, so if you include it, it should go in an appendix.
The issues there are that, you need to provide extra arguments to make to get the kernel to actually build with LLVM/Clang. There is also a kernel config option I had to disable to get it to complete the build. So that's the reason I was asking about a separate section for building with LLVM/Clang, or we have a "problems/issues" section to deal with those issues, or do you think what you already suggested could deal with that (given the extra make arguments and disabling a option so it completes the build)?

I agree with the rest of what you said about the content for the configuration section though.

So I take it the very rough structure I done looks ok to you?
 
Old 12-22-2020, 06:36 AM   #4
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by jsbjsb001 View Post
While I knew about the rest of what you said, I've never heard of a "kernel seed" before. What exactly is that?
It's basically the same kind of thing that defconfig does. It provides a .config file with sensible defaults. The difference is that sites can include scripts that collect basic hardware parameters, so you get a default configuration that is a bit more tailored than the one the kernel team provide.
Quote:
The issues there are that, you need to provide extra arguments to make to get the kernel to actually build with LLVM/Clang. There is also a kernel config option I had to disable to get it to complete the build. So that's the reason I was asking about a separate section for building with LLVM/Clang, or we have a "problems/issues" section to deal with those issues, or do you think what you already suggested could deal with that (given the extra make arguments and disabling a option so it completes the build)?
I think that will only confuse people. Anyone who hasn't built a kernel before will want to build it with the standard method. Anyone who is experienced in building kernels probably won't read the wiki. Actually I think a separate wiki page is the best way to deal with a clang build.
Quote:
So I take it the very rough structure I done looks ok to you?
Yes, though I'm not sure what you mean by "configuring the kernel for use with your system". If you configured it properly before building it, no further configuration should be needed. You have to configure the bootloader of course but that's a different matter.
 
1 members found this post helpful.
Old 12-22-2020, 06:50 AM   #5
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by hazel View Post
...I think that will only confuse people. Anyone who hasn't built a kernel before will want to build it with the standard method. Anyone who is experienced in building kernels probably won't read the wiki. Actually I think a separate wiki page is the best way to deal with a clang build.
Perhaps in the intro section we can give at least a brief intro to the fact you can use purely the GNU toolchain, or you use LLVM/Clang to build the kernel - albeit having to use the GNU linker if you opt for the latter route?

Quote:
Yes, though I'm not sure what you mean by "configuring the kernel for use with your system". If you configured it properly before building it, no further configuration should be needed. You have to configure the bootloader of course but that's a different matter.
Yes, the bootloader was one of the things I meant, since while the makefile did attempt to configure LILO, it didn't add any GRUB entry - I had to do that myself. I also had to build the initrd myself as well. So namely those things was what I was referring to regarding that section. But I suppose we might be able to include that info elsewhere though. To be clear, I think that info, along with the info about clang should be included in the same wiki page since we are talking about building the kernel and all of that is still relevant to the kernel. There's also the fact that once LLVM/Clang become more accepted with other distro's it's probably likely that we'll see more of them at least providing those options, and not just a "pure" GNU toolchain.
 
Old 12-22-2020, 07:17 AM   #6
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
So we need a section called "Making your new kernel bootable". This will cover where you need to copy it to, whether or not you need to make an initrd (you should be able to avoid that in a hand-built kernel) and how to make lilo, elilo or grub see the kernel.
 
Old 12-22-2020, 07:30 AM   #7
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Yeah, that sounds like a far better title and idea than I come up with before. Agreed, if you're happy with that.

I was also thinking that in the "preparing your system for building/prerequisites" we could perhaps include something about the skills required to build the kernel (be that with just the GNU toolchain or using clang). So for example:

-basic command-line skills - preferably using development tools such as make, etc
-a basic understanding of what "building from source" means - preferably being comfortable compiling software (doesn't have to be any previous kernel building experience)
-basic troubleshooting skills

Because let's face it, a complete newbie who is terrified of using the command-line/terminal isn't likely to attempt to build a kernel in the first place. So it's going to really require somewhere between beginner and intermediate skills to be able to have the basic prerequisites required. So I think that's probably who we should aim the article at, and perhaps make that clear in the intro, that before attempting any of the steps to try and build the kernel, the reader should make sure they have at least the basic skills needed?
 
Old 12-22-2020, 07:43 AM   #8
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by jsbjsb001 View Post
I was also thinking that in the "preparing your system for building/prerequisites" we could perhaps include something about the skills required to build the kernel.
LFS does something like that in its introductory matter. See http://www.linuxfromscratch.org/lfs/...equisites.html. But remember, the kernel building environment is quite different from the standard autotools. To build an autotools package, you have to have some idea of what "configure" and "make" actually do. You don't really need that for the kernel; in fact having it won't particularly help you. And if you use a graphical configuration menu, you don't even need command line skills until you come to installing the thing.
 
Old 12-22-2020, 07:59 AM   #9
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
But you would still need to issue the make command to build the kernel after you've configured it, and you would need to supply extra arguments to make if building with clang though.

In any case, it might be wise to just make the point that there is a certain level of skill involved, albeit not a particularly advanced level of skill per se, certainly you don't need to be a kernel developer to be able to build it and then install it.
 
Old 12-22-2020, 10:58 AM   #10
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
I've created a stub page https://wiki.linuxquestions.org/wiki...n_Linux_kernel so that we can start adding actual text. btw where is everyone else?

Last edited by hazel; 12-22-2020 at 11:29 AM.
 
1 members found this post helpful.
Old 12-22-2020, 11:55 AM   #11
eight.bit.al
Member
 
Registered: Jul 2015
Location: Prison
Distribution: a new distro every day
Posts: 124

Rep: Reputation: Disabled
Put me in the simply curious category. Eagerly waiting.

8bit
 
Old 12-23-2020, 06:29 AM   #12
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
Quote:
Originally Posted by hazel View Post
I've created a stub page https://wiki.linuxquestions.org/wiki...n_Linux_kernel so that we can start adding actual text. btw where is everyone else?
Looks good Hazel, you'll have to forgive me for thinking that you've done this before, yes?

It might be a good idea if we focus on a section at a time in regards to content.

I think the intro section looks fairly complete and probably good enough, so in relation to the "Prerequisites for the build" section: while I think we should explicitly list the development packages for building the kernel itself like, "libelf" (and obviously the devel package for it) for one example, in regards to the development tools themselves; should we just state for example, "GNU toolchain" or gcc, ld, make, etc and actually list the individual development packages for the various tools themselves?
 
Old 12-23-2020, 07:08 AM   #13
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
Quote:
Originally Posted by jsbjsb001 View Post
I think the intro section looks fairly complete and probably good enough, so in relation to the "Prerequisites for the build" section: while I think we should explicitly list the development packages for building the kernel itself like, "libelf" (and obviously the devel package for it) for one example, in regards to the development tools themselves; should we just state for example, "GNU toolchain" or gcc, ld, make, etc and actually list the individual development packages for the various tools themselves?
I think if you list too many tools, you'll frighten people off! I know that in Debian distros, you only need one metapackage called build-essential, Arch has something called base-devel, and I assume Red Hat distros also have the like. Slackware of course has everything you need if you do the full install. I'll see if I can cook up a paragraph that covers the ground.
 
Old 12-23-2020, 09:51 AM   #14
jsbjsb001
Senior Member
 
Registered: Mar 2009
Location: Earth, unfortunately...
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881

Original Poster
Rep: Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063Reputation: 2063
I think mentioning the metapackage for the development tools rather than the tools themselves individually is a good idea, but there are a few devel packages apart from the tools themselves that you need, that may not be installed by default in all distros. So I do think that those devel packages should be explicitly mentioned in the prerequisites section, as this wiki page is supposed to be a complete guide, and I'd think that if someone is serious about building the kernel themselves, a full list of devel packages required (excluding the development tools themselves once again) should be included. Like the devel package for libssl as well as libelf, and while you did mention libelf, I think it would be better if we explicitly state the devel package of libelf (as well as libssl), not just the library itself.

But apart from that, I think the prerequisites section is about right from the look of it I just had, so again, nice work.
 
Old 12-23-2020, 09:59 AM   #15
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,650
Blog Entries: 19

Rep: Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480Reputation: 4480
OK, I'm only writing drafts. Feel free to edit what you don't like. It's your project.

Last edited by hazel; 12-23-2020 at 10:01 AM.
 
  


Reply

Tags
development, kernel, lq wiki



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: Web Served 7: Wiki wiki wiki! LXer Syndicated Linux News 0 02-19-2013 09:10 PM
Tip: for answers, "wiki, wiki!" sundialsvcs Linux - Newbie 1 01-18-2006 02:40 PM
Wiki: Show Printable Version / printer friendly version / wiki page setup Emmanuel_uk LQ Suggestions & Feedback 1 10-24-2005 08:09 AM
tutorial on wiki wiki web alix123 Programming 1 04-02-2005 02:08 PM
wiki: supposed to use the same wiki namespace? liquigel LQ Suggestions & Feedback 1 03-07-2004 10:11 AM

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

All times are GMT -5. The time now is 04:08 AM.

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
Open Source Consulting | Domain Registration