From eb25844f8327a83ae5e7b4a35c6fc0289187503f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Tue, 26 Sep 2023 21:54:18 +0200 Subject: [PATCH 1/2] kernel-install: describe usage as installkernel For us, this is a compatibility mode, but most likely it is there to stay: the kernel Makefile's install target expects to be able to call /bin/installkernel. We want people who build their own kernels to use this, so that they use kernel-install and get support for all the functionality provided by it, including building of UKIs and other new features. So let's actually advertise that this exists and works. --- man/kernel-install.xml | 21 ++++++++++++++++++++- src/kernel-install/kernel-install.c | 16 +++++++++++----- 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/man/kernel-install.xml b/man/kernel-install.xml index 0bf3dfd5596..ddcc2184ac4 100644 --- a/man/kernel-install.xml +++ b/man/kernel-install.xml @@ -185,10 +185,29 @@ - + + Compatibility with the kernel build system + + + installkernel + OPTIONS + VERSION + VMLINUZ + MAP + INSTALLATION-DIR + + + When invoked as installkernel, this program accepts arguments as specified by + the kernel build system's make install command. The VERSION and + VMLINUZ parameters specify the kernel version and the kernel binary. The other two + parameters (MAP and INSTALLATION-DIR) are currently + ignored. + + + The <varname>$BOOT</varname> partition diff --git a/src/kernel-install/kernel-install.c b/src/kernel-install/kernel-install.c index abd6e2fdce1..b72e2ac79a0 100644 --- a/src/kernel-install/kernel-install.c +++ b/src/kernel-install/kernel-install.c @@ -1127,10 +1127,11 @@ static int help(void) { printf("%1$s [OPTIONS...] COMMAND ...\n\n" "%2$sAdd and remove kernel and initrd images to and from /boot%3$s\n" "\nUsage:\n" - " %1$s [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]\n" - " %1$s [OPTIONS...] remove KERNEL-VERSION\n" - " %1$s [OPTIONS...] inspect [KERNEL-IMAGE]\n" - "\nOptions:\n" + " kernel-install [OPTIONS...] add KERNEL-VERSION KERNEL-IMAGE [INITRD-FILE...]\n" + " kernel-install [OPTIONS...] remove KERNEL-VERSION\n" + " kernel-install [OPTIONS...] inspect [KERNEL-IMAGE]\n" + "\n" + "Options:\n" " -h --help Show this help\n" " --version Show package version\n" " -v --verbose Increase verbosity\n" @@ -1140,7 +1141,12 @@ static int help(void) { " Create $BOOT/ENTRY-TOKEN/ directory\n" " --entry-token=machine-id|os-id|os-image-id|auto|literal:…\n" " Entry token to use for this installation\n" - "\nSee the %4$s for details.\n", + "\n" + "This program may also be invoked as 'installkernel':\n" + " installkernel [OPTIONS...] VERSION VMLINUZ [MAP] [INSTALLATION-DIR]\n" + "(The optional arguments are passed by kernel build system, but ignored.)\n" + "\n" + "See the %4$s for details.\n", program_invocation_short_name, ansi_highlight(), ansi_normal(), From 9ec4f7c7a4f4d56de6d00adbfe5d316edd0ec314 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Wed, 27 Sep 2023 09:55:57 +0200 Subject: [PATCH 2/2] exec-util: print executed commands in do_execute() kernel-install uses do_execute(). We would log whenever a spawned child finished, but we would not log anything when the child is launched. When the children log output without a prefix (as the kernel-install plugins do), it is hard to see where that output is coming from. --- src/shared/exec-util.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/shared/exec-util.c b/src/shared/exec-util.c index 735334719ba..5da613bc17c 100644 --- a/src/shared/exec-util.c +++ b/src/shared/exec-util.c @@ -12,6 +12,7 @@ #include "env-file.h" #include "env-util.h" #include "errno-util.h" +#include "escape.h" #include "exec-util.h" #include "fd-util.h" #include "fileio.h" @@ -138,6 +139,14 @@ static int do_execute( return log_error_errno(fd, "Failed to open serialization file: %m"); } + if (DEBUG_LOGGING) { + _cleanup_free_ char *args = NULL; + if (argv) + args = quote_command_line(strv_skip(argv, 1), SHELL_ESCAPE_EMPTY); + + log_debug("About to execute %s%s%s", t, argv ? " " : "", argv ? strnull(args) : ""); + } + r = do_spawn(t, argv, fd, &pid, FLAGS_SET(flags, EXEC_DIR_SET_SYSTEMD_EXEC_PID)); if (r <= 0) continue;