@@ -276,6 +276,10 @@ Preparations: set up everything to build your own kernels
276276
277277The following steps lay the groundwork for all further tasks.
278278
279+ Note: the instructions assume you are building and testing on the same
280+ machine; if you want to compile the kernel on another system, check
281+ :ref: `Build kernels on a different machine <buildhost_bis >` below.
282+
279283.. _backup_bissbs :
280284
281285* Create a fresh backup and put system repair and restore tools at hand, just
@@ -2103,11 +2107,77 @@ problems will arise if the kernelrelease identifier exceeds 63 characters.
21032107[:ref: `back to step-by-step guide <introoptional_bissbs >`].
21042108
21052109
2106- Additional reading material
2107- ===========================
2110+ Additional information
2111+ ======================
2112+
2113+ .. _buildhost_bis :
2114+
2115+ Build kernels on a different machine
2116+ ------------------------------------
2117+
2118+ To compile kernels on another system, slightly alter the step-by-step guide's
2119+ instructions:
2120+
2121+ * Start following the guide on the machine where you want to install and test
2122+ the kernels later.
2123+
2124+ * After executing ':ref: `Boot into the working kernel and briefly use the
2125+ apparently broken feature <bootworking_bissbs>`', save the list of loaded
2126+ modules to a file using ``lsmod > ~/test-machine-lsmod ``. Then locate the
2127+ build configuration for the running kernel (see ':ref: `Start defining the
2128+ build configuration for your kernel <oldconfig_bisref>`' for hints on where
2129+ to find it) and store it as '~/test-machine-config-working'. Transfer both
2130+ files to the home directory of your build host.
2131+
2132+ * Continue the guide on the build host (e.g. with ':ref: `Ensure to have enough
2133+ free space for building [...] <diskspace_bissbs>`').
2134+
2135+ * When you reach ':ref: `Start preparing a kernel build configuration[...]
2136+ <oldconfig_bissbs>`': before running ``make olddefconfig `` for the first time,
2137+ execute the following command to base your configuration on the one from the
2138+ test machine's 'working' kernel::
2139+
2140+ cp ~/test-machine-config-working ~/linux/.config
2141+
2142+ * During the next step to ':ref: `disable any apparently superfluous kernel
2143+ modules <localmodconfig_bissbs>`' use the following command instead::
2144+
2145+ yes '' | make localmodconfig LSMOD=~/lsmod_foo-machine localmodconfig
2146+
2147+ * Continue the guide, but ignore the instructions outlining how to compile,
2148+ install, and reboot into a kernel every time they come up. Instead build
2149+ like this::
21082150
2109- Further sources
2110- ---------------
2151+ cp ~/kernel-config-working .config
2152+ make olddefconfig &&
2153+ make -j $(nproc --all) targz-pkg
2154+
2155+ This will generate a gzipped tar file whose name is printed in the last
2156+ line shown; for example, a kernel with the kernelrelease identifier
2157+ '6.0.0-rc1-local-g928a87efa423' built for x86 machines usually will
2158+ be stored as '~/linux/linux-6.0.0-rc1-local-g928a87efa423-x86.tar.gz'.
2159+
2160+ Copy that file to your test machine's home directory.
2161+
2162+ * Switch to the test machine to check if you have enough space to hold another
2163+ kernel. Then extract the file you transferred::
2164+
2165+ sudo tar -xvzf ~/linux-6.0.0-rc1-local-g928a87efa423-x86.tar.gz -C /
2166+
2167+ Afterwards :ref: `generate the initramfs and add the kernel to your boot
2168+ loader's configuration <install_bisref>`; on some distributions the following
2169+ command will take care of both these tasks::
2170+
2171+ sudo /sbin/installkernel 6.0.0-rc1-local-g928a87efa423 /boot/vmlinuz-6.0.0-rc1-local-g928a87efa423
2172+
2173+ Now reboot and ensure you started the intended kernel.
2174+
2175+ This approach even works when building for another architecture: just install
2176+ cross-compilers and add the appropriate parameters to every invocation of make
2177+ (e.g. ``make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- [...] ``).
2178+
2179+ Additional reading material
2180+ ---------------------------
21112181
21122182* The `man page for 'git bisect' <https://git-scm.com/docs/git-bisect >`_ and
21132183 `fighting regressions with 'git bisect' <https://git-scm.com/docs/git-bisect-lk2009.html >`_
0 commit comments