View previous topic :: View next topic |
Author |
Message |
cornplayz256 Tux's lil' helper


Joined: 25 Jun 2023 Posts: 107 Location: /dev/mmcblk0
|
Posted: Wed Aug 16, 2023 6:13 pm Post subject: how to i switch from a kernel-bin to genkernel? |
|
|
im using a bin-kernel and now i want to switch to genkernel so i can build my own kernel. can anyone tell me how to switch from a bin kernel to a genkernel? any help is appreciated.  |
|
Back to top |
|
 |
pietinger Moderator

Joined: 17 Oct 2006 Posts: 5654 Location: Bavaria
|
|
Back to top |
|
 |
stefan11111 l33t

Joined: 29 Jan 2023 Posts: 954 Location: Romania
|
Posted: Wed Aug 16, 2023 9:40 pm Post subject: Re: how to i switch from a kernel-bin to genkernel? |
|
|
+1
Why switch to genkernel when there is a better, more customizable, and easier to maintain way? _________________ My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev" |
|
Back to top |
|
 |
cornplayz256 Tux's lil' helper


Joined: 25 Jun 2023 Posts: 107 Location: /dev/mmcblk0
|
Posted: Wed Aug 16, 2023 10:46 pm Post subject: Re: how to i switch from a kernel-bin to genkernel? |
|
|
I just want to toggle some things in the menu config. Thats all.
Also, thanks for the info. |
|
Back to top |
|
 |
jburns Veteran

Joined: 18 Jan 2007 Posts: 1231 Location: Massachusetts USA
|
Posted: Wed Aug 16, 2023 11:51 pm Post subject: |
|
|
Code: | genkernel --menuconfig --kernel-config=/proc/config.gz all | would use the config for the running kernel and allow you to modify it for the new kernel that is built from source. menuconfig can be replaced by gconfig or xconfig depending on which desktop you are using. |
|
Back to top |
|
 |
sublogic Guru


Joined: 21 Mar 2022 Posts: 331 Location: Pennsylvania, USA
|
Posted: Thu Aug 17, 2023 1:01 am Post subject: Re: how to i switch from a kernel-bin to genkernel? |
|
|
cornplayz256 wrote: | im using a bin-kernel and now i want to switch to genkernel so i can build my own kernel. can anyone tell me how to switch from a bin kernel to a genkernel? any help is appreciated.  | Genkernel is a good (but slow) way to build a kernel from scratch, but you already have a working installation. I don't think you need genkernel.
I'll assume that you have a straightforward install with grub and a directly accessible root partition, as opposed to things like LVM or full disk encryption. If that's not the case, speak up !
Here's what I would do.- emerge gentoo-sources
- eselect kernel list
- eselect kernel set choose-by-number
- cd /usr/src/linux
- make localyesconfig
- make -j$(nproc)
- make modules_install
- mount /boot
- make install
- grub-mkconfig -o /boot/grub/grub.cfg
- reboot
EDIT: changed step 5 from "localmodconfig" to "localyesconfig".
Step 5 creates a kernel .config with the drivers currently in use builtin, and no other drivers. Those builtin drivers should be sufficient to boot the new kernel without an initramfs. The kernel should build much faster than with genkernel, which compiles tons of modules you won't use.
If the new kernel does not work, reboot and choose your -bin kernel from the grub menu.
To tweak the new kernel, or repair it if broken, Code: | # cd /usr/src/linux
# make menuconfig
# make -j$(nproc)
# make modules_install
# mount /boot && make install |
You may need to add drivers at the menuconfig step. For example, if you plug in a thumb drive and it is not recognized, you need to enable CONFIG_USB_STORAGE at the menuconfig step, either builtin or modular. The driver was not in use when you did your localmodconfig because the thumb drive wasn't plugged in, so it was left out of the .config .
EDIT 2: Ah, yes, the firmware. If you get a text console but can't start X, your graphics driver needs firmware. Find it in "menuconfig" and change it from "y" to "m" (=from builtin to module). (Also you should emerge sys-kernel/linux-firmware if you haven't already.)
Disclaimer: I never used a -bin kernel so I have to make ASSumptions in the above. Just keep your working initial kernel as a fallback in case anything goes wrong.
EDIT 3: See NeddySeagoon's remark in followup post below.
Last edited by sublogic on Fri Aug 18, 2023 12:02 am; edited 1 time in total |
|
Back to top |
|
 |
Gentoopc Guru

Joined: 25 Dec 2017 Posts: 413
|
Posted: Thu Aug 17, 2023 2:55 am Post subject: Re: how to i switch from a kernel-bin to genkernel? |
|
|
the Gentoo forum no longer understands why it is necessary to build a kernel. this raises questions for them already. this place will soon need to be renamed microsoft forum.
you're good for trying to pick at the core. |
|
Back to top |
|
 |
Hu Administrator

Joined: 06 Mar 2007 Posts: 23395
|
Posted: Thu Aug 17, 2023 12:00 pm Post subject: Re: how to i switch from a kernel-bin to genkernel? |
|
|
Gentoopc wrote: | the Gentoo forum no longer understands why it is necessary to build a kernel. this raises questions for them already. this place will soon need to be renamed microsoft forum.
you're good for trying to pick at the core. | The Gentoo forum consists of a great many people, most of whom choose to stay out of any given thread. Please quit your sniping that the whole forum is doomed because a few people do not try to use the distribution the way you think it should be done. Moreover, I do not see any replies in this thread that would even justify your snipe.- OP asked the question.
- pietinger asked for elaboration, because the specific goals the OP seeks to achieve influence which answer is best. pietinger did not try to discourage OP from doing a custom kernel.
- stefan11111 posted general agreement to pietinger's response, so this also was not discouraging a custom kernel.
- OP acknowledged pietinger.
- jburns posted a response directly addressing OP's original intent to use genkernel.
- sublogic posted a detailed response on how to build a custom kernel without relying on genkernel. While not directly addressing OP's question, I think that was a well intentioned and helpful response. At worst, I would say sublogic discouraged OP from using the requested prebuilt tool (genkernel) and pushed instead for a deeper understanding of how to do the work manually - exactly the thing you seem to want people to do.
Therefore, from my perspective, every response in this thread is on-topic, well intentioned, and undeserving of your snipe. |
|
Back to top |
|
 |
NeddySeagoon Administrator


Joined: 05 Jul 2003 Posts: 55212 Location: 56N 3W
|
Posted: Thu Aug 17, 2023 4:53 pm Post subject: |
|
|
sublogic,
Your reboot will fail because grub will use root=UUID= on the kernel command line.
Mounting root by filesystem UUID requires the user space mount command, which in turn, forces the use of an initrd.
Grub needs to be coaxed to use root=PARTUUID=, then it should boot. Note that root=/dev/... is discouraged as it in not deterministic, unless you have exactly one drive.
I'll leave the how of that to others as I use syslinux. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
 |
stefan11111 l33t

Joined: 29 Jan 2023 Posts: 954 Location: Romania
|
Posted: Thu Aug 17, 2023 7:21 pm Post subject: |
|
|
NeddySeagoon wrote: | sublogic,
Your reboot will fail because grub will use root=UUID= on the kernel command line.
Mounting root by filesystem UUID requires the user space mount command, which in turn, forces the use of an initrd.
Grub needs to be coaxed to use root=PARTUUID=, then it should boot. Note that root=/dev/... is discouraged as it in not deterministic, unless you have exactly one drive.
I'll leave the how of that to others as I use syslinux. |
Here, grub-mkconfig does that by itself without any external config.
Does root=/dev/... actually work? How can it read from /dev before the rootfs has been mounted? _________________ My overlay: https://github.com/stefan11111/stefan_overlay
INSTALL_MASK="/etc/systemd /lib/systemd /usr/lib/systemd /usr/lib/modules-load.d *udev* /usr/lib/tmpfiles.d *tmpfiles* /var/lib/dbus /usr/bin/gdbus /lib/udev" |
|
Back to top |
|
 |
sublogic Guru


Joined: 21 Mar 2022 Posts: 331 Location: Pennsylvania, USA
|
Posted: Fri Aug 18, 2023 12:38 am Post subject: |
|
|
stefan11111 wrote: | ... Does root=/dev/... actually work? How can it read from /dev before the rootfs has been mounted? | (Drifting off-topic but OK) Huh? I never thought of that.
Aha. Solution in /usr/src/linux/init/do_mounts.c . Code is moving, with added comments, to /usr/src/linux/block/early-lookup.c .
(cornplayz256, keep us posted.) |
|
Back to top |
|
 |
sam_ Developer


Joined: 14 Aug 2020 Posts: 2307
|
|
Back to top |
|
 |
|