Solved releng/13.0 - "make kernel" fails

tingo

Daemon

Reaction score: 550
Messages: 2,409

I've trying to build latest FreeBSD 13.0 (BETA3) from source, but the kernel fails here
Code:
===> drm-current-kmod/linuxkpi (all)
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/local/sys/modules/drm-current-kmod/linuxkpi...]
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
make[4]: don't know how to make dma-resv.c. Stop

make[4]: stopped in /usr/local/sys/modules/drm-current-kmod/linuxkpi
*** Error code 2
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GENERIC
*** Error code 1
*** Error code 1
The source I've checked out with git:
Code:
root@kg-vm5:/usr/src # git status
On branch releng/13.0
Your branch is up to date with 'origin/releng/13.0'.

nothing to commit, working tree clean


root@kg-vm5:/usr/src # git log | head -10
commit 9f00cb5fa8a438e7b9efb2158f2e2edc730badd1
Author: Jamie Gritton <jamie@FreeBSD.org>
Date:   Tue Feb 16 11:19:13 2021 -0800

    MFS jail: Handle a possible race between jail_remove(2) and fork(2)
    
    jail_remove(2) includes a loop that sends SIGKILL to all processes
    in a jail, but skips processes in PRS_NEW state.  Thus it is possible
    the a process in mid-fork(2) during jail removal can survive the jail
    being removed.
and
Code:
root@kg-vm5:/usr/src # egrep "^BRANCH|^REVISION" /usr/src/sys/conf/newvers.sh
REVISION="13.0"
BRANCH="BETA3"

I've using the "make world" procedure from the Handbook.
This should work, right?
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,185
Messages: 35,689

I suspect you've added PORTS_MODULES to /etc/make.conf that forces a build of graphics/drm-current-kmod. But for 13.0 you should use graphics/drm-fbsd13-kmod (-CURRENT moved to 14.0). You can probably remove this module altogether and just install the package.
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

No, that's not it. There isn't even a make.conf file:
Code:
root@kg-vm5:~ # cat /etc/make.conf
cat: /etc/make.conf: No such file or directory
FreeBSD on this machine was installed from a snapshot some time ago:
Code:
root@kg-vm5:~ # freebsd-version -ku
13.0-CURRENT
13.0-CURRENT
root@kg-vm5:~ # uname -a
FreeBSD kg-vm5 13.0-CURRENT FreeBSD 13.0-CURRENT #0 2ed50808d2b-c254384(main): Thu Nov 12 07:29:09 UTC 2020     root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC  amd64
But I can't see how that would make the build fail.
 

mark_j

Aspiring Daemon

Reaction score: 422
Messages: 790

It's part of the generic kernel config, ie COMPAT_LINUXKPI
Comment it out of GENERIC in /usr/src/sys/amd64/conf and see how you go (or is it needed?)

(It's needed for some 1GB+ cards, but, again if you don't need it... ) I would consider the build broken if it can't pass this!
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

Nope - no src.conf. This installation is as plain as you can get it, so I'm very confused why it doesn't work.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,185
Messages: 35,689

Code:
===> drm-current-kmod/linuxkpi (all)
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/local/sys/modules/drm-current-kmod/linuxkpi...]
machine -> /usr/src/sys/amd64/include
This is something that shouldn't be built. So there's something funky going on with your configuration or source. There is no /usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/local when building the kernel.

I would suggest backing up your kernel configs (if you have any custom kernels), nuking /usr/src and do a fresh clean checkout of the releng/13.0 branch.
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

Well, yes - that's the whole point: I checked out the source fresh, there is no custom configuration going on.
To summarize:
1. I installed FreeBSD 13.0-current from a snapshot. No source was installed.
2. I used that snapshot, installed various packages etc.
3. I decided to upgrade, and checked out source fresh, into an empty /usr/src directory.
4. I started the "make world" procedure # make buildworld succeeded, # make kernel failed.

I will nuke the /usr/src directory and try again with a fresh source.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,185
Messages: 35,689

# make kernel failed.
After a make buildworld do a make buildkernel first. And double check your environment variables ( setenv or set depending on your shell). That PORTS_MODULES might be set as an environment variable.
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

FWIW, # make kernel does make buildkernel followed by # make installkernel (I'm sure you know this already).
Nope - no PORTS_MODULES or other suspicious environment variables set.
 

Zirias

Daemon

Reaction score: 608
Messages: 1,216

This sounds very weird, cause, agreed, this shouldn't be built at all. I have a vm I use for testing ports currently on r368718 (via svn), will try to reproduce this. Might take a while cause I first have to build a git package :)
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,185
Messages: 35,689

I've built several systems (from source) with releng/13.0 and stable/13 the past week. Never encountered this issue. So I still think it's a local setting somewhere.
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

So I nuked /usr/src and /usr/obj (for good measure), checked out a new source like so
Code:
root@kg-vm5:/usr # git clone -b releng/13.0 https://git.freebsd.org/src.git src
Cloning into 'src'...
remote: Enumerating objects: 377634, done.
remote: Counting objects: 100% (377634/377634), done.
remote: Compressing objects: 100% (26656/26656), done.
remote: Total 3848438 (delta 371969), reused 350978 (delta 350978), pack-reused 3470804
Receiving objects: 100% (3848438/3848438), 1.17 GiB | 8.05 MiB/s, done.
Resolving deltas: 100% (3048492/3048492), done.
Updating files: 100% (85282/85282), done.
which gives me
Code:
root@kg-vm5:/usr # egrep "^BRANCH|^REVISION" /usr/src/sys/conf/newvers.sh
REVISION="13.0"
BRANCH="BETA3"

root@kg-vm5:/usr/src # git log --oneline | head -10
1d0d443daa5 arm64: rpi4: gpio: Add brcm,bcm2711-gpio compatible
07efb4cef7b arm64: rpi4: firmware: Attach at BUS_PASS_BUS + BUS_PASS_ORDER_LATE
26b11d047d2 libpmc: fix linking with C programs
a310973472b pf: Fix osfp configuration
9f00cb5fa8a MFS jail: Handle a possible race between jail_remove(2) and fork(2)
889cf2bf73a ffs_vnops.c: Move opt_*.h includes to the top.
150b4388d3b update to 13.0-BETA3
eb7d18ff0ab loader: do not autoselect smaller font than 8x16 with high res display
d560d01b02a loader: remove BORDER_PIXELS
03c31d3ca31 vt: terminal size can grow too big with small font
make buildworld succeeds
Code:
root@kg-vm5:/usr/src # make -j8 buildworld
[..]
--------------------------------------------------------------
>>> World build completed on Mon Feb 22 17:58:52 CET 2021
>>> World built in 6895 seconds, ncpu: 8, make -j8
--------------------------------------------------------------
but make kernel fails
Code:
root@kg-vm5:/usr/src # make kernel
[..]
cc -target x86_64-unknown-freebsd13.0 --sysroot=/usr/obj/usr/src/amd64.amd64/tmp -B/usr/obj/usr/src/amd64.amd64/tmp/usr/bin -O2 -pipe -fno-common -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -DKLD_TIED -nostdinc -DHAVE_KERNEL_OPTION_HEADERS -include /usr/obj/usr/src/amd64.amd64/sys/GENERIC/opt_global.h -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -g -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdebug-prefix-map=./machine=/usr/src/sys/amd64/include -fdebug-prefix-map=./x86=/usr/src/sys/x86/include -I/usr/obj/usr/src/amd64.amd64/sys/GENERIC -MD -MF.depend.zutil.o -MTzutil.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -Wno-format-zero-length -mno-aes -mno-avx -std=iso9899:1999 -c /usr/src/sys/contrib/zlib/zutil.c -o zutil.o
ctfconvert -L VERSION -g zutil.o
ld -m elf_x86_64_fbsd -d -warn-common --build-id=sha1 -T /usr/src/sys/conf/ldscript.kmod.amd64 -r -d -o zlib.ko.full zcalloc.o zlib_mod.o adler32.o compress.o crc32.o deflate.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
ctfmerge -L VERSION -g -o zlib.ko.full zcalloc.o zlib_mod.o adler32.o compress.o crc32.o deflate.o inffast.o inflate.o inftrees.o trees.o uncompr.o zutil.o
:> export_syms
awk -f /usr/src/sys/conf/kmod_syms.awk zlib.ko.full export_syms | xargs -J% objcopy % zlib.ko.full
objcopy --only-keep-debug zlib.ko.full zlib.ko.debug
objcopy --strip-debug --add-gnu-debuglink=zlib.ko.debug zlib.ko.full zlib.ko
===> drm-current-kmod (all)
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/local/sys/modules/drm-current-kmod...]
===> drm-current-kmod/linuxkpi (all)
[Creating objdir /usr/obj/usr/src/amd64.amd64/sys/GENERIC/modules/usr/local/sys/modules/drm-current-kmod/linuxkpi...]
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
make[4]: don't know how to make dma-resv.c. Stop

make[4]: stopped in /usr/local/sys/modules/drm-current-kmod/linuxkpi
*** Error code 2
*** Error code 1

Stop.
make[2]: stopped in /usr/obj/usr/src/amd64.amd64/sys/GENERIC
*** Error code 1
*** Error code 1
As far as I can tell, there isn't any settings (environment variables, make.conf, src.conf) or other files that should affect this on the system.
The packages installed shouldn't affect the build of the system, right?
Code:
root@kg-vm5:~ # pkg info -a | wc -l
     555
 

Zirias

Daemon

Reaction score: 608
Messages: 1,216

It does seem that having graphics/drm-current-kmod installed makes a difference:
Having a closer look at this: so the drm-kmod ports have a SOURCE knob installing the module source and in that case, a kernel build *automatically* picks it up? :eek:

Well, then the solution should be simple, uninstall that port and try again.

For the records, upgrade from a 13.0-CURRENT snapshot to 13.0-BETA3 went smooth on my test vm as well...
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

Thanks - it seems that my google-fu wasn't strong enough this time. With drm-current-kmod deinstalled, the kernel built fine
Code:
# make kernel 
[..]
--------------------------------------------------------------
>>> Installing kernel GENERIC completed on Mon Feb 22 22:36:25 CET 2021
--------------------------------------------------------------
and the rest of the procedure went without any surprises.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Reaction score: 10,185
Messages: 35,689

For 13.0 (-BETA#, -RC#, -RELEASE) you're going to need to replace it with graphics/drm-fbsd13-kmod, pkg(8) should do this "automagically" when you run pkg upgrade after the upgrade.
 
OP
T

tingo

Daemon

Reaction score: 550
Messages: 2,409

well, since I had removed it, I just installed the drm-kmod package again :)
 

Jose

Aspiring Daemon

Reaction score: 497
Messages: 656

Thanks - it seems that my google-fu wasn't strong enough this time. With drm-current-kmod deinstalled, the kernel built fine
Glad it worked. The trick was adding "-linux" to the search terms to weed out all the Linux red herrings.
 
Top