build custom kernel under FreeBSD 12

Rodney W. Grimes freebsd-rwg at gndrsh.dnsmgr.net
Sat Jul 20 07:11:48 UTC 2019


> I did some more testing.
> 
> When I copy the src tree and set $MAKEOBJDIRPREFIX accordingly, I can
> run "make kernel-toolchain && make buildkernel" without problems.
> 
> The permission denied error comes only when I symlink /usr/src/* and only
> copy sys/ to my local directory. So, my idea is that? FreeBSD12 differs
> from 11 and 10 by using something like realpath in either some Makefile
> or make itself.

It is most likely the munging of relative paths that
use to be ../../foo into ${SRCTP}/foo that is the change
causing issues with what you are doing.  SRCTOP is probably
changing values depnding on what location a submake was
started from.

> *****************************************
> * demig Prozessautomatisierung GmbH     *
> *                                       *
> * Anschrift:          Haardtstrasse 40  *
> *                       D-57076 Siegen  *
> * Registergericht:     Siegen HRB 2819  *
> * Geschaeftsfuehrer:   Joachim Herbst,  *
> *                        Winfried Held  *
> * Telefon:              +49 271 772020  *
> * Telefax:              +49 271 74704   *
> * E-Mail:                info at demig.de  *
> *                  http://www.demig.de  *
> *****************************************
> Am 2019-07-19 um 09:28 schrieb Gary Jennejohn:
> > On Fri, 19 Jul 2019 08:40:05 +0200
> > Norbert Koch <nkoch at demig.de> wrote:
> >
> >> Here is a typescript:
> >>
> >> 12.0-RELEASE-p7 (3) nk at entw-pr4 [~/src/kernel/src] $ export
> >> MAKEOBJDIRPREFIX=`realpath tmp`
> >> 12.0-RELEASE-p7 (3) nk at entw-pr4 [~/src/kernel/src] $ echo $MAKEOBJDIRPREFIX
> >> /usr/home/nk/src/kernel/src/tmp
> >>
> >> 12.0-RELEASE-p7 (3) nk at entw-pr4 [~/src/kernel/src] $ make buildkernel
> >> make[1]: "/usr/home/nk/src/kernel/src/Makefile.inc1" line 341:
> >> SYSTEM_COMPILER: Determined that CC=cc matches the source tree. Not
> >> bootstrapping a cross-compiler.
> >> make[1]: "/usr/home/nk/src/kernel/src/Makefile.inc1" line 348:
> >> SYSTEM_LINKER: libclang will be built for bootstrapping a cross-linker.
> >>
> >> --------------------------------------------------------------
> >>   >>> Kernel build for GENERIC started on Fri Jul 19 08:34:27 CEST 2019
> >> --------------------------------------------------------------
> >> ===> GENERIC
> >> mkdir -p /usr/src/sys
> >>
> >> --------------------------------------------------------------
> >>   >>> stage 1: configuring the kernel
> >> --------------------------------------------------------------
> >> cd /usr/home/nk/src/kernel/src/sys/i386/conf;
> >> PATH=/usr/src/tmp/legacy/usr/sbin:/usr/src/tmp/legacy/usr/bin:/usr/src/tmp/legacy/bin:/usr/src/tmp/usr/sbin:/usr/src/tmp/usr/bin:/sbin:/bin:/usr/sbin:/usr/bin
> >> config__ -d /usr/src/sys/GENERIC__ -I
> >> '/usr/home/nk/src/kernel/src/sys/i386/conf'
> >> '/usr/home/nk/src/kernel/src/sys/i386/conf/GENERIC'
> >> config: /usr/src/sys/GENERIC: Permission denied
> >> *** Error code 2
> >>
> >> Stop.
> >> make[1]: stopped in /usr/home/nk/src/kernel/src
> >> *** Error code 1
> >>
> >> Stop.
> >> make: stopped in /usr/home/nk/src/kernel/src
> >>
> > It's peculiar that you have a mix of /usr/src and /usr/home/nk/src.
> > Looking at /usr/src/Makefile.inc1 it would appear that you may also
> > have to set KRNLOBJDIR to /usr/home/nk/src/kernel/src.
> >
> > Does the tmp directory really exist?  Seems like a weird choice.
> >
> > I did what Ryan suggested and was able to make build{kernel,world}
> > from /usr/src with no problem.  But I haven't modified the kernel
> > sources.
> >
> >> Am 2019-07-18 um 19:22 schrieb Ryan Stone:
> >>> How are you setting MAKEOBJDIRPREFIX?  It needs to be set in your
> >>> environment, i.e.
> >>>
> >>> $ export MAKEOBJDIRPREFIX=$HOME/obj
> >>> $ make buildkernel
> >>>
> >>> Trying 'make MAKEOBJDIRPREFIX=$HOME/obj buildkernel' will fail in
> >>> strange ways due to how make passes arguments to sub-makes.
> >>>
> >>> On Thu, Jul 18, 2019 at 9:53 AM Norbert Koch <nkoch at demig.de> wrote:
> >>>> Hello.
> >>>>
> >>>> I am obviously too stupid to figure out how to build a custom kernel
> >>>> as non-root user in a non-standard directory.
> >>>> Under FreeBSD9/10/11 I could put src/ under my own directory
> >>>> and start a kernel-compilation by just setting $MAKEOBJDIRPREFIX
> >>>> accordingly. Doing this under FreeBSD12 gives me 'permission denied'
> >>>> with 'config -d /usr/src/sys/GENERIC ...'. Seems like ${KRNLOBJDIR} is
> >>>> not set correctly while the other parameters to config are.
> >>>> I see that Makefiles differ between 12 and older releases.
> >>>> ${OBJTOP} vs. ${OBJTREE}?
> >>>>
> >>>> So, what am I doing wrong?
> >>>>
> >>>> Thank you for any help.
> 
> -- 
> Dipl.-Ing. Norbert Koch
> Entwicklung Prozessregler
> 
> 
> _______________________________________________
> freebsd-hackers at freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-hackers
> To unsubscribe, send any mail to "freebsd-hackers-unsubscribe at freebsd.org"
> 
> 

-- 
Rod Grimes                                                 rgrimes at freebsd.org


More information about the freebsd-hackers mailing list