<?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 kernel)</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>Mon, 19 Jun 2023 15:32:03 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>Linux kernel USB errors -71 and -110</title>
    <link>https://daniel-lange.com/archives/183-Linux-kernel-USB-errors-71-and-110.html</link>
            <category>Linux</category>
    
    <comments>https://daniel-lange.com/archives/183-Linux-kernel-USB-errors-71-and-110.html#comments</comments>
    <wfw:comment>https://daniel-lange.com/wfwcomment.php?cid=183</wfw:comment>

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

    <author>nospam@example.com (Daniel Lange)</author>
    <content:encoded>
    &lt;p&gt;After an upgrade of my PC&#039;s mainboard BIOS the boot would take a minute or more to complete and sometimes the lightdm login screen would sit there but not accept keyboard input for another minute or so. Then the keyboard got enabled and I could log in normally. Everything worked fine after that bootup struggle completed. This was fully reproducible and persisted across reboots. Weird.&lt;/p&gt;

&lt;p&gt;The kernel &lt;code&gt;dmesg&lt;/code&gt; log showed entries that looked suspicious:&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:708 --&gt;&lt;img class=&quot;serendipity_image_center&quot; width=&quot;607&quot; height=&quot;373&quot;  src=&quot;https://daniel-lange.com/uploads/entries/230619_Linux_kernel_USB_errors_minus_71_and_minus_110.png&quot;  alt=&quot;dmesg log excerpt showing USB error messages&quot;&gt;&lt;/p&gt;

&lt;p&gt;Googleing these &lt;code&gt;error -110&lt;/code&gt; and &lt;code&gt;error -71&lt;/code&gt; is a bit hard. Now why the USB driver does not give useful error messages instead of archaic &lt;code&gt;errno&lt;/code&gt;-style numbers escapes me. This is not the 80s anymore.&lt;/p&gt;

&lt;p&gt;&lt;!-- s9ymdb:709 --&gt;&lt;img class=&quot;serendipity_image_right&quot; width=&quot;163&quot; height=&quot;176&quot;  src=&quot;https://daniel-lange.com/uploads/icons/citation_needed.png&quot; title=&quot;This is from https://xkcd.com/285/&quot; alt=&quot;Citation needed (Wikipedia style)&quot;&gt;
The wisdom of the crowd says &lt;code&gt;error -110&lt;/code&gt; is something around &quot;the USB port power supply was exceeded&quot; [&lt;a href=&quot;https://askubuntu.com/questions/644010/ubuntu-cant-read-my-usb-device-descriptor-read-64-error-110&quot;&gt;source&lt;/a&gt;].&lt;/p&gt;

&lt;p&gt;Now &lt;code&gt;lsusb -tv&lt;/code&gt; shows device 1-7 ... to be my USB keyboard. I somehow doubt that wants more power than the hub is willing to provide.&lt;/p&gt;

&lt;p&gt;The Archlinux BBS Forums recommend to &lt;a href=&quot;https://bbs.archlinux.org/viewtopic.php?id=149708&quot;&gt;piece together&lt;/a&gt; information from &lt;code&gt;drivers/usb/host/ohci.h&lt;/code&gt; and (updated from their piece which is from 2012) &lt;code&gt;/tools/include/uapi/asm-generic/errno.h&lt;/code&gt;. This is why some people then consider &lt;code&gt;-110&lt;/code&gt; to mean &quot;Connection timed out&quot;. Nah, not likely either.&lt;/p&gt;

&lt;p&gt;Reading through the kernel source around &lt;code&gt;drivers/usb/host&lt;/code&gt; did not enlighten me either. To the contrary. Uuugly. There seems to be no comprehensive list what these error codes mean. And the numbers are assigned to errors conditions quite arbitrarily. And - of course - there is no documentation. &lt;em&gt;&quot;It was hard to do, so it should be hard to understand as well.&quot;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Luckily some of the random musings I read through contained some curious advice: power cycle the host. So I did and that did not make the error go away. Other people insisted on removing cables out of wall sockets, unplugging everything and conducting esoteric rituals. That made it dawn on me, the mainboard of course nicely powers the USB in &quot;off&quot; state, too. So switching the power supply off (yes, these have a separate switch, go find yours), waiting a bit for capacitors to drain and switching things back on and ... the errors were gone, the system booted within seconds again.&lt;/p&gt;

&lt;p&gt;So the takeaway message: If you get random error messages like&lt;/p&gt;

&lt;div class=&quot;apache geshi&quot; style=&quot;text-align: left&quot;&gt;device descriptor read/&lt;span style=&quot;color: #ff0000;&quot;&gt;64&lt;/span&gt;, error -&lt;span style=&quot;color: #ff0000;&quot;&gt;110&lt;/span&gt;&lt;br /&gt;device not accepting address &lt;span style=&quot;color: #ff0000;&quot;&gt;42&lt;/span&gt;, error -&lt;span style=&quot;color: #ff0000;&quot;&gt;71&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;on devices that previously worked fine ... completely remove power from the host, the hubs and the USB devices. So they forget they saw each other on the bus before. And when they see each other after that blackout, they will happily go through negotiating protocol details with each other again successfully.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Mon, 19 Jun 2023 11:00:00 +0000</pubDate>
    <guid isPermaLink="false">https://daniel-lange.com/archives/183-guid.html</guid>
    <category>codes</category>
<category>error</category>
<category>hardware</category>
<category>kernel</category>
<category>linux</category>
<category>usb</category>

</item>
<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>
