Skip to content

Commit cb63fc2

Browse files
committed
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
2 parents a9642fa + 4d47dde commit cb63fc2

10 files changed

Lines changed: 73 additions & 63 deletions

File tree

‎Makefile‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -981,7 +981,7 @@ _modinst_:
981981
# boot a modules.dep even before / is mounted read-write. However the
982982
# boot script depmod is the master version.
983983
PHONY += _modinst_post
984-
_modinst_post: _modinst_
984+
_modinst_post: include/config/kernel.release _modinst_
985985
$(Q)$(MAKE) -f $(srctree)/scripts/Makefile.fwinst obj=firmware __fw_modinst
986986
$(call cmd,depmod)
987987

@@ -1116,6 +1116,7 @@ help:
11161116
@echo ' gtags - Generate GNU GLOBAL index'
11171117
@echo ' kernelrelease - Output the release version string'
11181118
@echo ' kernelversion - Output the version stored in Makefile'
1119+
@echo ' image_name - Output the image name'
11191120
@echo ' headers_install - Install sanitised kernel headers to INSTALL_HDR_PATH'; \
11201121
echo ' (default: $(INSTALL_HDR_PATH))'; \
11211122
echo ''
@@ -1310,7 +1311,7 @@ export_report:
13101311
endif #ifeq ($(config-targets),1)
13111312
endif #ifeq ($(mixed-targets),1)
13121313

1313-
PHONY += checkstack kernelrelease kernelversion
1314+
PHONY += checkstack kernelrelease kernelversion image_name
13141315

13151316
# UML needs a little special treatment here. It wants to use the host
13161317
# toolchain, so needs $(SUBARCH) passed to checkstack.pl. Everyone
@@ -1331,6 +1332,9 @@ kernelrelease:
13311332
kernelversion:
13321333
@echo $(KERNELVERSION)
13331334

1335+
image_name:
1336+
@echo $(KBUILD_IMAGE)
1337+
13341338
# Clear a bunch of variables before executing the submake
13351339
tools/: FORCE
13361340
$(Q)mkdir -p $(objtree)/tools

‎scripts/Makefile.headersinst‎

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,18 +47,24 @@ header-y := $(filter-out $(generic-y), $(header-y))
4747
all-files := $(header-y) $(genhdr-y) $(wrapper-files)
4848
output-files := $(addprefix $(installdir)/, $(all-files))
4949

50-
input-files := $(foreach hdr, $(header-y), \
50+
input-files1 := $(foreach hdr, $(header-y), \
5151
$(if $(wildcard $(srcdir)/$(hdr)), \
52-
$(wildcard $(srcdir)/$(hdr)), \
52+
$(wildcard $(srcdir)/$(hdr))) \
53+
)
54+
input-files1-name := $(notdir $(input-files1))
55+
input-files2 := $(foreach hdr, $(header-y), \
56+
$(if $(wildcard $(srcdir)/$(hdr)),, \
5357
$(if $(wildcard $(oldsrcdir)/$(hdr)), \
5458
$(wildcard $(oldsrcdir)/$(hdr)), \
5559
$(error Missing UAPI file $(srcdir)/$(hdr))) \
56-
)) \
57-
$(foreach hdr, $(genhdr-y), \
60+
))
61+
input-files2-name := $(notdir $(input-files2))
62+
input-files3 := $(foreach hdr, $(genhdr-y), \
5863
$(if $(wildcard $(gendir)/$(hdr)), \
5964
$(wildcard $(gendir)/$(hdr)), \
6065
$(error Missing generated UAPI file $(gendir)/$(hdr)) \
6166
))
67+
input-files3-name := $(notdir $(input-files3))
6268

6369
# Work out what needs to be removed
6470
oldheaders := $(patsubst $(installdir)/%,%,$(wildcard $(installdir)/*.h))
@@ -72,7 +78,9 @@ printdir = $(patsubst $(INSTALL_HDR_PATH)/%/,%,$(dir $@))
7278
quiet_cmd_install = INSTALL $(printdir) ($(words $(all-files))\
7379
file$(if $(word 2, $(all-files)),s))
7480
cmd_install = \
75-
$(CONFIG_SHELL) $< $(installdir) $(input-files); \
81+
$(CONFIG_SHELL) $< $(installdir) $(srcdir) $(input-files1-name); \
82+
$(CONFIG_SHELL) $< $(installdir) $(oldsrcdir) $(input-files2-name); \
83+
$(CONFIG_SHELL) $< $(installdir) $(gendir) $(input-files3-name); \
7684
for F in $(wrapper-files); do \
7785
echo "\#include <asm-generic/$$F>" > $(installdir)/$$F; \
7886
done; \
@@ -98,7 +106,7 @@ __headersinst: $(subdirs) $(install-file)
98106
@:
99107

100108
targets += $(install-file)
101-
$(install-file): scripts/headers_install.sh $(input-files) FORCE
109+
$(install-file): scripts/headers_install.sh $(input-files1) $(input-files2) $(input-files3) FORCE
102110
$(if $(unwanted),$(call cmd,remove),)
103111
$(if $(wildcard $(dir $@)),,$(shell mkdir -p $(dir $@)))
104112
$(call if_changed,install)

‎scripts/Makefile.lib‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ multi-objs := $(multi-objs-y) $(multi-objs-m)
6363
subdir-obj-y := $(filter %/built-in.o, $(obj-y))
6464

6565
# $(obj-dirs) is a list of directories that contain object files
66-
obj-dirs := $(dir $(multi-objs) $(subdir-obj-y))
66+
obj-dirs := $(dir $(multi-objs) $(obj-y))
6767

6868
# Replace multi-part objects by their individual parts, look at local dir only
6969
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 > $@) || \
244244
# ---------------------------------------------------------------------------
245245

246246
# Generate an assembly file to wrap the output of the device tree compiler
247-
quiet_cmd_dt_S_dtb= DTB $@
247+
quiet_cmd_dt_S_dtb= DTB $@
248248
cmd_dt_S_dtb= \
249249
( \
250250
echo '\#include <asm-generic/vmlinux.lds.h>'; \

‎scripts/headers_install.sh‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22

33
if [ $# -lt 1 ]
44
then
5-
echo "Usage: headers_install.sh OUTDIR [FILES...]
5+
echo "Usage: headers_install.sh OUTDIR SRCDIR [FILES...]
66
echo
77
echo "Prepares kernel header files for use by user space, by removing"
88
echo "all compiler.h definitions and #includes, removing any"
99
echo "#ifdef __KERNEL__ sections, and putting __underscores__ around"
1010
echo "asm/inline/volatile keywords."
1111
echo
1212
echo "OUTDIR: directory to write each userspace header FILE to."
13+
echo "SRCDIR: source directory where files are picked."
1314
echo "FILES: list of header files to operate on."
1415

1516
exit 1
@@ -19,6 +20,8 @@ fi
1920

2021
OUTDIR="$1"
2122
shift
23+
SRCDIR="$1"
24+
shift
2225

2326
# Iterate through files listed on command line
2427

@@ -34,7 +37,7 @@ do
3437
-e 's/(^|[^a-zA-Z0-9])__packed([^a-zA-Z0-9_]|$)/\1__attribute__((packed))\2/g' \
3538
-e 's/(^|[ \t(])(inline|asm|volatile)([ \t(]|$)/\1__\2__\3/g' \
3639
-e 's@#(ifndef|define|endif[ \t]*/[*])[ \t]*_UAPI@#\1 @' \
37-
"$i" > "$OUTDIR/$FILE.sed" || exit 1
40+
"$SRCDIR/$i" > "$OUTDIR/$FILE.sed" || exit 1
3841
scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ "$OUTDIR/$FILE.sed" \
3942
> "$OUTDIR/$FILE"
4043
[ $? -gt 1 ] && exit 1

‎scripts/mod/Makefile‎

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ endef
1515
quiet_cmd_offsets = GEN $@
1616
define cmd_offsets
1717
(set -e; \
18-
echo "#ifndef __DEVICEVTABLE_OFFSETS_H__"; \
19-
echo "#define __DEVICEVTABLE_OFFSETS_H__"; \
18+
echo "#ifndef __DEVICETABLE_OFFSETS_H__"; \
19+
echo "#define __DEVICETABLE_OFFSETS_H__"; \
2020
echo "/*"; \
2121
echo " * DO NOT MODIFY."; \
2222
echo " *"; \
@@ -29,15 +29,10 @@ define cmd_offsets
2929
echo "#endif" ) > $@
3030
endef
3131

32-
# We use internal kbuild rules to avoid the "is up to date" message from make
33-
scripts/mod/devicetable-offsets.s: scripts/mod/devicetable-offsets.c FORCE
34-
$(Q)mkdir -p $(dir $@)
35-
$(call if_changed_dep,cc_s_c)
32+
$(obj)/$(devicetable-offsets-file): $(obj)/devicetable-offsets.s
33+
$(call if_changed,offsets)
3634

37-
$(obj)/$(devicetable-offsets-file): scripts/mod/devicetable-offsets.s
38-
$(call cmd,offsets)
39-
40-
targets += $(devicetable-offsets-file)
35+
targets += $(devicetable-offsets-file) devicetable-offsets.s
4136

4237
# dependencies on generated files need to be listed explicitly
4338

‎scripts/mod/file2alias.c‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,10 +79,12 @@ struct devtable **__start___devtable, **__stop___devtable;
7979
extern struct devtable *__start___devtable[], *__stop___devtable[];
8080
#endif /* __MACH__ */
8181

82-
#if __GNUC__ == 3 && __GNUC_MINOR__ < 3
83-
# define __used __attribute__((__unused__))
84-
#else
85-
# define __used __attribute__((__used__))
82+
#if !defined(__used)
83+
# if __GNUC__ == 3 && __GNUC_MINOR__ < 3
84+
# define __used __attribute__((__unused__))
85+
# else
86+
# define __used __attribute__((__used__))
87+
# endif
8688
#endif
8789

8890
/* Define a variable f that holds the value of field f of struct devid

‎scripts/package/mkspec‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ echo ""
7474
fi
7575

7676
echo "%install"
77+
echo 'KBUILD_IMAGE=$(make image_name)'
7778
echo "%ifarch ia64"
7879
echo 'mkdir -p $RPM_BUILD_ROOT/boot/efi $RPM_BUILD_ROOT/lib/modules'
7980
echo 'mkdir -p $RPM_BUILD_ROOT/lib/firmware'

‎scripts/setlocalversion‎

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,9 +71,6 @@ scm_version()
7171
printf -- '-svn%s' "`git svn find-rev $head`"
7272
fi
7373

74-
# Update index only on r/w media
75-
[ -w . ] && git update-index --refresh --unmerged > /dev/null
76-
7774
# Check for uncommitted changes
7875
if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
7976
printf '%s' -dirty

‎tools/include/tools/be_byteshift.h‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
#ifndef _TOOLS_BE_BYTESHIFT_H
22
#define _TOOLS_BE_BYTESHIFT_H
33

4-
#include <linux/types.h>
4+
#include <stdint.h>
55

6-
static inline __u16 __get_unaligned_be16(const __u8 *p)
6+
static inline uint16_t __get_unaligned_be16(const uint8_t *p)
77
{
88
return p[0] << 8 | p[1];
99
}
1010

11-
static inline __u32 __get_unaligned_be32(const __u8 *p)
11+
static inline uint32_t __get_unaligned_be32(const uint8_t *p)
1212
{
1313
return p[0] << 24 | p[1] << 16 | p[2] << 8 | p[3];
1414
}
1515

16-
static inline __u64 __get_unaligned_be64(const __u8 *p)
16+
static inline uint64_t __get_unaligned_be64(const uint8_t *p)
1717
{
18-
return (__u64)__get_unaligned_be32(p) << 32 |
18+
return (uint64_t)__get_unaligned_be32(p) << 32 |
1919
__get_unaligned_be32(p + 4);
2020
}
2121

22-
static inline void __put_unaligned_be16(__u16 val, __u8 *p)
22+
static inline void __put_unaligned_be16(uint16_t val, uint8_t *p)
2323
{
2424
*p++ = val >> 8;
2525
*p++ = val;
2626
}
2727

28-
static inline void __put_unaligned_be32(__u32 val, __u8 *p)
28+
static inline void __put_unaligned_be32(uint32_t val, uint8_t *p)
2929
{
3030
__put_unaligned_be16(val >> 16, p);
3131
__put_unaligned_be16(val, p + 2);
3232
}
3333

34-
static inline void __put_unaligned_be64(__u64 val, __u8 *p)
34+
static inline void __put_unaligned_be64(uint64_t val, uint8_t *p)
3535
{
3636
__put_unaligned_be32(val >> 32, p);
3737
__put_unaligned_be32(val, p + 4);
3838
}
3939

40-
static inline __u16 get_unaligned_be16(const void *p)
40+
static inline uint16_t get_unaligned_be16(const void *p)
4141
{
42-
return __get_unaligned_be16((const __u8 *)p);
42+
return __get_unaligned_be16((const uint8_t *)p);
4343
}
4444

45-
static inline __u32 get_unaligned_be32(const void *p)
45+
static inline uint32_t get_unaligned_be32(const void *p)
4646
{
47-
return __get_unaligned_be32((const __u8 *)p);
47+
return __get_unaligned_be32((const uint8_t *)p);
4848
}
4949

50-
static inline __u64 get_unaligned_be64(const void *p)
50+
static inline uint64_t get_unaligned_be64(const void *p)
5151
{
52-
return __get_unaligned_be64((const __u8 *)p);
52+
return __get_unaligned_be64((const uint8_t *)p);
5353
}
5454

55-
static inline void put_unaligned_be16(__u16 val, void *p)
55+
static inline void put_unaligned_be16(uint16_t val, void *p)
5656
{
5757
__put_unaligned_be16(val, p);
5858
}
5959

60-
static inline void put_unaligned_be32(__u32 val, void *p)
60+
static inline void put_unaligned_be32(uint32_t val, void *p)
6161
{
6262
__put_unaligned_be32(val, p);
6363
}
6464

65-
static inline void put_unaligned_be64(__u64 val, void *p)
65+
static inline void put_unaligned_be64(uint64_t val, void *p)
6666
{
6767
__put_unaligned_be64(val, p);
6868
}

‎tools/include/tools/le_byteshift.h‎

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,68 @@
11
#ifndef _TOOLS_LE_BYTESHIFT_H
22
#define _TOOLS_LE_BYTESHIFT_H
33

4-
#include <linux/types.h>
4+
#include <stdint.h>
55

6-
static inline __u16 __get_unaligned_le16(const __u8 *p)
6+
static inline uint16_t __get_unaligned_le16(const uint8_t *p)
77
{
88
return p[0] | p[1] << 8;
99
}
1010

11-
static inline __u32 __get_unaligned_le32(const __u8 *p)
11+
static inline uint32_t __get_unaligned_le32(const uint8_t *p)
1212
{
1313
return p[0] | p[1] << 8 | p[2] << 16 | p[3] << 24;
1414
}
1515

16-
static inline __u64 __get_unaligned_le64(const __u8 *p)
16+
static inline uint64_t __get_unaligned_le64(const uint8_t *p)
1717
{
18-
return (__u64)__get_unaligned_le32(p + 4) << 32 |
18+
return (uint64_t)__get_unaligned_le32(p + 4) << 32 |
1919
__get_unaligned_le32(p);
2020
}
2121

22-
static inline void __put_unaligned_le16(__u16 val, __u8 *p)
22+
static inline void __put_unaligned_le16(uint16_t val, uint8_t *p)
2323
{
2424
*p++ = val;
2525
*p++ = val >> 8;
2626
}
2727

28-
static inline void __put_unaligned_le32(__u32 val, __u8 *p)
28+
static inline void __put_unaligned_le32(uint32_t val, uint8_t *p)
2929
{
3030
__put_unaligned_le16(val >> 16, p + 2);
3131
__put_unaligned_le16(val, p);
3232
}
3333

34-
static inline void __put_unaligned_le64(__u64 val, __u8 *p)
34+
static inline void __put_unaligned_le64(uint64_t val, uint8_t *p)
3535
{
3636
__put_unaligned_le32(val >> 32, p + 4);
3737
__put_unaligned_le32(val, p);
3838
}
3939

40-
static inline __u16 get_unaligned_le16(const void *p)
40+
static inline uint16_t get_unaligned_le16(const void *p)
4141
{
42-
return __get_unaligned_le16((const __u8 *)p);
42+
return __get_unaligned_le16((const uint8_t *)p);
4343
}
4444

45-
static inline __u32 get_unaligned_le32(const void *p)
45+
static inline uint32_t get_unaligned_le32(const void *p)
4646
{
47-
return __get_unaligned_le32((const __u8 *)p);
47+
return __get_unaligned_le32((const uint8_t *)p);
4848
}
4949

50-
static inline __u64 get_unaligned_le64(const void *p)
50+
static inline uint64_t get_unaligned_le64(const void *p)
5151
{
52-
return __get_unaligned_le64((const __u8 *)p);
52+
return __get_unaligned_le64((const uint8_t *)p);
5353
}
5454

55-
static inline void put_unaligned_le16(__u16 val, void *p)
55+
static inline void put_unaligned_le16(uint16_t val, void *p)
5656
{
5757
__put_unaligned_le16(val, p);
5858
}
5959

60-
static inline void put_unaligned_le32(__u32 val, void *p)
60+
static inline void put_unaligned_le32(uint32_t val, void *p)
6161
{
6262
__put_unaligned_le32(val, p);
6363
}
6464

65-
static inline void put_unaligned_le64(__u64 val, void *p)
65+
static inline void put_unaligned_le64(uint64_t val, void *p)
6666
{
6767
__put_unaligned_le64(val, p);
6868
}

0 commit comments

Comments
 (0)