From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1795946936; b=2hEfdZWcsYQMenL/M1sEIfBKpvlkh4hDzJdl2DpPS0ITdR9bw9UT9If8kesuYP0QrBXM 3FMPLGqLQS19h919sCopnCUPvb4gfrPq6nqML5Kqta8p+LbeFCis4ztHYBiCkdYZSR//S yt4sqi3WO0hvHmUOowYM5Zyv1xMYUxO2GpqXX1wZ5nLt0oViyRWG1IhGR6QabijBMx5Zu nHY+nq46DNvzrb5WRXaXipON/5XQd+Kx5cvdHLVb4JTzUhDhKp/P84KQ3KattjsB3X8PK c0jSqIEOiTOg4r+NupwIW3bA785QK7XKK4eizM2n+jBTx1Ran/RUsloo9hIdq5xngMA== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795946936; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID:X-Mailer: MIME-Version:Content-Type:Content-Transfer-Encoding; bh=bgOyslr1RF4eCQYjdzV3ZCuOmoCd4JO9nJIYfimxhcw=; b=5nVhICoF3jk30TBznrKPv+MoQeVXZX567Mq8CSlirB69bfgxJ34cHrDUbZWPWtzqbyJx K+evx9HnOxvrLD0prAcKtAc7stPi9xIk94GXBY+41n8nknxZS4lbLRebGtI6U9uF9Ao3d 52nbOrIo7vRxUq/nZUZUeJTAeTay7NwikSbWjpWb/5MFiN8biRiAKf1i/g6BkRG9yB0ev GH2QAko/rNgCNNU1bf4nJPzRyOjzlGpjxa6iNu3OQvSdrLYliZ7Z83kOu/oHKsBezJTP1 bRZBSmXtXl/EytrPRVCJJLO3aPGcU4Wi9d4eULgZeGozlqaAHDyE2bbjpGLY1FXBL3g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FoEYd7Pb; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4A3B7606A327; Sun, 29 Nov 2026 10:08:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=FoEYd7Pb Received: by smtp.kernel.org (Postfix) with ESMTPSA id C41C81F00939; Sun, 29 Nov 2026 10:08:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795946936; bh=bgOyslr1RF4eCQYjdzV3ZCuOmoCd4JO9nJIYfimxhcw=; h=From:To:Cc:Subject:Date; b=FoEYd7Pb146V0voJlw8OuLVM41tefuqrwziS6gSlIYohmuncxHL1ulRe2ySr5m4Hi Bcar0vQ2cFf8XKQPhlytmR6he+2wjxoPaEDX8pm386MnOeWwYJIP0tc0VndAn+l317 Ifzz5n9hKpPYc2fpC53OmDFY8u/NeGVUD2YTSMiMGXRcJIzbn+7wtGc5Ib5Gk6w2NA CfaapiICu/2T0relOtAxuUXkiWb/IIKq03RBNrHluqkeBRuyEW1YzhfT2EZbWgI9ky UjSu+6g+qkaxSN8gsCQomrt37ZHrkRdfkJS0hZlDTY9aH0aCzBk0bEy9cmLgZELdFZ mHwBXsPB5CNTA== From: "Masami Hiramatsu (Google)" To: snambakam@microsoft.com, Steven Rostedt , linux-trace-kernel@vger.kernel.org Cc: linux-kernel@vger.kernel.org, Jonathan Corbet , Shuah Khan , Randy Dunlap , Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Andrew Morton , Mathieu Desnoyers , linux-doc@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: [RFC PATCH v2 0/5] bootconfig: Support multiple named bootconfigs in initrd Date: Sun, 29 Nov 2026 18:50:47 +0900 Message-ID: <20261128011620.54399-1-mhiramat@kernel.org> X-Mailer: UndineD 0.1 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Hi, This RFC v2 series proposes support for bundling multiple named bootconfig files in a single initrd image and selecting which subset to load at boot time via the kernel command line. This work is based on our discussion at LPC 2026 on supporting multiple bootconfigs in single-image / signed Unified Kernel Image (UKI) setups. I would appreciate your feedback on the overall design, on-disk format, command-line semantics, and user-space CLI before finalizing this series. Changes in v2: - [1/5] Track each open brace's source position in open_brace_pos[] so an unclosed brace on a reopened key reports the offending config and offset instead of blaming the earlier config that defined the key. - [2/5] Fall back to index 0 in setup_boot_config() under CONFIG_BOOT_CONFIG_FORCE=y even when bootconfig= matches no entry, and document why bootconfig_cmdline_requested() forces early prepending only when no active selection is present. (This can be a discussion point. I think falling back to the default one is still safe enough.) - [3/5] Add a test case in test-bootconfig.sh for unclosed-brace error reporting on a reopened key. - [4/5] Preserve the guest SKIP reason string in host KTAP output in run_boottime_test.sh. Motivation ---------- Bootconfig currently allows only a single bootconfig block appended to an initrd. In single-image or signed UKI environments, it is often useful to ship a default production bootconfig alongside optional debug, tracing, or scenario-specific overlays in the same initrd image, and enable or combine them at boot without rebuilding or re-signing the image. Proposed Specification (Feedback Welcome) ----------------------------------------- 1. In-band naming ("#BOOTCONFIG-ID: "): Each named bootconfig carries an optional first-line comment "#BOOTCONFIG-ID: " (1..31 bytes matching [A-Za-z_][A-Za-z0-9_.-]*), keeping the existing 20-byte "#BOOTCONFIG" trailer format, size, and checksum framing unchanged for backward compatibility. 2. Stacked trailers & index 0 as default: Up to XBC_CONFIG_MAX (32) stacked bootconfig trailers can be attached to an initrd. Block 0 (the first block immediately after initramfs) is defined as the default bootconfig rather than the outermost trailer, so appending optional overlays never alters what bare "bootconfig" loads and places the default first in stack-order merging so overlays can override keys via ":=" or "+=". All valid trailers are always stripped from initrd_end so initramfs unpacking is unaffected. 3. Command-line selection ("bootconfig=[+][,...]"): Each may be a bootconfig ID, a 0-based index, or empty (index 0, e.g. "bootconfig=,debug"). A leading "+" appends to a prior selection (or to index 0 if none preceded it). Empty "bootconfig=" clears any prior selection (for example, to override a UKI .cmdline), unless CONFIG_BOOT_CONFIG_FORCE=y is set, which continues to force index 0 when no config ends up selected. Note that previously empty "bootconfig=" was equivalent to bare "bootconfig". CONFIG_CMDLINE_FROM_BOOTCONFIG on x86 is updated to follow the same selection rule. 4. User-space CLI ("tools/bootconfig -i "): Extends tools/bootconfig with "-i" across apply, delete, show, list, and cmdline rendering, with rollback safety on write failure and merge-conflict warnings against block 0. Five new QEMU boottime selftests are included to exercise the selection modes. Does this specification and command-line/tool interface look reasonable for your use cases? Any comments or suggestions are very welcome. Patch Overview -------------- 1. bootconfig: Add multi-config ID helpers and xbc_init_configs() support 2. bootconfig: Support stacked initrd bootconfigs and bootconfig= selection 3. tools/bootconfig: Support multiple named bootconfigs with -i option 4. selftests/ftrace: Add boottime tests for multiple bootconfig selection 5. Documentation: bootconfig: Document multiple bootconfigs and selection Thank you, Masami Hiramatsu (Google) (5): bootconfig: Add multi-config ID helpers and xbc_init_configs() support bootconfig: Support stacked initrd bootconfigs and bootconfig= selection tools/bootconfig: Support multiple named bootconfigs with -i option selftests/ftrace: Add boottime tests for multiple bootconfig selection Documentation: bootconfig: Document multiple bootconfigs and selection Documentation/admin-guide/bootconfig.rst | 82 +- .../admin-guide/kernel-parameters.txt | 10 + arch/x86/kernel/setup.c | 7 +- include/linux/bootconfig.h | 32 + init/main.c | 261 ++++-- lib/bootconfig.c | 490 +++++++++-- tools/bootconfig/include/linux/bootconfig.h | 4 + tools/bootconfig/main.c | 779 ++++++++++++++---- tools/bootconfig/test-bootconfig.sh | 128 +++ .../testing/selftests/ftrace/boottime/README | 4 +- .../bootconfigs/bconf-multi-01-default.bconf | 5 + .../bconf-multi-01-default.debug.bconf | 5 + .../bconf-multi-02-select.alt.bconf | 5 + .../bconf-multi-02-select.base.bconf | 7 + .../bconf-multi-02-select.dbg.bconf | 7 + .../bootconfigs/bconf-multi-03-append.bconf | 6 + .../bconf-multi-03-append.dbg.bconf | 6 + .../bootconfigs/bconf-multi-04-clear.bconf | 5 + .../bootconfigs/bconf-multi-05-conflict.bconf | 6 + .../ftrace/boottime/run_boottime_test.sh | 105 ++- .../boottime/tests/bconf-multi-01-default.sh | 23 + .../boottime/tests/bconf-multi-02-select.sh | 53 ++ .../boottime/tests/bconf-multi-03-append.sh | 26 + .../boottime/tests/bconf-multi-04-clear.sh | 26 + .../boottime/tests/bconf-multi-05-conflict.sh | 22 + 25 files changed, 1791 insertions(+), 313 deletions(-) create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-01-default.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-01-default.debug.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-02-select.alt.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-02-select.base.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-02-select.dbg.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-03-append.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-03-append.dbg.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-04-clear.bconf create mode 100644 tools/testing/selftests/ftrace/boottime/bootconfigs/bconf-multi-05-conflict.bconf create mode 100755 tools/testing/selftests/ftrace/boottime/tests/bconf-multi-01-default.sh create mode 100755 tools/testing/selftests/ftrace/boottime/tests/bconf-multi-02-select.sh create mode 100755 tools/testing/selftests/ftrace/boottime/tests/bconf-multi-03-append.sh create mode 100755 tools/testing/selftests/ftrace/boottime/tests/bconf-multi-04-clear.sh create mode 100755 tools/testing/selftests/ftrace/boottime/tests/bconf-multi-05-conflict.sh base-commit: 56bb11fe6aacc7666938e8e6765b44aa0cf1fcdd -- Masami Hiramatsu (Google)