Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Configuring kernel automatic and manual .
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Fri Jun 14, 2024 5:36 pm    Post subject: [Solved] Configuring kernel automatic and manual . Reply with quote

hi,
I am installing Gentoo Linux in a VirtualBox (To understand the installation process). For my Dell laptop 64 bit I am following https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel for reference. The profile is set at amd64/23.0//desktop/systemd (stable) *.
Currently, I am in the Kernel installation process. I want to understand the steps as follows.

1- Full automation approach: Distribution kernels

According to the handbook, I understand that only these commands are sufficient if a user wants to void compiling the kernel.

Code:
root #emerge --ask sys-kernel/gentoo-kernel-bin


I explore the handbook and I extract the steps (maybe I am wrong). I think that " sys-kernel/linux-firmware " , " sys-firmware/sof-firmware " and " ys-firmware/intel-microcode " are necessary for both automation and manual approaches.

Code:
(chroot) Livecd / #emerge --ask sys-kernel/linux-firmware
(chroot) Livecd / #emerge --ask sys-firmware/sof-firmware
(chroot) Livecd / # emerge –-ask sys-firmware/intel-microcode
(chroot) Livecd / #emerge --ask sys-kernel/gentoo-kernel-bin


Technically can you suggest that the steps I write are correct for the Distribution kernel? You can edit it as to your experience .

2- Full manual approach

Well if someone wants to configure and compile the kernel manually the steps I understand are as following.


Code:
(chroot) Livecd / #emerge --ask sys-kernel/linux-firmware
(chroot) Livecd / #emerge --ask sys-firmware/sof-firmware
(chroot) Livecd / # emerge –-ask sys-firmware/intel-microcode
(chroot) Livecd / # emerge --ask sys-kernel/installkernel
(chroot) Livecd / # emerge --ask sys-kernel/gentoo-sources
(chroot) Livecd / # eselect kernel list
(chroot) Livecd / # eselect kernel set 1

(chroot) Livecd / # ls -l /usr/src/linux
(chroot) Livecd / # emerge --ask sys-apps/pciutils
(chroot) Livecd / # cd /usr/src/linux
(chroot) Livecd / # make menuconfig
(chroot) Livecd / # make && make modules_install
(chroot) Livecd / # make install


Building an initramfs

Code:
(chroot) Livecd / # emerge --ask sys-kernel/dracut
(chroot) Livecd / # dracut --kver <kernel_version>


https://ibb.co/zfxDcKj
https://ibb.co/6YLvgG4

please correct me If I am wrong in any steps.

Thanks,
gardenair


Last edited by gardenair on Sat Jun 22, 2024 11:28 am; edited 2 times in total
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6650
Location: The soundosphere

PostPosted: Fri Jun 14, 2024 6:12 pm    Post subject: Reply with quote

I don't use the full manual approach any more, but your understanding of using kernel-bin is correct.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Fri Jun 14, 2024 6:23 pm    Post subject: Reply with quote

Thanks "audiodef" for your reply. Well, I am more interested in the manual approach. Though it's a time-consuming process but good for learning and flexibility in the system.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6650
Location: The soundosphere

PostPosted: Fri Jun 14, 2024 6:48 pm    Post subject: Reply with quote

Very true. I have no regrets about manually configuring my kernels when I started using Gentoo. It does teach you a lot.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4506
Location: Bavaria

PostPosted: Fri Jun 14, 2024 10:05 pm    Post subject: Reply with quote

gardenair wrote:
[...] Well, I am more interested in the manual approach. Though it's a time-consuming process but good for learning and flexibility in the system.

If you have never done a manual kernel configuration, I suggest to start here:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration

(Please be aware that you need all VM drivers I have disabled here: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6
+ Dont forget to disable some use-flags (like "dracut") for some packages (like "installkernel"), if you go completely manual )

If you do all queries(*) (e.g. lspci -nnk and lsmod) when booting with our GentooLiveCD it is not necessary to emerge "pciutils" (because it is already available) - it is mentionend in our Handbook only if you do the queries later.

*) I mean this: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Before_you_start

Maybe read also this short article: https://wiki.gentoo.org/wiki/User:Pietinger/New_at_Gentoo
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Tue Jun 18, 2024 6:53 pm    Post subject: Reply with quote

Thanks "pietinger" for your detailed reply. Well first I want to discuss about gentoo-kernel-bin.

Code:
(chroot) Livecd / #emerge --ask sys-kernel/gentoo-kernel-bin


You can view the image at https://ibb.co/KrRjW3N

I created a file with the name" kernel-dracut" after the package.use directory
Code:
vim /etc/portage/package.use/kernel-dracut   
and add a line
Code:
 sys-kernel/installkernel dracut

after that, I successfully installed my kernel. Are sys-kernel/installkernel-28 dracut and sys-kernel/installkernel dracut are same or different? I add sys-kernel/installkernel dracut .

2- Why do we not add the entry in /etc/portage/package/make.conf ? The main difference between /etc/portage/package/make.conf and /etc/portage/package/package.use?


There is also a query related to kernel manual installation, but first I want to clarify my above concepts.

Thanks once again for guiding me.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4506
Location: Bavaria

PostPosted: Tue Jun 18, 2024 10:45 pm    Post subject: Reply with quote

gardenair wrote:
[...] Are sys-kernel/installkernel-28 dracut and sys-kernel/installkernel dracut are same or different? [...]

There is a difference: If you add the use-flag "dracut" to "installkernel-28" you have set it only for this specific version (28 ) ... with the next update you will not have this use-flag set for installkernel-29 ... so, yes it was correct from you to set it for every version of "installkernel".

gardenair wrote:
[...] 2- Why do we not add the entry in /etc/portage/package/make.conf ? The main difference between /etc/portage/package/make.conf and /etc/portage/package/package.use? [...]

There exist no /etc/portage/package/make.conf :lol: ... only a /etc/portage/make.conf. In this make.conf you can set some use-flags globally (USE="..."). Sometimes this is the right decision ... sometimes it is better to enable a use-flag only for a specific package. (You can see all globally set use-flags with "emerge --info"). Setting a use-flag in the make.conf was historically the first (and only) option ... today you can even set use-flags globally in /etc/portage/package.use/... just enable it with */* for every package ... if you have installed according to our Handbook you have already done this with:
Code:
echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags

(from: https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base#CPU_FLAGS_.2A )

gardenair wrote:
[...] Thanks once again for guiding me.

You are very Welcome ! :D
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Wed Jun 19, 2024 5:02 am    Post subject: Reply with quote

Sorry for the typing mistake " /etc/portage/package/make.conf" from my side. Yes, only a /etc/portage/make.conf. :)

Ok now coming to manual kernel compiling which I did and unfortunately after rebooting my machine just stuck...The reason I don't know but one thing came to my mind during manual configuration I skipped the topic "Building an initramfs" You can see it here https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Kernel#Building_an_initramfs

Maybe it was the reason. How may I fix it...is it possible to fix my Virtual Machine...? I just google it and in help, it says to press "e" and edit at the end of the kernel line ...It is a new thing for me. If it is the solution (As to my approach) please guide me on how may I enter a prompt and fix the issue...or if the solution is something else please let me know.

https://ibb.co/jbN4ktD
https://ibb.co/0JMhwZ4 ......>You can see at the bottom the Virtual Hard Disk icon is not blinking there is a silence here.
https://ibb.co/K5BZdDK
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4506
Location: Bavaria

PostPosted: Wed Jun 19, 2024 9:31 am    Post subject: Reply with quote

If you configure your kernel yourself you will need an initramfs ONLY IF you want do very special things, like e.g. booting from an encrypted root partition.

(See short explanation in this chapter: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Initramfs_Overview#What_is_an_initramfs_.3F )

Without any special needs you dont need it ... therefore I dont configure it in: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_Configuring_Kernel_Version_6.6#Part_2_-_Slim_kernel

Now the next part: GRUB

When using grub as bootmanager you must configure grub - with grub-mkconfig ... and this routine search for every part of a kernel - also initramfs ... and creates an entry with every thing it found ...

So, if you have some parts of your Gentoo dist-kernel "lying" in /boot you might get a wrong entry in the grub boot menu - this is the reason I wrote ...:
Quote:
If you ever have problems with a make install, then read Installkernel (because this package creates some routines that are then started by a make install"), OR simply copy the kernel yourself to /boot (=instead using make install):

... here: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Manual_kernel_configuration#Cheat_Sheets

What I suggest now:

1. Chroot into your Gentoo installation: https://wiki.gentoo.org/wiki/User:Pietinger/New_at_Gentoo#Pause_during_Installation
2. Check what you have in /efi with "ls -lR /efi" and in /boot with "ls -l /boot" (we dont need all the grub stuff)
3. Read the explanation of parameter "initrd" in: https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Kernel_Commandline_Parameter#Parameter:_initrd.3D and see in your /boot/grub/grub.cfg all entries in chapter "10..."
4. Clean in /boot all what you dont need and make a new grub.cfg with grub-mkconfig .... OR ...

... Maybe you are interested to boot your manually configured kernel directly from UEFI wihtout using grub ... then I recommend this:
https://wiki.gentoo.org/wiki/User:Pietinger/Tutorials/Boot_kernel_via_UEFI

... this is even a better solution if you have already installed the dist-kernel booting with grub ... because it is better separated from each other ;-)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Wed Jun 19, 2024 4:20 pm    Post subject: Reply with quote

Well, once again thanks many times. Being an average Linux user at the moment it is hard for me to digest the stuff. In my own experience in Gentoo Linux installation, I keep all installation steps on one side and the manual kernel configuration on the other side. In manual kernel installation, there are many nuts and bolts in it. It seems easy at first glance but when I dig into it it is like a sea for me. Yes with time one day, I shall be also able to manually install the kernel and fix its issues.

I am using Debian Linux (xfce4 desktop) as a daily drive and the applications I use are, Firefox, LibreOffice, VirtualBox, VLC, Kdenlive, OBS Studio, and Audacity.
Currently, I am planning to switch to Gentoo Linux using the above application.

For an average Linux user(like me) who is interested in switching to Gentoo (XFCE Desktop), what do you suggest to me in the Gentoo installation process which approach may I select? To install a Full automation approach: Distribution kernels or Hybrid approach: Genkernel?
Needs your kind opinion about it.
Back to top
View user's profile Send private message
pietinger
Moderator
Moderator


Joined: 17 Oct 2006
Posts: 4506
Location: Bavaria

PostPosted: Wed Jun 19, 2024 7:03 pm    Post subject: Reply with quote

gardenair wrote:
For an average Linux user(like me) who is interested in switching to Gentoo (XFCE Desktop), what do you suggest to me in the Gentoo installation process which approach may I select? To install a Full automation approach: Distribution kernels or Hybrid approach: Genkernel?
Needs your kind opinion about it.

I dont recommend genkernel ... because:
1. It will die soon, AND
2. You need the same informations/knowledge/experience as for a manual kernel configuration ... and then - for me - the manual installation is easier ... :lol:

I recommend always to install our dist-kernel at first to get a running system ... IF you really have a problem with your manual configured kernel you can easily boot the dist-kernel ... INSTEAD booting with a Admin-/Minimal-/LiveCD and chrooting into your installation ... 8)

See also the first chapter of: https://wiki.gentoo.org/wiki/User:Pietinger/New_at_Gentoo

In this article you will also find this: https://wiki.gentoo.org/wiki/User:Pietinger/Draft/Quick_Installation_OpenRC_for_an_UEFI_System

It is the most current description when using OpenRC as init system - of course you must always do what IBM said: "THINK" ... :lol:

LATER you can always emerge "gentoo-sources", configure and compile your kernel AND (IMHO best) boot it directly with UEFI, so you have no problem with "gentoo-kernel-bin"/"grub"/"dracut"/"installkernel"+use-flags for these.

Yes, the learning experience in Gentoo is great. 8)
_________________
https://wiki.gentoo.org/wiki/User:Pietinger
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Thu Jun 20, 2024 6:39 am    Post subject: Reply with quote

Thanks once again for the nice stuff :) appreciate you. The link is really very impressive but if it should be for systemd then excellent .The reason is all new laptop,desktop are leaving Legacy BIOS and moving to UEFI. So in my opinion Gentoo should only fallow systemd for new computers. https://wiki.gentoo.org/wiki/User:Pietinger/Draft/Quick_Installation_OpenRC_for_an_UEFI_System The point you have mention is very appealing that " I recommend always to install our dist-kernel at first to get a running system " means that user like me should install
Code:
root #emerge --ask sys-kernel/gentoo-kernel-bin
when installing Gentoo first time.

i.e (precompiled Gentoo kernel) . For my own knowledge I can say precompiled Gentoo kernel is just like a sort of kernel when we install Ubuntu, Debian,Fedora because in that distro the user is not worry about the kernel installation which is the backend part of the installation. After installation almost every things works fines like wifi,camera etc etc.
In case of Gentoo which has a flexibility and gives the user a control what he wants to play. So the beauty is if a user like me try to learn Gentoo he must install precompiled Gentoo kernel root #emerge --ask sys-kernel/gentoo-kernel-bin .The reason is as you have mentioned that at least the system will be up after rebooting.

2nd query is suppose I install a fresh Gentoo system (amd64/desktop/systemd ) using root #emerge --ask sys-kernel/gentoo-kernel-bin is it possible after successful booting I may to compile the kernel according to my need or there is other way to manual configure and compile the kernel

Yes I love to play with kernel but your recommendation is very strong to use dist-kernel at first to get a running system.
Back to top
View user's profile Send private message
Hu
Administrator
Administrator


Joined: 06 Mar 2007
Posts: 21976

PostPosted: Thu Jun 20, 2024 11:47 am    Post subject: Reply with quote

gardenair wrote:
The link is really very impressive but if it should be for systemd then excellent .The reason is all new laptop,desktop are leaving Legacy BIOS and moving to UEFI. So in my opinion Gentoo should only fallow systemd for new computers.
There is no logical connection here. OpenRC and systemd are both able to work properly on both BIOS and UEFI systems. There is no reason that the rise of UEFI should imply coercing everyone over to systemd.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54484
Location: 56N 3W

PostPosted: Thu Jun 20, 2024 3:41 pm    Post subject: Reply with quote

gardenair,

Understand PC Boot Process
The firmware is almost irrelevant to bringing up the system as far as starting PID 1.
I say almost an UEFI can do a few things that BIOS cannot. Like secure boot. That's a misfeature aimed at denying equipment owners full control of the equipment that they own.
It can be turned off on AMD/Intel hardware but not on ARM based hardware, if its present.

This post NeddySeagoons' Rough Guide to DIY Kernels from nearly 20 years ago still gives the correct method but the details have changed over the years.
Since that time, if /usr is on its own filesystem, you will need to mount it using an initrd.

If you feel the need to wake your own initrd, rather than use one of the autoblackmagic alternatives, there is Initramfs - make your own too.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6650
Location: The soundosphere

PostPosted: Thu Jun 20, 2024 11:54 pm    Post subject: Reply with quote

Hu wrote:
gardenair wrote:
The link is really very impressive but if it should be for systemd then excellent .The reason is all new laptop,desktop are leaving Legacy BIOS and moving to UEFI. So in my opinion Gentoo should only fallow systemd for new computers.
There is no logical connection here. OpenRC and systemd are both able to work properly on both BIOS and UEFI systems. There is no reason that the rise of UEFI should imply coercing everyone over to systemd.


Totally agree. I personally prefer OpenRC. The only reason I use systemd in my custom Gentoo OS is to make users comfortable when switching from a similar Linux environment.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
gardenair
n00b
n00b


Joined: 05 Oct 2021
Posts: 60

PostPosted: Fri Jun 21, 2024 9:12 am    Post subject: [Solved] Reply with quote

Thanks all for guiding me. Well there was misconception from my side that OpenRc is for BIOS based PC and Systemd for UEFI.
So in short I can say that a latest laptop (Intel Core I7 12th Gen) having UEFI I can install Gentoo using OpenRC or Systemd. Its up to the user choice.
Back to top
View user's profile Send private message
audiodef
Watchman
Watchman


Joined: 06 Jul 2005
Posts: 6650
Location: The soundosphere

PostPosted: Sun Jun 23, 2024 11:51 pm    Post subject: Reply with quote

Correct - you can use either. I find OpenRC to be easier and more intuitive. systemd is more "standard" in that most Linux distros these days use it. Completely your choice.
_________________
decibel Linux: https://decibellinux.org
Github: https://github.com/Gentoo-Music-and-Audio-Technology
Facebook: https://www.facebook.com/decibellinux
Discord: https://discord.gg/73XV24dNPN
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum