Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 5 Aug 2016 20:20:11 -0700
From:      Adrian Chadd <adrian.chadd@gmail.com>
To:        ticso@cicely.de
Cc:        "freebsd-arm@freebsd.org" <freebsd-arm@freebsd.org>, Bernd Walter <ticso@cicely7.cicely.de>
Subject:   Re: out of tree kernel modules (was: compiling modules and FDT define)
Message-ID:  <CAJ-VmonNG1XycPWUH%2BrrpcKBUKH8R6u_aD=odmbPB17r8UyM0A@mail.gmail.com>
In-Reply-To: <20160805134358.GN18406@cicely7.cicely.de>
References:  <20160805005433.GL18406@cicely7.cicely.de> <20160805134358.GN18406@cicely7.cicely.de>

next in thread | previous in thread | raw e-mail | index | archive | help
Hi,

Try adding opt_platform.h to SRCS in the module makefile?

You don't need to add it to the tree. You just have to setup your path
to point things /at/ a kernel build tree withall the opt_xxx.h in
them.

here's what I do:

#!/bin/sh

X_SRCDIR=${X_SRCDIR:="/home/adrian/work/freebsd/head/src/"}
X_KERNDIR=${X_KERNDIR:="/home/adrian/work/freebsd/head/obj/usr/home/adrian/work/freebsd/head/src/sys/GERTRUDE/"}
X_KMODOWN=${X_KMODOWN:="adrian"}
X_KMODGRP=${X_KMODGRP:="adrian"}

# This allows for -HEAD includes for net80211 ..
env CFLAGS="-I../../../sys/" \
make \
    MODULES_OVERRIDE="" \
    DEBUG_FLAGS="-g" \
    DEBUG_FLAGS="-g" \
    KMODDIR="/home/adrian/git/github/erikarn/athp/otus/freebsd/modules/" \
    KMODOWN="${X_KMODOWN}" \
    KMODGRP="${X_KMODGRP}" \
    MAKESYSPATH="${X_SRCDIR}/share/mk" \
    SYSDIR="${X_SRCDIR}/sys/" \
    KERNBUILDDIR="${X_KERNDIR}" \
    KERN_DEBUGDIR="" \
    $@

That gets me all the bits I need to be able to run make in module
directories and get the correct includes/links setup.



-a


On 5 August 2016 at 06:43, Bernd Walter <ticso@cicely7.cicely.de> wrote:
> On Fri, Aug 05, 2016 at 02:54:34AM +0200, Bernd Walter wrote:
>> I compile a driver as module and it seems that FDT isn't defined
>> on a rpi.
>
> When compiling kernel with modules you get an opt_platform.h containing
> #define FDT 1
>
> For my out of tree module all I get is an empty file.
> I assume that also happens when you just manually compile anything in
> sys/modules.
>
> Do I really need to integrate the driver into the kernel source tree
> and always compile everything?
>
> The symptoms of missing FDT support is subtile, because everything
> may seem to work, the device probing just accepts more devices than
> it is supposed to handle.
>
> On a side note, the ofw_bus_is_compatible and ofw_bus_search_compatible
> functions are undocumented.
> At least they don't have a manpage.
> My only option was to blindly copy from another driver, without really
> understanding the differences between those two functions.
>
> --
> B.Walter <bernd@bwct.de> http://www.bwct.de
> Modbus/TCP Ethernet I/O Baugruppen, ARM basierte FreeBSD Rechner uvm.
> _______________________________________________
> freebsd-arm@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-arm
> To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAJ-VmonNG1XycPWUH%2BrrpcKBUKH8R6u_aD=odmbPB17r8UyM0A>