GIT 946dc121d7d1c606f6bbeb8ae778963a1e2ff59c master.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git --- Signed-off-by: Andrew Morton --- Makefile | 33 ++++++++--- include/asm-generic/vmlinux.lds.h | 9 +++ init/Makefile | 3 - scripts/Makefile.build | 2 scripts/Makefile.host | 3 - scripts/kernel-doc | 8 ++ scripts/mkcompile_h | 12 ++-- scripts/mod/modpost.c | 9 ++- scripts/package/Makefile | 24 ++++++-- scripts/package/builddeb | 56 +++++++++++++++++-- scripts/package/buildtar | 111 ++++++++++++++++++++++++++++++++++++++ scripts/package/mkspec | 9 +++ scripts/reference_discarded.pl | 1 scripts/reference_init.pl | 1 Lindent | 0 15 files changed, 252 insertions(+), 29 deletions(-) diff -puN include/asm-generic/vmlinux.lds.h~git-kbuild include/asm-generic/vmlinux.lds.h --- devel/include/asm-generic/vmlinux.lds.h~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/include/asm-generic/vmlinux.lds.h 2005-07-14 17:34:42.000000000 -0700 @@ -6,6 +6,9 @@ #define VMLINUX_SYMBOL(_sym_) _sym_ #endif +/* Align . to a 8 byte boundary equals to maximum function alignment. */ +#define ALIGN_FUNCTION() . = ALIGN(8) + #define RODATA \ .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \ *(.rodata) *(.rodata.*) \ @@ -79,12 +82,18 @@ VMLINUX_SYMBOL(__security_initcall_end) = .; \ } +/* sched.text is aling to function alignment to secure we have same + * address even at second ld pass when generating System.map */ #define SCHED_TEXT \ + ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__sched_text_start) = .; \ *(.sched.text) \ VMLINUX_SYMBOL(__sched_text_end) = .; +/* spinlock.text is aling to function alignment to secure we have same + * address even at second ld pass when generating System.map */ #define LOCK_TEXT \ + ALIGN_FUNCTION(); \ VMLINUX_SYMBOL(__lock_text_start) = .; \ *(.spinlock.text) \ VMLINUX_SYMBOL(__lock_text_end) = .; diff -puN init/Makefile~git-kbuild init/Makefile --- devel/init/Makefile~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/init/Makefile 2005-07-14 17:34:42.000000000 -0700 @@ -25,4 +25,5 @@ $(obj)/version.o: include/linux/compile. 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 -puN Makefile~git-kbuild Makefile --- devel/Makefile~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/Makefile 2005-07-14 17:34:42.000000000 -0700 @@ -722,6 +722,16 @@ quiet_cmd_kallsyms = KSYM $@ # Needs to visit scripts/ before $(KALLSYMS) can be used. $(KALLSYMS): scripts ; +# Generate some data for debugging strange kallsyms problems +debug_kallsyms: .tmp_map$(last_kallsyms) + +.tmp_map%: .tmp_vmlinux% FORCE + ($(OBJDUMP) -h $< | $(AWK) '/^ +[0-9]/{print $$4 " 0 " $$2}'; $(NM) $<) | sort > $@ + +.tmp_map3: .tmp_map2 + +.tmp_map2: .tmp_map1 + endif # ifdef CONFIG_KALLSYMS # vmlinux image - including updated kernel symbols @@ -757,7 +767,7 @@ $(vmlinux-dirs): prepare-all scripts prepare2: ifneq ($(KBUILD_SRC),) @echo ' Using $(srctree) as source for kernel' - $(Q)if [ -h $(srctree)/include/asm -o -f $(srctree)/.config ]; then \ + $(Q)if [ -f $(srctree)/.config ]; then \ echo " $(srctree) is not clean, please run 'make mrproper'";\ echo " in the '$(srctree)' directory.";\ /bin/false; \ @@ -769,7 +779,8 @@ endif # prepare1 creates a makefile if using a separate output directory prepare1: prepare2 outputmakefile -prepare0: prepare1 include/linux/version.h include/asm include/config/MARKER +prepare0: prepare1 include/linux/version.h include/asm \ + include/config/MARKER ifneq ($(KBUILD_MODULES),) $(Q)rm -rf $(MODVERDIR) $(Q)mkdir -p $(MODVERDIR) @@ -1159,28 +1170,34 @@ else __srctree = $(srctree)/ endif +ALLSOURCE_ARCHS := $(ARCH) + define all-sources ( find $(__srctree) $(RCS_FIND_IGNORE) \ \( -name include -o -name arch \) -prune -o \ -name '*.[chS]' -print; \ - find $(__srctree)arch/$(ARCH) $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print; \ + for ARCH in $(ALLSOURCE_ARCHS) ; do \ + find $(__srctree)arch/$${ARCH} $(RCS_FIND_IGNORE) \ + -name '*.[chS]' -print; \ + done ; \ find $(__srctree)security/selinux/include $(RCS_FIND_IGNORE) \ -name '*.[chS]' -print; \ find $(__srctree)include $(RCS_FIND_IGNORE) \ \( -name config -o -name 'asm-*' \) -prune \ -o -name '*.[chS]' -print; \ - find $(__srctree)include/asm-$(ARCH) $(RCS_FIND_IGNORE) \ - -name '*.[chS]' -print; \ + for ARCH in $(ALLSOURCE_ARCHS) ; do \ + find $(__srctree)include/asm-$${ARCH} $(RCS_FIND_IGNORE) \ + -name '*.[chS]' -print; \ + done ; \ find $(__srctree)include/asm-generic $(RCS_FIND_IGNORE) \ -name '*.[chS]' -print ) endef quiet_cmd_cscope-file = FILELST cscope.files - cmd_cscope-file = $(all-sources) > cscope.files + cmd_cscope-file = (echo \-k; echo \-q; $(all-sources)) > cscope.files quiet_cmd_cscope = MAKE cscope.out - cmd_cscope = cscope -k -b -q + cmd_cscope = cscope -b cscope: FORCE $(call cmd,cscope-file) diff -puN scripts/kernel-doc~git-kbuild scripts/kernel-doc --- devel/scripts/kernel-doc~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/kernel-doc 2005-07-14 17:34:44.000000000 -0700 @@ -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}; } diff -puN scripts/Lindent~git-kbuild scripts/Lindent diff -puN scripts/Makefile.build~git-kbuild scripts/Makefile.build --- devel/scripts/Makefile.build~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/Makefile.build 2005-07-14 17:34:44.000000000 -0700 @@ -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 diff -puN scripts/Makefile.host~git-kbuild scripts/Makefile.host --- devel/scripts/Makefile.host~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/Makefile.host 2005-07-14 17:34:44.000000000 -0700 @@ -98,7 +98,8 @@ hostcxx_flags = -Wp,-MD,$(depfile) $(__ # 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) diff -puN scripts/mkcompile_h~git-kbuild scripts/mkcompile_h --- devel/scripts/mkcompile_h~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/mkcompile_h 2005-07-14 17:34:44.000000000 -0700 @@ -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\} # 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`\" diff -puN scripts/mod/modpost.c~git-kbuild scripts/mod/modpost.c --- devel/scripts/mod/modpost.c~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/mod/modpost.c 2005-07-14 17:34:44.000000000 -0700 @@ -359,11 +359,16 @@ handle_modversions(struct module *mod, s /* 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 diff -puN scripts/package/builddeb~git-kbuild scripts/package/builddeb --- devel/scripts/package/builddeb~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/package/builddeb 2005-07-14 17:34:44.000000000 -0700 @@ -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 + 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" + fi fi # Install the maintainer scripts @@ -53,6 +73,8 @@ linux ($version) unstable; urgency=low EOF # Generate a control file +if [ "$ARCH" == "um" ]; then + cat < debian/control Source: linux Section: base @@ -60,12 +82,34 @@ Priority: optional Maintainer: $name Standards-Version: 3.6.1 -Package: linux-$version +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 +Priority: optional +Maintainer: $name +Standards-Version: 3.6.1 + +Package: $packagename Architecture: any Description: Linux kernel, version $version This package contains the Linux kernel, modules and corresponding other - files version $version. + files version $version EOF +fi # Fix some ownership and permissions chown -R root:root "$tmpdir" diff -puN /dev/null scripts/package/buildtar --- /dev/null 2003-09-15 06:40:47.000000000 -0700 +++ devel-akpm/scripts/package/buildtar 2005-07-14 17:34:44.000000000 -0700 @@ -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 + diff -puN scripts/package/Makefile~git-kbuild scripts/package/Makefile --- devel/scripts/package/Makefile~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/package/Makefile 2005-07-14 17:34:44.000000000 -0700 @@ -59,7 +59,7 @@ $(objtree)/binkernel.spec: $(MKSPEC) $(s $(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,16 +74,30 @@ clean-files += $(objtree)/binkernel.spec # .PHONY: deb-pkg deb-pkg: - $(MAKE) + $(MAKE) KBUILD_SRC= $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb 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 + @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' + @echo ' tarbz2-pkg - Build the kernel as a bzip2 compressed tarball' diff -puN scripts/package/mkspec~git-kbuild scripts/package/mkspec --- devel/scripts/package/mkspec~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/package/mkspec 2005-07-14 17:34:44.000000000 -0700 @@ -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" diff -puN scripts/reference_discarded.pl~git-kbuild scripts/reference_discarded.pl --- devel/scripts/reference_discarded.pl~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/reference_discarded.pl 2005-07-14 17:34:44.000000000 -0700 @@ -96,6 +96,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 -puN scripts/reference_init.pl~git-kbuild scripts/reference_init.pl --- devel/scripts/reference_init.pl~git-kbuild 2005-07-14 17:34:42.000000000 -0700 +++ devel-akpm/scripts/reference_init.pl 2005-07-14 17:34:44.000000000 -0700 @@ -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); } _