[Bug 258081] opt_platform.h always created empty on kmod build

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 27 Aug 2021 11:02:59 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=258081

            Bug ID: 258081
           Summary: opt_platform.h always created empty on kmod build
           Product: Base System
           Version: 13.0-STABLE
          Hardware: arm
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: mishin@mh.net.ru

Running "make depend" in a kernel module sources folder outside of the kernel
sources tree makes an empty "./opt_platform.h". I expect it to contain the
lines "#define FDT 1" and "#define EFI 1" which are contained in
"/usr/obj/arm.armv7/sys/${KERNCONF}/opt_platform.h".

My "Makefile":
# $FreeBSD$
KMOD=rcrecv
SRCS=rcrecv.c
SRCS+=  \
        bus_if.h \
        device_if.h \
        gpio_if.h \
        gpiobus_if.h \
        ofw_bus_if.h \
        opt_platform.h \
        fdt_pinctrl_if.h \
CFLAGS+=  -I.
.include <bsd.kmod.mk>

Maybe it is important: I always mount on my ARM host "/usr/src" for building
kernel modules by nfs but I have not mounted "/usr/obj" there.

I tried also run "make TARGET_ARCH=armv7 KERNCONF=OPI_PC depend" on amd64 PC (I
build world & kernel for my OrangePI PC, on amd64 and with that variables, and
"/usr/obj/arm.armv7/sys/${KERNCONF}/opt_platform.h" is exists and is not
empty). But the "./opt_platform.h" created empty in this case too.

This is an output of the command I run (I don't got what ":>" means):
machine -> /usr/src/sys/amd64/include
x86 -> /usr/src/sys/x86/include
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/bus_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/kern/device_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/gpio/gpio_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/gpio/gpiobus_if.m -h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/ofw/ofw_bus_if.m -h
:> opt_platform.h
awk -f /usr/src/sys/tools/makeobjops.awk /usr/src/sys/dev/fdt/fdt_pinctrl_if.m
-h
touch opt_global.h

Of course I can place a definition of FDT to the code, to the Makefile or even
to the "./opt_platform.h" file but I want to make it more platform dependent.
Is it a bug or maybe I misunderstand this step of making kmods?

-- 
You are receiving this mail because:
You are the assignee for the bug.