View previous topic :: View next topic |
Author |
Message |
james.h.bates n00b
Joined: 11 Jul 2013 Posts: 12
|
Posted: Thu Jan 14, 2021 9:01 pm Post subject: sys-kernel/gentoo-kernel automatically call grub-mkconfig ? |
|
|
I used fulldisk encryption and LVM, an appropriate initramfs image I build with dracut, grub to boot, and a heavily customized kernel config. I used to use sys-kernel/gentoo-sources, which meant manually running make oldconfig & make in the kernel src tree, installing manually, calling dracut manually, and calling grub-mkconfig manually.
Recently (yesterday) I discovered sys-kernel/gentoo-kernel, which actually does 99% of this for me. Using savedconfig I can still use my custom kernel config, and I've setup a /etc/dracut.conf such that the initramfs image is built as I want it, automatically. All working great.
The only thing missing, is to call grub-mkconfig -o /boot/grub/grub.cfg at the end, to add the newly installed kernel & initramfs to my boot menu. Is there someway, I can have that happen automatically when sys-kernel/gentoo-kernel is updated? If so, my kernel upgrades would be 100% automatic upon emerge -u @world, which would be brilliant...
Any help would be appreciated |
|
Back to top |
|
|
DespLock n00b
Joined: 27 Jul 2020 Posts: 65
|
Posted: Thu Jan 14, 2021 9:21 pm Post subject: |
|
|
Easiest thing would be to wrap your emerge in a shell script and add the grub command at last. Like update.sh
Code: |
#!/bin/bash
[...]
emerge --sync
emerge -u @world
[...]
grub-mkconfig -o /boot/grub/grub.cfg
|
This would run grub command after each emerge, but that seems to be a non-issue to me. |
|
Back to top |
|
|
Ionen Developer
Joined: 06 Dec 2018 Posts: 2889
|
Posted: Thu Jan 14, 2021 9:31 pm Post subject: |
|
|
gentoo-kernel first merges the (stripped) sources alongside the kernel in /usr/src/, then in pkg_postinst() it'll call /sbin/installkernel (default provided by installkernel-gentoo) to copy the kernel to /boot, roughly the same `make install` would do.
This installkernel script itself runs any executable scripts in /etc/kernel/postinst.d/* with $1 being kernel version, and $2 path to the kernel.
These scripts can be used for whatever needed, grub setup, efi stub installs, cleaning or backing up old kernels/modules, etc... With a little work most things can be automated if not a too exotic setup, and with the new USE=dist-kernel even third party modules get rebuilt without user workarounds now (albeit need portage >=3.0.13 to solve a portage bug when multiple modules). |
|
Back to top |
|
|
james.h.bates n00b
Joined: 11 Jul 2013 Posts: 12
|
Posted: Fri Jan 15, 2021 9:12 am Post subject: |
|
|
Ionen wrote: | gentoo-kernel first merges the (stripped) sources alongside the kernel in /usr/src/, then in pkg_postinst() it'll call /sbin/installkernel (default provided by installkernel-gentoo) to copy the kernel to /boot, roughly the same `make install` would do.
This installkernel script itself runs any executable scripts in /etc/kernel/postinst.d/* with $1 being kernel version, and $2 path to the kernel.
These scripts can be used for whatever needed, grub setup, efi stub installs, cleaning or backing up old kernels/modules, etc... With a little work most things can be automated if not a too exotic setup, and with the new USE=dist-kernel even third party modules get rebuilt without user workarounds now (albeit need portage >=3.0.13 to solve a portage bug when multiple modules). |
Perfect; works great! |
|
Back to top |
|
|
|
|
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
|
|