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>

next in thread | previous in thread | raw e-mail | index | archive | help
--000000000000c3f93a05ec213036
Content-Type: text/plain; charset="UTF-8"

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

--000000000000c3f93a05ec213036
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div dir=3D"ltr"><br></div><br><div class=3D"gmail_quote">=
<div dir=3D"ltr" class=3D"gmail_attr">On Fri, Oct 28, 2022 at 2:23 PM Mitch=
ell Horne &lt;<a href=3D"mailto:mhorne@freebsd.org">mhorne@freebsd.org</a>&=
gt; wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0=
px 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=3D"https://cgit.FreeBSD.org/src/commit/?id=3D701ab6dba4a22=
32751cd91f79bfc1d8e96bf5316" rel=3D"noreferrer" target=3D"_blank">https://c=
git.FreeBSD.org/src/commit/?id=3D701ab6dba4a2232751cd91f79bfc1d8e96bf5316</=
a><br>
&gt;&gt;<br>
&gt;&gt; commit 701ab6dba4a2232751cd91f79bfc1d8e96bf5316<br>
&gt;&gt; Author:=C2=A0=C2=A0=C2=A0=C2=A0 Andrew Turner &lt;andrew@FreeBSD.o=
rg&gt;<br>
&gt;&gt; AuthorDate: 2022-10-27 17:01:44 +0000<br>
&gt;&gt; Commit:=C2=A0=C2=A0=C2=A0=C2=A0 Andrew Turner &lt;andrew@FreeBSD.o=
rg&gt;<br>
&gt;&gt; CommitDate: 2022-10-27 17:59:33 +0000<br>
&gt;&gt;<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 Stop building FDT-only modules in an ACPI=
 only kernel<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 When building a kernel without FDT these =
modules don&#39;t build. As <br>
&gt;&gt; they<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 depend on FDT and don&#39;t work with ACP=
I disable them.<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 Reviewed by:=C2=A0=C2=A0=C2=A0 imp, kevan=
s<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 Sponsored by:=C2=A0=C2=A0 The FreeBSD Fou=
ndation<br>
&gt;&gt; =C2=A0=C2=A0=C2=A0=C2=A0 Differential Revision: <a href=3D"https:/=
/reviews.freebsd.org/D37178" rel=3D"noreferrer" target=3D"_blank">https://r=
eviews.freebsd.org/D37178</a><br>
&gt; <br>
&gt; Hmm, the OPT_FDT handling seems a bit atypical.=C2=A0 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}=3D ${_allwinner} \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${_if_=
cgem} \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0${_sdh=
ci_fdt} \<br>
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0...<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 ex=
tensive set of changes I&#39;m working on that I might as well</div><div>tr=
ot 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 Make=
file.$MACHINE. This makefile would be responsible</div><div>for defining a =
MODULES_FEATURES variable that would be a list like</div><div>MODULE_FEATUE=
RS=3D32bit x86 64bit-atomics<br></div><div>for i386. Each of these features=
 would have subdirs associated with them</div><div>SUBDIR.64bit-atomics+=3D=
mpr</div><div><div>SUBDIR.64bit-atomics+=3Dmps</div><div>and then we&#39;d =
join them all together at the end. The Makefile.$MACHINE</div><div>might al=
so 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; conditional=
ly to MODULE_FEATURES</div><div>so it would need to be more than just a bun=
ch of MODULE_FEATURES.&lt;arch&gt;=3D</div><div>lines at the top of this Ma=
kefile.</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>

--000000000000c3f93a05ec213036--



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