diff --git a/stages/org.osbuild.bootc.install-to-filesystem b/stages/org.osbuild.bootc.install-to-filesystem index ace91ac8..2494b726 100755 --- a/stages/org.osbuild.bootc.install-to-filesystem +++ b/stages/org.osbuild.bootc.install-to-filesystem @@ -40,6 +40,13 @@ SCHEMA_2 = r""" "type": "string" } }, + "kernel-args": { + "description": "array of additional kernel arguments", + "type": "array", + "items": { + "type": "string" + } + } } }, "devices": { @@ -70,6 +77,9 @@ def main(options, inputs, paths): tmpf.write(key.encode("utf8") + b"\n") tmpf.flush() pargs.extend(["--root-ssh-authorized-keys", tmpf.name]) + # customize kernel-args + for karg in options.get("kernel-args", []): + pargs.extend(["--karg", karg]) # add target and go pargs.append(dst) subprocess.run(pargs, check=True) diff --git a/stages/test/test_bootc_install_to_fs.py b/stages/test/test_bootc_install_to_fs.py index cd9db887..be9c48aa 100644 --- a/stages/test/test_bootc_install_to_fs.py +++ b/stages/test/test_bootc_install_to_fs.py @@ -43,9 +43,20 @@ FAKE_INPUTS = { @pytest.mark.parametrize("options,expected_args", [ ({}, []), + # root-ssh ({"root-ssh-authorized-keys": []}, []), ({"root-ssh-authorized-keys": ["ssh-key"]}, ["--root-ssh-authorized-keys", "/tmp/fake-named-tmpfile-name"]), ({"root-ssh-authorized-keys": ["key1", "key2"]}, ["--root-ssh-authorized-keys", "/tmp/fake-named-tmpfile-name"]), + # kernel args + ({"kernel-args": []}, []), + ({"kernel-args": ["console=ttyS0"]}, ["--karg", "console=ttyS0"]), + ({"kernel-args": ["arg1", "arg2"]}, ["--karg", "arg1", "--karg", "arg2"]), + # all + ({"root-ssh-authorized-keys": ["key1", "key2"], + "kernel-args": ["arg1", "arg2"]}, + ["--root-ssh-authorized-keys", "/tmp/fake-named-tmpfile-name", + "--karg", "arg1", "--karg", "arg2"], + ), ]) @patch("subprocess.run") def test_bootc_install_to_fs(mock_run, mocked_named_tmp, mocked_temp_dir, stage_module, options, expected_args): # pylint: disable=unused-argument