<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   >
<channel>
    
    <title>Daniel Lange's blog (Entries tagged as emerge)</title>
    <link>https://daniel-lange.com/</link>
    <description>agrep -pB IT /dev/life</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 2.6-alpha1 - http://www.s9y.org/</generator>
    <pubDate>Fri, 02 May 2025 17:41:55 GMT</pubDate>

    <image>
    <url>//daniel-lange.com/uploads/Avatar_Blog_144_234.png</url>
    <title>RSS: Daniel Lange's blog - agrep -pB IT /dev/life</title>
    <link>https://daniel-lange.com/</link>
    <width>144</width>
    <height>234</height>
</image>

<item>
    <title>Compiling and installing the Gentoo Linux kernel on emerge without genkernel (part 2)</title>
    <link>https://daniel-lange.com/archives/170-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-2.html</link>
            <category>Gentoo</category>
    
    <comments>https://daniel-lange.com/archives/170-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-2.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=170</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=170</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;The first install of a Gentoo kernel needs to be somewhat manual if you want to optimize the kernel for the (virtual) system it boots on.&lt;/p&gt;

&lt;p&gt;In &lt;a href=&quot;https://daniel-lange.com/archives/169-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-1.html&quot;&gt;part 1&lt;/a&gt; I laid out how to improve the subsequent emerges of &lt;code&gt;sys-kernel/gentoo-sources&lt;/code&gt; with a small drop in script to build the kernel as part of the ebuild.&lt;/p&gt;

&lt;p&gt;Since end of last year Gentoo also supports &lt;a href=&quot;https://wiki.gentoo.org/wiki/Project:Distribution_Kernel&quot;&gt;a less manual way&lt;/a&gt; of emerging a kernel:&lt;/p&gt;

&lt;p&gt;The following kernel blends are available:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;sys-kernel/gentoo-kernel (the Gentoo kernel you can configure and compile locally - typically this is what you want if you run Gentoo)&lt;/li&gt;
&lt;li&gt;sys-kernel/gentoo-kernel-bin (a pre-compiled Gentoo kernel similar to what genkernel would get you)&lt;/li&gt;
&lt;li&gt;sys-kernel/vanilla-kernel (the upstream Linux kernel, again configurable and locally compiled)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So a quick walk-through for the &lt;code&gt;gentoo-kernel&lt;/code&gt; variant:&lt;/p&gt;

&lt;h2&gt;1. Set up the correct package USE flags&lt;/h2&gt;

&lt;p&gt;We do not want an initrd and we want our own config to be re-used so:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sys-kernel/gentoo-kernel -initramfs savedconfig&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;portage&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;package.use&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gentoo-kernel&lt;/div&gt;

&lt;h2&gt;2. Preseed the saved config&lt;/h2&gt;

&lt;p&gt;The current kernel config needs to be saved as the initial &lt;code&gt;savedconfig&lt;/code&gt; so it is found and applied for our emerge below:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;mkdir&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-p&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;portage&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;savedconfig&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sys-kernel&lt;br /&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/usr/src/linux-&lt;span style=&quot;color: #007800;&quot;&gt;$(uname -r)&lt;/span&gt;/.config&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;portage&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;savedconfig&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sys-kernel&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gentoo-kernel&lt;/div&gt;

&lt;h2&gt;3. Emerge the new kernel&lt;/h2&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;emerge sys-kernel&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gentoo-kernel&lt;/div&gt;

&lt;h2&gt;4. Update grub and reboot&lt;/h2&gt;

&lt;p&gt;Unfortunately this ebuild does not update grub, so we have to run &lt;code&gt;grub-mkconfig&lt;/code&gt; manually. This can again be automated via a  &lt;code&gt;post_pkg_postinst()&lt;/code&gt; script. See the step 7 below.&lt;/p&gt;

&lt;p&gt;But for now, let&#039;s do it manually:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;grub-mkconfig &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;boot&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub.cfg&lt;br /&gt;&lt;span style=&quot;color: #666666; font-style: italic;&quot;&gt;# All fine? Time to reboot the machine:&lt;/span&gt;&lt;br /&gt;reboot&lt;/div&gt;

&lt;h2&gt;5. (Optional) Prepare for the next kernel build&lt;/h2&gt;

&lt;p&gt;Run &lt;code&gt;etc-update&lt;/code&gt; and merge the new kernel config entries into your &lt;code&gt;savedconfig&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:674 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;717&quot; height=&quot;380&quot;  src=&quot;https://daniel-lange.com/uploads/entries/gentoo_sys-kernel_etc-update.png&quot;  alt=&quot;Screenshot of etc-update&quot;&gt;&lt;/p&gt;

&lt;p&gt;The kernel should auto-build once new versions become available via portage.&lt;/p&gt;

&lt;p&gt;Again the &lt;code&gt;etc-update&lt;/code&gt; can be automated if you feel that is sufficiently safe to do in your environment. See step 7 below for details.&lt;/p&gt;

&lt;h2&gt;6. (Optional) Remove the old kernel sources&lt;/h2&gt;

&lt;p&gt;If you want to switch from the method based on &lt;code&gt;gentoo-sources&lt;/code&gt; to the &lt;code&gt;gentoo-kernel&lt;/code&gt; one, you can remove the kernel sources:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;emerge &lt;span style=&quot;color: #660033;&quot;&gt;-C&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;=sys-kernel/gentoo-sources-5*&amp;quot;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;Be sure to update the &lt;code&gt;/usr/src/linux&lt;/code&gt; symlink to the new kernel sources directory from &lt;code&gt;gentoo-kernel&lt;/code&gt;, e.g.:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;rm&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;src&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;linux; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;ln&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-s&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;/usr/src/&lt;span style=&quot;color: #007800;&quot;&gt;$(uname -r)&lt;/span&gt;&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;usr&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;src&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;linux&lt;/div&gt;

&lt;p&gt;This may be a good time for a bit more house-keeping: Clean up a bit in &lt;code&gt;/usr/src/&lt;/code&gt; to remove old build artefacts, &lt;code&gt;/boot/&lt;/code&gt; to remove old kernels and &lt;code&gt;/lib/modules/&lt;/code&gt; to get rid of old kernel modules.&lt;/p&gt;

&lt;h2&gt;7. (Optional) Further automate the ebuild&lt;/h2&gt;

&lt;p&gt;In &lt;a href=&quot;https://daniel-lange.com/archives/169-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-1.html&quot;&gt;part 1&lt;/a&gt; we automated the kernel compile, install and a bit more via a helper function for &lt;code&gt;post_pkg_postinst()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;We can do the similarly for what is (currently) missing from the &lt;code&gt;gentoo-kernel&lt;/code&gt; ebuilds:&lt;/p&gt;

&lt;p&gt;Create &lt;code&gt;/etc/portage/env/sys-kernel/gentoo-kernel&lt;/code&gt; with the following:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;post_pkg_postinst&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; etc-update &lt;span style=&quot;color: #660033;&quot;&gt;--automode&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-5&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;portage&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;savedconfig&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;sys-kernel&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; grub-mkconfig &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;boot&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub.cfg&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;The upside of &lt;code&gt;gentoo-kernel&lt;/code&gt; over &lt;code&gt;gentoo-sources&lt;/code&gt; is that you can put &quot;config override files&quot; in &lt;code&gt;/etc/kernel/config.d/&lt;/code&gt;. That way you theoretically profit from config improvements made by the upstream developers. See the &lt;a href=&quot;https://wiki.gentoo.org/wiki/Project:Distribution_Kernel&quot;&gt;Gentoo distribution kernel documentation&lt;/a&gt; for a sample snippet. I am fine with &lt;code&gt;savedconfig&lt;/code&gt; for now but it is nice that Gentoo provides the flexibility to support both approaches.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Wed, 03 Feb 2021 12:52:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/170-guid.html</guid>
    <category>emerge</category>
<category>kernel</category>
<category>postinst</category>

</item>
<item>
    <title>Compiling and installing the Gentoo Linux kernel on emerge without genkernel (part 1)</title>
    <link>https://daniel-lange.com/archives/169-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-1.html</link>
            <category>Gentoo</category>
    
    <comments>https://daniel-lange.com/archives/169-Compiling-and-installing-the-Gentoo-Linux-kernel-on-emerge-without-genkernel-part-1.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=169</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>https://daniel-lange.com/rss.php?version=2.0&amp;type=comments&amp;cid=169</wfw:commentRss>
    

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;Gentoo emerges of &lt;code&gt;sys-kernel/gentoo-sources&lt;/code&gt; will nicely install the current kernel into &lt;code&gt;/usr/src/linux-*&lt;/code&gt; but it will not compile them.&lt;/p&gt;

&lt;p&gt;The Gentoo wiki kernel documentation has a &lt;a href=&quot;https://wiki.gentoo.org/wiki/Kernel/Upgrade#Automated_build_and_installation&quot;&gt;script snippet&lt;/a&gt; to automate the kernel build with &lt;code&gt;genkernel&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I do not like to use &lt;code&gt;genkernel&lt;/code&gt; as it brings in lots of firmware files to build initrds that are not needed on virtual hardware. It also makes building the kernel slower.&lt;/p&gt;

&lt;p&gt;So, the plain approach:&lt;/p&gt;

&lt;p&gt;Make &lt;code&gt;emerge sys-kernel/gentoo-sources&lt;/code&gt; symlink the latest kernel to
&lt;code&gt;/usr/src/linux&lt;/code&gt; so we can find it easily:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;echo&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;sys-kernel/gentoo-sources symlink&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;etc&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;portage&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;package.use&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;gentoo-sources&lt;/div&gt;

&lt;p&gt;Create &lt;code&gt;/etc/portage/env/sys-kernel/gentoo-sources&lt;/code&gt; with the following:&lt;/p&gt;

&lt;div class=&quot;bash geshi&quot; style=&quot;text-align: left&quot;&gt;post_pkg_postinst&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#123;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #007800;&quot;&gt;CURRENT_KV&lt;/span&gt;=$&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#40;&lt;/span&gt;&lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;uname&lt;/span&gt; -r&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#41;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;unset&lt;/span&gt; ARCH&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;if&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#91;&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-f&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;${EROOT:-/}&lt;/span&gt;usr/src/linux-&lt;span style=&quot;color: #007800;&quot;&gt;${CURRENT_KV}&lt;/span&gt;/.config&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#93;&lt;/span&gt; ; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;then&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;cp&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-n&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;${EROOT:-/}&lt;/span&gt;usr/src/linux-&lt;span style=&quot;color: #007800;&quot;&gt;${CURRENT_KV}&lt;/span&gt;/.config&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;${EROOT:-/}&lt;/span&gt;usr/src/linux/.config&amp;quot;&lt;/span&gt;&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;cd&lt;/span&gt; &lt;span style=&quot;color: #ff0000;&quot;&gt;&amp;quot;&lt;span style=&quot;color: #007800;&quot;&gt;${EROOT:-/}&lt;/span&gt;usr/src/linux/&amp;quot;&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; olddefconfig &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #660033;&quot;&gt;-j5&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; modules_install &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;make&lt;/span&gt; &lt;span style=&quot;color: #c20cb9; font-weight: bold;&quot;&gt;install&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;&amp;amp;&amp;amp;&lt;/span&gt; \&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; &amp;#160; grub-mkconfig &lt;span style=&quot;color: #660033;&quot;&gt;-o&lt;/span&gt; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;boot&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub&lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;/&lt;/span&gt;grub.cfg&lt;br /&gt;&amp;#160; &amp;#160; &amp;#160; &amp;#160; &lt;span style=&quot;color: #000000; font-weight: bold;&quot;&gt;fi&lt;/span&gt;&lt;br /&gt;&lt;span style=&quot;color: #7a0874; font-weight: bold;&quot;&gt;&amp;#125;&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;This will compile the next kernel on the basis of the config of the currently running kernel, install the modules and the kernel bzImage and update grub so it knows about the new kernel for the next reboot.&lt;/p&gt;

&lt;p&gt;If you forget to unset &lt;code&gt;ARCH&lt;/code&gt; the Linux build system will complain like:&lt;/p&gt;

&lt;pre&gt;
Makefile:583: arch/amd64/Makefile: No such file or directory
make: *** No rule to make target &#039;arch/amd64/Makefile&#039;.  Stop.
&lt;/pre&gt;

&lt;p&gt;You can test the new magic by re-emerging the latest kernel, e.g. currently
&lt;code&gt;emerge =sys-kernel/gentoo-sources-5.4.80-r1&lt;/code&gt;:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:673 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;975&quot; height=&quot;1064&quot;  src=&quot;https://daniel-lange.com/uploads/entries/gentoo_kernel_compile_in_emerge.png&quot; title=&quot;Gentoo emerge with embedded kernel compile&quot; alt=&quot;&quot;&gt;&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 28 Jan 2021 09:45:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/169-guid.html</guid>
    <category>emerge</category>
<category>kernel</category>
<category>postinst</category>

</item>

</channel>
</rss>
