From nobody Fri Feb 03 20:39:11 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 4P7nZ81Zzlz3kk0Q; Fri, 3 Feb 2023 20:39:12 +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 4P7nZ813vzz3MvZ; Fri, 3 Feb 2023 20:39:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675456752; 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=9wAluXOhDgFooYTj+mKVeODNJM05BUWEgBsJWW1YQzs=; b=gGGeWlszsebSJzST2zzj381K4/aF2z25m+zvIxCyqe82iyJQAw0Qbxe6D448lZnxTMf9du vQuysjm2EXqHvDKrZTnVfWop63gXumo5eQ8jldLr8eLgsNBE9uSowhy4zEGDIeKpbmQjGm shcphLy6kF8a7wMxOE6Kheem3uNpXJ1oFYEtPoF7rf0TSCwwK/dpm/LEjTDRwxxE1wJ40a JDiR1rVlrbgwVyL8VRgPf1nUv93uPgjhbBi3F9qr8MpFIwv0MeAHWTtdtSmc9zscJrQDas AmRA7rYnzsoNC6xsoCWzclGn+Tpyw/kRpMtUqHgtxSkTmmLQIrC0pG85lDvxTw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1675456752; 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=9wAluXOhDgFooYTj+mKVeODNJM05BUWEgBsJWW1YQzs=; b=DHCsOSIynIXQoCP7XQ+DJrq5PSrAxIdO9q6bECeo3WcOnJWNgDV6LlsSUsAtgnHtNBVtro esrHcnbN6fx9SdB4RgmFgt8N0SbVYCCeFTozlh5xrasOlsQQ+YwIalaRQ8RYdd+1+QFQhN GL3vv47WeBgRk/fP0gGZzDtlyfd2xYC7fwe0Ii606Ge4wfzHC7U5xToUcoi7s4HA2V83e0 fjZxkBtL11fNHQOU451lc/CDDt3GANEFf2W2Q3Ev/z9EE3CdraNHFEpLMr/oJqPb13HblA mLa/FO1fcAegTCwiztz90kwRp33o5qUp0DfbkdQjUEymH8J3cFjBHh5BMpLGJw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1675456752; a=rsa-sha256; cv=none; b=Dsi37hABlNkJ7ZcQnub4RgTJnFHBudj0PHNKRVFTfzHKGD4P6SNdD181qiQfVC72D133tW 30R0iSLf8/OEB2YSnOXu+j421k1uf3Yu1FUGK9aGJ9AWVj15AsNq/mv0dd0FBQGmBtQCCS 9uppuwMyABFImG9VLkIZxJ3pEfQmesuKg7QD0xxg3yaZnA93TF8rd0ohl/G3P/fWtue0wl gbvpeKhwblbm4X+P0FybCgzhAsN+9gPnvRS6NCBtyLGdhZNnjZ/0DCQnigqZm+zhCT4GpW fjqgHmDuGSWEFGzPOK3x3AofWpKj0nlOINidWPnUTjRrmiiqI6f9o0IaHK3xtA== 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 4P7nZ806LmzpSK; Fri, 3 Feb 2023 20:39:12 +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 313KdBko027163; Fri, 3 Feb 2023 20:39:11 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 313KdBfr027162; Fri, 3 Feb 2023 20:39:11 GMT (envelope-from git) Date: Fri, 3 Feb 2023 20:39:11 GMT Message-Id: <202302032039.313KdBfr027162@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mitchell Horne Subject: git: 8859960436f5 - main - loader: always install help files 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: mhorne X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 8859960436f5727f163a7b3468e08710c5e6d874 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by mhorne: URL: https://cgit.FreeBSD.org/src/commit/?id=8859960436f5727f163a7b3468e08710c5e6d874 commit 8859960436f5727f163a7b3468e08710c5e6d874 Author: Mitchell Horne AuthorDate: 2021-02-11 14:29:00 +0000 Commit: Mitchell Horne CommitDate: 2023-02-03 20:35:06 +0000 loader: always install help files Address two issues with current help file logic: The existing condition prevents the common help file from being installed when there are no additional help files defined. This results in no loader.help on EFI platforms, for example. Second, due to the fact that we build and install multiple loader types, each successive install will clobber the previous loader.help. The result is that we could lose type-specific commands, or possibly list them in loaders that do not have such commands. Instead, give each loader type a uniquely named help file. The EFI loader will look for /boot/loader.help.efi, userboot will look for /boot/loader.help.userboot, etc. The interpreter variant has no effect on which help file is loaded. This leaves the old /boot/loader.help unused. Some credit for the final approach goes to Mathieu for their version of the fix in https://reviews.freebsd.org/D22951. PR: 267134 Reported by: Daniel O'Connor Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D28591 --- ObsoleteFiles.inc | 3 +++ stand/common/commands.c | 4 ++-- stand/efi/loader/Makefile | 1 + stand/i386/loader/Makefile | 1 + stand/kboot/Makefile | 2 ++ stand/loader.mk | 15 ++++++++++----- stand/powerpc/ofw/Makefile | 1 + stand/uboot/Makefile | 3 ++- stand/userboot/userboot/Makefile | 2 ++ 9 files changed, 24 insertions(+), 8 deletions(-) diff --git a/ObsoleteFiles.inc b/ObsoleteFiles.inc index ed6d929dd79b..b1b896a77925 100644 --- a/ObsoleteFiles.inc +++ b/ObsoleteFiles.inc @@ -52,6 +52,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20230203: loader help files renamed +OLD_FILES+=boot/loader.help + # 20230201: timeout moved from /usr/bin to /bin OLD_FILES+=usr/tests/usr.bin/timeout/Kyuafile OLD_FILES+=usr/tests/usr.bin/timeout/timeout_test diff --git a/stand/common/commands.c b/stand/common/commands.c index d86c1a4a6f96..6643a3ca360e 100644 --- a/stand/common/commands.c +++ b/stand/common/commands.c @@ -123,7 +123,6 @@ help_emitsummary(char *topic, char *subtopic, char *desc) return (pager_output("\n")); } - static int command_help(int argc, char *argv[]) { @@ -132,7 +131,8 @@ command_help(int argc, char *argv[]) char *topic, *subtopic, *t, *s, *d; /* page the help text from our load path */ - snprintf(buf, sizeof(buf), "%s/boot/loader.help", getenv("loaddev")); + snprintf(buf, sizeof(buf), "%s/boot/%s", getenv("loaddev"), + HELP_FILENAME); if ((hfd = open(buf, O_RDONLY)) < 0) { printf("Verbose help not available, " "use '?' to list commands\n"); diff --git a/stand/efi/loader/Makefile b/stand/efi/loader/Makefile index 2aaba4fbb377..4c94f67cf4e0 100644 --- a/stand/efi/loader/Makefile +++ b/stand/efi/loader/Makefile @@ -83,6 +83,7 @@ CFLAGS+= -DEFI_SECUREBOOT NEWVERSWHAT= "EFI loader" ${MACHINE} VERSION_FILE= ${.CURDIR}/../loader/version +HELP_FILENAME= loader.help.efi # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/i386/loader/Makefile b/stand/i386/loader/Makefile index 99a814497802..088629a70b7f 100644 --- a/stand/i386/loader/Makefile +++ b/stand/i386/loader/Makefile @@ -62,6 +62,7 @@ CFLAGS.main.c+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs .if exists(${.CURDIR}/help.i386) HELP_FILES= ${.CURDIR}/help.i386 .endif +HELP_FILENAME= loader.help.bios # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/kboot/Makefile b/stand/kboot/Makefile index 745dcd30a938..922944707340 100644 --- a/stand/kboot/Makefile +++ b/stand/kboot/Makefile @@ -44,6 +44,8 @@ CFLAGS+= -I${SYSDIR}/contrib/openzfs/include/os/freebsd/zfs HAVE_ZFS=yes .endif +HELP_FILENAME= loader.help.kboot + .include "${BOOTSRC}/fdt.mk" # We share bootinfo.c with efi diff --git a/stand/loader.mk b/stand/loader.mk index 9fa4c74e2501..b30e9f4e66b7 100644 --- a/stand/loader.mk +++ b/stand/loader.mk @@ -162,12 +162,17 @@ vers.c: ${LDRSRC}/newvers.sh ${VERSION_FILE} CFLAGS+= -DELF_VERBOSE .endif -.if !empty(HELP_FILES) +# Each loader variant defines their own help filename. Optional or +# build-specific commands are included by augmenting HELP_FILES. +.if !defined(HELP_FILENAME) +.error Define HELP_FILENAME before including loader.mk +.endif + HELP_FILES+= ${LDRSRC}/help.common -CLEANFILES+= loader.help -FILES+= loader.help +CFLAGS+= -DHELP_FILENAME=\"${HELP_FILENAME}\" +CLEANFILES+= ${HELP_FILENAME} +FILES+= ${HELP_FILENAME} -loader.help: ${HELP_FILES} +${HELP_FILENAME}: ${HELP_FILES} cat ${HELP_FILES} | awk -f ${LDRSRC}/merge_help.awk > ${.TARGET} -.endif diff --git a/stand/powerpc/ofw/Makefile b/stand/powerpc/ofw/Makefile index 28eb8ee91fad..5912ceae93d5 100644 --- a/stand/powerpc/ofw/Makefile +++ b/stand/powerpc/ofw/Makefile @@ -37,6 +37,7 @@ SRCS+= trampolineLE.S .endif HELP_FILES= ${FDTSRC}/help.fdt +HELP_FILENAME= loader.help.ofw # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/uboot/Makefile b/stand/uboot/Makefile index ed2253cdae6f..5b8275a0131b 100644 --- a/stand/uboot/Makefile +++ b/stand/uboot/Makefile @@ -35,7 +35,8 @@ WARNS?= 1 CWARNFLAGS.self_reloc.c+= -Wno-error=maybe-uninitialized .endif -HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILES= ${.CURDIR}/help.uboot ${BOOTSRC}/fdt/help.fdt +HELP_FILENAME= loader.help.uboot # Always add MI sources .include "${BOOTSRC}/loader.mk" diff --git a/stand/userboot/userboot/Makefile b/stand/userboot/userboot/Makefile index c5e2e6fe7c7c..43011b9577c9 100644 --- a/stand/userboot/userboot/Makefile +++ b/stand/userboot/userboot/Makefile @@ -54,6 +54,8 @@ CFLAGS+= -DUSERBOOT_ZFS_SUPPORT HAVE_ZFS=yes .endif +HELP_FILENAME= loader.help.userboot + # Always add MI sources .include "${BOOTSRC}/loader.mk" CFLAGS+= -I.