build: clean up kclean and distclean for kernel
PATCH 1/1 build: clean up kclean and distclean for kernel
* Don't delete non-existent %.tar.bz2 in buildconfigs/Rules.mk's %-mrproper
* Add a mrpropper target to buildconfigs/mk.linux-2.6-xen, and have this delete the local patch and tarball
* Make distclean depend on kdekete, rather than calling delete target by hand
* Stop kclean from erroring out if the kernel directory doesn't exist
* Remove patches/*/.makedep in top level Makefile rather than in buildconfigs/Rules.mk, as calling rules in the latter causes patches/*/.make to be created (Magnus)
Makefile +2 -2
@@ -123,13 +123,13 @@ clean:: # clean, but blow away kernel build tree plus tarballs .PHONY: distclean -distclean: +distclean: kdelete $(MAKE) -C xen distclean $(MAKE) -C tools distclean $(MAKE) -C docs distclean rm -rf dist patches/tmp - for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done for i in $(ALLSPARSETREES) ; do $(MAKE) $$i-mrproper ; done + rm -rf patches/*/.makedep # Linux name for GNU distclean .PHONY: mrproper
buildconfigs/Rules.mk +2 -5
@@ -59,10 +59,6 @@ ifneq ($(PATCHDIRS),) $(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep: @echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@ -.PHONY: clean -clean:: - rm -f patches/*/.makedep - ref-%/.valid-ref: pristine-%/.valid-pristine set -e rm -rf $(@D)
@@ -111,7 +107,8 @@ linux-2.6-xen.patch: ref-linux-$(LINUX_V rm -rf tmp-$@ %-mrproper: - rm -rf pristine-$(*)* ref-$(*)* $*.tar.bz2 + $(MAKE) -f buildconfigs/mk.$*-xen mrpropper + rm -rf pristine-$(*)* ref-$(*)* rm -rf $*-xen.patch .PHONY: config-update-pae
buildconfigs/mk.linux-2.6-xen +7 -1
@@ -47,8 +47,14 @@ config: $(LINUX_DIR)/include/linux/autoc .PHONY: clean clean:: - $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean + [ ! -d $(LINUX_DIR) ] || \ + $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean + .PHONY: delete delete: rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR) + +.PHONY: mrpropper +mrpropper: + rm -f $(LINUX_SRCS)
buildconfigs/mk.linux-2.6-xen config: $(LINUX_DIR)/include/linux/autoc · line 60
Quoted 4 lines · Horms
buildconfigs/mk.linux-2.6-xen +4
-0+ +.PHONY: mrpropper +mrpropper: + rm -f $(LINUX_SRCS)
Where does LINUX_SRCS come from?
-- Keir
Quoted 9 lines · Keir Fraser
buildconfigs/mk.linux-2.6-xen config: $(LINUX_DIR)/include/linux/autoc · line 60
Quoted 4 lines · Horms
buildconfigs/mk.linux-2.6-xen +4
-0+ +.PHONY: mrpropper +mrpropper: + rm -f $(LINUX_SRCS)Where does
LINUX_SRCScome from?
Ooops, I think thats part of another patch that never got merged. I'll replace LINUX_SRCS with something more appropriate and repost.
Signature · 2 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
cover build: clean up
Quoted 11 lines · Horms
Quoted 9 lines · Keir Fraser
buildconfigs/mk.linux-2.6-xen config: $(LINUX_DIR)/include/linux/autoc · line 60
Quoted 4 lines · Horms
buildconfigs/mk.linux-2.6-xen +4
-0+ +.PHONY: mrpropper +mrpropper: + rm -f $(LINUX_SRCS)Where does
LINUX_SRCScome from?
Quoted 2 lines
Ooops, I think thats part of another patch that never got merged. I'll replace
LINUX_SRCSwith something more appropriate and repost.
On further inspection I see that LINUX_SRCS used to exist, but has disapeared since I originally wrote the patch. I will post an update which removes the local tarball using the currently available LINUX_VER variable.
I will also post a second patch which reworks how the tarballs and patches are downloaded, in order to make the mirror site configuration more flexible. It also allows the mrpropper to remove the local patch file (if any) more easily. I guess this last bit could be incoporated into the previous patch, but to be honest I am not quite sure why.
Signature · 2 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
PATCH 1/2 build: clean up kclean and distclean for kernel
* Don't delete non-existent %.tar.bz2 in buildconfigs/Rules.mk's %-mrproper
* Add a mrpropper target to buildconfigs/mk.linux-2.6-xen, and have this delete the local tarball
- This should also delete the local patch, if there is one, but I am not sure how to do this with the current incarntation of the code, and I will post a subsequent patch which makes this easier and effects this chang. As there currently is no local patch this is not a big deal at this moment. (Horms)
* Make distclean depend on kdekete, rather than calling delete target by hand
* Stop kclean from erroring out if the kernel directory doesn't exist
* Remove patches/*/.makedep in top level Makefile rather than in buildconfigs/Rules.mk, as calling rules in the latter causes patches/*/.make to be created (Magnus)
Config.mk +11 -1
@@ -57,7 +57,17 @@ LDFLAGS += $(foreach i, $(EXTRA_LIB), -L CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) # Choose the best mirror to download linux kernel -KERNEL_REPO = http://www.kernel.org +DOWNLOAD_PATH_DEFAULT := .:.. +LINUX_REPO_DEFAULT := http://www.kernel.org/pub/linux/kernel/ +ifdef LINUX_SRC_PATH +DOWNLOAD_PATH ?= $(LINUX_SRC_PATH) # Compatibility +else +DOWNLOAD_PATH ?= $(DOWNLOAD_PATH_DEFAULT) +endif +DOWNLOAD_DIR := $(firstword $(subst :, ,$(DOWNLOAD_PATH))) +LINUX_REPO ?= $(LINUX_REPO_DEFAULT) +# LINUX_REPO_KERNEL_PATH Set in buildconfigs/Rules.mk, if not in environment +# LINUX_REPO_PATCH_PATH Set in buildconfigs/Rules.mk, if not in environment # If ACM_SECURITY = y, then the access control module is compiled # into Xen and the policy type can be set by the boot policy file
Makefile +14 -0
@@ -175,6 +175,20 @@ help: @echo ' install into prefix/lib/python<VERSION>' @echo ' instead of <PREFIX>/lib/python' @echo ' true if set to non-empty value, false otherwise' + @echo ' LINUX_REPO=URL - Base URL to download linux kernel from' + @echo ' Default: "$(LINUX_REPO_DEFAULT)"' + @echo ' LINUX_REPO_KERNEL_PATH=DIRECTORY' + @echo ' - LINUX_REPO assumes that the URL has the same directory' + @echo ' structure as $(LINUX_REPO_DEFAULT)' + @echo ' and the rest of the path to the tarball is derived.' + @echo ' If set, override the derivation.' + @echo ' Default: ""' + @echo ' LINUX_REPO_PATCHL_PATH=DIRECTORY' + @echo ' - LINUX_REPO assumes that the URL has the same directory' + @echo ' structure as $(LINUX_REPO_DEFAULT)' + @echo ' and the rest of the path to the patches is derived.' + @echo ' If set, override the derivation.' + @echo ' Default: ""' # Use this target with extreme care! .PHONY: uninstall
buildconfigs/Rules.mk +35 -9
67 lines not on this page · raw message
buildconfigs/mk.linux-2.6-xen +3 -1
@@ -1,5 +1,7 @@ LINUX_SERIES = 2.6 LINUX_VER = 2.6.16.13 +LINUX_TARBALL = linux-2.6.16.13.tar.bz2 # Only one makes sense +#LINUX_PATCHES = patch-2.6.17-rcN.bz2 # Usually zero or one patch EXTRAVERSION ?= xen
@@ -57,4 +59,4 @@ delete: .PHONY: mrpropper mrpropper: - rm -f linux-$(LINUX_VER).tar.bz2 + rm -f $(LINUX_TARBALL) $(LINUX_PATCHES)
The version of this patch that I sent earlier today was bogus as it was actually a duplicate of the 2nd patch I sent in this patch ([PATCH 2/2] build: make linux download more flexible). This is what it should have looked like.
The second patch itself should be fine as sent earlier today.
Signature · 82 lines
Horms
H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
build: clean up kclean and distclean for kernel
* Don't delete non-existent %.tar.bz2 in buildconfigs/Rules.mk's %-mrproper
* Add a mrpropper target to buildconfigs/mk.linux-2.6-xen, and
have this delete the local tarball
- This should also delete the local patch, if there is one, but I am not
sure how to do this with the current incarntation of the code, and I
will post a subsequent patch which makes this easier and effects this
chang. As there currently is no local patch this is not a big deal at
this moment. (Horms)
* Make distclean depend on kdekete, rather than calling delete target by
hand
* Stop kclean from erroring out if the kernel directory doesn't exist
* Remove patches/*/.makedep in top level Makefile rather than in
buildconfigs/Rules.mk, as calling rules in the latter causes
patches/*/.make to be created (Magnus)
Signed-Off-By: Magnus Damm <[email protected]>
Signed-Off-By: Horms <[email protected]>
--- from-0001/Makefile
+++ to-work/Makefile 2006-06-28 10:54:02.000000000 +0900
@@ -123,13 +123,13 @@ clean::
# clean, but blow away kernel build tree plus tarballs
.PHONY: distclean
-distclean:
+distclean: kdelete
$(MAKE) -C xen distclean
$(MAKE) -C tools distclean
$(MAKE) -C docs distclean
rm -rf dist patches/tmp
- for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
for i in $(ALLSPARSETREES) ; do $(MAKE) $$i-mrproper ; done
+ rm -rf patches/*/.makedep
# Linux name for GNU distclean
.PHONY: mrproper
--- from-0001/buildconfigs/Rules.mk
+++ to-work/buildconfigs/Rules.mk 2006-06-28 10:47:15.000000000 +0900
@@ -59,10 +59,6 @@ ifneq ($(PATCHDIRS),)
$(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep:
@echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@
-.PHONY: clean
-clean::
- rm -f patches/*/.makedep
-
ref-%/.valid-ref: pristine-%/.valid-pristine
set -e
rm -rf $(@D)
@@ -111,7 +107,8 @@ linux-2.6-xen.patch: ref-linux-$(LINUX_V
rm -rf tmp-$@
%-mrproper:
- rm -rf pristine-$(*)* ref-$(*)* $*.tar.bz2
+ $(MAKE) -f buildconfigs/mk.$*-xen mrpropper
+ rm -rf pristine-$(*)* ref-$(*)*
rm -rf $*-xen.patch
.PHONY: config-update-pae
--- from-0001/buildconfigs/mk.linux-2.6-xen
+++ to-work/buildconfigs/mk.linux-2.6-xen 2006-06-28 10:47:15.000000000 +0900
@@ -47,8 +47,14 @@ config: $(LINUX_DIR)/include/linux/autoc
.PHONY: clean
clean::
- $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
+ [ ! -d $(LINUX_DIR) ] || \
+ $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
+
.PHONY: delete
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
+
+.PHONY: mrpropper
+mrpropper:
+ rm -f linux-$(LINUX_VER).tar.bz2Quoted 6 lines · Horms
The version of this patch that I sent earlier today was bogus as it was actually a duplicate of the 2nd patch I sent in this patch ([PATCH 2/2] build: make linux download more flexible). This is what it should have looked like.
The second patch itself should be fine as sent earlier today.
These patches seem to churn the build system a bit but I'm not clear how much they improve things. What do they improve? Anyone else interested in seeing them committed?
-- Keir
Quoted 8 lines · Keir Fraser
Quoted 5 lines · Horms
The version of this patch that I sent earlier today was bogus as it was actually a duplicate of the 2nd patch I sent in this patch ([PATCH 2/2] build: make linux download more flexible). This is what it should have looked like.
Quoted 5 lines
Quoted 1 line
The second patch itself should be fine as sent earlier today.
These patches seem to churn the build system a bit but I'm not clear how much they improve things. What do they improve? Anyone else interested in seeing them committed?
I feel that what they improve is farily clearly listed in the inline comments. I'm happy to trim them down if some bits are unwanted. But I do believe they significantly improve the semantics of both downloads and distclean. I have tested them quite extensively over serveral months now (though oviously not the minor updates I made yesterday relating to $LINUX_VER vs $LINUX_SRC, and I can confirm that at least in my environment they work well.
Signature · 2 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
Quoted 2 lines · Horms
* Make distclean depend on kdekete, rather than calling delete target by hand
This changes semantics of distclean to clean only KERNELS rather than ALLKERNELS. It makes sense for distclean to do the latter.
-- Keir
Quoted 9 lines · Keir Fraser
Quoted 3 lines · Horms
* Make distclean depend on kdekete, rather than calling delete target by
handThis changes semantics of distclean to clean only KERNELS rather than ALLKERNELS. It makes sense for distclean to do the latter.
Sorry about that. I'll take a look into that and get a fresh patch out.
Signature · 2 lines
Horms H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
Quoted 4 lines · Horms
Quoted 3 lines · Keir Fraser
On 29 Jun 2006, at 10:18, Horms wrote:
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
* Make distclean depend on kdekete, rather than calling delete target by
handThis changes semantics of distclean to clean only KERNELS rather than ALLKERNELS. It makes sense for distclean to do the latter.
Sorry about that. I'll take a look into that and get a fresh patch out.
I have removed the offending portion, and the patch now leave she cleaning ALLKERNELS in a for loop intact. New patch below.
Signature · 75 lines
Horms
H: http://www.vergenet.net/~horms/ W: http://www.valinux.co.jp/en/
* Don't delete non-existent %.tar.bz2 in buildconfigs/Rules.mk's %-mrproper
* Add a mrpropper target to buildconfigs/mk.linux-2.6-xen, and
have this delete the local tarball
- This should also delete the local patch, if there is one, but I am not
sure how to do this with the current incarntation of the code, and I
will post a subsequent patch which makes this easier and effects this
chang. As there currently is no local patch this is not a big deal at
this moment. (Horms)
* Stop kclean from erroring out if the kernel directory doesn't exist
* Remove patches/*/.makedep in top level Makefile rather than in
buildconfigs/Rules.mk, as calling rules in the latter causes
patches/*/.make to be created (Magnus)
Signed-Off-By: Magnus Damm <[email protected]>
Signed-Off-By: Horms <[email protected]>
Makefile | 1 +
buildconfigs/Rules.mk | 7 ++-----
buildconfigs/mk.linux-2.6-xen | 8 +++++++-
3 files changed, 10 insertions(+), 6 deletions(-)
--- from-0001/Makefile
+++ to-work/Makefile 2006-07-03 12:18:44.000000000 +0900
@@ -130,6 +130,7 @@ distclean:
rm -rf dist patches/tmp
for i in $(ALLKERNELS) ; do $(MAKE) $$i-delete ; done
for i in $(ALLSPARSETREES) ; do $(MAKE) $$i-mrproper ; done
+ rm -rf patches/*/.makedep
# Linux name for GNU distclean
.PHONY: mrproper
--- from-0001/buildconfigs/Rules.mk
+++ to-work/buildconfigs/Rules.mk 2006-07-03 11:48:26.000000000 +0900
@@ -59,10 +59,6 @@ ifneq ($(PATCHDIRS),)
$(patsubst patches/%,patches/%/.makedep,$(PATCHDIRS)): patches/%/.makedep:
@echo 'ref-$*/.valid-ref: $$(wildcard patches/$*/*.patch)' >$@
-.PHONY: clean
-clean::
- rm -f patches/*/.makedep
-
ref-%/.valid-ref: pristine-%/.valid-pristine
set -e
rm -rf $(@D)
@@ -111,7 +107,8 @@ linux-2.6-xen.patch: ref-linux-$(LINUX_V
rm -rf tmp-$@
%-mrproper:
- rm -rf pristine-$(*)* ref-$(*)* $*.tar.bz2
+ $(MAKE) -f buildconfigs/mk.$*-xen mrpropper
+ rm -rf pristine-$(*)* ref-$(*)*
rm -rf $*-xen.patch
.PHONY: config-update-pae
--- from-0001/buildconfigs/mk.linux-2.6-xen
+++ to-work/buildconfigs/mk.linux-2.6-xen 2006-07-03 11:48:26.000000000 +0900
@@ -47,8 +47,14 @@ config: $(LINUX_DIR)/include/linux/autoc
.PHONY: clean
clean::
- $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
+ [ ! -d $(LINUX_DIR) ] || \
+ $(MAKE) -C $(LINUX_DIR) ARCH=$(LINUX_ARCH) clean
+
.PHONY: delete
delete:
rm -rf tmp-linux-$(LINUX_VER) $(LINUX_DIR)
+
+.PHONY: mrpropper
+mrpropper:
+ rm -f linux-$(LINUX_VER).tar.bz2Re: [PATCH 2/2] build: make linux download more flexible
In reply to Horms* Allow LINUX_REPO to specify the URL of the repository for the linux kernel,
- Defaults is: http://www.kernel.org/pub/linux/kernel/
* Allow LINUX_REPO to be overridden in the environment
* LINUX_REPO it should be the path, trimmed to give a structure equivalent to http://www.kernel.org/pub/linux/kernel/
- The kernel tarball will be downloaded from
$(LINUX_REPO)/v$(KERNEL_MAJOR).$(KERNEL_MINOR)/
e.g. http://www.kernel.org/pub/linux/kernel/v2.6
Where KERNEL_MAJOR and KERNEL_MINOR are calculated at runtime
- The path of the tarball can be overridden using LINUX_REPO_KERNEL_PATH
in the environment, in which case the tarball will be downloaded from
$(LINUX_REPO)/v$(LINUX_REPO_KERNEL_PATH)/
- If needed kernel patches will be downloaded from
$(LINUX_REPO)/v$(KERNEL_MAJOR).$(KERNEL_MINOR)/snapshots
if present, else
$(LINUX_REPO)/v$(KERNEL_MAJOR).$(KERNEL_MINOR)/testing
This will depend on the version of the patch
- The path of the tarball can be overridden using LINUX_REPO_KERNEL_PATH
in the environment, in which case the patch will be downloaded from
$(LINUX_REPO)/v$(LINUX_REPO_PATCH_PATH)/ - The intention of LINUX_REPO_KERNEL_PATH and LINUX_REPO_PATCH_PATH is to allow for sites that don't follow the directory hierarchy of kernel.org, while simplifying the presumably common case where they do
* Previously KERNEL_REPO had similar properties to LINUX_REPO, but it was not as flexible, had a somewhat presumptuous name and could not be overridden in the environment. It has been removed
* Allow DOWNLOAD_PATH to set a search path for previously downloaded files
- Use the first element of the path as the directory to save downloaded files
- Default is LINUX_SRC_PATH if set in environment, else .:..
- Note that kclean-tarball, makedistlcean-* and friends intentionally only remove tarballs in the top level xen directory, regardless of the value of this variable. This is to allow more persistent storage of tarballs in a specified location, which cam be manually cleaned if desired.
* Fix bug introduced by xen-unstable.hg:9931:39fa9a75d84b whereby the downloaded kernel source is not removed on mrproper
* Remove the local tarball, if any, on mrproper
Config.mk | 12 ++++++++++- Makefile | 14 +++++++++++++ buildconfigs/Rules.mk | 44 ++++++++++++++++++++++++++++++++--------- buildconfigs/mk.linux-2.6-xen | 4 ++- 4 files changed, 63 insertions(+), 11 deletions(-)
Config.mk +11 -1
@@ -57,7 +57,17 @@ LDFLAGS += $(foreach i, $(EXTRA_LIB), -L CFLAGS += $(foreach i, $(EXTRA_INCLUDES), -I$(i)) # Choose the best mirror to download linux kernel -KERNEL_REPO = http://www.kernel.org +DOWNLOAD_PATH_DEFAULT := .:.. +LINUX_REPO_DEFAULT := http://www.kernel.org/pub/linux/kernel/ +ifdef LINUX_SRC_PATH +DOWNLOAD_PATH ?= $(LINUX_SRC_PATH) # Compatibility +else +DOWNLOAD_PATH ?= $(DOWNLOAD_PATH_DEFAULT) +endif +DOWNLOAD_DIR := $(firstword $(subst :, ,$(DOWNLOAD_PATH))) +LINUX_REPO ?= $(LINUX_REPO_DEFAULT) +# LINUX_REPO_KERNEL_PATH Set in buildconfigs/Rules.mk, if not in environment +# LINUX_REPO_PATCH_PATH Set in buildconfigs/Rules.mk, if not in environment # If ACM_SECURITY = y, then the access control module is compiled # into Xen and the policy type can be set by the boot policy file
Makefile +14 -0
@@ -175,6 +175,20 @@ help: @echo ' install into prefix/lib/python<VERSION>' @echo ' instead of <PREFIX>/lib/python' @echo ' true if set to non-empty value, false otherwise' + @echo ' LINUX_REPO=URL - Base URL to download linux kernel from' + @echo ' Default: "$(LINUX_REPO_DEFAULT)"' + @echo ' LINUX_REPO_KERNEL_PATH=DIRECTORY' + @echo ' - LINUX_REPO assumes that the URL has the same directory' + @echo ' structure as $(LINUX_REPO_DEFAULT)' + @echo ' and the rest of the path to the tarball is derived.' + @echo ' If set, override the derivation.' + @echo ' Default: ""' + @echo ' LINUX_REPO_PATCHL_PATH=DIRECTORY' + @echo ' - LINUX_REPO assumes that the URL has the same directory' + @echo ' structure as $(LINUX_REPO_DEFAULT)' + @echo ' and the rest of the path to the patches is derived.' + @echo ' If set, override the derivation.' + @echo ' Default: ""' # Use this target with extreme care! .PHONY: uninstall
buildconfigs/Rules.mk +35 -9
67 lines not on this page · raw message
buildconfigs/mk.linux-2.6-xen +3 -1
@@ -1,5 +1,7 @@ LINUX_SERIES = 2.6 LINUX_VER = 2.6.16.13 +LINUX_TARBALL = linux-2.6.16.13.tar.bz2 # Only one makes sense +#LINUX_PATCHES = patch-2.6.17-rcN.bz2 # Usually zero or one patch EXTRAVERSION ?= xen
@@ -57,4 +59,4 @@ delete: .PHONY: mrpropper mrpropper: - rm -f linux-$(LINUX_VER).tar.bz2 + rm -f $(LINUX_TARBALL) $(LINUX_PATCHES)