Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 2024 11:07:25 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        "Bjoern A. Zeeb" <bzeeb-lists@lists.zabbadoz.net>
Cc:        "Stephen J. Kiernan" <stevek@freebsd.org>, src-committers@freebsd.org,  dev-commits-src-all@freebsd.org, dev-commits-src-main@freebsd.org
Subject:   Re: git: 22ca6db50f4e - main - config.mk: Add MK_VIMAGE knob
Message-ID:  <CANCZdfqJtQgCx%2Bq3KjH50eWtiZxM5eq_wcwwmTowm%2B4OFwkJag@mail.gmail.com>
In-Reply-To: <5op16p78-969n-61p6-q049-o34ps2n04677@yvfgf.mnoonqbm.arg>
References:  <202404091707.439H7vOb043582@gitrepo.freebsd.org> <5op16p78-969n-61p6-q049-o34ps2n04677@yvfgf.mnoonqbm.arg>

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

On Fri, Apr 12, 2024 at 1:29=E2=80=AFPM Bjoern A. Zeeb <
bzeeb-lists@lists.zabbadoz.net> wrote:

> On Tue, 9 Apr 2024, Stephen J. Kiernan wrote:
>
> > The branch main has been updated by stevek:
> >
> > URL:
> https://cgit.FreeBSD.org/src/commit/?id=3D22ca6db50f4e6bd75a141f57cf953d8=
de6531a06
> >
> > commit 22ca6db50f4e6bd75a141f57cf953d8de6531a06
> > Author:     Stephen J. Kiernan <stevek@FreeBSD.org>
> > AuthorDate: 2024-04-09 17:04:24 +0000
> > Commit:     Stephen J. Kiernan <stevek@FreeBSD.org>
> > CommitDate: 2024-04-09 17:05:56 +0000
> >
> >    config.mk: Add MK_VIMAGE knob
> >
> >    Default to VIMAGE as yes.
> >    Add VIMAGE to __DEFAULT_DEPENDENT_OPTIONS (to define VIMAGE_SUPPORT)
> >
> >    Only output VIMAGE to opt_global.h when VIMAGE support is wanted.
> >
> >    Obtained from:  Juniper Networks, Inc.
> >    Differential Revision:  https://reviews.freebsd.org/D39636
> > ---
> > share/mk/src.opts.mk  | 2 ++
> > sys/conf/config.mk    | 2 ++
> > sys/conf/kern.opts.mk | 4 +++-
> > 3 files changed, 7 insertions(+), 1 deletion(-)
>
> I now see:
>
> cat: /usr/obj/usr/src/src.git/amd64.amd64/sys/FOO/opt_vimage.h: No such
> file or directory
>
> during builds.  I made sure I cleaned the sys/FOO obj tree.  Any ideas?
>

I see this too... :(

The problem is that VIMAGE is in opt_global.h, not in opt_vimage, so it was
improper to add it here:
for var in \
    INET \
    INET6 \
    VIMAGE
.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} =3D=3D "no"
MK_${var}_SUPPORT:=3D no
.else
.if defined(KERNBUILDDIR)       # See if there's an opt_foo.h


.if !defined(OPT_${var})
OPT_${var}!=3D cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo <-----------------
opt_vimage.h isn't a thing, it lives in opt_global.h
.export OPT_${var}
.endif
.if ${OPT_${var}} =3D=3D ""         # nothing -> no



MK_${var}_SUPPORT:=3D no
.else
MK_${var}_SUPPORT:=3D yes
.endif
.else                           # otherwise, yes



MK_${var}_SUPPORT:=3D yes
.endif
.endif
.endfor

So prior to this addition, this was abusing our build system somewhat, but
it worked. Now, it doesn't work and can only work with more abuse:

diff --git a/sys/conf/kern.opts.mk b/sys/conf/kern.opts.mk
index 8b1151f3d624..99e4433ec3cf 100644
--- a/sys/conf/kern.opts.mk
+++ b/sys/conf/kern.opts.mk
@@ -188,9 +188,13 @@ OPT_${opt}:=3D       ${rep}
 .if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} =3D=3D "no"
 MK_${var}_SUPPORT:=3D no
 .else
-.if defined(KERNBUILDDIR)  # See if there's an opt_foo.h
+.if defined(KERNBUILDDIR)    # See if there's an opt_foo.h or opt_global.h
 .if !defined(OPT_${var})
+.if exists(${KERNBUILDDIR}/opt_${var:tl}.h)
 OPT_${var}!=3D cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo
+.else
+OPT_${var}!=3D cat ${KERNBUILDDIR}/opt_global.h; echo
+.endif
 .export OPT_${var}
 .endif
 .if ${OPT_${var}} =3D=3D ""                # nothing -> no

which I think gets us past the present problem...

But I think that config(8) should be generating a canonical list of options
so we don't have to do this crazy gymnastics of kludgitude.

Warner

Warner

--000000000000db26820615fd6c1b
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, Apr 12, 2024 at 1:29=E2=80=AF=
PM Bjoern A. Zeeb &lt;<a href=3D"mailto:bzeeb-lists@lists.zabbadoz.net" tar=
get=3D"_blank">bzeeb-lists@lists.zabbadoz.net</a>&gt; wrote:<br></div><bloc=
kquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:=
1px solid rgb(204,204,204);padding-left:1ex">On Tue, 9 Apr 2024, Stephen J.=
 Kiernan wrote:<br>
<br>
&gt; The branch main has been updated by stevek:<br>
&gt;<br>
&gt; URL: <a href=3D"https://cgit.FreeBSD.org/src/commit/?id=3D22ca6db50f4e=
6bd75a141f57cf953d8de6531a06" rel=3D"noreferrer" target=3D"_blank">https://=
cgit.FreeBSD.org/src/commit/?id=3D22ca6db50f4e6bd75a141f57cf953d8de6531a06<=
/a><br>
&gt;<br>
&gt; commit 22ca6db50f4e6bd75a141f57cf953d8de6531a06<br>
&gt; Author:=C2=A0 =C2=A0 =C2=A0Stephen J. Kiernan &lt;stevek@FreeBSD.org&g=
t;<br>
&gt; AuthorDate: 2024-04-09 17:04:24 +0000<br>
&gt; Commit:=C2=A0 =C2=A0 =C2=A0Stephen J. Kiernan &lt;stevek@FreeBSD.org&g=
t;<br>
&gt; CommitDate: 2024-04-09 17:05:56 +0000<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 <a href=3D"http://config.mk" rel=3D"noreferrer" target=3D=
"_blank">config.mk</a>: Add MK_VIMAGE knob<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 Default to VIMAGE as yes.<br>
&gt;=C2=A0 =C2=A0 Add VIMAGE to __DEFAULT_DEPENDENT_OPTIONS (to define VIMA=
GE_SUPPORT)<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 Only output VIMAGE to opt_global.h when VIMAGE support is=
 wanted.<br>
&gt;<br>
&gt;=C2=A0 =C2=A0 Obtained from:=C2=A0 Juniper Networks, Inc.<br>
&gt;=C2=A0 =C2=A0 Differential Revision:=C2=A0 <a href=3D"https://reviews.f=
reebsd.org/D39636" rel=3D"noreferrer" target=3D"_blank">https://reviews.fre=
ebsd.org/D39636</a><br>
&gt; ---<br>
&gt; share/mk/<a href=3D"http://src.opts.mk" rel=3D"noreferrer" target=3D"_=
blank">src.opts.mk</a>=C2=A0 | 2 ++<br>
&gt; sys/conf/<a href=3D"http://config.mk" rel=3D"noreferrer" target=3D"_bl=
ank">config.mk</a>=C2=A0 =C2=A0 | 2 ++<br>
&gt; sys/conf/<a href=3D"http://kern.opts.mk" rel=3D"noreferrer" target=3D"=
_blank">kern.opts.mk</a> | 4 +++-<br>
&gt; 3 files changed, 7 insertions(+), 1 deletion(-)<br>
<br>
I now see:<br>
<br>
cat: /usr/obj/usr/src/src.git/amd64.amd64/sys/FOO/opt_vimage.h: No such fil=
e or directory<br>
<br>
during builds.=C2=A0 I made sure I cleaned the sys/FOO obj tree.=C2=A0 Any =
ideas?<br></blockquote><div><br></div><div>I see this too... :(</div><div><=
br></div><div>The problem is that VIMAGE is in opt_global.h, not in opt_vim=
age, so it was improper to add it here:</div><div>for var in \<br>=C2=A0 =
=C2=A0 INET \<br>=C2=A0 =C2=A0 INET6 \<br>=C2=A0 =C2=A0 VIMAGE<br>.if defin=
ed(WITHOUT_${var}_SUPPORT) || ${MK_${var}} =3D=3D &quot;no&quot;<br>MK_${va=
r}_SUPPORT:=3D no<br>.else<br>.if defined(KERNBUILDDIR) =C2=A0 =C2=A0 =C2=
=A0 # See if there&#39;s an opt_foo.h =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0=C2=A0 <br>.if !defined(OPT_${var})<br>OPT_${var}!=3D cat ${KERNB=
UILDDIR}/opt_${var:tl}.h; echo &lt;----------------- opt_vimage.h isn&#39;t=
 a thing, it lives in opt_global.h<br></div>.export OPT_${var}<div>.endif<b=
r>.if ${OPT_${var}} =3D=3D &quot;&quot; =C2=A0 =C2=A0 =C2=A0 =C2=A0 # nothi=
ng -&gt; no =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 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A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<br>MK_${var}_SUPPORT:=3D y=
es<br>.endif<br>.endif<br>.endfor<br><br></div><div>So prior to this additi=
on, this was abusing our build system somewhat, but it worked. Now, it does=
n&#39;t work and can only work with more abuse:</div><div><br></div><div>di=
ff --git a/sys/conf/<a href=3D"http://kern.opts.mk">kern.opts.mk</a>; b/sys/=
conf/<a href=3D"http://kern.opts.mk">kern.opts.mk</a><br>index 8b1151f3d624=
..99e4433ec3cf 100644<br>--- a/sys/conf/<a href=3D"http://kern.opts.mk">ker=
n.opts.mk</a><br>+++ b/sys/conf/<a href=3D"http://kern.opts.mk">kern.opts.m=
k</a><br>@@ -188,9 +188,13 @@ OPT_${opt}:=3D =C2=A0 =C2=A0 =C2=A0 ${rep}<br=
>=C2=A0.if defined(WITHOUT_${var}_SUPPORT) || ${MK_${var}} =3D=3D &quot;no&=
quot;<br>=C2=A0MK_${var}_SUPPORT:=3D no<br>=C2=A0.else<br>-.if defined(KERN=
BUILDDIR) =C2=A0# See if there&#39;s an opt_foo.h<br>+.if defined(KERNBUILD=
DIR) =C2=A0 =C2=A0# See if there&#39;s an opt_foo.h or opt_global.h<br>=C2=
=A0.if !defined(OPT_${var})<br>+.if exists(${KERNBUILDDIR}/opt_${var:tl}.h)=
<br>=C2=A0OPT_${var}!=3D cat ${KERNBUILDDIR}/opt_${var:tl}.h; echo<br>+.els=
e<br>+OPT_${var}!=3D cat ${KERNBUILDDIR}/opt_global.h; echo<br>+.endif<br>=
=C2=A0.export OPT_${var}<br>=C2=A0.endif<br>=C2=A0.if ${OPT_${var}} =3D=3D =
&quot;&quot; =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0# nothi=
ng -&gt; no</div><div><br></div><div>which I think gets us past the present=
 problem...</div><div><br></div><div>But I think that config(8) should be g=
enerating a canonical list of options so we don&#39;t have to do this crazy=
 gymnastics of kludgitude.</div><div><br></div><div>Warner<br></div><div><b=
r></div><div>Warner <br></div></div></div>

--000000000000db26820615fd6c1b--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfqJtQgCx%2Bq3KjH50eWtiZxM5eq_wcwwmTowm%2B4OFwkJag>