mbox series

[XEN,v3,00/23] xen: Build system improvements

Message ID 20200226113355.2532224-1-anthony.perard@citrix.com (mailing list archive)
Headers show
Series xen: Build system improvements | expand

Message

Anthony PERARD Feb. 26, 2020, 11:33 a.m. UTC
Patch series available in this git branch:
https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v3

v3:
- new patches that do some cleanup or fix issues
- have rework most patches, to have better commit message or change the coding
  style, or fix issues that I've seen. There were some cases where CFLAGS were
  missing.
  See patch notes for details
- introduce if_changed*. That plenty of new patches on top of what we had in v2.
  (those changes ignore CONFIG_LTO=y, I'll see about fixing that later)

(There is more to come in order to use fixdep from Linux, but that's not ready)

v2.1:
- some fixes

v2:
Rather than taking Kbuild and making it work with Xen, the v2 takes the opposite
approach of slowly transforming our current build system into Kbuild. That have
the advantage of keeping all the feature we have and making the patches much
easier to review. Kconfig update is done in an other patch series.

Hi,

I have work toward building Xen (the hypervisor) with Linux's build system,
Kbuild.

The main reason for that is to be able to have out-of-tree build. It's annoying
when a build fail because of the pvshim. Other benefit is a much faster
rebuild, and `make clean` doesn't take ages, and better dependencies to figure
out what needs to be rebuild.

So, we are not there yet, but the series already contain quite a few
improvement and cleanup. More patches are going to be added to the series.

Cheers,

Anthony PERARD (23):
  xen/include: remove include of Config.mk
  Makefile: Fix install-tests
  xen/build: Remove confusing comment on the %.s:%.S rule
  xen/build: remove use of AFLAGS-y
  xen/build: Allow to test clang .include without asm symlink
  xen/build: Fix section-renaming of libfdt and libelf
  xen/build: Use obj-y += subdir/ instead of subdir-y
  xen/build: use $(clean) shorthand for clean targets
  xen/build: extract clean target from Rules.mk
  xen/build: run targets csopes,tags,.. without Rules.mk
  xen/build: make tests in test/ directly
  xen/build: Move as-option-add to xen/
  xen/build: include include/config/auto.conf in main Makefile
  xen/build: use new $(c_flags) and $(a_flags) instead of $(CFLAGS)
  xen/build: have the root Makefile generates the CFLAGS
  xen/build: introduce if_changed and if_changed_rule
  xen/build: Start using if_changed
  xen/build: use if_changed on built_in.o
  xen/build: Use if_changed_rules with %.o:%.c targets
  xen/build: factorise generation of the linker scripts
  xen/build: Use if_changed for prelink*.o
  xen,symbols: rework file symbols selection
  xen/build: use if_changed to build guest_%.o

 .gitignore                           |   1 +
 Config.mk                            |  17 --
 Makefile                             |   6 +-
 xen/Makefile                         | 257 ++++++++++++++++++++-----
 xen/Rules.mk                         | 269 +++++++++++++++------------
 xen/arch/arm/Makefile                |  33 ++--
 xen/arch/arm/Rules.mk                |  93 ---------
 xen/arch/arm/arch.mk                 |  88 +++++++++
 xen/arch/arm/arm32/Makefile          |   2 +-
 xen/arch/arm/arm64/Makefile          |   2 +-
 xen/arch/arm/efi/Makefile            |   2 +-
 xen/arch/x86/Makefile                |  55 +++---
 xen/arch/x86/Rules.mk                |  91 +--------
 xen/arch/x86/acpi/Makefile           |   2 +-
 xen/arch/x86/arch.mk                 |  84 +++++++++
 xen/arch/x86/cpu/Makefile            |   4 +-
 xen/arch/x86/efi/Makefile            |   9 +-
 xen/arch/x86/guest/Makefile          |   4 +-
 xen/arch/x86/hvm/Makefile            |   6 +-
 xen/arch/x86/mm/Makefile             |  19 +-
 xen/arch/x86/mm/hap/Makefile         |  15 +-
 xen/arch/x86/mm/shadow/Makefile      |  15 +-
 xen/arch/x86/x86_64/Makefile         |   2 +-
 xen/common/Makefile                  |  10 +-
 xen/common/libelf/Makefile           |  14 +-
 xen/common/libfdt/Makefile           |  11 +-
 xen/drivers/Makefile                 |  14 +-
 xen/drivers/acpi/Makefile            |   6 +-
 xen/drivers/passthrough/Makefile     |   8 +-
 xen/drivers/passthrough/vtd/Makefile |   2 +-
 xen/include/Makefile                 |   4 +-
 xen/lib/Makefile                     |   2 +-
 xen/scripts/Kbuild.include           | 134 +++++++++++++
 xen/scripts/Makefile.clean           |  30 +++
 xen/tools/symbols.c                  |  22 ++-
 xen/xsm/Makefile                     |   2 +-
 xen/xsm/flask/Makefile               |  21 ++-
 xen/xsm/flask/ss/Makefile            |   2 +-
 38 files changed, 870 insertions(+), 488 deletions(-)
 create mode 100644 xen/arch/arm/arch.mk
 create mode 100644 xen/arch/x86/arch.mk
 create mode 100644 xen/scripts/Makefile.clean

Comments

Stewart Hildebrand Feb. 27, 2020, 9:17 p.m. UTC | #1
On Wednesday, February 26, 2020 6:34 AM, Anthony PERARD wrote:
>Patch series available in this git branch:
>https://xenbits.xen.org/git-http/people/aperard/xen-unstable.git br.build-system-xen-v3
>
>v3:
>- new patches that do some cleanup or fix issues
>- have rework most patches, to have better commit message or change the coding
>  style, or fix issues that I've seen. There were some cases where CFLAGS were
>  missing.
>  See patch notes for details
>- introduce if_changed*. That plenty of new patches on top of what we had in v2.
>  (those changes ignore CONFIG_LTO=y, I'll see about fixing that later)
>
>(There is more to come in order to use fixdep from Linux, but that's not ready)
>
>v2.1:
>- some fixes
>
>v2:
>Rather than taking Kbuild and making it work with Xen, the v2 takes the opposite
>approach of slowly transforming our current build system into Kbuild. That have
>the advantage of keeping all the feature we have and making the patches much
>easier to review. Kconfig update is done in an other patch series.
>
>Hi,
>
>I have work toward building Xen (the hypervisor) with Linux's build system,
>Kbuild.
>
>The main reason for that is to be able to have out-of-tree build. It's annoying
>when a build fail because of the pvshim. Other benefit is a much faster
>rebuild, and `make clean` doesn't take ages, and better dependencies to figure
>out what needs to be rebuild.
>
>So, we are not there yet, but the series already contain quite a few
>improvement and cleanup. More patches are going to be added to the series.

Thanks for your efforts with this. With your br.build-system-xen-v3
branch, I'm having trouble doing an aarch64 build with early printk
enabled. I suspect the following unmerged patch that Julien authored
last September may have some helpful information:
https://lists.xenproject.org/archives/html/xen-devel/2019-09/msg01207.html

I tried the following...

echo "CONFIG_DEBUG=y" > xen/arch/arm/configs/arm64_defconfig
make -C xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=zynqmp defconfig
make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=zynqmp dist-xen

... but I was met with:
prelink.o:(.data+0x578): undefined reference to `early_puts'
aarch64-linux-gnu-ld: /home/stew/rpi/xen/xen/.xen-syms.0: hidden symbol `early_puts' isn't defined

Stew
Anthony PERARD March 6, 2020, 10:12 a.m. UTC | #2
On Thu, Feb 27, 2020 at 09:17:51PM +0000, Stewart Hildebrand wrote:
> Thanks for your efforts with this. With your br.build-system-xen-v3
> branch, I'm having trouble doing an aarch64 build with early printk
> enabled. I suspect the following unmerged patch that Julien authored
> last September may have some helpful information:
> https://lists.xenproject.org/archives/html/xen-devel/2019-09/msg01207.html

Thank you Stewart for testing! And thanks for pointing out Julien's
patch, that looks like the best way to fix the problem. I'll fix the
issue.

The issue is in patch
    [XEN PATCH v3 15/23] xen/build: have the root Makefile generates the CFLAGS
where EARLY_PRINTK isn't set when needed anymore.

> I tried the following...
> 
> echo "CONFIG_DEBUG=y" > xen/arch/arm/configs/arm64_defconfig
> make -C xen XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=zynqmp defconfig
> make XEN_TARGET_ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- CONFIG_EARLY_PRINTK=zynqmp dist-xen
> 
> ... but I was met with:
> prelink.o:(.data+0x578): undefined reference to `early_puts'
> aarch64-linux-gnu-ld: /home/stew/rpi/xen/xen/.xen-syms.0: hidden symbol `early_puts' isn't defined

Cheers,