Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Oct 2025 09:45:02 -0600
From:      Warner Losh <imp@bsdimp.com>
To:        Michael Grimm <trashcan@ellael.org>
Cc:        Lexi Winter <ivy@freebsd.org>, freebsd-hackers@freebsd.org
Subject:   Re: multiple kernels with the same world
Message-ID:  <CANCZdfrt2hK5o80Jd1bTAOVPu_5xmJ3kNpMkHvTHFAPHwXgLHA@mail.gmail.com>
In-Reply-To: <04D75F4D-5C17-4D8F-93C1-0BDF5251CBD2@ellael.org>

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

On Thu, Oct 16, 2025 at 9:39=E2=80=AFAM Michael Grimm <trashcan@ellael.org>=
 wrote:

> Lexi Winter <ivy@FreeBSD.org> wrote:
> > Anthony Pankov wrote in <575313120.20251014120303@yahoo.com>:
>
> >> I wander can I build multiple kernel from the same sources while using
> >> once builded world?
> >>
> >> My aim is to have basepkgs containing different kernels. It would be
> >> nice to have FreeBSD-kernel-general-*.pkg,
> >> FreeBSD-kernel-virtualmachine-*.pkg etc. in the same base package
> >> repository.
> >
> > % make KERNCONF=3D'GENERIC FOO BAR BAZ' buildworld buildkernel
> update-packages
> >
> > the first kernel listed in KERNCONF will be installed in /boot/kernel,
> > the rest will be installed in /boot/kernel.NAME.  for consistency, i
> > prefer to always build GENERIC as the first kernel, but there's no
> > actual requirement to do that.
>
> Cool.
>
> Please excuse my ignorance but is there a way to get /boot/kernel.NAME
> installed without going via packages?
>
> I am used to build and install by source. Thus I tried:
>
> MWN> make KERNCONF=3D'GENERIC CUSTOM' DESTDIR=3D/tmp/NEW installkernel | =
& tee
> LOG
>
> MWN> grep '^>>>' LOG
> >>> Install check kernel started on Thu Oct 16 17:27:31 CEST 2025
> >>> Installing kernel GENERIC on Thu Oct 16 17:27:31 CEST 2025
> >>> Installing kernel GENERIC completed on Thu Oct 16 17:27:44 CEST 2025
> >>> Install kernel(s) GENERIC completed in 13 seconds, ncpu: 16
>
> MWN> ls -al /tmp/NEW/boot | grep kernel
> drwxr-xr-x  2 root wheel 717 Oct 16 17:29 kernel
>
> Only the first kernel found in KERNCONF will be installed, though.
>
> Is there a way to end up in something like the following?
>
> tmp/NEW/boot/kernel
> tmp/NEW/boot/kernel.GENERIC
>
> P.S. I tried make KERNCONF=3D'GENERIC CUSTOM' KERNEL=3D'GENERIC CUSTOM'
> DESTDIR=3D/tmp/NEW installkernel
>      same results as mentioned above
>

The only way I know is to do them one at a time. The code in Makefile.inc1
treats the first one specially. You'd have to hack it so it doesn't.

Warner

--000000000000c015e10641488024
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 g=
mail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Oct 16,=
 2025 at 9:39=E2=80=AFAM Michael Grimm &lt;<a href=3D"mailto:trashcan@ellae=
l.org">trashcan@ellael.org</a>&gt; wrote:<br></div><blockquote class=3D"gma=
il_quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,2=
04,204);padding-left:1ex">Lexi Winter &lt;ivy@FreeBSD.org&gt; wrote:<br>
&gt; Anthony Pankov wrote in &lt;<a href=3D"mailto:575313120.20251014120303=
@yahoo.com" target=3D"_blank">575313120.20251014120303@yahoo.com</a>&gt;:<b=
r>
<br>
&gt;&gt; I wander can I build multiple kernel from the same sources while u=
sing<br>
&gt;&gt; once builded world?<br>
&gt;&gt; <br>
&gt;&gt; My aim is to have basepkgs containing different kernels. It would =
be<br>
&gt;&gt; nice to have FreeBSD-kernel-general-*.pkg,<br>
&gt;&gt; FreeBSD-kernel-virtualmachine-*.pkg etc. in the same base package<=
br>
&gt;&gt; repository.<br>
&gt; <br>
&gt; % make KERNCONF=3D&#39;GENERIC FOO BAR BAZ&#39; buildworld buildkernel=
 update-packages<br>
&gt; <br>
&gt; the first kernel listed in KERNCONF will be installed in /boot/kernel,=
<br>
&gt; the rest will be installed in /boot/kernel.NAME.=C2=A0 for consistency=
, i<br>
&gt; prefer to always build GENERIC as the first kernel, but there&#39;s no=
<br>
&gt; actual requirement to do that.<br>
<br>
Cool. <br>
<br>
Please excuse my ignorance but is there a way to get /boot/kernel.NAME inst=
alled without going via packages?<br>
<br>
I am used to build and install by source. Thus I tried:<br>
<br>
MWN&gt; make KERNCONF=3D&#39;GENERIC CUSTOM&#39; DESTDIR=3D/tmp/NEW install=
kernel | &amp; tee LOG<br>
<br>
MWN&gt; grep &#39;^&gt;&gt;&gt;&#39; LOG<br>
&gt;&gt;&gt; Install check kernel started on Thu Oct 16 17:27:31 CEST 2025<=
br>
&gt;&gt;&gt; Installing kernel GENERIC on Thu Oct 16 17:27:31 CEST 2025<br>
&gt;&gt;&gt; Installing kernel GENERIC completed on Thu Oct 16 17:27:44 CES=
T 2025<br>
&gt;&gt;&gt; Install kernel(s) GENERIC completed in 13 seconds, ncpu: 16<br=
>
<br>
MWN&gt; ls -al /tmp/NEW/boot | grep kernel<br>
drwxr-xr-x=C2=A0 2 root wheel 717 Oct 16 17:29 kernel<br>
<br>
Only the first kernel found in KERNCONF will be installed, though.<br>
<br>
Is there a way to end up in something like the following? <br>
<br>
tmp/NEW/boot/kernel<br>
tmp/NEW/boot/kernel.GENERIC<br>
<br>
P.S. I tried make KERNCONF=3D&#39;GENERIC CUSTOM&#39; KERNEL=3D&#39;GENERIC=
 CUSTOM&#39; DESTDIR=3D/tmp/NEW installkernel<br>
=C2=A0 =C2=A0 =C2=A0same results as mentioned above<br></blockquote><div><b=
r></div><div>The only way I know is to do them one at a time. The code in M=
akefile.inc1 treats the first one specially. You&#39;d have to hack it so i=
t doesn&#39;t.</div><div><br></div><div>Warner=C2=A0</div></div></div>

--000000000000c015e10641488024--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CANCZdfrt2hK5o80Jd1bTAOVPu_5xmJ3kNpMkHvTHFAPHwXgLHA>