stubdom: prepare more fine grained Xen library usage
cover stubdom: prepare more fine grained Xen library usage
Prepare the build system of stubdoms to allow a more fine grained Xen library usage per stubdom (today its all or none).
This is a first step to set the stage for related Mini-OS changes which are required to have stubdoms using e.g. only stable Xen libraries.
Juergen Gross (4):
stubdom: add local .gitignore file
stubdom: explcitly add libc and lwip Mini-OS config options
build: move xenlibs-dependencies make definition to uselibs.mk
stubdom: add fine grained library config items to Mini-OS configs
.gitignore | 37 +------------------------ stubdom/.gitignore | 37 +++++++++++++++++++++++++ stubdom/Makefile | 49 +++++++++++++++++++++++++--------- stubdom/c/minios.cfg | 2 ++ stubdom/grub/minios.cfg | 3 ++- stubdom/ioemu-minios.cfg | 2 ++ stubdom/vtpm/minios.cfg | 3 ++- stubdom/vtpmmgr/minios.cfg | 3 ++- stubdom/xenstore-minios.cfg | 1 + stubdom/xenstorepvh-minios.cfg | 1 + tools/Rules.mk | 7 ----- tools/libs/uselibs.mk | 7 +++++ 12 files changed, 94 insertions(+), 58 deletions(-) create mode 100644 stubdom/.gitignore
Signature · 1 line
2.43.0
PATCH 1/4 stubdom: add local .gitignore file
Add a stubdom specfic .gitignore file.
--- .gitignore | 37 +------------------------------------ stubdom/.gitignore | 36 ++++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+), 36 deletions(-) create mode 100644 stubdom/.gitignore
.gitignore +1 -36
@@ -39,7 +39,6 @@ cscope.po.out .vscode dist -stubdom/*.tar.gz autom4te.cache/ automation/build/yocto/*.dockerfile
@@ -66,41 +65,7 @@ docs/pdf/ docs/txt/ extras/ install/* -stubdom/*-minios-config.mk -stubdom/autom4te.cache/ -stubdom/binutils-* -stubdom/config.cache -stubdom/config.log -stubdom/config.status -stubdom/cross-root-* -stubdom/gcc-* -stubdom/gmp-* -stubdom/grub-* -stubdom/include -stubdom/ioemu -stubdom/ioemu/ -stubdom/libs-* -stubdom/libxencall-* -stubdom/libxenevtchn-* -stubdom/libxenforeignmemory-* -stubdom/libxengnttab-* -stubdom/libxentoolcore-* -stubdom/libxentoollog-* -stubdom/lwip-* -stubdom/lwip/ -stubdom/mini-os-* -stubdom/mk-headers-* -stubdom/newlib-1.* -stubdom/newlib-x86* -stubdom/pciutils-* -stubdom/pkg-config/* -stubdom/polarssl-* -stubdom/stubdompath.sh -stubdom/tpm_emulator-* -stubdom/vtpm/vtpm_manager.h -stubdom/xenstore -stubdom/xenstorepvh -stubdom/zlib-* + tools/*/build/lib*/*.py tools/autom4te.cache/ tools/config.h
stubdom/.gitignore new file +36 -0
@@ -0,0 +1,36 @@ +/*.tar.gz +/*-minios-config.mk +/autom4te.cache/ +/binutils-* +/config.cache +/config.log +/config.status +/cross-root-* +/gcc-* +/gmp-* +/grub-* +/include +/ioemu +/ioemu/ +/libs-* +/libxencall-* +/libxenevtchn-* +/libxenforeignmemory-* +/libxengnttab-* +/libxentoolcore-* +/libxentoollog-* +/lwip-* +/lwip/ +/mini-os-* +/mk-headers-* +/newlib-1.* +/newlib-x86* +/pciutils-* +/pkg-config/* +/polarssl-* +/stubdompath.sh +/tpm_emulator-* +/vtpm/vtpm_manager.h +/xenstore +/xenstorepvh +/zlib-*
Signature · 1 line
2.43.0
Re: [PATCH 1/4] stubdom: add local .gitignore file
Quoted 1 line · Juergen Gross
Add a stubdom specfic .gitignore file.
More like "Move stubdom specific ignored file into it." because there's no changes to the list of ignored paths, and we don't usually need to repeate the title of the commit in its description in the Xen repo.
Quoted 1 line
Signed-off-by Juergen Gross <[email protected]>
In any case all looks fine:
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
PATCH 2/4 stubdom: explcitly add libc and lwip Mini-OS config options
In reply to Juergen GrossToday the Mini-OS build systems derives libc and lwip config options from the stubdom and LWIPDIR make variables supplied by the Xen build system.
In order to prepare those being explicit Mini-OS config options, add them to the related stubdom Mini-OS config files.
While at it remove the CONFIG_START_NETWORK setting from config files disabling lwip, as CONFIG_START_NETWORK requires lwip for becoming effective.
--- stubdom/c/minios.cfg | 2 ++ stubdom/grub/minios.cfg | 3 ++- stubdom/ioemu-minios.cfg | 2 ++ stubdom/vtpm/minios.cfg | 3 ++- stubdom/vtpmmgr/minios.cfg | 3 ++- stubdom/xenstore-minios.cfg | 1 + stubdom/xenstorepvh-minios.cfg | 1 + 7 files changed, 12 insertions(+), 3 deletions(-)
stubdom/c/minios.cfg +2 -0
@@ -0,0 +1,2 @@ +CONFIG_LIBC=y +CONFIG_LWIP=y
stubdom/grub/minios.cfg +2 -1
@@ -1,3 +1,4 @@ -CONFIG_START_NETWORK=n +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_SPARSE_BSS=n CONFIG_TPMFRONT=y
stubdom/ioemu-minios.cfg +2 -0
@@ -1,3 +1,5 @@ +CONFIG_LIBC=y +CONFIG_LWIP=y CONFIG_START_NETWORK=n CONFIG_QEMU_XS_ARGS=y CONFIG_PCIFRONT=y
stubdom/vtpm/minios.cfg +2 -1
@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=n CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=y
stubdom/vtpmmgr/minios.cfg +2 -1
@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=y CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=y
stubdom/xenstore-minios.cfg +1 -0
@@ -1,3 +1,4 @@ +CONFIG_LIBC=y CONFIG_BLKFRONT=n CONFIG_NETFRONT=n CONFIG_FBFRONT=n
stubdom/xenstorepvh-minios.cfg +1 -0
@@ -1,3 +1,4 @@ +CONFIG_LIBC=y CONFIG_PARAVIRT=n CONFIG_BLKFRONT=n CONFIG_NETFRONT=n
Signature · 1 line
2.43.0
Re: [PATCH 2/4] stubdom: explcitly add libc and lwip Mini-OS config options
stubdom/grub/minios.cfg line 4
Quoted 10 lines
stubdom/grub/minios.cfg +2
-1@@ -1,3 +1,4 @@ -CONFIG_START_NETWORK=n +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_SPARSE_BSS=n CONFIG_TPMFRONT=y
Grub does use LWIP, and just does not want mini-os to start network automatically, grub does so by itself from minios_probe.
Quoted 19 lines
stubdom/vtpm/minios.cfg +2
-1@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=n CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=ystubdom/vtpmmgr/minios.cfg +0
-0
stubdom/vtpmmgr/minios.cfg line 8
Quoted 9 lines
stubdom/vtpmmgr/minios.cfg +2
-1@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=y CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=y
I guess vtpm indeed don't need lwip.
Samuel
Re: [PATCH 2/4] stubdom: explcitly add libc and lwip Mini-OS config options
Quoted 5 lines · Samuel Thibault
Quoted 5 lines
stubdom/grub/minios.cfg +0
-0@@ -1,3 +1,4 @@
Quoted 8 lines
stubdom/grub/minios.cfg line 4
Quoted 5 lines
stubdom/grub/minios.cfg +2
-1-CONFIG_START_NETWORK=n +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_SPARSE_BSS=n CONFIG_TPMFRONT=yGrub does use LWIP, and just does not want mini-os to start network automatically, grub does so by itself from
minios_probe.
Are you sure? LWIPDIR isn't being set for building grub-stubdom. How does this work?
Juergen
Re: [PATCH 2/4] stubdom: explcitly add libc and lwip Mini-OS config options
Jürgen Groß, le mar. 08 oct. 2024 11:18:26 +0200, a ecrit:
Quoted 15 lines · Samuel Thibault
Quoted 5 lines
Quoted 5 lines
stubdom/grub/minios.cfg +0
-0@@ -1,3 +1,4 @@Quoted 8 lines
stubdom/grub/minios.cfg line 4
Quoted 5 lines
stubdom/grub/minios.cfg +2
-1-CONFIG_START_NETWORK=n +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_SPARSE_BSS=n CONFIG_TPMFRONT=yGrub does use LWIP, and just does not want mini-os to start network automatically, grub does so by itself from
minios_probe.
Quoted 2 lines
Are you sure? LWIPDIR isn't being set for building grub-stubdom. How does this work?
Ah, sorry, grub implements tcp/ip itself indeed, so it's only netfront that stubdom-grub needs.
Samuel
Re: [PATCH 2/4] stubdom: explcitly add libc and lwip Mini-OS config options
In reply to Juergen GrossJuergen Gross, le sam. 05 oct. 2024 17:15:46 +0200, a ecrit:
Quoted 4 lines
Today the Mini-OS build systems derives libc and lwip config options from the stubdom and LWIPDIR make variables supplied by the Xen build system.
Quoted 8 lines
In order to prepare those being explicit Mini-OS config options, add them to the related stubdom Mini-OS config files.
While at it remove the
CONFIG_START_NETWORKsetting from config files disabling lwip, asCONFIG_START_NETWORKrequires lwip for becoming effective.Signed-off-by Juergen Gross <[email protected]>
Quoted 86 lines
--- stubdom/c/minios.cfg | 2 ++ stubdom/grub/minios.cfg | 3 ++- stubdom/ioemu-minios.cfg | 2 ++ stubdom/vtpm/minios.cfg | 3 ++- stubdom/vtpmmgr/minios.cfg | 3 ++- stubdom/xenstore-minios.cfg | 1 + stubdom/xenstorepvh-minios.cfg | 1 + 7 files changed, 12 insertions(+), 3 deletions(-)stubdom/c/minios.cfg +2
-0@@ -0,0 +1,2 @@ +CONFIG_LIBC=y +CONFIG_LWIP=ystubdom/grub/minios.cfg +2
-1@@ -1,3 +1,4 @@ -CONFIG_START_NETWORK=n +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_SPARSE_BSS=n CONFIG_TPMFRONT=ystubdom/ioemu-minios.cfg +2
-0@@ -1,3 +1,5 @@ +CONFIG_LIBC=y +CONFIG_LWIP=y CONFIG_START_NETWORK=n CONFIG_QEMU_XS_ARGS=y CONFIG_PCIFRONT=ystubdom/vtpm/minios.cfg +2
-1@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=n CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=ystubdom/vtpmmgr/minios.cfg +2
-1@@ -1,7 +1,8 @@ +CONFIG_LIBC=y +CONFIG_LWIP=n CONFIG_TPMFRONT=y CONFIG_TPM_TIS=y CONFIG_TPMBACK=y -CONFIG_START_NETWORK=n CONFIG_TEST=n CONFIG_PCIFRONT=n CONFIG_BLKFRONT=ystubdom/xenstore-minios.cfg +1
-0@@ -1,3 +1,4 @@ +CONFIG_LIBC=y CONFIG_BLKFRONT=n CONFIG_NETFRONT=n CONFIG_FBFRONT=nstubdom/xenstorepvh-minios.cfg +1
-0@@ -1,3 +1,4 @@ +CONFIG_LIBC=y CONFIG_PARAVIRT=n CONFIG_BLKFRONT=n CONFIG_NETFRONT=nSignature · 1 line
2.43.0
Signature · 4 lines
Samuel Pour un père, autant mourir que de faire plein de calculs et pas s'occuper de son fils -+- y sur #ens-mim - sombres histoires de zombies -+-
PATCH 3/4 build: move xenlibs-dependencies make definition to uselibs.mk
In reply to Juergen GrossIn order to be able to use the xenlibs-dependencies macro from stubdom build, move it to tools/libs/uselibs.mk, which is included from current users and stubdom/Makefile.
No functional change intended.
--- tools/Rules.mk | 7 ------- tools/libs/uselibs.mk | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-)
tools/Rules.mk +0 -7
@@ -81,13 +81,6 @@ endif # include any CFLAGS or LDLIBS relating to libbar or libbaz unless # they use those libraries directly (not via libfoo) too. -# Give the list of Xen library that the libraries in $(1) are linked against, -# directly or indirectly. -define xenlibs-dependencies - $(sort $(foreach lib,$(1), \ - $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib))))) -endef - # Flags for linking recursive dependencies of Xen libraries in $(1) define xenlibs-rpath $(addprefix -Wl$(comma)-rpath-link=$(XEN_ROOT)/tools/libs/,$(call xenlibs-dependencies,$(1)))
tools/libs/uselibs.mk +7 -0
@@ -31,3 +31,10 @@ USELIBS_light := toollog evtchn toolcore ctrl store hypfs guest LIBS_LIBS += util USELIBS_util := light FILENAME_util := xlutil + +# Give the list of Xen library that the libraries in $(1) are linked against, +# directly or indirectly. +define xenlibs-dependencies + $(sort $(foreach lib,$(1), \ + $(USELIBS_$(lib)) $(call xenlibs-dependencies,$(USELIBS_$(lib))))) +endef
Signature · 1 line
2.43.0
Re: [PATCH 3/4] build: move xenlibs-dependencies make definition to uselibs.mk
Quoted 7 lines · Juergen Gross
In order to be able to use the xenlibs-dependencies macro from stubdom build, move it to
tools/libs/uselibs.mk, which is included from current users and stubdom/Makefile.No functional change intended.
Signed-off-by Juergen Gross <[email protected]>
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
PATCH 4/4 stubdom: add fine grained library config items to Mini-OS configs
In reply to Juergen GrossToday Mini-OS can only be configured to use all or none Xen library. In order to prepare a more fine grained configuration scheme, add per library config items to the Mini-OS config files.
As some libraries pull in others, the config files need to be extended at build time to reflect those indirect library uses.
--- stubdom/.gitignore | 1 + stubdom/Makefile | 49 ++++++++++++++++++++++++++++++++++------------ 2 files changed, 38 insertions(+), 12 deletions(-)
stubdom/.gitignore +1 -0
@@ -1,3 +1,4 @@ +*.out.cfg /*.tar.gz /*-minios-config.mk /autom4te.cache/
stubdom/Makefile +37 -12
106 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH 4/4] stubdom: add fine grained library config items to Mini-OS configs
Quoted 5 lines · Juergen Gross
stubdom/Makefile +0
-0
stubdom/Makefile endef · line 349
Quoted 10 lines
stubdom/Makefile +7
-0@@ -340,6 +340,14 @@ endef $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib)))) +define BUILD_config + cp $< $@ + for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \ + u=`echo $$i | tr a-z A-Z`; \ + echo "CONFIG_LIBXEN$$u=y"; \ + done >> $@ +endef
I don't think I like having a recipe hidden like that in a variable, maybe if it was a full rule it would be a bit less annoying to me. But how about something slightly different:
First, the name, "GEN_config" would be a bit better, then we could have it only do the output and not writing any file:
define GEN_config
(cat '$<' && \
for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \
u=echo $$i | tr a-z A-Z; \
echo "CONFIG_LIBXEN$$u=y"; \
done)
endef
The this can be used in rules as:
$(GEN_config) > $@
Would that be ok?
(It might be better to have the macro not depends on the environment have take parameter explicitly which could be used as $(call GEN_config,$<,evtchn gnttab) > $@ or take a variable if it's useful elsewhere, but I'm already fine if $@ is taken out of the macro.)
stubdom/Makefile $(TARGETS_MINIOS): mini-os-%: · line 385
Quoted 12 lines
stubdom/Makefile +3
-2+ xenstore/stamp: $(XEN_ROOT)/tools/xenstored/Makefile.common $(do_links)@@ -373,8 +381,12 @@ $(TARGETS_MINIOS): mini-os-%: # ioemu ####### -ioemu-minios-config.mk: $(CURDIR)/ioemu-minios.cfg - MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config +ioemu-minios.out.cfg: APP_LIBS = evtchn gnttab ctrl guest +ioemu-minios.out.cfg: $(CURDIR)/ioemu-minios.cfg Makefile
Could you change the suffix to ".gen.cfg"? ".out.cfg" is a bit generic while "generated" is more common for the kind of file that are automatically generated by the build system for it's own use.
BTW, in the first prerequisite, $(CURDIR) isn't necessary anymore, it was only to be used in "MINIOS_CONFIG" just below.
stubdom/Makefile $(TARGETS_MINIOS): mini-os-%: · line 389
Quoted 4 lines
stubdom/Makefile +4
-0+ $(BUILD_config) + +ioemu-minios-config.mk: ioemu-minios.out.cfg + MINIOS_CONFIG="$(CURDIR)/$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config
Thanks,
Signature · 5 lines
Anthony Perard | Vates XCP-ng Developer XCP-ng & Xen Orchestra - Vates solutions web: https://vates.tech
Re: [PATCH 4/4] stubdom: add fine grained library config items to Mini-OS configs
Quoted 29 lines · Anthony PERARD
Quoted 5 lines · Juergen Gross
stubdom/Makefile +0
-0stubdom/Makefile endef · line 349
Quoted 10 lines
stubdom/Makefile +7
-0@@ -340,6 +340,14 @@ endef $(foreach lib,$(STUB_LIBS),$(eval $(call BUILD_lib,$(lib)))) +define BUILD_config + cp $< $@ + for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \ + u=`echo $$i | tr a-z A-Z`; \ + echo "CONFIG_LIBXEN$$u=y"; \ + done >> $@ +endefI don't think I like having a recipe hidden like that in a variable, maybe if it was a full rule it would be a bit less annoying to me. But how about something slightly different:
First, the name, "
GEN_config" would be a bit better, then we could have it only do the output and not writing any file:define
GEN_config
(cat '$<' && \for i in $(sort $(APP_LIBS) $(call xenlibs-dependencies,$(APP_LIBS))); do \ u=`echo $$i | tr a-z A-Z`; \ echo "CONFIG_LIBXEN$$u=y"; \
Quoted 7 lines
done)
endefThe this can be used in rules as:
$(GEN_config) > $@Would that be ok?
Absolutely fine with me.
Quoted 13 lines
(It might be better to have the macro not depends on the environment have take parameter explicitly which could be used as $(call GEN_config,$<,evtchn gnttab) > $@ or take a variable if it's useful elsewhere, but I'm already fine if $@ is taken out of the macro.)
Quoted 8 lines
stubdom/Makefile +1
-0+ xenstore/stamp: $(XEN_ROOT)/tools/xenstored/Makefile.common $(do_links)@@ -373,8 +381,12 @@ $(TARGETS_MINIOS): mini-os-%: # ioemu #######
Quoted 8 lines
stubdom/Makefile $(TARGETS_MINIOS): mini-os-%: · line 385
Quoted 4 lines
stubdom/Makefile +2
-2-ioemu-minios-config.mk: $(CURDIR)/ioemu-minios.cfg - MINIOS_CONFIG="$<" CONFIG_FILE="$(CURDIR)/$@" $(MAKE) DESTDIR= -C $(MINI_OS) config +ioemu-minios.out.cfg: APP_LIBS = evtchn gnttab ctrl guest +ioemu-minios.out.cfg: $(CURDIR)/ioemu-minios.cfg MakefileCould you change the suffix to ".gen.cfg"? ".out.cfg" is a bit generic while "generated" is more common for the kind of file that are automatically generated by the build system for it's own use.
Okay.
Quoted 3 lines
BTW, in the first prerequisite, $(CURDIR) isn't necessary anymore, it was only to be used in "
MINIOS_CONFIG" just below.
Ah, right. Will remove it.
Juergen