Skip to content

Commit 923f797

Browse files
committed
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild
Pull kbuild changes from Michal Marek: - Unification of cmd_uimage among archs that use it - make headers_check tries harder before reporting a missing <linux/types.h> include - kbuild portability fix for shells that do not support echo -e - make clean descends into samples/ - setlocalversion grep fix - modpost typo fix - dtc warnings fix * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild: setlocalversion: Use "grep -q" instead of piping output to "read dummy" modpost: fix ALL_INIT_DATA_SECTIONS Kbuild: centralize MKIMAGE and cmd_uimage definitions headers_check: recursively search for linux/types.h inclusion scripts/Kbuild.include: Fix portability problem of "echo -e" scripts: dtc: fix compile warnings kbuild: clean up samples directory kbuild: disable -Wmissing-field-initializers for W=1
2 parents a7697b9 + 7f3bd6c commit 923f797

File tree

16 files changed

+98
-72
lines changed

16 files changed

+98
-72
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1170,7 +1170,7 @@ MRPROPER_FILES += .config .config.old .version .old_version \
11701170
#
11711171
clean: rm-dirs := $(CLEAN_DIRS)
11721172
clean: rm-files := $(CLEAN_FILES)
1173-
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation)
1173+
clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation samples)
11741174

11751175
PHONY += $(clean-dirs) clean archclean
11761176
$(clean-dirs):

arch/arm/boot/Makefile

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# Copyright (C) 1995-2002 Russell King
1212
#
1313

14-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
15-
1614
ifneq ($(MACHINE),)
1715
include $(srctree)/$(MACHINE)/Makefile.boot
1816
endif
@@ -69,22 +67,19 @@ $(obj)/dtbs: $(addprefix $(obj)/, $(dtb-y))
6967

7068
clean-files := *.dtb
7169

72-
quiet_cmd_uimage = UIMAGE $@
73-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A arm -O linux -T kernel \
74-
-C none -a $(LOADADDR) -e $(STARTADDR) \
75-
-n 'Linux-$(KERNELRELEASE)' -d $< $@
76-
77-
ifeq ($(CONFIG_ZBOOT_ROM),y)
78-
$(obj)/uImage: LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
70+
ifneq ($(LOADADDR),)
71+
UIMAGE_LOADADDR=$(LOADADDR)
7972
else
80-
$(obj)/uImage: LOADADDR=$(ZRELADDR)
73+
ifeq ($(CONFIG_ZBOOT_ROM),y)
74+
UIMAGE_LOADADDR=$(CONFIG_ZBOOT_ROM_TEXT)
75+
else
76+
UIMAGE_LOADADDR=$(ZRELADDR)
77+
endif
8178
endif
8279

83-
$(obj)/uImage: STARTADDR=$(LOADADDR)
84-
8580
check_for_multiple_loadaddr = \
86-
if [ $(words $(LOADADDR)) -gt 1 ]; then \
87-
echo 'multiple load addresses: $(LOADADDR)'; \
81+
if [ $(words $(UIMAGE_LOADADDR)) -gt 1 ]; then \
82+
echo 'multiple load addresses: $(UIMAGE_LOADADDR)'; \
8883
echo 'This is incompatible with uImages'; \
8984
echo 'Specify LOADADDR on the commandline to build an uImage'; \
9085
false; \

arch/avr32/boot/images/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66
# for more details.
77
#
88

9-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
10-
119
extra-y := vmlinux.bin vmlinux.gz
1210

1311
OBJCOPYFLAGS_vmlinux.bin := -O binary -R .note.gnu.build-id
@@ -17,10 +15,9 @@ $(obj)/vmlinux.bin: vmlinux FORCE
1715
$(obj)/vmlinux.gz: $(obj)/vmlinux.bin FORCE
1816
$(call if_changed,gzip)
1917

20-
quiet_cmd_uimage = UIMAGE $@
21-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A avr32 -O linux -T kernel \
22-
-C gzip -a $(CONFIG_LOAD_ADDRESS) -e $(CONFIG_ENTRY_ADDRESS) \
23-
-n 'Linux-$(KERNELRELEASE)' -d $< $@
18+
UIMAGE_LOADADDR = $(CONFIG_LOAD_ADDRESS)
19+
UIMAGE_ENTRYADDR = $(CONFIG_ENTRY_ADDRESS)
20+
UIMAGE_COMPRESSION = gzip
2421

2522
targets += uImage uImage.srec
2623
$(obj)/uImage: $(obj)/vmlinux.gz

arch/blackfin/boot/Makefile

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,20 +6,17 @@
66
# for more details.
77
#
88

9-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
10-
119
targets := vmImage vmImage.bin vmImage.bz2 vmImage.gz vmImage.lzma vmImage.lzo vmImage.xip
1210
extra-y += vmlinux.bin vmlinux.bin.gz vmlinux.bin.bz2 vmlinux.bin.lzma vmlinux.bin.lzo vmlinux.bin.xip
1311

14-
UIMAGE_OPTS-y :=
15-
UIMAGE_OPTS-$(CONFIG_RAMKERNEL) += -a $(CONFIG_BOOT_LOAD)
16-
UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -a $(CONFIG_ROM_BASE) -x
17-
18-
quiet_cmd_uimage = UIMAGE $@
19-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(ARCH) -O linux -T kernel \
20-
-C $(2) -n '$(CPU_REV)-$(KERNELRELEASE)' \
21-
-e $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}') \
22-
$(UIMAGE_OPTS-y) -d $< $@
12+
ifeq ($(CONFIG_RAMKERNEL),y)
13+
UIMAGE_LOADADDR = $(CONFIG_BOOT_LOAD)
14+
else # CONFIG_ROMKERNEL must be set
15+
UIMAGE_LOADADDR = $(CONFIG_ROM_BASE)
16+
endif
17+
UIMAGE_ENTRYADDR = $(shell $(NM) vmlinux | awk '$$NF == "__start" {print $$1}')
18+
UIMAGE_NAME = '$(CPU_REV)-$(KERNELRELEASE)'
19+
UIMAGE_OPTS-$(CONFIG_ROMKERNEL) += -x
2320

2421
$(obj)/vmlinux.bin: vmlinux FORCE
2522
$(call if_changed,objcopy)

arch/microblaze/boot/Makefile

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
# arch/microblaze/boot/Makefile
33
#
44

5-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
6-
75
obj-y += linked_dtb.o
86

97
targets := linux.bin linux.bin.gz simpleImage.%
@@ -35,11 +33,9 @@ quiet_cmd_strip = STRIP $@
3533
cmd_strip = $(STRIP) -K microblaze_start -K _end -K __log_buf \
3634
-K _fdt_start vmlinux -o $@
3735

38-
quiet_cmd_uimage = UIMAGE $@.ub
39-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A microblaze -O linux -T kernel \
40-
-C none -n 'Linux-$(KERNELRELEASE)' \
41-
-a $(CONFIG_KERNEL_BASE_ADDR) -e $(CONFIG_KERNEL_BASE_ADDR) \
42-
36+
UIMAGE_IN = $@
37+
UIMAGE_OUT = $@.ub
38+
UIMAGE_LOADADDR = $(CONFIG_KERNEL_BASE_ADDR)
4339

4440
$(obj)/simpleImage.%: vmlinux FORCE
4541
$(call if_changed,cp,.unstrip)

arch/sh/boot/Makefile

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
# Copyright (C) 1999 Stuart Menefy
99
#
1010

11-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
12-
1311
#
1412
# Assign safe dummy values if these variables are not defined,
1513
# in order to suppress error message.
@@ -61,10 +59,8 @@ KERNEL_ENTRY := $(shell /bin/bash -c 'printf "0x%08x" \
6159
$(KERNEL_MEMORY) + \
6260
$(CONFIG_ZERO_PAGE_OFFSET) + $(CONFIG_ENTRY_OFFSET)]')
6361

64-
quiet_cmd_uimage = UIMAGE $@
65-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
66-
-C $(2) -a $(KERNEL_LOAD) -e $(KERNEL_ENTRY) \
67-
-n 'Linux-$(KERNELRELEASE)' -d $< $@
62+
UIMAGE_LOADADDR = $(KERNEL_LOAD)
63+
UIMAGE_ENTRYADDR = $(KERNEL_ENTRY)
6864

6965
$(obj)/vmlinux.bin: vmlinux FORCE
7066
$(call if_changed,objcopy)

arch/sparc/boot/Makefile

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
ROOT_IMG := /usr/src/root.img
77
ELFTOAOUT := elftoaout
8-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
98

109
hostprogs-y := piggyback btfixupprep
1110
targets := tftpboot.img btfix.o btfix.S image zImage vmlinux.aout
@@ -92,11 +91,9 @@ $(obj)/image.bin: $(obj)/image FORCE
9291
$(obj)/image.gz: $(obj)/image.bin
9392
$(call if_changed,gzip)
9493

95-
quiet_cmd_uimage = UIMAGE $@
96-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sparc -O linux -T kernel \
97-
-C gzip -a $(CONFIG_UBOOT_LOAD_ADDR) \
98-
-e $(CONFIG_UBOOT_ENTRY_ADDR) -n 'Linux-$(KERNELRELEASE)' \
99-
-d $< $@
94+
UIMAGE_LOADADDR = $(CONFIG_UBOOT_LOAD_ADDR)
95+
UIMAGE_ENTRYADDR = $(CONFIG_UBOOT_ENTRY_ADDR)
96+
UIMAGE_COMPRESSION = gzip
10097

10198
quiet_cmd_uimage.o = UIMAGE.O $@
10299
cmd_uimage.o = $(LD) -Tdata $(CONFIG_UBOOT_FLASH_ADDR) \

arch/unicore32/boot/Makefile

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@
1111
# Copyright (C) 2001~2010 GUAN Xue-tao
1212
#
1313

14-
MKIMAGE := $(srctree)/scripts/mkuboot.sh
15-
1614
targets := Image zImage uImage
1715

1816
$(obj)/Image: vmlinux FORCE
@@ -26,14 +24,8 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
2624
$(call if_changed,objcopy)
2725
@echo ' Kernel: $@ is ready'
2826

29-
quiet_cmd_uimage = UIMAGE $@
30-
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A unicore -O linux -T kernel \
31-
-C none -a $(LOADADDR) -e $(STARTADDR) \
32-
-n 'Linux-$(KERNELRELEASE)' -d $< $@
33-
34-
$(obj)/uImage: LOADADDR=0x0
35-
36-
$(obj)/uImage: STARTADDR=$(LOADADDR)
27+
UIMAGE_ARCH = unicore
28+
UIMAGE_LOADADDR = 0x0
3729

3830
$(obj)/uImage: $(obj)/zImage FORCE
3931
$(call if_changed,uimage)

scripts/Kbuild.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ as-option = $(call try-run,\
104104
# Usage: cflags-y += $(call as-instr,instr,option1,option2)
105105

106106
as-instr = $(call try-run,\
107-
/bin/echo -e "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
107+
printf "%b\n" "$(1)" | $(CC) $(KBUILD_AFLAGS) -c -xassembler -o "$$TMP" -,$(2),$(3))
108108

109109
# cc-option
110110
# Usage: cflags-y += $(call cc-option,-march=winchip-c6,-march=i586)

scripts/Makefile.build

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,15 @@ warning-1 += -Wmissing-prototypes
6969
warning-1 += -Wold-style-definition
7070
warning-1 += $(call cc-option, -Wmissing-include-dirs)
7171
warning-1 += $(call cc-option, -Wunused-but-set-variable)
72+
warning-1 += $(call cc-disable-warning, missing-field-initializers)
7273

7374
warning-2 := -Waggregate-return
7475
warning-2 += -Wcast-align
7576
warning-2 += -Wdisabled-optimization
7677
warning-2 += -Wnested-externs
7778
warning-2 += -Wshadow
7879
warning-2 += $(call cc-option, -Wlogical-op)
80+
warning-2 += $(call cc-option, -Wmissing-field-initializers)
7981

8082
warning-3 := -Wbad-function-cast
8183
warning-3 += -Wcast-qual

scripts/Makefile.lib

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,30 @@ cmd_lzo = (cat $(filter-out FORCE,$^) | \
304304
lzop -9 && $(call size_append, $(filter-out FORCE,$^))) > $@ || \
305305
(rm -f $@ ; false)
306306

307+
# U-Boot mkimage
308+
# ---------------------------------------------------------------------------
309+
310+
MKIMAGE := $(srctree)/scripts/mkuboot.sh
311+
312+
# SRCARCH just happens to match slightly more than ARCH (on sparc), so reduces
313+
# the number of overrides in arch makefiles
314+
UIMAGE_ARCH ?= $(SRCARCH)
315+
UIMAGE_COMPRESSION ?= $(if $(2),$(2),none)
316+
UIMAGE_OPTS-y ?=
317+
UIMAGE_TYPE ?= kernel
318+
UIMAGE_LOADADDR ?= arch_must_set_this
319+
UIMAGE_ENTRYADDR ?= $(UIMAGE_LOADADDR)
320+
UIMAGE_NAME ?= 'Linux-$(KERNELRELEASE)'
321+
UIMAGE_IN ?= $<
322+
UIMAGE_OUT ?= $@
323+
324+
quiet_cmd_uimage = UIMAGE $(UIMAGE_OUT)
325+
cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A $(UIMAGE_ARCH) -O linux \
326+
-C $(UIMAGE_COMPRESSION) $(UIMAGE_OPTS-y) \
327+
-T $(UIMAGE_TYPE) \
328+
-a $(UIMAGE_LOADADDR) -e $(UIMAGE_ENTRYADDR) \
329+
-n $(UIMAGE_NAME) -d $(UIMAGE_IN) $(UIMAGE_OUT)
330+
307331
# XZ
308332
# ---------------------------------------------------------------------------
309333
# Use xzkern to compress the kernel image and xzmisc to compress other things.

scripts/dtc/dtc.c

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ int main(int argc, char *argv[])
101101
const char *outform = "dts";
102102
const char *outname = "-";
103103
const char *depname = NULL;
104-
int force = 0, check = 0, sort = 0;
104+
int force = 0, sort = 0;
105105
const char *arg;
106106
int opt;
107107
FILE *outf = NULL;
@@ -143,9 +143,6 @@ int main(int argc, char *argv[])
143143
case 'f':
144144
force = 1;
145145
break;
146-
case 'c':
147-
check = 1;
148-
break;
149146
case 'q':
150147
quiet++;
151148
break;

scripts/dtc/flattree.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
697697
{
698698
struct reserve_info *reservelist = NULL;
699699
struct reserve_info *new;
700-
const char *p;
701700
struct fdt_reserve_entry re;
702701

703702
/*
@@ -706,7 +705,6 @@ static struct reserve_info *flat_read_mem_reserve(struct inbuf *inb)
706705
*
707706
* First pass, count entries.
708707
*/
709-
p = inb->ptr;
710708
while (1) {
711709
flat_read_chunk(inb, &re, sizeof(re));
712710
re.address = fdt64_to_cpu(re.address);

scripts/headers_check.pl

Lines changed: 37 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
# 3) Check for leaked CONFIG_ symbols
2020

2121
use strict;
22+
use File::Basename;
2223

2324
my ($dir, $arch, @files) = @ARGV;
2425

@@ -99,6 +100,39 @@ sub check_asm_types
99100
}
100101

101102
my $linux_types;
103+
my %import_stack = ();
104+
sub check_include_typesh
105+
{
106+
my $path = $_[0];
107+
my $import_path;
108+
109+
my $fh;
110+
my @file_paths = ($path, $dir . "/" . $path, dirname($filename) . "/" . $path);
111+
for my $possible ( @file_paths ) {
112+
if (not $import_stack{$possible} and open($fh, '<', $possible)) {
113+
$import_path = $possible;
114+
$import_stack{$import_path} = 1;
115+
last;
116+
}
117+
}
118+
if (eof $fh) {
119+
return;
120+
}
121+
122+
my $line;
123+
while ($line = <$fh>) {
124+
if ($line =~ m/^\s*#\s*include\s+<linux\/types.h>/) {
125+
$linux_types = 1;
126+
last;
127+
}
128+
if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
129+
check_include_typesh($included);
130+
}
131+
}
132+
close $fh;
133+
delete $import_stack{$import_path};
134+
}
135+
102136
sub check_sizetypes
103137
{
104138
if ($filename =~ /types.h|int-l64.h|int-ll64.h/o) {
@@ -113,6 +147,9 @@ sub check_sizetypes
113147
$linux_types = 1;
114148
return;
115149
}
150+
if (my $included = ($line =~ /^\s*#\s*include\s+[<"](\S+)[>"]/)[0]) {
151+
check_include_typesh($included);
152+
}
116153
if ($line =~ m/__[us](8|16|32|64)\b/) {
117154
printf STDERR "$filename:$lineno: " .
118155
"found __[us]{8,16,32,64} type " .
@@ -122,4 +159,3 @@ sub check_sizetypes
122159
#$ret = 1;
123160
}
124161
}
125-

scripts/mod/modpost.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -849,7 +849,7 @@ static void check_section(const char *modname, struct elf_info *elf,
849849

850850
#define ALL_INIT_DATA_SECTIONS \
851851
".init.setup$", ".init.rodata$", \
852-
".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$" \
852+
".devinit.rodata$", ".cpuinit.rodata$", ".meminit.rodata$", \
853853
".init.data$", ".devinit.data$", ".cpuinit.data$", ".meminit.data$"
854854
#define ALL_EXIT_DATA_SECTIONS \
855855
".exit.data$", ".devexit.data$", ".cpuexit.data$", ".memexit.data$"

scripts/setlocalversion

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ scm_version()
7575
[ -w . ] && git update-index --refresh --unmerged > /dev/null
7676

7777
# Check for uncommitted changes
78-
if git diff-index --name-only HEAD | grep -v "^scripts/package" \
79-
| read dummy; then
78+
if git diff-index --name-only HEAD | grep -qv "^scripts/package"; then
8079
printf '%s' -dirty
8180
fi
8281

0 commit comments

Comments
 (0)