From nobody Tue Mar 14 02:46:51 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4PbHwr0lHQz3xYLp; Tue, 14 Mar 2023 02:46:52 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4PbHwq700sz3y7m; Tue, 14 Mar 2023 02:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678762012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fvIKPYcXpA2Lg4jaOKo48VTxlNqKYh9mPiTkcs8PGWI=; b=ozvkHIl3q5pYnHQuxEtm51Qs5UaKTOQyOYrelpRhZXngRhhaK2Ej3eYAdVVjLcydUP3ga3 QXKPkYuwM2rSfKOXv7H8SlysPG6vvWrQ7Gny7c1D60fHYgoorWFvKYJWWjsysxcXiQKHz2 RTx9KUxgCrQ88RPRfFAPewAXzNjWhTd2bSP6eGLrV3A+5kik4WU4cKb3PsyKcG7AXWcLj7 H/3fmSJ6kj+NamG2CZK3TDAHni+0kFXPHh74kXqU8w3aDhv6Efy7YR6IuBzjmoavnbJr4A k4sEesnKV+wf8ieUa5nkREch16tcmohJuvwlcxEYIOXl095dCEirPyaXmbvd/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1678762012; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=fvIKPYcXpA2Lg4jaOKo48VTxlNqKYh9mPiTkcs8PGWI=; b=jEn75YO2NtoDR5mJrdPc2ElNMbAC3E5d+exRLySVGMFnVFWdnGue9icnId7qaRC9myg1Hv sCpMQUcnlnaFW6sUWRACcHgSzoLDPqt634PdKz3q0xNpRfDN+gyiAGnwFfXQLhuX7rAJDO x+pBfm8ReHBkpKWkb3Sd1bHTHA9emTeawu7C6LNraQiKUn84htzRD/XBtrhn85r3BaeI94 uj2k5Msh0vvaMmihKoPQOjVD19NoL/3KTznUqsKq1OIADeL67ryRb/IkwUEZRmvi2txtUe gln3Ufl4w0zYJfXtmd0/vhzXAfJD57SQCjhMOCSfhiceqf0kjTE8DEtPp1VGUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1678762012; a=rsa-sha256; cv=none; b=hxH06J2QPq99IuUja4x5GXpktk5EzSOEomxM2ReRYzZuntkBfdWNW4l7z+gRZ+joVSgb4h 7o309C2JzZ9TtsMtBP6hML7DKL2usgEYZOzbDXoE7fBgslo6vqwK7oCSIqRXw//ijB07nS RKRji2YTjh7pX+O7gSaW3d1dLejoyO28v1tj6e6nDGcmR8B416Yr39CtybZsVUPk4dASMV fnAJZFbM+f9Q26yfTdk+zRei9MfLbudbtGIU7YQBBu9B5HP7VA2fBS54kTf3KEJsmnrhGH sdYCft/sBbdisPG+bsHUS1WSBdyzaLbXYll75F5RQmACnq0TjekzZW/dt8TzpA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4PbHwq5xSdzJZH; Tue, 14 Mar 2023 02:46:51 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 32E2kpBF008994; Tue, 14 Mar 2023 02:46:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 32E2kpJ4008993; Tue, 14 Mar 2023 02:46:51 GMT (envelope-from git) Date: Tue, 14 Mar 2023 02:46:51 GMT Message-Id: <202303140246.32E2kpJ4008993@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Warner Losh Subject: git: 7f3c3606465f - main - Parse /kboot.conf List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7f3c3606465f36040bacd85e1f9443ae6b5ca39a Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=7f3c3606465f36040bacd85e1f9443ae6b5ca39a commit 7f3c3606465f36040bacd85e1f9443ae6b5ca39a Author: Warner Losh AuthorDate: 2023-03-14 02:33:35 +0000 Commit: Warner Losh CommitDate: 2023-03-14 02:45:50 +0000 Parse /kboot.conf If there's a kboot.conf, prase it after the command line args are parsed. It's not always easy to get all the right command line args depending on the environment. Allow an escape hatch. While we can't do everything one might like in this file, we can do enough. Sponsored by: Netflix --- stand/kboot/main.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/stand/kboot/main.c b/stand/kboot/main.c index 849ad46add6c..3895f7e76773 100644 --- a/stand/kboot/main.c +++ b/stand/kboot/main.c @@ -195,6 +195,31 @@ has_acpi(void) return rsdp != 0; } +static void +parse_file(const char *fn) +{ + struct stat st; + int fd = -1; + char *env = NULL; + + if (stat(fn, &st) != 0) + return; + fd = open(fn, O_RDONLY); + if (fd == -1) + return; + env = malloc(st.st_size + 1); + if (env == NULL) + goto out; + if (read(fd, env, st.st_size) != st.st_size) + goto out; + env[st.st_size] = '\0'; + boot_parse_cmdline(env); +out: + free(env); + close(fd); +} + + int main(int argc, const char **argv) { @@ -221,6 +246,8 @@ main(int argc, const char **argv) /* Parse the command line args -- ignoring for now the console selection */ parse_args(argc, argv); + parse_file("host:/kboot.conf"); + /* * Set up console. */