[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH RFC] build: respect top-level .config also for out-of-tree hypervisor builds


  • To: Jan Beulich <jbeulich@xxxxxxxx>
  • From: Anthony PERARD <anthony.perard@xxxxxxxxxx>
  • Date: Fri, 5 May 2023 17:08:12 +0100
  • Authentication-results: esa1.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: "xen-devel@xxxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxxx>, "Andrew Cooper" <andrew.cooper3@xxxxxxxxxx>, George Dunlap <george.dunlap@xxxxxxxxxx>, Julien Grall <julien@xxxxxxx>, Stefano Stabellini <sstabellini@xxxxxxxxxx>, Wei Liu <wl@xxxxxxx>
  • Delivery-date: Fri, 05 May 2023 16:08:42 +0000
  • Ironport-data: A9a23:3+8r5qzNCsK8S2c4dyd6t+cdxirEfRIJ4+MujC+fZmUNrF6WrkUFz mMeWWjSOf+INjSnLtsnbYnko00DsZ/Sx9UwTQdu+CAxQypGp/SeCIXCJC8cHc8wwu7rFxs7s ppEOrEsCOhuExcwcz/0auCJQUFUjP3OHfykTrafYEidfCc8IA85kxVvhuUltYBhhNm9Emult Mj75sbSIzdJ4RYtWo4vw//F+UIHUMja4mtC5QRjPa0T5jcyqlFOZH4hDfDpR5fHatE88t6SH 47r0Ly/92XFyBYhYvvNfmHTKxBirhb6ZGBiu1IOM0SQqkEqSh8ai87XAME0e0ZP4whlqvgqo Dl7WT5cfi9yVkHEsLx1vxC1iEiSN4UekFPMCSDXXcB+UyQq2pYjqhljJBheAGEWxgp4KWBU3 /YqNwxRUhKCibut/5bjZcZG3dt2eaEHPKtH0p1h5TTQDPJgSpHfWaTao9Rf2V/chOgXQ6yYP ZBAL2MyMlKZOUYn1lQ/UfrSmM+hgGX/dDtJ7kqYv6Mt70DYzRBr0airO93QEjCPbZwNzhrC9 jqdowwVBDkGEpuP6zyB9kvrobHzsz+4YIkvPuSBo6sCbFq7mTVIVUx+uUGAifuzh1O6WtlfA 1cJ4Sdopq83nGS7Q9+4UxCmrXqsuh8HR8EWA+A88BuKyKff/0CeHGdsZjxcbN0rsucmSDps0 UWG9/vyHiBmurCRTXOb95+XoCm0NCxTKnUNDQcbSSMV7t+lp5s85jrGVtt5GbS5psH0Ezr3h TuNqUADa6471JBRkf/hpBae3mzq/8KSJuIo2unJdmO/xAlLe7L5W46p5wHA0tIYA6mzFUbU6 RDohPOiAPAy4YClzXLdG79QTejwuJ5pIxWH3wcxQsBJGyCFvif6INsOuGwWyFJBaJ5sRNP/X KPEVeq9Drd3NWDiU6J4apnZ5y8Cnfm5ToSNuhw5g7NzjnlNmOyvpnsGiba4hTyFraTVufhX1 W2nWcitF20GLq9s0SC7QewQuZdymHBlnzmNGcmql0/4uVZ7WEN5tJ9faAfeBgzHxPrsTPrpH yZ3aJLRlkQ3vBzWaSjL648DRW03wYwALcmu8aR/L7fTSjeK7Ul9U5c9N5t9Id0690mU/8+Ul kyAtrhwkQWk3iKbc1XUMhiOqtrHBP5CkJ7yBgR0VX7A5pTpSdzHAHs3H3fvQYQayQ==
  • Ironport-hdrordr: A9a23:R/nPka8LOhLzFriCjfxuk+DjI+orL9Y04lQ7vn2ZKCYlCvBw8v rF8cjzuiWE7Ar5NEtQ/+xoW5PgfZq/z+8R3WB5B97LNzUO3lHYT72KwrGSoQEIcBeOkdK1u5 0QCpSWy+eeMbG5t6rHCcWDferICePmzJyV
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On Wed, Mar 15, 2023 at 03:58:59PM +0100, Jan Beulich wrote:
> With in-tree builds Config.mk includes a .config file (if present) from
> the top-level directory. Similar functionality is wanted with out-of-
> tree builds. Yet the concept of "top-level directory" becomes fuzzy in
> that case, because there is not really a requirement to have identical
> top-level directory structure in the output tree; in fact there's no
> need for anything top-level-ish there. Look for such a .config, but only
> if the tree layout matches (read: if the directory we're building in is
> named "xen").

Well, as long as the "xen/" part of the repository is the only build
system to be able to build out-of-srctree, there isn't going to be a
top-level .config possible in the build tree, as such .config will be
outside of the build tree. Reading outside of the build tree or source
tree might be problematic.

It's a possibility that some project might want to just build the
hypervisor, and they happened to name the build tree "xen", but they
also have a ".config" use for something else. Kconfig is using ".config"
for other reason for example, like we do to build Xen.

It might be better to have a different name instead of ".config", and
putting it in the build tree rather than the parent directory. Maybe
".xenbuild-config" ?


I've been using the optional makefile named "xen-version" to adjust
variable of the build system, with content like:

    export XEN_TARGET_ARCH=arm64
    export CROSS_COMPILE=aarch64-linux-gnu-

so that I can have multiple build tree for different arch, and not have
to do anything other than running make and do the expected build. Maybe
that's not possible because for some reason, the build system still
reconfigure some variable when entering a sub-directory, but that's a
start.


> Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx>
> ---
> RFC: The directory name based heuristic of course isn't nice. But I
>      couldn't think of anything better. Suggestions?

I can only thing of looking at a file that is in the build-tree rather
than outside of it. A file named ".xenbuild-config" proposed early for
example.

> RFC: There also being a .config in the top-level source dir would be a
>      little problematic: It would be included _after_ the one in the
>      object tree. Yet if such a scenario is to be expected/supported at
>      all, it makes more sense the other way around.

Well, that would mean teaching Config.mk about out-of-tree build that
part of the repository is capable of, or better would be to stop trying
to read ".config" from Config.mk, and handle the file in the different
sub-build systems. Or just let people writing ".config" files to handle
the cases in those .config files.

> --- a/xen/Makefile
> +++ b/xen/Makefile
> @@ -236,8 +236,17 @@ endif
>  
>  include scripts/Kbuild.include
>  
> -# Don't break if the build process wasn't called from the top level
> -# we need XEN_TARGET_ARCH to generate the proper config
> +# Don't break if the build process wasn't called from the top level.  We need
> +# XEN_TARGET_ARCH to generate the proper config.  If building outside of the
> +# source tree also check whether we need to include a "top-level" .config:
> +# Config.mk, using $(XEN_ROOT)/.config, would look only in the source tree.
> +ifeq ($(building_out_of_srctree),1)
> +# Try to avoid including a random unrelated .config: Assume our parent dir
> +# is a "top-level" one only when the objtree is .../xen.
> +ifeq ($(patsubst %/xen,,$(abs_objtree)),)
> +-include ../.config
> +endif
> +endif
>  include $(XEN_ROOT)/Config.mk
>  
>  # Set ARCH/SUBARCH appropriately.
> --- a/xen/Rules.mk
> +++ b/xen/Rules.mk
> @@ -17,6 +17,13 @@ __build:
>  
>  -include $(objtree)/include/config/auto.conf
>  
> +# See commentary around the similar contruct in Makefile.
> +ifneq ($(abs_objtree),$(abs_srctree))
> +ifeq ($(patsubst %/xen,,$(abs_objtree)),)
> +../.config: ;
> +-include ../.config
> +endif
> +endif
>  include $(XEN_ROOT)/Config.mk
>  include $(srctree)/scripts/Kbuild.include

There's another makefile, "scripts/Makefile.clean", doesn't this would
need to be change as well?

Cheers,

-- 
Anthony PERARD



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.