Skip to contentSkip to conversation

stubdom: fix make clean and distclean on a freshly cloned tree

PATCH In review Wei Liu 3 participants 4 messages Mar 2, 2015 – Mar 10, 2015 Kbuild

lore
Share & tools
lore

Wei Liu

author
#0 lore raw

PATCH v2 1/1 stubdom: fix make clean and distclean on a freshly cloned tree

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

Note that one subtle issue is that $(XEN_ROOT)/Config.mk tries to include $(XEN_ROOT)/config/$(XEN_OS).mk. In stubdom's case XEN_OS is "MiniOS". Then $(XEN_ROOT)/config/MiniOS.mk tries to include mini-os's Config.mk.

Since clean and distclean don't enforce existence of mini-os tree, don't include $(XEN_ROOT)/Config.mk to avoid getting error due to the aforementioned issue.

Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Samuel Thibault <[email protected]>
---
 stubdom/Makefile      | 13 ++++++++-----
 stubdom/c/Makefile    |  2 ++
 stubdom/caml/Makefile |  2 ++
 3 files changed, 12 insertions(+), 5 deletions(-)
stubdom/Makefile +8 -5
index 1a1f263..f339b20 100644
@@ -1,15 +1,18 @@
 XEN_ROOT = $(CURDIR)/..
 MINI_OS = $(XEN_ROOT)/extras/mini-os
 
-ifeq ($(wildcard $(MINI_OS)/Config.mk),)
-$(error Please run `make mini-os-dir' in top-level directory)
-endif
-
 export XEN_OS=MiniOS
 
 export stubdom=y
 export debug=y
-include $(XEN_ROOT)/Config.mk
+
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
+  ifeq ($(wildcard $(MINI_OS)/Config.mk),)
+    $(error Please run `make mini-os-dir' in top-level directory)
+  endif
+  include $(XEN_ROOT)/Config.mk
+endif
+
 -include $(XEN_ROOT)/config/Stubdom.mk
 
 GNU_TARGET_ARCH:=$(XEN_TARGET_ARCH)
stubdom/c/Makefile +2 -0
index c646c26..b252dca 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 all: main.a
 
stubdom/caml/Makefile +2 -0
index e79c98d..f550de1 100644
@@ -1,6 +1,8 @@
 XEN_ROOT = $(CURDIR)/../..
 
+ifeq (,$(findstring clean,$(MAKECMDGOALS)))
 include $(XEN_ROOT)/Config.mk
+endif
 
 CAMLLIB = $(shell $(OCAMLC_CROSS_PREFIX)ocamlc -where)
 DEF_CPPFLAGS += -I$(CAMLLIB)
Signature · 1 line
1.9.1
#1 lore raw
Quoted 13 lines · Wei Liu

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

Note that one subtle issue is that $(XEN_ROOT)/Config.mk tries to include $(XEN_ROOT)/config/$(XEN_OS).mk. In stubdom's case XEN_OS is "MiniOS". Then $(XEN_ROOT)/config/MiniOS.mk tries to include mini-os's Config.mk.

Since clean and distclean don't enforce existence of mini-os tree, don't include $(XEN_ROOT)/Config.mk to avoid getting error due to the aforementioned issue.

Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Samuel Thibault <[email protected]>

Acked + applied, thanks.

#2 lore raw
Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ian Campbell
Sent: Tuesday, March 03, 2015 1:00 AM
To: Wei Liu
Cc: Samuel Thibault; Stefano Stabellini; Ian Jackson; [email protected]
Subject: Re: [Xen-devel] [PATCH v2] stubdom: fix make clean and distclean on a freshly cloned tree

Quoted 13 lines · Wei Liu

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

Note that one subtle issue is that $(XEN_ROOT)/Config.mk tries to include $(XEN_ROOT)/config/$(XEN_OS).mk. In stubdom's case XEN_OS is "MiniOS". Then $(XEN_ROOT)/config/MiniOS.mk tries to include mini-os's Config.mk.

Since clean and distclean don't enforce existence of mini-os tree, don't include $(XEN_ROOT)/Config.mk to avoid getting error due to the aforementioned issue.

Quoted 9 lines
Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Samuel Thibault <[email protected]>

Acked + applied, thanks.

When building pv-grub, error occurred with " ld: warning: app.lds contains output sections; did you forget -T?
ld: cannot find -lxenguest "

Building pv-grub steps(after building xen and tools):
"cd xen
make mini-os-dir
cd studom
./configure
make pv-grub"

There were some errors in mini-os.git/Makefile introduced by commit 55f7cd74.
1. The commit had deleted the XEN_ROOT variable in Makefile, bug it still used it;
2. And XEN_TARGET_ARCH was blank for the above steps; it will report " ld: cannot find -lxenguest ";
3. it lacks a "-T" option, it would report the warning " ld: warning: app.lds contains output sections; did you forget -T?".

Following patch may work around this issue.

Makefile +3 -2
index f16520e..dfb58c8 100644
@@ -6,6 +6,7 @@
 
 OBJ_DIR=$(CURDIR)
 TOPLEVEL_DIR=$(CURDIR)
+XEN_TARGET_ARCH=x86_64
 
 ifeq ($(MINIOS_CONFIG),)
 include Config.mk
@@ -165,7 +166,7 @@ OBJS := $(filter-out $(OBJ_DIR)/lwip%.o $(LWO), $(OBJS))
 
 ifeq ($(libc),y)
 ifeq ($(CONFIG_XC),y)
-APP_LDLIBS += -L$(XEN_ROOT)/stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
+APP_LDLIBS += -L../../stubdom/libxc-$(XEN_TARGET_ARCH) -whole-archive -lxenguest -lxenctrl -no-whole-archive
 endif
 APP_LDLIBS += -lpci
 APP_LDLIBS += -lz
@@ -178,7 +179,7 @@ OBJS := $(filter-out $(OBJ_DIR)/daytime.o, $(OBJS))
 endif
 
 $(OBJ_DIR)/$(TARGET)_app.o: $(APP_OBJS) app.lds
-       $(LD) -r -d $(LDFLAGS) -\( $^ -\) $(APP_LDLIBS) --undefined main -o $@
+       $(LD) -r -d $(LDFLAGS) -\( $< -T app.lds -\) $(APP_LDLIBS) --undefined main -o $@
 
 ifneq ($(APP_OBJS),)
 APP_O=$(OBJ_DIR)/$(TARGET)_app.o __________________________________________

Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel

author
#3 lore raw
Quoted 42 lines · SongtaoX
Quoted 23 lines

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Ian Campbell
Sent: Tuesday, March 03, 2015 1:00 AM
To: Wei Liu
Cc: Samuel Thibault; Stefano Stabellini; Ian Jackson; [email protected]
Subject: Re: [Xen-devel] [PATCH v2] stubdom: fix make clean and distclean on a freshly cloned tree

Quoted 13 lines · Wei Liu

Clean and distclean targets need not depend on existence of the mini-os tree. Don't check for mini-os and don't try to blindly include mini-os's Config.mk when doing clean and distclean.

Note that one subtle issue is that $(XEN_ROOT)/Config.mk tries to include $(XEN_ROOT)/config/$(XEN_OS).mk. In stubdom's case XEN_OS is "MiniOS". Then $(XEN_ROOT)/config/MiniOS.mk tries to include mini-os's Config.mk.

Since clean and distclean don't enforce existence of mini-os tree, don't include $(XEN_ROOT)/Config.mk to avoid getting error due to the aforementioned issue.

Quoted 9 lines
Quoted 6 lines
Cc Ian Campbell <[email protected]>
Cc Ian Jackson <[email protected]>
Cc Stefano Stabellini <[email protected]>
Cc Samuel Thibault <[email protected]>

Acked + applied, thanks.

When building pv-grub, error occurred with " ld: warning: app.lds contains output sections; did you forget -T?
ld: cannot find -lxenguest "

Building pv-grub steps(after building xen and tools):
"cd xen
make mini-os-dir
cd studom
./configure
make pv-grub"

Quoted 7 lines

There were some errors in mini-os.git/Makefile introduced by commit 55f7cd74.
1. The commit had deleted the XEN_ROOT variable in Makefile, bug it still used it;
2. And XEN_TARGET_ARCH was blank for the above steps; it will report " ld: cannot find -lxenguest ";
3. it lacks a "-T" option, it would report the warning " ld: warning: app.lds contains output sections; did you forget -T?".

Following patch may work around this issue.

Thanks for reporting. The patch below is not correct.

I will submit a patch series to fix these problems and CC you.

We.