| Commit message (Collapse) | Author | Age | Lines |
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
diff_kernel relies on the existence of the /boot/config-{kernel} file
which is usually installed by the install-kernel script. This file may
be missing on systems with a custom install workflow or EFI systems that
use the systemd install_kernel functionality. The latter installs the
EFI stub kernel only, no auxiliary files of any kind. Comparisons
against the /boot/config-{kernel} file therefore fail on such systems.
This commit attempts to support a wider range of install workflows by
extracting the config from /proc/config.gz instead. Regardless of how
the kernel is installed, this particular file should exist as long as
CONFIG_IKCONFIG is enabled in the running kernel.
A word about "running config": The way that phrase was used previous to
this commit is technically inaccurate, since the "running config" could
change by installing a kernel and replacing the config file under /boot.
Now we *always* refer to the configuration saved within the currently
running kernel.
|
|
|
|
|
|
|
|
|
|
| |
Some commands need to be launched inside the kernel source directory.
Even though the manual points this out, users may not know or forget.
Make sure to refuse working on a non-kernel directory: this will point
users in the right direction and avoid doing unnecessary work.
To detect a kernel source tree, check for existence of the 'Kbuild' and
'Kconfig' files.
|
| |
|
|
|
|
|
|
| |
In test_diff() we are duplicating the sed invocation that strips config
files of anything irrelevant. Move that part of the functionality into
its own function.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Commit 1b8d91f ("Use configuration file under /boot instead of
/proc/config.gz") enables us to drop neovim as a dependency, since we
can now access all configuration data through actual files.
Use git-diff(1) (which has automatic paging & colours) if available to
show the changes between kernel configurations, else fall back to
diff(1).
Since the exit code of diff utilities is >0 if inputs are different,
ignore the exit code of the diff utility in test_diff() to continue like
normal.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
kern(1) has been using /proc/config.gz as the source of the currently
running kernel's config since its initial commit. Whilst this location
is convenient because of its static nature, it does need a specific
kernel option, IKCONFIG_PROC, to be set.
Furthermore, it introduces a dependency on gzip(1) to decompress the
file on the fly. Consequently, we need to stream gzip's output to
commands or save it in a temporary file to access it neatly.
Since Gentoo's default install script for the kernel, installkernel(8),
places each kernel's configuration file in /boot, we can use this
location to retrieve the currently running kernel's configuration
instead and work around all of the above limitations.
Of course we need to make sure that /boot is mounted before we try
accessing any configuration files on there. We use the already existing
code from install_kernel() for that.
|
|
|
|
|
|
| |
kern(1) is supposed to be used on Gentoo Linux, and the canonical
location for kernels is /usr/src. Until there is an actual need to have
the user override this location, remove SRCDIR and inline its contents.
|
|
|
|
|
|
| |
get_selected_kernel uses eselect(1) to retrieve the currently selected
kernel. Since the eselect tool itself does nothing other than invoke
readlink(1) on /usr/src/linux, use that instead.
|
|
|
|
|
|
|
|
| |
In a similar vein to commit 5f83bed ("Use consistent and explicit
terminology in set_kernel()"), the term "current" kernel is ambiguous
here. An upcoming commit will introduce the concept of the "running
config", which is the kernel configuration the currently running kernel
uses. To reduce any ambiguity, use "selected" instead of "current".
|
|
|
|
|
| |
Use a more succinct and clear style in two places by converting if
commands into simple OR lists.
|
|
|
|
|
| |
Since fragment merging will fail if the base template does not exist,
make sure to mention it in the manual.
|
|
|
|
|
|
| |
It was really never a good idea to make this a fatal error, especially
considering consecutive calls of kern(1) without any arguments will fail
after the kernel has been set successfully once.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously we recorded the return value of the sed ... | diff pipeline
into a variable and later used it to test whether the command returned
successfully or not. Since we enable errexit, this meant that the diff
command failing would terminate the execution of the whole script.
We are unsure how this was not caught earlier as the script has been in
use for quite a while now - it is possible that bash 5.0 shows different
behaviour here. It is our understanding that bash's current behaviour is
correct, however.
Instead of using a variable to store the return value, put the whole
pipeline into an if clause, and react to its success or failure there.
Whilst this does remove our ability to indicate diff's actual return
value, it makes this test simpler and more straightforward.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
With the introduction of the manuals, we realized that the term "active
kernel" is ambiguous. It might refer to both the currently selected
kernel in eselect and the kernel the system is running on at the moment.
Use "selected" instead of "active" to make this more explicit and line
it up with the usage in the manual.
|
| |
|
|
|
|
|
| |
Since the script uses the `set -e' option, chaining together commands
with && will fully negate its effects.
|
| |
|
|
|
|
|
|
|
| |
This commit adds code to check whether /boot is mounted or not, and will
skip the mount command if the path is already mounted. This will fix an
issue where the script exited prematurely if /boot was already present,
as the mount command failed and we use `set -e'.
|
|
|
|
|
|
| |
For differences in config files that can safely be ignored, introduce
the possibility of continuing with the build and install instead of
exiting unconditionally.
|
|
|
|
|
|
|
| |
If the user removes the old kernel sources whilst still having the
symlink point to the kernel directory, eselect will issue a warning
about an invalid kernel target. For the purposes of kern, we can safely
ignore this warning.
|
|
|