Linux - KernelThis forum is for all discussion relating to the Linux kernel.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
there is no need to go into details, but letting people to know about all possibilities can't harm. Everyone interested can do their own research once they are made aware.
I think this is true.
I try nconfig with kernel source, but it not works.
Maybe put this text in wiki also?
With my motherboard if I hit F11 after powerup I will be presented with a boot menu, where I can choose the image to boot.
I'm surprised there are UEFI motherboards which do not have such a menu.
Ah, you mean the "magic key". Yes, of course my UEFI has that. It's <F1> as far as I can remember. But using it is awkward; you have to press it at exactly the right moment or it doesn't work. Apparently some UEFIs can be set to print a menu out as part of their normal startup procedure, but mine can't.
While I'll have a proper look at it when I've got more time on my hands (I did add a link to the "See also" section at the bottom of the wiki article, as upon a quick skim, it did look quite interesting), but thanks for the link in any case, I'll have a look at it later on.
Quote:
Originally Posted by hazel
nconfig looks prettier than menuconfig. I don't think there's any functional difference.
I just had a look, and yes, that does seem to be the case. So I added a bit about it with the make menuconfig bit in the configure the kernel part of the article.
Quote:
Originally Posted by hazel
The main problem with Emerson's method is that it requires deep knowledge of how the kernel works and what is or is not necessary to make a particular collection of software work reliably on particular hardware.
...
I don't think they are saying we should add a detailed explanation of how to build "that perfect kernel".
Quote:
Originally Posted by hazel
I have played around too with the idea of self-booting kernels. They sound like an elegant solution, but I have several distros so I need a menu to boot them from. I understand that some UEFIs have a built-in menu facility but mine doesn't seem to have one; apparently it's something the UEFI standard doesn't require. But we certainly could add a paragraph about booting without a bootloader for single-distro users.
There seems to me to be a couple of ways I could add the bit about booting the kernel directly from UEFI (without using a bootloader). I think it does warrant a quick mention in the Tips and tricks section in terms of a basic outline of which kernel config option needs to be set, along with an example in regards to adding an entry with efibootmgr. Along with a quick pointer to the Tips and tricks sub-section for it in the main body of the article, being in the "making your kernel bootable" section. In any case, it should be added, and if I knew about that before, I would have added it already. But before I do add anything about it, may I ask you what your way of adding it might be?
Quote:
Originally Posted by hazel
I would be unhappy with the idea of making the existing wiki entry much longer. Actually I think it is already too long. A better solution imho would be to write a sequel on fine tuning your kernel. This would assume the knowledge of how to actually build a kernel by referencing the present entry and then take it on from there, explaining how to interpret the configuration options and determine which ones you actually need on your system. I think it might prove particularly useful for single-board computer users.
...
I think you're a little too fixated on "the article is too long". As long as it's something that's directly relevant to the process of building the kernel and the merit is there, then I think that's more important than just how long the article is. At the end of the day, if someone isn't prepared to do the required reading, then they shouldn't be trying to build a kernel in the first place, period. However, I do agree that when it comes to things like fine-tuning a build, then yes, I think you have a point. There is also already a wiki article about patching the kernel, which is why I added the "See also" section at the bottom of the article and added a link to the existing wiki page about patching the kernel (and the existing configuring the kernel page as well). Because while yes, patching the kernel for one thing is still about the kernel, it's not something that someone building a kernel is explicitly required to consider, not to mention to do that "justice" as it were, it's better off in it's own separate page instead (as it already is). The various kernel config options are a good example of the point I'm making here, in that, yes if we included every single one of them in the article, let alone with a description, then yes, that would make it far too long. Not to mention the fact the page would have to be updated with every new kernel release in that case. Besides, you can go to kernel.org for that info already anyway - I'll add a link to that in the "See also" section at the bottom of the article.
I think it does warrant a quick mention in the Tips and tricks section in terms of a basic outline of which kernel config option needs to be set, along with an example in regards to adding an entry with efibootmgr. Along with a quick pointer to the Tips and tricks sub-section for it in the main body of the article, being in the "making your kernel bootable" section. In any case, it should be added, and if I knew about that before, I would have added it already. But before I do add anything about it, may I ask you what your way of adding it might be?
Tips and Tricks sounds like a good place. The main kernel configuration option that you need is efistubs, which incorporates the efi bootloader code. I think all stock kernels include this nowadays. If you use an initrd, you will also need config_initramfs_source, which allows the kernel to identify and load this without a bootloader to pass the information. I don't know how you insert the kernel command line but I'm sure there's a way of configuring it in.
Then you just copy your kernel to the ESP with a name that ends with 64.efi. If your particular UEFI won't boot vmlinuz64.efi or linux64.efi, rename it boot64.efi.
If your particular UEFI won't boot vmlinuz64.efi or linux64.efi, rename it boot64.efi.
There is a typo, it must be EFI/boot/bootx64.efi. Also, the location is important as I wrote in one of my previous posts. But only if you want your image to be found automatically. When you use efibootmgr to add your images to the boot list then you do not have these restrictions.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Original Poster
Rep:
Quote:
Originally Posted by hazel
Tips and Tricks sounds like a good place. The main kernel configuration option that you need is efistubs, which incorporates the efi bootloader code. I think all stock kernels include this nowadays. If you use an initrd, you will also need config_initramfs_source, which allows the kernel to identify and load this without a bootloader to pass the information. I don't know how you insert the kernel command line but I'm sure there's a way of configuring it in.
Then you just copy your kernel to the ESP with a name that ends with 64.efi. If your particular UEFI won't boot vmlinuz64.efi or linux64.efi, rename it boot64.efi.
With the CONFIG_INITRAMFS_SOURCE option, I assume like the kernel itself, you would need to copy the initrd to the ESP? Assuming I'm right in thinking that; would an example of that be:
Code:
CONFIG_INITRAMFS_SOURCE="/EFI/boot/initrd"
?
or
Do you need to specify the initrd in /boot instead, so an example being:
With the CONFIG_INITRAMFS_SOURCE option, I assume like the kernel itself, you would need to copy the initrd to the ESP? Assuming I'm right in thinking that; would an example of that be:
Code:
CONFIG_INITRAMFS_SOURCE="/EFI/boot/initrd"
or do you need to specify the initrd in /boot instead, so an example being:
Code:
CONFIG_INITRAMFS_SOURCE="/boot/initrd"
I really have no idea. Emerson would know, I think. I've never booted a kernel that way. And any kernel I build doesn't need an initrd anyway because I always build the root filesystem driver in.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Original Poster
Rep:
No worries Hazel, I'll wait for Emerson's advice about that. I have starting writing the bit about booting the kernel directly from UEFI (I haven't added anything to the wiki article itself just yet though - just in a text file on my machine), but I thought I'd clear up any bits that I'm not entirely sure about before I post it to the article.
Uncharted territory for me, also. Like Hazel, I have no noteworthy experience with initrd. I understand it is a build-time option, not boot-time. As you can read here multiple directories can be specified. If you are into EFI booting with initrd then initrd=<image> can be used by EFI firmware (one would guess it must be on ESP or it won't be found), but to be honest, in cases like this I'd probably resort to using rEFInd which has no limitiations.
Distribution: Currently: OpenMandriva. Previously: openSUSE, PCLinuxOS, CentOS, among others over the years.
Posts: 3,881
Original Poster
Rep:
Thanks Emerson. If I'm understanding your link right, it basically says there are two methods one can use. Being either specifying an existing initrd image or building an image (I assume a separate image rather than built into the kernel itself?). So in any case, it does seem to suggest you can use an existing initrd image for the CONFIG_INITRAMFS_SOURCE kernel config option - which was what I was wondering.
PS: You should add an article to your website about fine-tuning a kernel without the clutter like you were talking about before Emerson - I'd love to read that if you do that.
I may be good enough to build my own kernels but teaching others means taking it to another level. I'm not ready for this. I'm honest with you, I feel this would be too much work for me. There are tens of features and options which need to be discussed and explained for fine tuning. Some bits and pieces can be collected from kernelnewbies.org. In any case, an internet search brings up plenty of sites dedicated to kernel tuning, I do not feel I have much to add at this time.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.