How do GEOM_PART_* options configure geom_part_* modules??

Warner Losh imp at bsdimp.com
Thu Sep 28 15:54:40 UTC 2017


On Thu, Sep 28, 2017 at 9:31 AM, Nick Hibma <nick at van-laarhoven.org> wrote:

> I created a new kernel config file from scratch, wondered what the
> GEOM_PART_MBR option and friends were doing, search for them, didn't find
> them in the tree, and deleted them from my config. But... de resulting disk
> image didn't boot, because of the fact that it didn't recognise the MBR
> partitions (it only had a single diskid entry on the mount-root prompt).
>
> Can anyone explain to me how these kernel options work, as in: they are
> defined in kernel configs and as a consequence in opt_geom.h, but how are
> they actually used to select which geom_part_* modules/kernel parts to
> build? I thought these options were translated to stuff that cpp would use,
> but there are not uses of for example GEOM_PART_MBR anywhere for example!
>

The module always build them because they are listed in the module's
Makefile.

The kernel only sometimes does. Here's the key lines from conf/files:
files:geom/geom_bsd_enc.c optional geom_bsd | geom_part_bsd
files:geom/part/g_part_apm.c optional geom_part_apm
files:geom/part/g_part_bsd.c optional geom_part_bsd
files:geom/part/g_part_bsd64.c optional geom_part_bsd64
files:geom/part/g_part_ebr.c optional geom_part_ebr
files:geom/part/g_part_gpt.c optional geom_part_gpt
files:geom/part/g_part_ldm.c optional geom_part_ldm
files:geom/part/g_part_mbr.c optional geom_part_mbr
files:geom/part/g_part_vtoc8.c optional geom_part_vtoc8

which turn on/off which files get included. config "helpfully" convers the
upper case options to lower case for this.

Warner

Warner


> The only thing I was able to come up with, but could not figure out, was
> FEATURE() doing some magic.
>
> Thanks in advance for any pointers!
>
> Nick Hibma
> nick at van-laarhoven.org <mailto:nick at van-laarhoven.org>
>
> -- Open Source: We stand on the shoulders of giants.
>
>
> % grep -r GEOM_PART_ /usr/src/sys/ | grep -Ev '/conf/.*options'
> /usr/src/sys/geom/part/g_part_mbr.c:    "GEOM_PART_MBR Master Boot
> Record");
> /usr/src/sys/geom/part/g_part_ldm.c:    "GEOM_PART_LDM Logical Disk
> Manager");
> /usr/src/sys/geom/part/g_part_ldm.c:     * XXX: We use some knowledge
> about GEOM_PART_GPT internal
> /usr/src/sys/geom/part/g_part_ebr.c:#if defined(GEOM_PART_EBR_COMPAT)
> /usr/src/sys/geom/part/g_part_ebr.c:#ifndef GEOM_PART_EBR_COMPAT
> /usr/src/sys/geom/part/g_part_ebr.c:#if defined(GEOM_PART_EBR_COMPAT)
> /usr/src/sys/geom/part/g_part_ebr.c:#if defined(GEOM_PART_EBR_COMPAT)
> /usr/src/sys/geom/part/g_part_ebr.c:#if defined(GEOM_PART_EBR_COMPAT)
> /usr/src/sys/geom/part/g_part_ebr.c:#if defined(GEOM_PART_EBR_COMPAT)
> /usr/src/sys/geom/part/g_part_ebr.c:#ifndef GEOM_PART_EBR_COMPAT
> /usr/src/sys/geom/part/g_part_ebr.c:#ifndef GEOM_PART_EBR_COMPAT
> /usr/src/sys/geom/part/g_part_ebr.c:#ifndef GEOM_PART_EBR_COMPAT
> /usr/src/sys/geom/part/g_part_ebr.c:#ifndef GEOM_PART_EBR_COMPAT
> /usr/src/sys/geom/part/g_part.h:#ifndef _GEOM_PART_H_
> /usr/src/sys/geom/part/g_part.h:#define _GEOM_PART_H_
> /usr/src/sys/geom/part/g_part.h:#endif /* !_GEOM_PART_H_ */
>


More information about the freebsd-current mailing list