From 6d983feab80948cdd0e3920c40d453a6436eeb23 Mon Sep 17 00:00:00 2001 From: Jan-Benedict Glaw Date: Tue, 24 May 2005 11:27:37 +0200 Subject: [PATCH] kbuild: create tarballs It adds tarball packaging, which I prefer for distribution. Also one of the two blanks after @echo is removed. One seems to be enough :) Signed-off-by: Jan-Benedict Glaw Signed-off-by: Sam Ravnborg --- scripts/package/Makefile | 19 ++++++-- scripts/package/buildtar | 111 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 127 insertions(+), 3 deletions(-) create mode 100644 scripts/package/buildtar (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 3b1f2eff258448..fbb8cf5d4e19d4 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -80,10 +80,23 @@ deb-pkg: clean-dirs += $(objtree)/debian/ +# tarball targets +# --------------------------------------------------------------------------- +.PHONY: tar%pkg +tar%pkg: + $(MAKE) + $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@ + +clean-dirs += $(objtree)/tar-install/ + + # Help text displayed when executing 'make help' # --------------------------------------------------------------------------- help: - @echo ' rpm-pkg - Build the kernel as an RPM package' - @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules' - @echo ' deb-pkg - Build the kernel as an deb package' + @echo ' rpm-pkg - Build the kernel as an RPM package' + @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules' + @echo ' deb-pkg - Build the kernel as an deb package' + @echo ' tar-pkg - Build the kernel as an uncompressed tarball' + @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' + @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' diff --git a/scripts/package/buildtar b/scripts/package/buildtar new file mode 100644 index 00000000000000..d8fffe6f890657 --- /dev/null +++ b/scripts/package/buildtar @@ -0,0 +1,111 @@ +#!/bin/sh + +# +# buildtar 0.0.3 +# +# (C) 2004-2005 by Jan-Benedict Glaw +# +# This script is used to compile a tarball from the currently +# prepared kernel. Based upon the builddeb script from +# Wichert Akkerman . +# + +set -e + +# +# Some variables and settings used throughout the script +# +version="${VERSION}.${PATCHLEVEL}.${SUBLEVEL}${EXTRAVERSION}${EXTRANAME}" +tmpdir="${objtree}/tar-install" +tarball="${objtree}/linux-${version}.tar" + + +# +# Figure out how to compress, if requested at all +# +case "${1}" in + tar-pkg) + compress="cat" + file_ext="" + ;; + targz-pkg) + compress="gzip -c9" + file_ext=".gz" + ;; + tarbz2-pkg) + compress="bzip2 -c9" + file_ext=".bz2" + ;; + *) + echo "Unknown tarball target \"${1}\" requested, please add it to ${0}." >&2 + exit 1 + ;; +esac + + +# +# Clean-up and re-create the temporary directory +# +rm -rf -- "${tmpdir}" +mkdir -p -- "${tmpdir}/boot" + + +# +# Try to install modules +# +if ! make INSTALL_MOD_PATH="${tmpdir}" modules_install; then + echo "" >&2 + echo "Ignoring error at module_install time, since that could be" >&2 + echo "a result of missing local modutils/module-init-tools," >&2 + echo "or you just didn't compile in module support at all..." >&2 + echo "" >&2 +fi + + +# +# Install basic kernel files +# +cp -v -- System.map "${tmpdir}/boot/System.map-${version}" +cp -v -- .config "${tmpdir}/boot/config-${version}" +cp -v -- vmlinux "${tmpdir}/boot/vmlinux-${version}" + + +# +# Install arch-specific kernel image(s) +# +case "${ARCH}" in + i386) + [ -f arch/i386/boot/bzImage ] && cp -v -- arch/i386/boot/bzImage "${tmpdir}/boot/vmlinuz-${version}" + ;; + alpha) + [ -f arch/alpha/boot/vmlinux.gz ] && cp -v -- arch/alpha/boot/vmlinux.gz "${tmpdir}/boot/vmlinuz-${version}" + ;; + vax) + [ -f vmlinux.SYS ] && cp -v -- vmlinux.SYS "${tmpdir}/boot/vmlinux-${version}.SYS" + [ -f vmlinux.dsk ] && cp -v -- vmlinux.dsk "${tmpdir}/boot/vmlinux-${version}.dsk" + ;; + *) + [ -f "${KBUILD_IMAGE}" ] && cp -v -- "${KBUILD_IMAGE}" "${tmpdir}/boot/vmlinux-kbuild-${version}" + echo "" >&2 + echo '** ** ** WARNING ** ** **' >&2 + echo "" >&2 + echo "Your architecture did not define any architecture-dependant files" >&2 + echo "to be placed into the tarball. Please add those to ${0} ..." >&2 + echo "" >&2 + sleep 5 + ;; +esac + + +# +# Create the tarball +# +( + cd "${tmpdir}" + tar cf - . | ${compress} > "${tarball}${file_ext}" +) + +echo "Tarball successfully created in ${tarball}${file_ext}" + +exit 0 + -- cgit 1.2.3-korg From b95d4fec89c1f503ebad4c704ac08c3c6761329b Mon Sep 17 00:00:00 2001 From: Fabio Massimo Di Nitto Date: Wed, 13 Jul 2005 08:25:49 +0200 Subject: [PATCH] kbuild: modpost needs to cope with new glibc elf header on sparc Recently a change in the glibc elf.h header has been introduced causing modpost to spawn tons of warnings (like the one below) building the kernel on sparc: [SNIP] *** Warning: "current_thread_info_reg" [net/sunrpc/auth_gss/auth_rpcgss.ko] undefined! *** Warning: "" [net/sunrpc/auth_gss/auth_rpcgss.ko] undefined! *** Warning: "" [net/sunrpc/auth_gss/auth_rpcgss.ko] undefined! [SNIP] Ben Collins discovered that the STT_REGISTERED definition in glibc did change and that this change needs to be propagated to modpost. glibc change: -#define STT_REGISTER 13 /* Global register reserved to app. */ +#define STT_SPARC_REGISTER 13 /* Global register reserved to app. */ I did and tested this simple patch to maintain compatibility with newer (>= 2.3.4) and older (<= 2.3.2) glibc. Signed-off-by: Fabio M. Di Nitto Signed-off-by: Sam Ravnborg --- scripts/mod/modpost.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index 9b9f94c915d234..09ffca54b37341 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -359,11 +359,16 @@ handle_modversions(struct module *mod, struct elf_info *info, /* ignore __this_module, it will be resolved shortly */ if (strcmp(symname, MODULE_SYMBOL_PREFIX "__this_module") == 0) break; -#ifdef STT_REGISTER +/* cope with newer glibc (2.3.4 or higher) STT_ definition in elf.h */ +#if defined(STT_REGISTER) || defined(STT_SPARC_REGISTER) +/* add compatibility with older glibc */ +#ifndef STT_SPARC_REGISTER +#define STT_SPARC_REGISTER STT_REGISTER +#endif if (info->hdr->e_machine == EM_SPARC || info->hdr->e_machine == EM_SPARCV9) { /* Ignore register directives. */ - if (ELF_ST_TYPE(sym->st_info) == STT_REGISTER) + if (ELF_ST_TYPE(sym->st_info) == STT_SPARC_REGISTER) break; } #endif -- cgit 1.2.3-korg From d2cb1a95c5fa4d1691c90a4f530955b4ea3cfa24 Mon Sep 17 00:00:00 2001 From: Greg Edwards Date: Thu, 29 Jul 2004 13:07:32 -0500 Subject: [PATCH] kbuild: add ia64 support to rpm Makefile target On ia64, only the EFI (fat) partition is available to boot from. The rpm needs to install the kernel under /boot/efi to be useable on ia64. Signed-off-by: Greg Edwards Signed-off-by: Sam Ravnborg --- scripts/package/mkspec | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'scripts') diff --git a/scripts/package/mkspec b/scripts/package/mkspec index 6e7a58f145adfa..0b10387375480e 100755 --- a/scripts/package/mkspec +++ b/scripts/package/mkspec @@ -62,10 +62,19 @@ echo "" fi echo "%install" +echo "%ifarch ia64" +echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' +echo "%else" echo 'mkdir -p $RPM_BUILD_ROOT/boot $RPM_BUILD_ROOT/lib $RPM_BUILD_ROOT/lib/modules' +echo "%endif" echo 'INSTALL_MOD_PATH=$RPM_BUILD_ROOT make %{_smp_mflags} modules_install' +echo "%ifarch ia64" +echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/efi/vmlinuz-$KERNELRELEASE" +echo 'ln -s '"efi/vmlinuz-$KERNELRELEASE" '$RPM_BUILD_ROOT'"/boot/" +echo "%else" echo 'cp $KBUILD_IMAGE $RPM_BUILD_ROOT'"/boot/vmlinuz-$KERNELRELEASE" +echo "%endif" echo 'cp System.map $RPM_BUILD_ROOT'"/boot/System.map-$KERNELRELEASE" -- cgit 1.2.3-korg From e0af0d85f55ea800a2e38bf782d68b83e9942611 Mon Sep 17 00:00:00 2001 From: Matthias Urlichs Date: Fri, 18 Feb 2005 10:23:41 +0100 Subject: [PATCH] kbuild: obey HOSTLOADLIBES_programname for single-file compilation Single-file HOSTCC calls added the libraries from $(HOSTLOADLIBES), but not from $(HOSTLOADLIBES_programname). Multi-file HOSTCC calls do both. This patch fixes that inconsistency. Signed-Off-By: Matthias Urlichs Signed-off-by: Sam Ravnborg --- scripts/Makefile.host | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.host b/scripts/Makefile.host index 2821a2b83bbb3c..2d519704b8fd79 100644 --- a/scripts/Makefile.host +++ b/scripts/Makefile.host @@ -98,7 +98,8 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__hostcxx_flags) # Create executable from a single .c file # host-csingle -> Executable quiet_cmd_host-csingle = HOSTCC $@ - cmd_host-csingle = $(HOSTCC) $(hostc_flags) $(HOST_LOADLIBES) -o $@ $< + cmd_host-csingle = $(HOSTCC) $(hostc_flags) -o $@ $< \ + $(HOST_LOADLIBES) $(HOSTLOADLIBES_$(@F)) $(host-csingle): %: %.c FORCE $(call if_changed_dep,host-csingle) -- cgit 1.2.3-korg From be3cef986f7c44593d6d112584fbdf4618b6569e Mon Sep 17 00:00:00 2001 From: Yum Rayan Date: Wed, 8 Jun 2005 22:04:32 -0700 Subject: [PATCH] kbuild: restrain output of "make help" to 80 columns This patch fixes the output of "make help" to fit in a 80 column screen. Please push upstream as part of your other patches. Signed-off-by: Yum Rayan Signed-off-by: Sam Ravnborg --- scripts/package/Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index fbb8cf5d4e19d4..353b8ea5c32cd5 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -94,7 +94,8 @@ clean-dirs += $(objtree)/tar-install/ # --------------------------------------------------------------------------- help: @echo ' rpm-pkg - Build the kernel as an RPM package' - @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel & modules' + @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel + @echo ' and modules' @echo ' deb-pkg - Build the kernel as an deb package' @echo ' tar-pkg - Build the kernel as an uncompressed tarball' @echo ' targz-pkg - Build the kernel as a gzip compressed tarball' -- cgit 1.2.3-korg From 66da665ca36b07728acf35881f918a89a2c9fbb2 Mon Sep 17 00:00:00 2001 From: Jeff Mahoney Date: Wed, 13 Jul 2005 11:55:42 -0400 Subject: [PATCH] Lindent: ignore .indent.pro When I recently submitted a Lindent patch, it turned out that my .indent.pro options were also applied to the tree. This patch directs indent(1) to ignore the .indent.pro directives and only use options specified on the command line. Signed-off-by: Jeff Mahoney Signed-off-by: Sam Ravnborg --- scripts/Lindent | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Lindent b/scripts/Lindent index 34ed785116b661..7d8d8896e309fb 100755 --- a/scripts/Lindent +++ b/scripts/Lindent @@ -1,2 +1,2 @@ #!/bin/sh -indent -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" +indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@" -- cgit 1.2.3-korg From 2283a117f65650352f2a9fd6b9af4cdbf5478d14 Mon Sep 17 00:00:00 2001 From: Randy Dunlap Date: Thu, 7 Jul 2005 15:39:26 -0700 Subject: [PATCH] scripts/kernel-doc: don't use uninitialized SRCTREE Current kernel-doc (perl) script generates this warning: Use of uninitialized value in concatenation (.) or string at scripts/kernel-doc line 1668. So explicitly check for SRCTREE in the ENV before using it, and then if it is set, append a '/' to the end of it, otherwise the SRCTREE + filename can (will) be missing the intermediate '/'. Signed-off-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- scripts/kernel-doc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/kernel-doc b/scripts/kernel-doc index 0835dc2a8aa9f4..8aaf74e64183ff 100755 --- a/scripts/kernel-doc +++ b/scripts/kernel-doc @@ -1665,11 +1665,17 @@ sub xml_escape($) { } sub process_file($) { - my ($file) = "$ENV{'SRCTREE'}@_"; + my $file; my $identifier; my $func; my $initial_section_counter = $section_counter; + if (defined($ENV{'SRCTREE'})) { + $file = "$ENV{'SRCTREE'}" . "/" . "@_"; + } + else { + $file = "@_"; + } if (defined($source_map{$file})) { $file = $source_map{$file}; } -- cgit 1.2.3-korg From cfca82f2179dd1aee84a5bf3b14710e4d7487aed Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:12:40 +0000 Subject: kbuild: Fix build as root then user From: Matthew Wilcox I inadvertently built a tree as root and then rebuilt it as a user. I got a lot of prompts ... mv: overwrite `drivers/char/drm/drm_auth.o', overriding mode 0644? Using mv -f fixes that. Signed-off-by: Matthew Wilcox Signed-off-by: Sam Ravnborg --- scripts/Makefile.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 76ba6be3dfc9cd..282bfb310f5b92 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -169,7 +169,7 @@ cmd_modversions = \ -T $(@D)/.tmp_$(@F:.o=.ver); \ rm -f $(@D)/.tmp_$(@F) $(@D)/.tmp_$(@F:.o=.ver); \ else \ - mv $(@D)/.tmp_$(@F) $@; \ + mv -f $(@D)/.tmp_$(@F) $@; \ fi; endif -- cgit 1.2.3-korg From 53e88e03e63621a15ec7fbccaaaca1a0f1616ed4 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:14:42 +0000 Subject: buildcheck: reduce DEBUG_INFO noise from reference* scripts From: Randy Dunlap Reduce noise in 'make buildcheck' that is caused by CONFIG_DEBUG_INFO=y. Signed-off-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- scripts/reference_discarded.pl | 3 +++ scripts/reference_init.pl | 1 + 2 files changed, 4 insertions(+) (limited to 'scripts') diff --git a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl index d5cabb81bd1be5..44b8722da0ea3f 100644 --- a/scripts/reference_discarded.pl +++ b/scripts/reference_discarded.pl @@ -82,6 +82,8 @@ foreach $object (keys(%object)) { } if (($line =~ /\.text\.exit$/ || $line =~ /\.exit\.text$/ || + $line =~ /\.text\.init$/ || + $line =~ /\.init\.text$/ || $line =~ /\.data\.exit$/ || $line =~ /\.exit\.data$/ || $line =~ /\.exitcall\.exit$/) && @@ -96,6 +98,7 @@ foreach $object (keys(%object)) { $from !~ /\.debug_ranges$/ && $from !~ /\.debug_line$/ && $from !~ /\.debug_frame$/ && + $from !~ /\.debug_loc$/ && $from !~ /\.exitcall\.exit$/ && $from !~ /\.eh_frame$/ && $from !~ /\.stab$/)) { diff --git a/scripts/reference_init.pl b/scripts/reference_init.pl index 9a240845386958..7f6960b175a213 100644 --- a/scripts/reference_init.pl +++ b/scripts/reference_init.pl @@ -98,6 +98,7 @@ foreach $object (sort(keys(%object))) { $from !~ /\.pdr$/ && $from !~ /\__param$/ && $from !~ /\.altinstructions/ && + $from !~ /\.eh_frame/ && $from !~ /\.debug_/)) { printf("Error: %s %s refers to %s\n", $object, $from, $line); } -- cgit 1.2.3-korg From bd5bdd875b29e882f80d2cd6dd1da468641dad2a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:18:07 +0000 Subject: kbuild: "PREEMPT" in UTS_VERSION From: Matt Mackall Add PREEMPT to UTS_VERSION where enabled as is done for SMP to make preempt kernels easily identifiable. Added SMP PREEMPT as comment in compile.h to force it to be updated when they change (sam). Signed-off-by: Matt Mackall Signed-off-by: Sam Ravnborg --- init/Makefile | 3 ++- scripts/mkcompile_h | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/init/Makefile b/init/Makefile index 93a53fbdbe7963..a2300078f2b7d9 100644 --- a/init/Makefile +++ b/init/Makefile @@ -25,4 +25,5 @@ $(obj)/version.o: include/linux/compile.h include/linux/compile.h: FORCE @echo ' CHK $@' - @$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CC) $(CFLAGS)" + $(Q)$(CONFIG_SHELL) $(srctree)/scripts/mkcompile_h $@ \ + "$(UTS_MACHINE)" "$(CONFIG_SMP)" "$(CONFIG_PREEMPT)" "$(CC) $(CFLAGS)" diff --git a/scripts/mkcompile_h b/scripts/mkcompile_h index 8d118d1819508c..d7b8a384b4a799 100755 --- a/scripts/mkcompile_h +++ b/scripts/mkcompile_h @@ -1,7 +1,8 @@ TARGET=$1 ARCH=$2 SMP=$3 -CC=$4 +PREEMPT=$4 +CC=$5 # If compile.h exists already and we don't own autoconf.h # (i.e. we're not the same user who did make *config), don't @@ -26,8 +27,10 @@ fi UTS_VERSION="#$VERSION" -if [ -n "$SMP" ] ; then UTS_VERSION="$UTS_VERSION SMP"; fi -UTS_VERSION="$UTS_VERSION `LC_ALL=C LANG=C date`" +CONFIG_FLAGS="" +if [ -n "$SMP" ] ; then CONFIG_FLAGS="SMP"; fi +if [ -n "$PREEMPT" ] ; then CONFIG_FLAGS="$CONFIG_FLAGS PREEMPT"; fi +UTS_VERSION="$UTS_VERSION $CONFIG_FLAGS `LC_ALL=C LANG=C date`" # Truncate to maximum length @@ -37,7 +40,8 @@ UTS_TRUNCATE="sed -e s/\(.\{1,$UTS_LEN\}\).*/\1/" # Generate a temporary compile.h ( echo /\* This file is auto generated, version $VERSION \*/ - + if [ -n "$CONFIG_FLAGS" ] ; then echo "/* $CONFIG_FLAGS */"; fi + echo \#define UTS_MACHINE \"$ARCH\" echo \#define UTS_VERSION \"`echo $UTS_VERSION | $UTS_TRUNCATE`\" -- cgit 1.2.3-korg From c5f75eca120de6587e67a1951ce3e6912e2c6879 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:20:13 +0000 Subject: kbuild: fix buildcheck From: Randy Dunlap I should not have added init.text test here; it's more than useless, it actually degrades the output. Signed-off-by: Randy Dunlap Signed-off-by: Sam Ravnborg --- scripts/reference_discarded.pl | 2 -- 1 file changed, 2 deletions(-) (limited to 'scripts') diff --git a/scripts/reference_discarded.pl b/scripts/reference_discarded.pl index 44b8722da0ea3f..f04f6273685161 100644 --- a/scripts/reference_discarded.pl +++ b/scripts/reference_discarded.pl @@ -82,8 +82,6 @@ foreach $object (keys(%object)) { } if (($line =~ /\.text\.exit$/ || $line =~ /\.exit\.text$/ || - $line =~ /\.text\.init$/ || - $line =~ /\.init\.text$/ || $line =~ /\.data\.exit$/ || $line =~ /\.exit\.data$/ || $line =~ /\.exitcall\.exit$/) && -- cgit 1.2.3-korg From 687c3dac59f1746a1cf877eb52e93046a4998e03 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:24:00 +0000 Subject: uml: Make deb-pkg build target build a Debian-style user-mode-linux package From: Ryan Anderson Make the deb-pkg build target understand the "um" arch and set up the package and directory structure to match a mainline-Debian style user-mode-linux package. This is primarily so that it stops matching, exactly, the naming convention used by normal, non-UML kernels generated by this command. Installing "linux-2.6.11" and "linux-2.6.11", where one is a UML kernel doesn't do the right thing. This fixes that. Signed-off-by: Ryan Anderson Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 32 ++++++++++++++++++++++++++------ 1 file changed, 26 insertions(+), 6 deletions(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index c279b6310f02f1..bec1a10174ecd3 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -14,18 +14,38 @@ set -e # Some variables and settings used throughout the script version=$KERNELRELEASE tmpdir="$objtree/debian/tmp" +packagename=linux-$version + +if [ "$ARCH" == "um" ] ; then + packagename=user-mode-linux-$version +fi # Setup the directory structure rm -rf "$tmpdir" mkdir -p "$tmpdir/DEBIAN" "$tmpdir/lib" "$tmpdir/boot" +if [ "$ARCH" == "um" ] ; then + mkdir -p "$tmpdir/usr/lib/uml/modules/$version" "$tmpdir/usr/share/doc/$packagename" "$tmpdir/usr/bin" +fi # Build and install the kernel -cp System.map "$tmpdir/boot/System.map-$version" -cp .config "$tmpdir/boot/config-$version" -cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" +if [ "$ARCH" == "um" ] ; then + $MAKE linux + cp System.map "$tmpdir/usr/lib/uml/modules/$version/System.map" + cp .config "$tmpdir/usr/share/doc/$packagename/config" + gzip "$tmpdir/usr/share/doc/$packagename/config" + cp $KBUILD_IMAGE "$tmpdir/usr/bin/linux-$version" +else + cp System.map "$tmpdir/boot/System.map-$version" + cp .config "$tmpdir/boot/config-$version" + cp $KBUILD_IMAGE "$tmpdir/boot/vmlinuz-$version" +fi if grep -q '^CONFIG_MODULES=y' .config ; then INSTALL_MOD_PATH="$tmpdir" make modules_install + if [ "$ARCH" == "um" ] ; then + mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" + rmdir "$tmpdir/lib/modules/$version" + fi fi # Install the maintainer scripts @@ -60,11 +80,11 @@ Priority: optional Maintainer: $name Standards-Version: 3.6.1 -Package: linux-$version +Package: $packagename Architecture: any -Description: Linux kernel, version $version +Description: Linux kernel, version $packagename This package contains the Linux kernel, modules and corresponding other - files version $version. + files version $packagename EOF # Fix some ownership and permissions -- cgit 1.2.3-korg From dc5962fdf13f4d10a5fb8d0b0ae6f406ee8aed49 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:24:56 +0000 Subject: uml: Restore proper descriptions in make deb-pkg target From: Ryan Anderson This pulls the description from the Debian user-mode-linux package, and puts $version back in the appropriate places for both descriptions. Signed-off-by: Ryan Anderson Signed-off-by: Sam Ravnborg --- scripts/package/builddeb | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/package/builddeb b/scripts/package/builddeb index bec1a10174ecd3..7edd4a095902dc 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -73,6 +73,29 @@ linux ($version) unstable; urgency=low EOF # Generate a control file +if [ "$ARCH" == "um" ]; then + +cat < debian/control +Source: linux +Section: base +Priority: optional +Maintainer: $name +Standards-Version: 3.6.1 + +Package: $packagename +Architecture: any +Description: User Mode Linux kernel, version $version + User-mode Linux is a port of the Linux kernel to its own system call + interface. It provides a kind of virtual machine, which runs Linux + as a user process under another Linux kernel. This is useful for + kernel development, sandboxes, jails, experimentation, and + many other things. + . + This package contains the Linux kernel, modules and corresponding other + files version $version +EOF + +else cat < debian/control Source: linux Section: base @@ -82,10 +105,11 @@ Standards-Version: 3.6.1 Package: $packagename Architecture: any -Description: Linux kernel, version $packagename +Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other - files version $packagename + files version $version EOF +fi # Fix some ownership and permissions chown -R root:root "$tmpdir" -- cgit 1.2.3-korg From a91f98a284321ffc9eb28ccfbf4329f7aa422f97 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Thu, 14 Jul 2005 20:26:09 +0000 Subject: kbuild: Fix bug in make deb-pkg when using seperate source and output directories From: Ryan Anderson When running "make O=something deb-pkg", I get a failure that claims I haven't configured my kernel (I have). Running it a second time tells me to run "make mrproper" (include/linux/version.h got built on the first run) Original patch from: From: Ajay Patel With modifications from: Signed-off-By: Ryan Anderson Signed-off-by: Sam Ravnborg --- scripts/package/Makefile | 4 ++-- scripts/package/builddeb | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 353b8ea5c32cd5..8afdef921cb7c1 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -59,7 +59,7 @@ $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@ binrpm-pkg: $(objtree)/binkernel.spec - $(MAKE) + $(MAKE) KBUILD_SRC= set -e; \ $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version set -e; \ @@ -74,7 +74,7 @@ clean-files += $(objtree)/binkernel.spec # .PHONY: deb-pkg deb-pkg: - $(MAKE) + $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb clean-dirs += $(objtree)/debian/ diff --git a/scripts/package/builddeb b/scripts/package/builddeb index 7edd4a095902dc..6edb29f2b4a6c8 100644 --- a/scripts/package/builddeb +++ b/scripts/package/builddeb @@ -41,7 +41,7 @@ else fi if grep -q '^CONFIG_MODULES=y' .config ; then - INSTALL_MOD_PATH="$tmpdir" make modules_install + INSTALL_MOD_PATH="$tmpdir" make KBUILD_SRC= modules_install if [ "$ARCH" == "um" ] ; then mv "$tmpdir/lib/modules/$version"/* "$tmpdir/usr/lib/uml/modules/$version/" rmdir "$tmpdir/lib/modules/$version" -- cgit 1.2.3-korg From d178817803d95e4e3ca270bccd1ae2bed4780977 Mon Sep 17 00:00:00 2001 From: Coywolf Qi Hunt Date: Tue, 19 Jul 2005 09:42:54 -0500 Subject: [PATCH] kbuild: make help binrpm-pkg fix This fixes kbuild make help binrpm-pkg missing `''. Signed-off-by: Coywolf Qi Hunt Signed-off-by: Sam Ravnborg --- scripts/package/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/package/Makefile b/scripts/package/Makefile index 8afdef921cb7c1..f3e7e8e4a500fe 100644 --- a/scripts/package/Makefile +++ b/scripts/package/Makefile @@ -94,7 +94,7 @@ clean-dirs += $(objtree)/tar-install/ # --------------------------------------------------------------------------- help: @echo ' rpm-pkg - Build the kernel as an RPM package' - @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel + @echo ' binrpm-pkg - Build an rpm package containing the compiled kernel' @echo ' and modules' @echo ' deb-pkg - Build the kernel as an deb package' @echo ' tar-pkg - Build the kernel as an uncompressed tarball' -- cgit 1.2.3-korg From 7c6b155fb49fbc63e0b30a1d49552693c0b45be7 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 25 Jul 2005 12:51:08 +0000 Subject: kbuild: drop descend - converting existing users There was only two users left of descend. Fix them so they use $(clean)= and $(build)=. Drop definition of descend. Signed-off-by: Sam Ravnborg --- --- Makefile | 5 ----- arch/m68knommu/Makefile | 2 +- arch/mips/Makefile | 2 +- scripts/Makefile.lib | 5 ----- 4 files changed, 2 insertions(+), 12 deletions(-) (limited to 'scripts') diff --git a/Makefile b/Makefile index 77198748ad71b4..7e4624a145867e 100644 --- a/Makefile +++ b/Makefile @@ -1356,11 +1356,6 @@ build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj # $(Q)$(MAKE) $(clean)=dir clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj -# $(call descend,,) -# Recursively call a sub-make in with target -# Usage is deprecated, because make does not see this as an invocation of make. -descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2) - endif # skip-makefile FORCE: diff --git a/arch/m68knommu/Makefile b/arch/m68knommu/Makefile index a254aa9d49986e..58c9fa57ca6707 100644 --- a/arch/m68knommu/Makefile +++ b/arch/m68knommu/Makefile @@ -109,7 +109,7 @@ libs-y += arch/m68knommu/lib/ prepare: include/asm-$(ARCH)/asm-offsets.h archclean: - $(call descend arch/$(ARCH)/boot, subdirclean) + $(Q)$(MAKE) $(clean)=arch/m68knommu/boot include/asm-$(ARCH)/asm-offsets.h: arch/$(ARCH)/kernel/asm-offsets.s \ include/asm include/linux/version.h \ diff --git a/arch/mips/Makefile b/arch/mips/Makefile index bc1c44274a58a4..26528b600b972c 100644 --- a/arch/mips/Makefile +++ b/arch/mips/Makefile @@ -683,7 +683,7 @@ drivers-$(CONFIG_OPROFILE) += arch/mips/oprofile/ ifdef CONFIG_LASAT rom.bin rom.sw: vmlinux - $(call descend,arch/mips/lasat/image,$@) + $(Q)$(MAKE) $(build)=arch/mips/lasat/image $@ endif # diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 7cf75cc4f849df..6e079f38a2c680 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -229,11 +229,6 @@ if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ cmd = @$(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) -# $(call descend,,) -# Recursively call a sub-make in with target -# Usage is deprecated, because make do not see this as an invocation of make. -descend =$(Q)$(MAKE) -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj=$(1) $(2) - # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= # Usage: # $(Q)$(MAKE) $(build)=dir -- cgit 1.2.3-korg From 8ec4b4ff1c89bb280e662b84eba503ca44abe836 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 25 Jul 2005 20:10:36 +0000 Subject: kbuild: introduce Kbuild.include Kbuild.include is a placeholder for definitions originally present in both the top-level Makefile and scripts/Makefile.build. There were a slight difference in the filechk definition, so the most videly used version was kept and usr/Makefile was adopted for this syntax. Signed-off-by: Sam Ravnborg --- --- Makefile | 74 ++----------------------------------- scripts/Kbuild.include | 96 ++++++++++++++++++++++++++++++++++++++++++++++++ scripts/Makefile.build | 1 + scripts/Makefile.lib | 94 ----------------------------------------------- scripts/Makefile.modinst | 2 +- scripts/Makefile.modpost | 1 + usr/Makefile | 2 +- 7 files changed, 103 insertions(+), 167 deletions(-) create mode 100644 scripts/Kbuild.include (limited to 'scripts') diff --git a/Makefile b/Makefile index 7e4624a145867e..7c607dc64479da 100644 --- a/Makefile +++ b/Makefile @@ -309,6 +309,9 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ # Look for make include files relative to root of kernel src MAKEFLAGS += --include-dir=$(srctree) +# We need some generic definitions +include scripts/Kbuild.include + # For maximum performance (+ possibly random breakage, uncomment # the following) @@ -367,11 +370,6 @@ export AFLAGS AFLAGS_KERNEL AFLAGS_MODULE # even be read-only. export MODVERDIR := $(if $(KBUILD_EXTMOD),$(firstword $(KBUILD_EXTMOD))/).tmp_versions -# The temporary file to save gcc -MD generated dependencies must not -# contain a comma -comma := , -depfile = $(subst $(comma),_,$(@D)/.$(@F).d) - # Files to ignore in find ... statements RCS_FIND_IGNORE := \( -name SCCS -o -name BitKeeper -o -name .svn -o -name CVS -o -name .pc \) -prune -o @@ -1285,72 +1283,6 @@ ifneq ($(cmd_files),) include $(cmd_files) endif -# Execute command and generate cmd file -if_changed = $(if $(strip $? \ - $(filter-out $(cmd_$(1)),$(cmd_$@))\ - $(filter-out $(cmd_$@),$(cmd_$(1)))),\ - @set -e; \ - $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ - $(cmd_$(1)); \ - echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) - - -# execute the command and also postprocess generated .d dependencies -# file -if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ - $(filter-out $(cmd_$(1)),$(cmd_$@))\ - $(filter-out $(cmd_$@),$(cmd_$(1)))),\ - $(Q)set -e; \ - $(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) \ - $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ - rm -f $(depfile); \ - mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) - -# Usage: $(call if_changed_rule,foo) -# will check if $(cmd_foo) changed, or any of the prequisites changed, -# and if so will execute $(rule_foo) - -if_changed_rule = $(if $(strip $? \ - $(filter-out $(cmd_$(1)),$(cmd_$(@F)))\ - $(filter-out $(cmd_$(@F)),$(cmd_$(1)))),\ - $(Q)$(rule_$(1))) - -# If quiet is set, only print short version of command - -cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) - -# filechk is used to check if the content of a generated file is updated. -# Sample usage: -# define filechk_sample -# echo $KERNELRELEASE -# endef -# version.h : Makefile -# $(call filechk,sample) -# The rule defined shall write to stdout the content of the new file. -# The existing file will be compared with the new one. -# - If no file exist it is created -# - If the content differ the new file is used -# - If they are equal no change, and no timestamp update - -define filechk - @set -e; \ - echo ' CHK $@'; \ - mkdir -p $(dir $@); \ - $(filechk_$(1)) < $< > $@.tmp; \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPD $@'; \ - mv -f $@.tmp $@; \ - fi -endef - -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj=dir -# Usage: -# $(Q)$(MAKE) $(build)=dir -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj - # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir # Usage: # $(Q)$(MAKE) $(clean)=dir diff --git a/scripts/Kbuild.include b/scripts/Kbuild.include new file mode 100644 index 00000000000000..9087273abf9166 --- /dev/null +++ b/scripts/Kbuild.include @@ -0,0 +1,96 @@ +#### +# kbuild: Generic definitions + +# Convinient variables +comma := , +empty := +space := $(empty) $(empty) + +### +# The temporary file to save gcc -MD generated dependencies must not +# contain a comma +depfile = $(subst $(comma),_,$(@D)/.$(@F).d) + +### +# filechk is used to check if the content of a generated file is updated. +# Sample usage: +# define filechk_sample +# echo $KERNELRELEASE +# endef +# version.h : Makefile +# $(call filechk,sample) +# The rule defined shall write to stdout the content of the new file. +# The existing file will be compared with the new one. +# - If no file exist it is created +# - If the content differ the new file is used +# - If they are equal no change, and no timestamp update +# - stdin is piped in from the first prerequisite ($<) so one has +# to specify a valid file as first prerequisite (often the kbuild file) +define filechk + $(Q)set -e; \ + echo ' CHK $@'; \ + mkdir -p $(dir $@); \ + $(filechk_$(1)) < $< > $@.tmp; \ + if [ -r $@ ] && cmp -s $@ $@.tmp; then \ + rm -f $@.tmp; \ + else \ + echo ' UPD $@'; \ + mv -f $@.tmp $@; \ + fi +endef + +### +# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= +# Usage: +# $(Q)$(MAKE) $(build)=dir +build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj + +# If quiet is set, only print short version of command +cmd = @$(if $($(quiet)cmd_$(1)),\ + echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) + +### +# if_changed - execute command if any prerequisite is newer than +# target, or command line has changed +# if_changed_dep - as if_changed, but uses fixdep to reveal dependencies +# including used config symbols +# if_changed_rule - as if_changed but execute rule instead +# See Documentation/kbuild/makefiles.txt for more info + +ifneq ($(KBUILD_NOCMDDEP),1) +# Check if both arguments has same arguments. Result in empty string if equal +# User may override this check using make KBUILD_NOCMDDEP=1 +arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) ) +endif + +# echo command. Short version is $(quiet) equals quiet, otherwise full command +echo-cmd = $(if $($(quiet)cmd_$(1)), \ + echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) + +# function to only execute the passed command if necessary +# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file +# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars +# +if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ + @set -e; \ + $(echo-cmd) \ + $(cmd_$(1)); \ + echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) + +# execute the command and also postprocess generated .d dependencies +# file +if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ + $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ + @set -e; \ + $(echo-cmd) \ + $(cmd_$(1)); \ + scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ + rm -f $(depfile); \ + mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) + +# Usage: $(call if_changed_rule,foo) +# will check if $(cmd_foo) changed, or any of the prequisites changed, +# and if so will execute $(rule_foo) +if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ + @set -e; \ + $(rule_$(1))) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 282bfb310f5b92..ebed6a41bc69bf 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -12,6 +12,7 @@ __build: include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile) +include scripts/Kbuild.include include scripts/Makefile.lib ifdef host-progs diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 6e079f38a2c680..0f81dcfd6909ae 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -1,13 +1,3 @@ -# =========================================================================== -# kbuild: Generic definitions -# =========================================================================== - -# Standard vars - -comma := , -empty := -space := $(empty) $(empty) - # Backward compatibility - to be removed... extra-y += $(EXTRA_TARGETS) # Figure out what we need to build from the various variables @@ -84,10 +74,6 @@ multi-objs-m := $(addprefix $(obj)/,$(multi-objs-m)) subdir-ym := $(addprefix $(obj)/,$(subdir-ym)) obj-dirs := $(addprefix $(obj)/,$(obj-dirs)) -# The temporary file to save gcc -MD generated dependencies must not -# contain a comma -depfile = $(subst $(comma),_,$(@D)/.$(@F).d) - # These flags are needed for modversions and compiling, so we define them here # already # $(modname_flags) #defines KBUILD_MODNAME as the name of the module it will @@ -179,84 +165,4 @@ cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ quiet_cmd_gzip = GZIP $@ cmd_gzip = gzip -f -9 < $< > $@ -# =========================================================================== -# Generic stuff -# =========================================================================== - -ifneq ($(KBUILD_NOCMDDEP),1) -# Check if both arguments has same arguments. Result in empty string if equal -# User may override this check using make KBUILD_NOCMDDEP=1 -arg-check = $(strip $(filter-out $(1), $(2)) $(filter-out $(2), $(1)) ) - -endif - -# echo command. Short version is $(quiet) equals quiet, otherwise full command -echo-cmd = $(if $($(quiet)cmd_$(1)), \ - echo ' $(subst ','\'',$($(quiet)cmd_$(1)))';) - -# function to only execute the passed command if necessary -# >'< substitution is for echo to work, >$< substitution to preserve $ when reloading .cmd file -# note: when using inline perl scripts [perl -e '...$$t=1;...'] in $(cmd_xxx) double $$ your perl vars -# -if_changed = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ - @set -e; \ - $(echo-cmd) \ - $(cmd_$(1)); \ - echo 'cmd_$@ := $(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).cmd) - - -# execute the command and also postprocess generated .d dependencies -# file - -if_changed_dep = $(if $(strip $? $(filter-out FORCE $(wildcard $^),$^)\ - $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ), \ - @set -e; \ - $(echo-cmd) \ - $(cmd_$(1)); \ - scripts/basic/fixdep $(depfile) $@ '$(subst $$,$$$$,$(subst ','\'',$(cmd_$(1))))' > $(@D)/.$(@F).tmp; \ - rm -f $(depfile); \ - mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd) - -# Usage: $(call if_changed_rule,foo) -# will check if $(cmd_foo) changed, or any of the prequisites changed, -# and if so will execute $(rule_foo) - -if_changed_rule = $(if $(strip $? $(call arg-check, $(cmd_$(1)), $(cmd_$@)) ),\ - @set -e; \ - $(rule_$(1))) - -# If quiet is set, only print short version of command - -cmd = @$(if $($(quiet)cmd_$(1)),echo ' $(subst ','\'',$($(quiet)cmd_$(1)))' &&) $(cmd_$(1)) - -# Shorthand for $(Q)$(MAKE) -f scripts/Makefile.build obj= -# Usage: -# $(Q)$(MAKE) $(build)=dir -build := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.build obj - -# filechk is used to check if the content of a generated file is updated. -# Sample usage: -# define filechk_sample -# echo $KERNELRELEASE -# endef -# version.h : Makefile -# $(call filechk,sample) -# The rule defined shall write to stdout the content of the new file. -# The existing file will be compared with the new one. -# - If no file exist it is created -# - If the content differ the new file is used -# - If they are equal no change, and no timestamp update - -define filechk - $(Q)set -e; \ - echo ' CHK $@'; \ - mkdir -p $(dir $@); \ - $(filechk_$(1)) $(2) > $@.tmp; \ - if [ -r $@ ] && cmp -s $@ $@.tmp; then \ - rm -f $@.tmp; \ - else \ - echo ' UPD $@'; \ - mv -f $@.tmp $@; \ - fi -endef diff --git a/scripts/Makefile.modinst b/scripts/Makefile.modinst index 85d6494e3c24a3..23fd1bdc25cebe 100644 --- a/scripts/Makefile.modinst +++ b/scripts/Makefile.modinst @@ -5,7 +5,7 @@ .PHONY: __modinst __modinst: -include scripts/Makefile.lib +include scripts/Kbuild.include # diff --git a/scripts/Makefile.modpost b/scripts/Makefile.modpost index 94b550e21be8d8..0c4f3a9f2ea95e 100644 --- a/scripts/Makefile.modpost +++ b/scripts/Makefile.modpost @@ -36,6 +36,7 @@ _modpost: __modpost include .config +include scripts/Kbuild.include include scripts/Makefile.lib symverfile := $(objtree)/Module.symvers diff --git a/usr/Makefile b/usr/Makefile index 248d5551029d5e..e2129cb570bba8 100644 --- a/usr/Makefile +++ b/usr/Makefile @@ -27,7 +27,7 @@ quotefixed_initramfs_source := $(shell echo $(CONFIG_INITRAMFS_SOURCE)) filechk_initramfs_list = $(CONFIG_SHELL) \ $(srctree)/scripts/gen_initramfs_list.sh $(gen_initramfs_args) $(quotefixed_initramfs_source) -$(obj)/initramfs_list: FORCE +$(obj)/initramfs_list: $(obj)/Makefile FORCE $(call filechk,initramfs_list) quiet_cmd_cpio = CPIO $@ -- cgit 1.2.3-korg From 2a691470345a0024dd7ffaf47ad3d0f5f4f41924 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 25 Jul 2005 20:26:04 +0000 Subject: kbuild: fix make O=... kbuild failed to locate Kbuild.include. Teach kbuild how to find Kbuild files when using make O=... Signed-off-by: Sam Ravnborg --- --- Makefile | 2 +- scripts/Makefile.build | 4 +++- scripts/Makefile.clean | 4 +++- 3 files changed, 7 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/Makefile b/Makefile index 7c607dc64479da..ed1f4b5b714f85 100644 --- a/Makefile +++ b/Makefile @@ -310,7 +310,7 @@ cc-version = $(shell $(CONFIG_SHELL) $(srctree)/scripts/gcc-version.sh \ MAKEFLAGS += --include-dir=$(srctree) # We need some generic definitions -include scripts/Kbuild.include +include $(srctree)/scripts/Kbuild.include # For maximum performance (+ possibly random breakage, uncomment # the following) diff --git a/scripts/Makefile.build b/scripts/Makefile.build index ebed6a41bc69bf..8f4f5a347767d6 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -10,7 +10,9 @@ __build: # Read .config if it exist, otherwise ignore -include .config -include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile) +# The filename Kbuild has precedence over Makefile +include $(if $(wildcard $(srctree)/$(src)/Kbuild), \ + $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile) include scripts/Kbuild.include include scripts/Makefile.lib diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index ff3e87dbf38741..9c978b7bbdf189 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -7,7 +7,9 @@ src := $(obj) .PHONY: __clean __clean: -include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile) +# The filename Kbuild has precedence over Makefile +include $(if $(wildcard $(srctree)/$(src)/Kbuild), \ + $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile) # Figure out what we need to build from the various variables # ========================================================================== -- cgit 1.2.3-korg From 2315c6e42278152360470124ce903ecb8c97270a Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Mon, 25 Jul 2005 22:41:12 +0000 Subject: kbuild: define clean before including kbuild file Defining clean before including the kbuild file give us knowledge when the kbuild file is included for cleaning. This is rarey usefull - but in a corner case in klibc this proved necessary. Signed-off-by: Sam Ravnborg --- --- scripts/Makefile.clean | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 9c978b7bbdf189..62351b630fabbe 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -7,6 +7,11 @@ src := $(obj) .PHONY: __clean __clean: +# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir +# Usage: +# $(Q)$(MAKE) $(clean)=dir +clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj + # The filename Kbuild has precedence over Makefile include $(if $(wildcard $(srctree)/$(src)/Kbuild), \ $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile) @@ -89,8 +94,3 @@ $(subdir-ymn): # If quiet is set, only print short version of command cmd = @$(if $($(quiet)cmd_$(1)),echo ' $($(quiet)cmd_$(1))' &&) $(cmd_$(1)) - -# Shorthand for $(Q)$(MAKE) scripts/Makefile.clean obj=dir -# Usage: -# $(Q)$(MAKE) $(clean)=dir -clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj -- cgit 1.2.3-korg From db8c1a7b2ca25f37b1429c00e82d6568f86caec1 Mon Sep 17 00:00:00 2001 From: Sam Ravnborg Date: Wed, 27 Jul 2005 22:11:01 +0200 Subject: kbuild: fix building external modules kbuild failed to locate Makefile for external modules. This brought to my attention how the variables for directories have different values in different usage scenarios. Different kbuild usage scenarios: make - plain make in same directory where kernel source lives make O= - kbuild is told to store output files in another directory make M= - building an external module make O= M= - building an external module with kernel output seperate from src Value assigned to the different variables: |$(src) |$(obj) |$(srctree) |$(objtree) make |reldir to k src |as src |abs path to k src |abs path to k src make O= |reldir to k src |as src |abs path to k src |abs path to output dir make M= |abs path to src |as src |abs path to k src |abs path to k src make O= M= |abs path to src |as src |abs path to k src |abs path to k output path to kbuild file: make | $(srctree)/$(src), $(src) make O= | $(srctree)/$(src) make M= | $(src) make O= M= | $(src) From the table above it can be seen that the only good way to find the home directory of the kbuild file is to locate the one of the two variants that is an absolute path. If $(src) is an absolute path (starts with /) then use it, otherwise prefix $(src) with $(srctree). Signed-off-by: Sam Ravnborg --- scripts/Makefile.build | 4 ++-- scripts/Makefile.clean | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts') diff --git a/scripts/Makefile.build b/scripts/Makefile.build index 8f4f5a347767d6..506e3f3befe310 100644 --- a/scripts/Makefile.build +++ b/scripts/Makefile.build @@ -11,8 +11,8 @@ __build: -include .config # The filename Kbuild has precedence over Makefile -include $(if $(wildcard $(srctree)/$(src)/Kbuild), \ - $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile) +kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) include scripts/Kbuild.include include scripts/Makefile.lib diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean index 62351b630fabbe..8974ea5fc87889 100644 --- a/scripts/Makefile.clean +++ b/scripts/Makefile.clean @@ -13,8 +13,8 @@ __clean: clean := -f $(if $(KBUILD_SRC),$(srctree)/)scripts/Makefile.clean obj # The filename Kbuild has precedence over Makefile -include $(if $(wildcard $(srctree)/$(src)/Kbuild), \ - $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile) +kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src)) +include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile) # Figure out what we need to build from the various variables # ========================================================================== -- cgit 1.2.3-korg From 84c2a2eb348f3bd85ec8eb3bb95ba04f65f4e217 Mon Sep 17 00:00:00 2001 From: Keenan Pepper Date: Wed, 27 Jul 2005 14:14:00 -0400 Subject: [PATCH] kbuild: signed/unsigned char fix for make menuconfig Quiet some silly warnings. Signed-off-by: Sam Ravnborg --- scripts/lxdialog/dialog.h | 2 +- scripts/lxdialog/inputbox.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'scripts') diff --git a/scripts/lxdialog/dialog.h b/scripts/lxdialog/dialog.h index c571548daa8200..eb63e1bb63a3be 100644 --- a/scripts/lxdialog/dialog.h +++ b/scripts/lxdialog/dialog.h @@ -163,7 +163,7 @@ int dialog_menu (const char *title, const char *prompt, int height, int width, int dialog_checklist (const char *title, const char *prompt, int height, int width, int list_height, int item_no, const char * const * items, int flag); -extern unsigned char dialog_input_result[]; +extern char dialog_input_result[]; int dialog_inputbox (const char *title, const char *prompt, int height, int width, const char *init); diff --git a/scripts/lxdialog/inputbox.c b/scripts/lxdialog/inputbox.c index fa7bebc693b932..074d2d68bd31fb 100644 --- a/scripts/lxdialog/inputbox.c +++ b/scripts/lxdialog/inputbox.c @@ -21,7 +21,7 @@ #include "dialog.h" -unsigned char dialog_input_result[MAX_LEN + 1]; +char dialog_input_result[MAX_LEN + 1]; /* * Print the termination buttons @@ -48,7 +48,7 @@ dialog_inputbox (const char *title, const char *prompt, int height, int width, { int i, x, y, box_y, box_x, box_width; int input_x = 0, scroll = 0, key = 0, button = -1; - unsigned char *instr = dialog_input_result; + char *instr = dialog_input_result; WINDOW *dialog; /* center dialog box on screen */ -- cgit 1.2.3-korg From 61d9cdf2a9ccb9e4770d7723db8b18b8952778ce Mon Sep 17 00:00:00 2001 From: "J.A. Magallon" Date: Fri, 15 Jul 2005 22:14:43 +0000 Subject: [PATCH] kbuild: signed char fixes for scripts This time I did not break anything... and they shut up gcc4 ;) Signed-off-by: Sam Ravnborg --- scripts/conmakehash.c | 2 +- scripts/kallsyms.c | 6 +++--- scripts/mod/sumversion.c | 8 ++++---- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'scripts') diff --git a/scripts/conmakehash.c b/scripts/conmakehash.c index 93dd23f21ec96b..e0c6891a9ad4f5 100644 --- a/scripts/conmakehash.c +++ b/scripts/conmakehash.c @@ -33,7 +33,7 @@ void usage(char *argv0) int getunicode(char **p0) { - unsigned char *p = *p0; + char *p = *p0; while (*p == ' ' || *p == '\t') p++; diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index d3d2e534105180..9be41a9f5aff77 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -207,9 +207,9 @@ symbol_valid(struct sym_entry *s) * move then they may get dropped in pass 2, which breaks the * kallsyms rules. */ - if ((s->addr == _etext && strcmp(s->sym + offset, "_etext")) || - (s->addr == _einittext && strcmp(s->sym + offset, "_einittext")) || - (s->addr == _eextratext && strcmp(s->sym + offset, "_eextratext"))) + if ((s->addr == _etext && strcmp((char*)s->sym + offset, "_etext")) || + (s->addr == _einittext && strcmp((char*)s->sym + offset, "_einittext")) || + (s->addr == _eextratext && strcmp((char*)s->sym + offset, "_eextratext"))) return 0; } diff --git a/scripts/mod/sumversion.c b/scripts/mod/sumversion.c index 1112347245c024..43271a1ca01ec8 100644 --- a/scripts/mod/sumversion.c +++ b/scripts/mod/sumversion.c @@ -252,9 +252,9 @@ static int parse_comment(const char *file, unsigned long len) } /* FIXME: Handle .s files differently (eg. # starts comments) --RR */ -static int parse_file(const signed char *fname, struct md4_ctx *md) +static int parse_file(const char *fname, struct md4_ctx *md) { - signed char *file; + char *file; unsigned long i, len; file = grab_file(fname, &len); @@ -332,7 +332,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) Sum all files in the same dir or subdirs. */ while ((line = get_next_line(&pos, file, flen)) != NULL) { - signed char* p = line; + char* p = line; if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) { check_files = 1; continue; @@ -458,7 +458,7 @@ out: close(fd); } -static int strip_rcs_crap(signed char *version) +static int strip_rcs_crap(char *version) { unsigned int len, full_len; -- cgit 1.2.3-korg From fb7f6ff614f3ead2ca41bb4a348b9ea431d95176 Mon Sep 17 00:00:00 2001 From: "blaisorblade@yahoo.it" Date: Thu, 28 Jul 2005 17:56:25 +0200 Subject: [PATCH] kconfig: trivial cleanup Replace all menu_add_prop mimicking menu_add_prompt with the latter func. I've had to add a return value to menu_add_prompt for one usage. I've rebuilt scripts/kconfig/zconf.tab.c_shipped by hand to reflect changes in the source (I've not the same Bison version so regenerating it wouldn't have been not a good idea), and compared it with what Roman itself did some time ago, and it's the same. So I guess this can be finally merged. Signed-off-by: Paolo 'Blaisorblade' Giarrusso Signed-off-by: Sam Ravnborg --- scripts/kconfig/lkc.h | 2 +- scripts/kconfig/menu.c | 4 ++-- scripts/kconfig/zconf.tab.c_shipped | 8 ++++---- scripts/kconfig/zconf.y | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/kconfig/lkc.h b/scripts/kconfig/lkc.h index 8b84c42b49b5bd..c3d25786a64dce 100644 --- a/scripts/kconfig/lkc.h +++ b/scripts/kconfig/lkc.h @@ -59,7 +59,7 @@ void menu_add_entry(struct symbol *sym); void menu_end_entry(void); void menu_add_dep(struct expr *dep); struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *expr, struct expr *dep); -void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); +struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep); void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep); void menu_add_symbol(enum prop_type type, struct symbol *sym, struct expr *dep); void menu_finalize(struct menu *parent); diff --git a/scripts/kconfig/menu.c b/scripts/kconfig/menu.c index 8c59b212722dc2..5cfa6c405cf074 100644 --- a/scripts/kconfig/menu.c +++ b/scripts/kconfig/menu.c @@ -136,9 +136,9 @@ struct property *menu_add_prop(enum prop_type type, char *prompt, struct expr *e return prop; } -void menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) +struct property *menu_add_prompt(enum prop_type type, char *prompt, struct expr *dep) { - menu_add_prop(type, prompt, NULL, dep); + return menu_add_prop(type, prompt, NULL, dep); } void menu_add_expr(enum prop_type type, struct expr *expr, struct expr *dep) diff --git a/scripts/kconfig/zconf.tab.c_shipped b/scripts/kconfig/zconf.tab.c_shipped index f163d8d2d9ef2e..ff4fcc09720ecb 100644 --- a/scripts/kconfig/zconf.tab.c_shipped +++ b/scripts/kconfig/zconf.tab.c_shipped @@ -1531,7 +1531,7 @@ yyreduce: { menu_add_entry(NULL); - menu_add_prop(P_MENU, yyvsp[-1].string, NULL, NULL); + menu_add_prompt(P_MENU, yyvsp[-1].string, NULL); printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1586,7 +1586,7 @@ yyreduce: { menu_add_entry(NULL); - menu_add_prop(P_COMMENT, yyvsp[-1].string, NULL, NULL); + menu_add_prompt(P_COMMENT, yyvsp[-1].string, NULL); printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); ;} break; @@ -1640,7 +1640,7 @@ yyreduce: case 86: { - menu_add_prop(P_PROMPT, yyvsp[-1].string, NULL, yyvsp[0].expr); + menu_add_prompt(P_PROMPT, yyvsp[-1].string, yyvsp[0].expr); ;} break; @@ -1925,7 +1925,7 @@ void conf_parse(const char *name) sym_init(); menu_init(); modules_sym = sym_lookup("MODULES", 0); - rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); + rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); //zconfdebug = 1; zconfparse(); diff --git a/scripts/kconfig/zconf.y b/scripts/kconfig/zconf.y index 54460f8d3696b2..e1a0f455d4a8de 100644 --- a/scripts/kconfig/zconf.y +++ b/scripts/kconfig/zconf.y @@ -342,7 +342,7 @@ if_block: menu: T_MENU prompt T_EOL { menu_add_entry(NULL); - menu_add_prop(P_MENU, $2, NULL, NULL); + menu_add_prompt(P_MENU, $2, NULL); printd(DEBUG_PARSE, "%s:%d:menu\n", zconf_curname(), zconf_lineno()); }; @@ -392,7 +392,7 @@ source_stmt: source comment: T_COMMENT prompt T_EOL { menu_add_entry(NULL); - menu_add_prop(P_COMMENT, $2, NULL, NULL); + menu_add_prompt(P_COMMENT, $2, NULL); printd(DEBUG_PARSE, "%s:%d:comment\n", zconf_curname(), zconf_lineno()); }; @@ -443,7 +443,7 @@ prompt_stmt_opt: /* empty */ | prompt if_expr { - menu_add_prop(P_PROMPT, $1, NULL, $2); + menu_add_prompt(P_PROMPT, $1, $2); }; prompt: T_WORD @@ -487,7 +487,7 @@ void conf_parse(const char *name) sym_init(); menu_init(); modules_sym = sym_lookup("MODULES", 0); - rootmenu.prompt = menu_add_prop(P_MENU, "Linux Kernel Configuration", NULL, NULL); + rootmenu.prompt = menu_add_prompt(P_MENU, "Linux Kernel Configuration", NULL); //zconfdebug = 1; zconfparse(); -- cgit 1.2.3-korg From aaebf4332018980fef4e601d1b5a6e52dd9e9ae4 Mon Sep 17 00:00:00 2001 From: Ryan Anderson Date: Sun, 31 Jul 2005 04:57:49 -0400 Subject: [PATCH] kbuild: automatically append a short string to the version based upon the git commit If CONFIG_AUTO_LOCALVERSION is set, the user is using a git-based tree, and the current HEAD is not referred to by any tags in .git/refs/tags/, append -g and the first 8 characters of the commit to the version string. This makes it easier to use git-bisect, and/or to do a daily build, without trampling on your older, working builds, or accidentally setting up conflicting sets of modules. Signed-off-by: Ryan Anderson Signed-off-by: Sam Ravnborg --- Makefile | 20 ++++++++++++++++++ init/Kconfig | 16 ++++++++++++++ scripts/setlocalversion | 56 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 scripts/setlocalversion (limited to 'scripts') diff --git a/Makefile b/Makefile index d01b004a2a0e74..c6aae86a02cdb1 100644 --- a/Makefile +++ b/Makefile @@ -548,6 +548,26 @@ export KBUILD_IMAGE ?= vmlinux # images. Default is /boot, but you can set it to other values export INSTALL_PATH ?= /boot +# If CONFIG_LOCALVERSION_AUTO is set, we automatically perform some tests +# and try to determine if the current source tree is a release tree, of any sort, +# or if is a pure development tree. +# +# A 'release tree' is any tree with a git TAG associated +# with it. The primary goal of this is to make it safe for a native +# git/CVS/SVN user to build a release tree (i.e, 2.6.9) and also to +# continue developing against the current Linus tree, without having the Linus +# tree overwrite the 2.6.9 tree when installed. +# +# Currently, only git is supported. +# Other SCMs can edit scripts/setlocalversion and add the appropriate +# checks as needed. + + +ifdef CONFIG_LOCALVERSION_AUTO + localversion-auto := $(shell $(PERL) $(srctree)/scripts/setlocalversion $(srctree)) + LOCALVERSION := $(LOCALVERSION)$(localversion-auto) +endif + # # INSTALL_MOD_PATH specifies a prefix to MODLIB for module directory # relocations required by build roots. This is not defined in the diff --git a/init/Kconfig b/init/Kconfig index eb86972be1c23d..f27fc48c1fdc80 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -77,6 +77,22 @@ config LOCALVERSION object and source tree, in that order. Your total string can be a maximum of 64 characters. +config LOCALVERSION_AUTO + bool "Automatically append version information to the version string" + default y + help + This will try to automatically determine if the current tree is a + release tree by looking for git tags that + belong to the current top of tree revision. + + A string of the format -gxxxxxxxx will be added to the localversion + if a git based tree is found. The string generated by this will be + appended after any matching localversion* files, and after the value + set in CONFIG_LOCALVERSION + + Note: This requires Perl, and a git repository, but not necessarily + the git or cogito tools to be installed. + config SWAP bool "Support for paging of anonymous memory (swap)" depends on MMU diff --git a/scripts/setlocalversion b/scripts/setlocalversion new file mode 100644 index 00000000000000..7c805c8fccd26b --- /dev/null +++ b/scripts/setlocalversion @@ -0,0 +1,56 @@ +#!/usr/bin/perl +# Copyright 2004 - Ryan Anderson GPL v2 + +use strict; +use warnings; +use Digest::MD5; +require 5.006; + +if (@ARGV != 1) { + print < +EOT + exit(1); +} + +my ($srctree) = @ARGV; +chdir($srctree); + +my @LOCALVERSIONS = (); + +# We are going to use the following commands to try and determine if this +# repository is at a Version boundary (i.e, 2.6.10 vs 2.6.10 + some patches) We +# currently assume that all meaningful version boundaries are marked by a tag. +# We don't care what the tag is, just that something exists. + +# Git/Cogito store the top-of-tree "commit" in .git/HEAD +# A list of known tags sits in .git/refs/tags/ +# +# The simple trick here is to just compare the two of these, and if we get a +# match, return nothing, otherwise, return a subset of the SHA-1 hash in +# .git/HEAD + +sub do_git_checks { + open(H,"<.git/HEAD") or return; + my $head = ; + chomp $head; + close(H); + + opendir(D,".git/refs/tags") or return; + foreach my $tagfile (grep !/^\.{1,2}$/, readdir(D)) { + open(F,"<.git/refs/tags/" . $tagfile) or return; + my $tag = ; + chomp $tag; + close(F); + return if ($tag eq $head); + } + closedir(D); + + push @LOCALVERSIONS, "g" . substr($head,0,8); +} + +if ( -d ".git") { + do_git_checks(); +} + +printf "-%s\n", join("-",@LOCALVERSIONS) if (scalar @LOCALVERSIONS > 0); -- cgit 1.2.3-korg