Skip to contentSkip to conversation

xen: FreeBSD build fixes

PATCH In review Roger Pau Monne 2 participants 13 messages Jul 2, 2018

lore
Share & tools
lore
#0 lore raw

cover xen: FreeBSD build fixes

Hello,

This series contains some minor FreeBSD build fixes and improvements required in order to add a Xen build on FreeBSD to osstest.

Thanks, Roger.

Roger Pau Monne (4):
firmware/seabios: fix build on systems with non GNU toolchains
tests: disable x86 emulator test harness when using clang tests/xs: use ENOENT instead of ENODATA
build: fix include paths in FreeBSD

 config/FreeBSD.mk              |  4 ++++
 tools/firmware/Makefile        | 13 ++++++++-----
 tools/tests/Makefile           |  2 ++
 tools/tests/xenstore/xs-test.c | 16 ++++++++--------
 4 files changed, 22 insertions(+), 13 deletions(-)
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/4 firmware/seabios: fix build on systems with non GNU toolchains

SeaBIOS requires gcc and GNU ld in order to build, so allow setting SEABIOSCC and SEABIOSLD by the caller when building in order to pass the path to the compiler and linker that should be used when building SeaBIOS.

Note that the LD32BIT-y variable was used by FreeBSD builds and is no longer needed due to the ability to select the LD to use for SeaBIOS builds, so remove it.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/firmware/Makefile | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)
tools/firmware/Makefile +8 -5
index 5a7cf7766d..842b48c3d3 100644
@@ -19,7 +19,8 @@ SUBDIRS-$(CONFIG_ROMBIOS) += etherboot
 SUBDIRS-$(CONFIG_PV_SHIM) += xen-dir
 SUBDIRS-y += hvmloader
 
-LD32BIT-$(CONFIG_FreeBSD) := LD32BIT_FLAG=-melf_i386_fbsd
+SEABIOSCC ?= $(CC)
+SEABIOSLD ?= $(LD)
 
 ovmf-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(OVMF_UPSTREAM_URL) $(OVMF_UPSTREAM_REVISION) ovmf-dir
@@ -28,7 +29,7 @@ ovmf-dir:
 seabios-dir:
 	GIT=$(GIT) $(XEN_ROOT)/scripts/git-checkout.sh $(SEABIOS_UPSTREAM_URL) $(SEABIOS_UPSTREAM_REVISION) seabios-dir
 	cp seabios-config seabios-dir/.config;
-	$(MAKE) -C seabios-dir olddefconfig
+	$(MAKE) -C seabios-dir olddefconfig CC=$(SEABIOSCC) LD=$(SEABIOSLD)
 
 .PHONY: all
 all: $(SUBDIRS-y)
@@ -41,8 +42,7 @@ ifeq ($(CONFIG_ROMBIOS),y)
 	false ; \
 	fi
 endif
-	$(MAKE) $(LD32BIT-y) CC=$(CC) PYTHON=$(PYTHON) subdirs-$@
-
+	$(MAKE) CC=$(CC) PYTHON=$(PYTHON) subdirs-$@
 
 .PHONY: install
 install: all
@@ -114,7 +114,7 @@ seabios-dir-force-update: seabios-dir
 
 subdir-clean-seabios-dir:
 	set -e; if test -d seabios-dir/.; then \
-		$(MAKE) -C seabios-dir clean; \
+		$(MAKE) -C seabios-dir CC=$(SEABIOSCC) LD=$(SEABIOSLD) clean; \
 	fi
 
 subtree-force-update:
@@ -128,3 +128,6 @@ endif
 subtree-force-update-all:
 	$(MAKE) seabios-dir-force-update
 	$(MAKE) ovmf-dir-force-update
+
+subdir-all-seabios-dir: seabios-dir
+	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) all;
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 1/4
#2 lore raw

Re: [PATCH 1/4] firmware/seabios: fix build on systems with non GNU toolchains

On Mon, Jul 02, 2018 at 10:28:23AM +0200, Roger Pau Monne wrote:
[...]

tools/firmware/Makefile endif · line 133

Quoted 9 lines

subtree-force-update:

tools/firmware/Makefile +3 -0
@@ -128,3 +128,6 @@ endif
 subtree-force-update-all:
 	$(MAKE) seabios-dir-force-update
 	$(MAKE) ovmf-dir-force-update
+
+subdir-all-seabios-dir: seabios-dir
+	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) all;

There is a pattern rule in Rules.mk, so I would very much avoid having it redefined.

On the other hand, you're not the first one to add such rules, so I won't object to this patch either.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#3 lore raw

Re: [PATCH 1/4] firmware/seabios: fix build on systems with non GNU toolchains

Quoted 14 lines · Wei Liu

On Mon, Jul 02, 2018 at 10:28:23AM +0200, Roger Pau Monne wrote:
[...]

tools/firmware/Makefile endif · line 133

Quoted 9 lines

subtree-force-update:

tools/firmware/Makefile +3 -0
@@ -128,3 +128,6 @@ endif
 subtree-force-update-all:
 	$(MAKE) seabios-dir-force-update
 	$(MAKE) ovmf-dir-force-update
+
+subdir-all-seabios-dir: seabios-dir
+	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) all;

There is a pattern rule in Rules.mk, so I would very much avoid having it redefined.

I know, but I need to redefine it so I can pass the extra options. I don't see any better way to do this TBH.

Quoted 4 lines

On the other hand, you're not the first one to add such rules, so I won't object to this patch either.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#4 lore raw

Re: [PATCH 1/4] firmware/seabios: fix build on systems with non GNU toolchains

Quoted 16 lines · Roger Pau Monné
Quoted 14 lines · Wei Liu

On Mon, Jul 02, 2018 at 10:28:23AM +0200, Roger Pau Monne wrote:
[...]

tools/firmware/Makefile endif · line 133

Quoted 9 lines

subtree-force-update:

tools/firmware/Makefile +3 -0
@@ -128,3 +128,6 @@ endif
 subtree-force-update-all:
 	$(MAKE) seabios-dir-force-update
 	$(MAKE) ovmf-dir-force-update
+
+subdir-all-seabios-dir: seabios-dir
+	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) all;

There is a pattern rule in Rules.mk, so I would very much avoid having it redefined.

Quoted 2 lines

I know, but I need to redefine it so I can pass the extra options. I don't see any better way to do this TBH.

Oh, can you try the following to see if it works?

  subdir-all-seabios-dir: CC=$(SEABIOSCC) LD=$(SEABIOSLD)

See
https://ftp.gnu.org/old-gnu/Manuals/make-3.79.1/html_chapter/make_6.html#SEC69

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#5 lore raw

Re: [PATCH 1/4] firmware/seabios: fix build on systems with non GNU toolchains

Quoted 17 lines · Wei Liu
Quoted 16 lines · Roger Pau Monné
Quoted 14 lines · Wei Liu

On Mon, Jul 02, 2018 at 10:28:23AM +0200, Roger Pau Monne wrote:
[...]

tools/firmware/Makefile endif · line 133

Quoted 9 lines

subtree-force-update:

tools/firmware/Makefile +3 -0
@@ -128,3 +128,6 @@ endif
 subtree-force-update-all:
 	$(MAKE) seabios-dir-force-update
 	$(MAKE) ovmf-dir-force-update
+
+subdir-all-seabios-dir: seabios-dir
+	$(MAKE) -C $< CC=$(SEABIOSCC) LD=$(SEABIOSLD) PYTHON=$(PYTHON) all;

There is a pattern rule in Rules.mk, so I would very much avoid having it redefined.

Quoted 6 lines
Quoted 2 lines

I know, but I need to redefine it so I can pass the extra options. I don't see any better way to do this TBH.

Oh, can you try the following to see if it works?

  subdir-all-seabios-dir: CC=$(SEABIOSCC) LD=$(SEABIOSLD)

This sadly doesn't seem to work. I assume this is some kind of weird behaviour of the Xen build system? Is this due to the patter rules that the build system uses?

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#6 lore raw

PATCH 2/4 tests: disable x86 emulator test harness when using clang

In reply to Roger Pau Monne

clang is not capable of building the x86 emulator test harness, so disconnect it from the clang build until it can be fixed.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/tests/Makefile | 2 ++
 1 file changed, 2 insertions(+)
tools/tests/Makefile +2 -0
index f6942a93fb..2522ea5063 100644
@@ -10,7 +10,9 @@ SUBDIRS-y += mem-sharing
 ifeq ($(XEN_TARGET_ARCH),__fixme__)
 SUBDIRS-y += regression
 endif
+ifneq ($(clang),y)
 SUBDIRS-$(CONFIG_X86) += x86_emulator
+endif
 SUBDIRS-y += xen-access
 SUBDIRS-y += xenstore
 SUBDIRS-$(CONFIG_HAS_PCI) += vpci
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 2/4
#7 lore raw

Re: [PATCH 2/4] tests: disable x86 emulator test harness when using clang

Quoted 4 lines · Roger Pau Monne

clang is not capable of building the x86 emulator test harness, so disconnect it from the clang build until it can be fixed.

Oh well.

Don't you need to disable afl harness build as well?

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#8 lore raw

Re: [PATCH 2/4] tests: disable x86 emulator test harness when using clang

Quoted 11 lines · Wei Liu
Quoted 4 lines · Roger Pau Monne

clang is not capable of building the x86 emulator test harness, so disconnect it from the clang build until it can be fixed.

Oh well.

Don't you need to disable afl harness build as well?

Hm, that seems to build fine so far (at least in my tests), so I will leave it for now.

Thanks, Roger.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#9 lore raw

PATCH 3/4 tests/xs: use ENOENT instead of ENODATA

In reply to Roger Pau Monne

ENODATA is not part of the standard set of errno values, so use ENOENT instead. This fixes the build on FreeBSD.

---
Cc: Ian Jackson <[email protected]>
Cc: Wei Liu <[email protected]>

---
 tools/tests/xenstore/xs-test.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)
tools/tests/xenstore/xs-test.c +8 -8
index eb5fe55722..38e71d4f92 100644
@@ -155,7 +155,7 @@ static int verify_node(char *node, char *data, unsigned int size)
     if ( !buf )
         return errno;
 
-    ret = (len == size && !memcmp(buf, data, len)) ? 0 : ENODATA;
+    ret = (len == size && !memcmp(buf, data, len)) ? 0 : ENOENT;
     free(buf);
 
     return ret;
@@ -237,10 +237,10 @@ static int test_dir_deinit(uintptr_t par)
             if ( dir[i][0] == 'a' + j && dir[i][1] == 0 )
                 break;
         if ( i == num )
-            rc = ENODATA;
+            rc = ENOENT;
     }
     if ( num != WRITE_BUFFERS_N )
-            rc = ENODATA;
+            rc = ENOENT;
     free(dir);
     return rc;
 }
@@ -320,14 +320,14 @@ static int test_ta2(uintptr_t par)
         buf = xs_read(xsh, t, paths[0], &len);
         if ( !buf )
             goto out;
-        errno = (len == 1 && buf[0] == 'b') ? 0 : ENODATA;
+        errno = (len == 1 && buf[0] == 'b') ? 0 : ENOENT;
         free(buf);
         if ( errno )
             goto out;
         buf = xs_read(xsh, XBT_NULL, paths[0], &len);
         if ( !buf )
             goto out;
-        errno = (len == 1 && buf[0] == 'a') ? 0 : ENODATA;
+        errno = (len == 1 && buf[0] == 'a') ? 0 : ENOENT;
         free(buf);
         if ( errno )
             goto out;
@@ -375,7 +375,7 @@ static int test_ta3(uintptr_t par)
     buf = xs_read(xsh, t, paths[0], &len);
     if ( !buf )
         goto out;
-    errno = (len == 1 && buf[0] == 'a') ? 0 : ENODATA;
+    errno = (len == 1 && buf[0] == 'a') ? 0 : ENOENT;
     free(buf);
     if ( errno )
         goto out;
@@ -384,12 +384,12 @@ static int test_ta3(uintptr_t par)
     buf = xs_read(xsh, t, paths[0], &len);
     if ( !buf )
         goto out;
-    errno = (len == 1 && buf[0] == 'c') ? 0 : ENODATA;
+    errno = (len == 1 && buf[0] == 'c') ? 0 : ENOENT;
     free(buf);
     if ( errno )
         goto out;
     if ( xs_transaction_end(xsh, t, false) || errno != EAGAIN )
-        return ENODATA;
+        return ENOENT;
     return 0;
 
  out:
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 3/4
#10 lore raw

Re: [PATCH 3/4] tests/xs: use ENOENT instead of ENODATA

Quoted 4 lines · Roger Pau Monne

ENODATA is not part of the standard set of errno values, so use ENOENT instead. This fixes the build on FreeBSD.

Linux manpage suggest ENODATA and ENOENT belong to the same standard, but [0] disagrees.

This being a test utility makes this patch less of a concern.

0: http://pubs.opengroup.org/onlinepubs/000095399/basedefs/errno.h.html

Wei.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel

#11 lore raw

PATCH 4/4 build: fix include paths in FreeBSD

In reply to Roger Pau Monne

FreeBSD package manager uses /usr/local/ as the default install path, but that's not part of the compiler search path, so add it using the APPEND_{LIB/INCLUDES} variables.

---
Cc: Andrew Cooper <[email protected]>
Cc: George Dunlap <[email protected]>
Cc: Ian Jackson <[email protected]>
Cc: Jan Beulich <[email protected]>
Cc: Julien Grall <[email protected]>
Cc: Konrad Rzeszutek Wilk <[email protected]>
Cc: Stefano Stabellini <[email protected]>
Cc: Tim Deegan <[email protected]>
Cc: Wei Liu <[email protected]>

---
 config/FreeBSD.mk | 4 ++++
 1 file changed, 4 insertions(+)
config/FreeBSD.mk +4 -0
index afeaefbde2..98a5117e60 100644
@@ -3,3 +3,7 @@ include $(XEN_ROOT)/config/StdGNU.mk
 # No wget on FreeBSD base system
 WGET = ftp
 PKG_INSTALLDIR = ${prefix}/libdata/pkgconfig
+
+# Add the default pkg install path
+APPEND_LIB += /usr/local/lib
+APPEND_INCLUDES += /usr/local/include
Signature · 7 lines
2.17.1


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Acked-by on v1 4/4
#12 lore raw

Re: [PATCH 4/4] build: fix include paths in FreeBSD

Quoted 5 lines · Roger Pau Monne

FreeBSD package manager uses /usr/local/ as the default install path, but that's not part of the compiler search path, so add it using the APPEND_{LIB/INCLUDES} variables.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel