Re: Syntax of files.* configuration
Vincent DEFERT <[email protected]>
| Newsgroups | gmane.os.netbsd.ports.arm |
|---|---|
| Message-ID | <[email protected]> |
Thank you, it helps a lot! :)
On 22/06/2025 01:47, Valery Ushakov wrote:
> On Sat, Jun 21, 2025 at 12:08:50 +0000, Vincent DEFERT wrote:
>
>> Is there any documentation explaining this syntax?
> Have you checked config(5)? It's a bit terse, but it should answer
> all of your questions, I think.
>
>> - what the optional 'with meson_uart' means
>> - where and how the 'meson_uart' boolean is set
> | Different attach definitions must use different names using
> | the with option. It is then possible to use the associated
> | name as a conditional element in a file statement.
>
>
>> - whether there is a relationship between the names in those configuration
>> files and the first argument of the CFATTACH_DECL_NEW macro
> Yes, config(1) creates (among other things) the ioconf.c file for the
> kernel, and "attach" directives
>
> attach base at attr[, attr[, ...]] [with name] [: dependencies]
>
> emit references to struct cfattach named either ${name}_ca, or
> ${base}_ca if there's no "with" clause.
>
> When you implement the attachment, you provide the struct cfattach
> definition with one of the CFATTACH_DECL* macros (that adds the "_ca"
> suffix to its first argument).
>
> So for
>
> attach foo at bar
>
> define CFATTACH_DECL*(foo, ...) - probably in what is your only driver
> file, foo.c that has both the driver and its only attachment.
>
> And for
>
> attach foo at bar with foo_bar
>
> define CFATTACH_DECL*(foo_bar, ...) in the file with that specific
> attachment, probably named dev/bar/foo_bar.c (or something similar
> under arch). The bar attachment glue is typically included into the
> kernel with
>
> file dev/bar/foo_bar.c foo_bar
>
> in dev/bar/file.bar where the conditional guard makes sure that file
> is used only when there's actually foo* at bar? attachment in your
> kernel config.
>
>
> -uwe