Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Oct 2022 18:09:28 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Mitchell Horne <mhorne@freebsd.org>
Cc:        John Baldwin <jhb@freebsd.org>, Andrew Turner <andrew@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 701ab6dba4a2 - main - Stop building FDT-only modules in an ACPI only kernel
Message-ID:  <CANCZdfqV3ATx2T%2BoAnL5mTirNbHHd=g_MSZV5q4qkv0WJufdpw@mail.gmail.com>
In-Reply-To: <b7bd480b-d9e7-b140-30b1-fce8292435b7@freebsd.org>
References:  <202210271759.29RHxoXe019330@gitrepo.freebsd.org> <a342ae9c-c688-5536-0feb-534d8a6975c3@FreeBSD.org> <b7bd480b-d9e7-b140-30b1-fce8292435b7@freebsd.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
On Fri, Oct 28, 2022 at 2:23 PM Mitchell Horne <mhorne@freebsd.org> wrote:

>
>
> On 10/28/22 12:59, John Baldwin wrote:
> > On 10/27/22 10:59 AM, Andrew Turner wrote:
> >> The branch main has been updated by andrew:
> >>
> >> URL:
> >>
> https://cgit.FreeBSD.org/src/commit/?id=701ab6dba4a2232751cd91f79bfc1d8e96bf5316
> >>
> >> commit 701ab6dba4a2232751cd91f79bfc1d8e96bf5316
> >> Author:     Andrew Turner <andrew@FreeBSD.org>
> >> AuthorDate: 2022-10-27 17:01:44 +0000
> >> Commit:     Andrew Turner <andrew@FreeBSD.org>
> >> CommitDate: 2022-10-27 17:59:33 +0000
> >>
> >>      Stop building FDT-only modules in an ACPI only kernel
> >>      When building a kernel without FDT these modules don't build. As
> >> they
> >>      depend on FDT and don't work with ACPI disable them.
> >>      Reviewed by:    imp, kevans
> >>      Sponsored by:   The FreeBSD Foundation
> >>      Differential Revision: https://reviews.freebsd.org/D37178
> >
> > Hmm, the OPT_FDT handling seems a bit atypical.  Other optional
> > components are
> > tested for by ${KERN_OPTS:M<foo>} rather than empty(OPT_<foo>) under
> > sys/modules.
> >
>
> Some time ago I experimented with trying to build a NOFDT kernel like
> this. I found that this type of construct worked well:
>
> SUBDIR.${MK_FDT}= ${_allwinner} \
>                    ${_if_cgem} \
>                    ${_sdhci_fdt} \
>                    ...
>
> That is, use the existing SUBDIR.yes logic to conditionally exclude
> these already conditional subdirectories. It avoids multiple identical
> checks, whether you use ${KERN_OPTS:MFDT} or empty(OPT_FDT) forms.
> Something to consider.
>

I have a more extensive set of changes I'm working on that I might as well
trot out here...

First, I'd 100% kill every last _foo variable. They aren't needed.
Next, I'd have a Makefile.$MACHINE. This makefile would be responsible
for defining a MODULES_FEATURES variable that would be a list like
MODULE_FEATUERS=32bit x86 64bit-atomics
for i386. Each of these features would have subdirs associated with them
SUBDIR.64bit-atomics+=mpr
SUBDIR.64bit-atomics+=mps
and then we'd join them all together at the end. The Makefile.$MACHINE
might also add modules to SUBDIRS that are always compiled for that machine,
and might add features like 'fdt' or 'acpi' conditionally to MODULE_FEATURES
so it would need to be more than just a bunch of MODULE_FEATURES.<arch>=
lines at the top of this Makefile.

I was hoping to share a preview early next week. I think this will be a good
balance between simplicity and the mess we have today...

Warner

[-- Attachment #2 --]
<div dir="ltr"><div dir="ltr"><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Fri, Oct 28, 2022 at 2:23 PM Mitchell Horne &lt;<a href="mailto:mhorne@freebsd.org">mhorne@freebsd.org</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 10/28/22 12:59, John Baldwin wrote:<br>
&gt; On 10/27/22 10:59 AM, Andrew Turner wrote:<br>
&gt;&gt; The branch main has been updated by andrew:<br>
&gt;&gt;<br>
&gt;&gt; URL: <br>
&gt;&gt; <a href="https://cgit.FreeBSD.org/src/commit/?id=701ab6dba4a2232751cd91f79bfc1d8e96bf5316" rel="noreferrer" target="_blank">https://cgit.FreeBSD.org/src/commit/?id=701ab6dba4a2232751cd91f79bfc1d8e96bf5316</a><br>;
&gt;&gt;<br>
&gt;&gt; commit 701ab6dba4a2232751cd91f79bfc1d8e96bf5316<br>
&gt;&gt; Author:     Andrew Turner &lt;andrew@FreeBSD.org&gt;<br>
&gt;&gt; AuthorDate: 2022-10-27 17:01:44 +0000<br>
&gt;&gt; Commit:     Andrew Turner &lt;andrew@FreeBSD.org&gt;<br>
&gt;&gt; CommitDate: 2022-10-27 17:59:33 +0000<br>
&gt;&gt;<br>
&gt;&gt;      Stop building FDT-only modules in an ACPI only kernel<br>
&gt;&gt;      When building a kernel without FDT these modules don&#39;t build. As <br>
&gt;&gt; they<br>
&gt;&gt;      depend on FDT and don&#39;t work with ACPI disable them.<br>
&gt;&gt;      Reviewed by:    imp, kevans<br>
&gt;&gt;      Sponsored by:   The FreeBSD Foundation<br>
&gt;&gt;      Differential Revision: <a href="https://reviews.freebsd.org/D37178" rel="noreferrer" target="_blank">https://reviews.freebsd.org/D37178</a><br>;
&gt; <br>
&gt; Hmm, the OPT_FDT handling seems a bit atypical.  Other optional <br>
&gt; components are<br>
&gt; tested for by ${KERN_OPTS:M&lt;foo&gt;} rather than empty(OPT_&lt;foo&gt;) under <br>
&gt; sys/modules.<br>
&gt; <br>
<br>
Some time ago I experimented with trying to build a NOFDT kernel like <br>
this. I found that this type of construct worked well:<br>
<br>
SUBDIR.${MK_FDT}= ${_allwinner} \<br>
                   ${_if_cgem} \<br>
                   ${_sdhci_fdt} \<br>
                   ...<br>
<br>
That is, use the existing SUBDIR.yes logic to conditionally exclude <br>
these already conditional subdirectories. It avoids multiple identical <br>
checks, whether you use ${KERN_OPTS:MFDT} or empty(OPT_FDT) forms. <br>
Something to consider.<br></blockquote><div><br></div><div>I have a more extensive set of changes I&#39;m working on that I might as well</div><div>trot out here...</div><div><br></div><div>First, I&#39;d 100% kill every last _foo variable. They aren&#39;t needed.</div><div>Next, I&#39;d have a Makefile.$MACHINE. This makefile would be responsible</div><div>for defining a MODULES_FEATURES variable that would be a list like</div><div>MODULE_FEATUERS=32bit x86 64bit-atomics<br></div><div>for i386. Each of these features would have subdirs associated with them</div><div>SUBDIR.64bit-atomics+=mpr</div><div><div>SUBDIR.64bit-atomics+=mps</div><div>and then we&#39;d join them all together at the end. The Makefile.$MACHINE</div><div>might also add modules to SUBDIRS that are always compiled for that machine,</div><div>and might add features like &#39;fdt&#39; or &#39;acpi&#39; conditionally to MODULE_FEATURES</div><div>so it would need to be more than just a bunch of MODULE_FEATURES.&lt;arch&gt;=</div><div>lines at the top of this Makefile.</div><div><br></div><div>I was hoping to share a preview early next week. I think this will be a good</div><div>balance between simplicity and the mess we have today...</div><div><br></div><div>Warner</div><div><br></div></div></div></div>
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqV3ATx2T%2BoAnL5mTirNbHHd=g_MSZV5q4qkv0WJufdpw>