Commit cb63fc26 authored by Linus Torvalds's avatar Linus Torvalds

Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild

Pull kbuild updates from Michal Marek:
 - fix for make headers_install argv explosion with too long path
 - scripts/setlocalversion does not call git update-index needlessly
 - fix for the src.rpm produced by make rpm-pkg.  The new make
   image_name can be useful also for other packaging tools.
 - scripts/mod/devicetable-offsets.o is not rebuilt during each make run
 - make modules_install dependency fix
 - scripts/sortextable portability fix
 - fix for kbuild to generate the output directory for all object files
   in subdirs.
 - a couple of minor fixes

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild:
  kbuild: create directory for dir/file.o
  tools/include: use stdint types for user-space byteshift headers
  Makefile: Fix install error with make -j option
  Fix a build warning in scripts/mod/file2alias.c
  improve modalias building
  scripts/mod: Spelling s/DEVICEVTABLE/DEVICETABLE/
  kbuild: fix error when building from src rpm
  scripts/setlocalversion on write-protected source tree
  Makefile.lib: align DTB quiet_cmd
  kbuild: fix make headers_install when path is too long
parents a9642fa3 4d47dde4
...@@ -981,7 +981,7 @@ _modinst_: ...@@ -981,7 +981,7 @@ _modinst_:
# boot a modules.dep even before / is mounted read-write. However the # boot a modules.dep even before / is mounted read-write. However the
# boot script depmod is the master version. # boot script depmod is the master version.
PHONY += _modinst_post PHONY += _modinst_post
_modinst_post: _modinst_ _modinst_post: include/config/kernel.release _modinst_
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst $(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
$(call cmd,depmod) $(call cmd,depmod)
...@@ -1116,6 +1116,7 @@ help: ...@@ -1116,6 +1116,7 @@ help:
@echo ' gtags - Generate GNU GLOBAL index' @echo ' gtags - Generate GNU GLOBAL index'
@echo ' kernelrelease - Output the release version string' @echo ' kernelrelease - Output the release version string'
@echo ' kernelversion - Output the version stored in Makefile' @echo ' kernelversion - Output the version stored in Makefile'
@echo ' image_name - Output the image name'
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \ @echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
echo ' (default: $(INSTALL_HDR_PATH))'; \ echo ' (default: $(INSTALL_HDR_PATH))'; \
echo '' echo ''
...@@ -1310,7 +1311,7 @@ export_report: ...@@ -1310,7 +1311,7 @@ export_report:
endif #ifeq ($(config-targets),1) endif #ifeq ($(config-targets),1)
endif #ifeq ($(mixed-targets),1) endif #ifeq ($(mixed-targets),1)
PHONY += checkstack kernelrelease kernelversion PHONY += checkstack kernelrelease kernelversion image_name
# UML needs a little special treatment here. It wants to use the host # UML needs a little special treatment here. It wants to use the host
# toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone # toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone
...@@ -1331,6 +1332,9 @@ kernelrelease: ...@@ -1331,6 +1332,9 @@ kernelrelease:
kernelversion: kernelversion:
@echo $(KERNELVERSION) @echo $(KERNELVERSION)
image_name:
@echo $(KBUILD_IMAGE)
# Clear a bunch of variables before executing the submake # Clear a bunch of variables before executing the submake
tools/: FORCE tools/: FORCE
$(Q)mkdir -p $(objtree)/tools $(Q)mkdir -p $(objtree)/tools
......
...@@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y)) ...@@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y))
all-files := $(header-y) $(genhdr-y) $(wrapper-files) all-files := $(header-y) $(genhdr-y) $(wrapper-files)
output-files := $(addprefix $(installdir)/, $(all-files)) output-files := $(addprefix $(installdir)/, $(all-files))
input-files := $(foreach hdr, $(header-y), \ input-files1 := $(foreach hdr, $(header-y), \
$(if $(wildcard $(srcdir)/$(hdr)), \ $(if $(wildcard $(srcdir)/$(hdr)), \
$(wildcard $(srcdir)/$(hdr)), \ $(wildcard $(srcdir)/$(hdr))) \
)
input-files1-name := $(notdir $(input-files1))
input-files2 := $(foreach hdr, $(header-y), \
$(if $(wildcard $(srcdir)/$(hdr)),, \
$(if $(wildcard $(oldsrcdir)/$(hdr)), \ $(if $(wildcard $(oldsrcdir)/$(hdr)), \
$(wildcard $(oldsrcdir)/$(hdr)), \ $(wildcard $(oldsrcdir)/$(hdr)), \
$(error Missing UAPI file $(srcdir)/$(hdr))) \ $(error Missing UAPI file $(srcdir)/$(hdr))) \
)) \ ))
$(foreach hdr, $(genhdr-y), \ input-files2-name := $(notdir $(input-files2))
input-files3 := $(foreach hdr, $(genhdr-y), \
$(if $(wildcard $(gendir)/$(hdr)), \ $(if $(wildcard $(gendir)/$(hdr)), \
$(wildcard $(gendir)/$(hdr)), \ $(wildcard $(gendir)/$(hdr)), \
$(error Missing generated UAPI file $(gendir)/$(hdr)) \ $(error Missing generated UAPI file $(gendir)/$(hdr)) \
)) ))
input-files3-name := $(notdir $(input-files3))
# Work out what needs to be removed # Work out what needs to be removed
oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h)) oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
...@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@)) ...@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\ quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
file$(if $(word 2, $(all-files)),s)) file$(if $(word 2, $(all-files)),s))
cmd_install = \ cmd_install = \
$(CONFIG_SHELL) $< $(installdir) $(input-files); \ $(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
for F in $(wrapper-files); do \ for F in $(wrapper-files); do \
echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \ echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
done; \ done; \
...@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file) ...@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file)
@: @:
targets += $(install-file) targets += $(install-file)
$(install-file): scripts/headers_install.sh $(input-files) FORCE $(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
$(if $(unwanted),$(call cmd,remove),) $(if $(unwanted),$(call cmd,remove),)
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@))) $(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
$(call if_changed,install) $(call if_changed,install)
......
...@@ -63,7 +63,7 @@ multi-objs := $(multi-objs-y) $(multi-objs-m) ...@@ -63,7 +63,7 @@ multi-objs := $(multi-objs-y) $(multi-objs-m)
subdir-obj-y := $(filter %/built-in.o, $(obj-y)) subdir-obj-y := $(filter %/built-in.o, $(obj-y))
# $(obj-dirs) is a list of directories that contain object files # $(obj-dirs) is a list of directories that contain object files
obj-dirs := $(dir $(multi-objs) $(subdir-obj-y)) obj-dirs := $(dir $(multi-objs) $(obj-y))
# Replace multi-part objects by their individual parts, look at local dir only # Replace multi-part objects by their individual parts, look at local dir only
real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y) real-objs-y := $(foreach m, $(filter-out $(subdir-obj-y), $(obj-y)), $(if $(strip $($(m:.o=-objs)) $($(m:.o=-y))),$($(m:.o=-objs)) $($(m:.o=-y)),$(m))) $(extra-y)
...@@ -244,7 +244,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \ ...@@ -244,7 +244,7 @@ cmd_gzip = (cat $(filter-out FORCE,$^) | gzip -n -f -9 > $@) || \
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
# Generate an assembly file to wrap the output of the device tree compiler # Generate an assembly file to wrap the output of the device tree compiler
quiet_cmd_dt_S_dtb= DTB $@ quiet_cmd_dt_S_dtb= DTB $@
cmd_dt_S_dtb= \ cmd_dt_S_dtb= \
( \ ( \
echo '\#include <asm-generic/vmlinux.lds.h>'; \ echo '\#include <asm-generic/vmlinux.lds.h>'; \
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
if [ $# -lt 1 ] if [ $# -lt 1 ]
then then
echo "Usage: headers_install.sh OUTDIR [FILES...] echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]
echo echo
echo "Prepares kernel header files for use by user space, by removing" echo "Prepares kernel header files for use by user space, by removing"
echo "all compiler.h definitions and #includes, removing any" echo "all compiler.h definitions and #includes, removing any"
...@@ -10,6 +10,7 @@ then ...@@ -10,6 +10,7 @@ then
echo "asm/inline/volatile keywords." echo "asm/inline/volatile keywords."
echo echo
echo "OUTDIR: directory to write each userspace header FILE to." echo "OUTDIR: directory to write each userspace header FILE to."
echo "SRCDIR: source directory where files are picked."
echo "FILES: list of header files to operate on." echo "FILES: list of header files to operate on."
exit 1 exit 1
...@@ -19,6 +20,8 @@ fi ...@@ -19,6 +20,8 @@ fi
OUTDIR="$1" OUTDIR="$1"
shift shift
SRCDIR="$1"
shift
# Iterate through files listed on command line # Iterate through files listed on command line
...@@ -34,7 +37,7 @@ do ...@@ -34,7 +37,7 @@ do
-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \ -e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
-e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \ -e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
-e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \ -e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
"$i" > "$OUTDIR/$FILE.sed" || exit 1 "$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
> "$OUTDIR/$FILE" > "$OUTDIR/$FILE"
[ $? -gt 1 ] && exit 1 [ $? -gt 1 ] && exit 1
......
...@@ -15,8 +15,8 @@ endef ...@@ -15,8 +15,8 @@ endef
quiet_cmd_offsets = GEN $@ quiet_cmd_offsets = GEN $@
define cmd_offsets define cmd_offsets
(set -e; \ (set -e; \
echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; \ echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
echo "#define __DEVICEVTABLE_OFFSETS_H__"; \ echo "#define __DEVICETABLE_OFFSETS_H__"; \
echo "/*"; \ echo "/*"; \
echo " * DO NOT MODIFY."; \ echo " * DO NOT MODIFY."; \
echo " *"; \ echo " *"; \
...@@ -29,15 +29,10 @@ define cmd_offsets ...@@ -29,15 +29,10 @@ define cmd_offsets
echo "#endif" ) > $@ echo "#endif" ) > $@
endef endef
# We use internal kbuild rules to avoid the "is up to date" message from make $(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
scripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE $(call if_changed,offsets)
$(Q)mkdir -p $(dir $@)
$(call if_changed_dep,cc_s_c)
$(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s targets += $(devicetable-offsets-file) devicetable-offsets.s
$(call cmd,offsets)
targets += $(devicetable-offsets-file)
# dependencies on generated files need to be listed explicitly # dependencies on generated files need to be listed explicitly
......
...@@ -79,10 +79,12 @@ struct devtable **__start___devtable, **__stop___devtable; ...@@ -79,10 +79,12 @@ struct devtable **__start___devtable, **__stop___devtable;
extern struct devtable *__start___devtable[], *__stop___devtable[]; extern struct devtable *__start___devtable[], *__stop___devtable[];
#endif /* __MACH__ */ #endif /* __MACH__ */
#if __GNUC__ == 3 && __GNUC_MINOR__ < 3 #if !defined(__used)
# define __used __attribute__((__unused__)) # if __GNUC__ == 3 && __GNUC_MINOR__ < 3
#else # define __used __attribute__((__unused__))
# define __used __attribute__((__used__)) # else
# define __used __attribute__((__used__))
# endif
#endif #endif
/* Define a variable f that holds the value of field f of struct devid /* Define a variable f that holds the value of field f of struct devid
......
...@@ -74,6 +74,7 @@ echo "" ...@@ -74,6 +74,7 @@ echo ""
fi fi
echo "%install" echo "%install"
echo 'KBUILD_IMAGE=$(make image_name)'
echo "%ifarch ia64" echo "%ifarch ia64"
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules' echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware' echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'
......
...@@ -71,9 +71,6 @@ scm_version() ...@@ -71,9 +71,6 @@ scm_version()
printf -- '-svn%s' "`git svn find-rev $head`" printf -- '-svn%s' "`git svn find-rev $head`"
fi fi
# Update index only on r/w media
[ -w . ] && git update-index --refresh --unmerged > /dev/null
# Check for uncommitted changes # Check for uncommitted changes
if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
printf '%s' -dirty printf '%s' -dirty
......
#ifndef _TOOLS_BE_BYTESHIFT_H #ifndef _TOOLS_BE_BYTESHIFT_H
#define _TOOLS_BE_BYTESHIFT_H #define _TOOLS_BE_BYTESHIFT_H
#include <linux/types.h> #include <stdint.h>
static inline __u16 __get_unaligned_be16(const __u8 *p) static inline uint16_t __get_unaligned_be16(const uint8_t *p)
{ {
return p[0] << 8 | p[1]; return p[0] << 8 | p[1];
} }
static inline __u32 __get_unaligned_be32(const __u8 *p) static inline uint32_t __get_unaligned_be32(const uint8_t *p)
{ {
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3]; return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
} }
static inline __u64 __get_unaligned_be64(const __u8 *p) static inline uint64_t __get_unaligned_be64(const uint8_t *p)
{ {
return (__u64)__get_unaligned_be32(p) << 32 | return (uint64_t)__get_unaligned_be32(p) << 32 |
__get_unaligned_be32(p + 4); __get_unaligned_be32(p + 4);
} }
static inline void __put_unaligned_be16(__u16 val, __u8 *p) static inline void __put_unaligned_be16(uint16_t val, uint8_t *p)
{ {
*p++ = val >> 8; *p++ = val >> 8;
*p++ = val; *p++ = val;
} }
static inline void __put_unaligned_be32(__u32 val, __u8 *p) static inline void __put_unaligned_be32(uint32_t val, uint8_t *p)
{ {
__put_unaligned_be16(val >> 16, p); __put_unaligned_be16(val >> 16, p);
__put_unaligned_be16(val, p + 2); __put_unaligned_be16(val, p + 2);
} }
static inline void __put_unaligned_be64(__u64 val, __u8 *p) static inline void __put_unaligned_be64(uint64_t val, uint8_t *p)
{ {
__put_unaligned_be32(val >> 32, p); __put_unaligned_be32(val >> 32, p);
__put_unaligned_be32(val, p + 4); __put_unaligned_be32(val, p + 4);
} }
static inline __u16 get_unaligned_be16(const void *p) static inline uint16_t get_unaligned_be16(const void *p)
{ {
return __get_unaligned_be16((const __u8 *)p); return __get_unaligned_be16((const uint8_t *)p);
} }
static inline __u32 get_unaligned_be32(const void *p) static inline uint32_t get_unaligned_be32(const void *p)
{ {
return __get_unaligned_be32((const __u8 *)p); return __get_unaligned_be32((const uint8_t *)p);
} }
static inline __u64 get_unaligned_be64(const void *p) static inline uint64_t get_unaligned_be64(const void *p)
{ {
return __get_unaligned_be64((const __u8 *)p); return __get_unaligned_be64((const uint8_t *)p);
} }
static inline void put_unaligned_be16(__u16 val, void *p) static inline void put_unaligned_be16(uint16_t val, void *p)
{ {
__put_unaligned_be16(val, p); __put_unaligned_be16(val, p);
} }
static inline void put_unaligned_be32(__u32 val, void *p) static inline void put_unaligned_be32(uint32_t val, void *p)
{ {
__put_unaligned_be32(val, p); __put_unaligned_be32(val, p);
} }
static inline void put_unaligned_be64(__u64 val, void *p) static inline void put_unaligned_be64(uint64_t val, void *p)
{ {
__put_unaligned_be64(val, p); __put_unaligned_be64(val, p);
} }
......
#ifndef _TOOLS_LE_BYTESHIFT_H #ifndef _TOOLS_LE_BYTESHIFT_H
#define _TOOLS_LE_BYTESHIFT_H #define _TOOLS_LE_BYTESHIFT_H
#include <linux/types.h> #include <stdint.h>
static inline __u16 __get_unaligned_le16(const __u8 *p) static inline uint16_t __get_unaligned_le16(const uint8_t *p)
{ {
return p[0] | p[1] << 8; return p[0] | p[1] << 8;
} }
static inline __u32 __get_unaligned_le32(const __u8 *p) static inline uint32_t __get_unaligned_le32(const uint8_t *p)
{ {
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24; return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
} }
static inline __u64 __get_unaligned_le64(const __u8 *p) static inline uint64_t __get_unaligned_le64(const uint8_t *p)
{ {
return (__u64)__get_unaligned_le32(p + 4) << 32 | return (uint64_t)__get_unaligned_le32(p + 4) << 32 |
__get_unaligned_le32(p); __get_unaligned_le32(p);
} }
static inline void __put_unaligned_le16(__u16 val, __u8 *p) static inline void __put_unaligned_le16(uint16_t val, uint8_t *p)
{ {
*p++ = val; *p++ = val;
*p++ = val >> 8; *p++ = val >> 8;
} }
static inline void __put_unaligned_le32(__u32 val, __u8 *p) static inline void __put_unaligned_le32(uint32_t val, uint8_t *p)
{ {
__put_unaligned_le16(val >> 16, p + 2); __put_unaligned_le16(val >> 16, p + 2);
__put_unaligned_le16(val, p); __put_unaligned_le16(val, p);
} }
static inline void __put_unaligned_le64(__u64 val, __u8 *p) static inline void __put_unaligned_le64(uint64_t val, uint8_t *p)
{ {
__put_unaligned_le32(val >> 32, p + 4); __put_unaligned_le32(val >> 32, p + 4);
__put_unaligned_le32(val, p); __put_unaligned_le32(val, p);
} }
static inline __u16 get_unaligned_le16(const void *p) static inline uint16_t get_unaligned_le16(const void *p)
{ {
return __get_unaligned_le16((const __u8 *)p); return __get_unaligned_le16((const uint8_t *)p);
} }
static inline __u32 get_unaligned_le32(const void *p) static inline uint32_t get_unaligned_le32(const void *p)
{ {
return __get_unaligned_le32((const __u8 *)p); return __get_unaligned_le32((const uint8_t *)p);
} }
static inline __u64 get_unaligned_le64(const void *p) static inline uint64_t get_unaligned_le64(const void *p)
{ {
return __get_unaligned_le64((const __u8 *)p); return __get_unaligned_le64((const uint8_t *)p);
} }
static inline void put_unaligned_le16(__u16 val, void *p) static inline void put_unaligned_le16(uint16_t val, void *p)
{ {
__put_unaligned_le16(val, p); __put_unaligned_le16(val, p);
} }
static inline void put_unaligned_le32(__u32 val, void *p) static inline void put_unaligned_le32(uint32_t val, void *p)
{ {
__put_unaligned_le32(val, p); __put_unaligned_le32(val, p);
} }
static inline void put_unaligned_le64(__u64 val, void *p) static inline void put_unaligned_le64(uint64_t val, void *p)
{ {
__put_unaligned_le64(val, p); __put_unaligned_le64(val, p);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment