Skip to content

Commit c37efa9

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next
* git://git.kernel.org/pub/scm/linux/kernel/git/sam/kbuild-next: (30 commits) Use macros for .data.page_aligned section. Use macros for .bss.page_aligned section. Use new __init_task_data macro in arch init_task.c files. kbuild: Don't define ALIGN and ENTRY when preprocessing linker scripts. arm, cris, mips, sparc, powerpc, um, xtensa: fix build with bash 4.0 kbuild: add static to prototypes kbuild: fail build if recordmcount.pl fails kbuild: set -fconserve-stack option for gcc 4.5 kbuild: echo the record_mcount command gconfig: disable "typeahead find" search in treeviews kbuild: fix cc1 options check to ensure we do not use -fPIC when compiling checkincludes.pl: add option to remove duplicates in place markup_oops: use modinfo to avoid confusion with underscored module names checkincludes.pl: provide usage helper checkincludes.pl: close file as soon as we're done with it ctags: usability fix kernel hacking: move STRIP_ASM_SYMS from General gitignore usr/initramfs_data.cpio.bz2 and usr/initramfs_data.cpio.lzma kbuild: Check if linker supports the -X option kbuild: introduce ld-option ... Fix trivial conflict in scripts/basic/fixdep.c
2 parents 9e12a7e + abe1ee3 commit c37efa9

94 files changed

Lines changed: 473 additions & 354 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/kbuild/kbuild.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,22 @@ INSTALL_PATH
6565
INSTALL_PATH specifies where to place the updated kernel and system map
6666
images. Default is /boot, but you can set it to other values.
6767

68+
INSTALLKERNEL
69+
--------------------------------------------------
70+
Install script called when using "make install".
71+
The default name is "installkernel".
72+
73+
The script will be called with the following arguments:
74+
$1 - kernel version
75+
$2 - kernel image file
76+
$3 - kernel map file
77+
$4 - default install path (use root directory if blank)
78+
79+
The implmentation of "make install" is architecture specific
80+
and it may differ from the above.
81+
82+
INSTALLKERNEL is provided to enable the possibility to
83+
specify a custom installer when cross compiling a kernel.
6884

6985
MODLIB
7086
--------------------------------------------------

Documentation/kbuild/makefiles.txt

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ This document describes the Linux kernel Makefiles.
1818
--- 3.9 Dependency tracking
1919
--- 3.10 Special Rules
2020
--- 3.11 $(CC) support functions
21+
--- 3.12 $(LD) support functions
2122

2223
=== 4 Host Program support
2324
--- 4.1 Simple Host Program
@@ -435,14 +436,14 @@ more details, with real examples.
435436
The second argument is optional, and if supplied will be used
436437
if first argument is not supported.
437438

438-
ld-option
439-
ld-option is used to check if $(CC) when used to link object files
439+
cc-ldoption
440+
cc-ldoption is used to check if $(CC) when used to link object files
440441
supports the given option. An optional second option may be
441442
specified if first option are not supported.
442443

443444
Example:
444445
#arch/i386/kernel/Makefile
445-
vsyscall-flags += $(call ld-option, -Wl$(comma)--hash-style=sysv)
446+
vsyscall-flags += $(call cc-ldoption, -Wl$(comma)--hash-style=sysv)
446447

447448
In the above example, vsyscall-flags will be assigned the option
448449
-Wl$(comma)--hash-style=sysv if it is supported by $(CC).
@@ -570,6 +571,19 @@ more details, with real examples.
570571
endif
571572
endif
572573

574+
--- 3.12 $(LD) support functions
575+
576+
ld-option
577+
ld-option is used to check if $(LD) supports the supplied option.
578+
ld-option takes two options as arguments.
579+
The second argument is an optional option that can be used if the
580+
first option is not supported by $(LD).
581+
582+
Example:
583+
#Makefile
584+
LDFLAGS_vmlinux += $(call really-ld-option, -X)
585+
586+
573587
=== 4 Host Program support
574588

575589
Kbuild supports building executables on the host for use during the

Makefile

Lines changed: 52 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -179,9 +179,46 @@ SUBARCH := $(shell uname -m | sed -e s/i.86/i386/ -e s/sun4u/sparc64/ \
179179
# Alternatively CROSS_COMPILE can be set in the environment.
180180
# Default value for CROSS_COMPILE is not to prefix executables
181181
# Note: Some architectures assign CROSS_COMPILE in their arch/*/Makefile
182+
#
183+
# To force ARCH and CROSS_COMPILE settings include kernel.* files
184+
# in the kernel tree - do not patch this file.
182185
export KBUILD_BUILDHOST := $(SUBARCH)
183-
ARCH ?= $(SUBARCH)
184-
CROSS_COMPILE ?=
186+
187+
# Kbuild save the ARCH and CROSS_COMPILE setting in kernel.* files.
188+
# Restore these settings and check that user did not specify
189+
# conflicting values.
190+
191+
saved_arch := $(shell cat include/generated/kernel.arch 2> /dev/null)
192+
saved_cross := $(shell cat include/generated/kernel.cross 2> /dev/null)
193+
194+
ifneq ($(CROSS_COMPILE),)
195+
ifneq ($(saved_cross),)
196+
ifneq ($(CROSS_COMPILE),$(saved_cross))
197+
$(error CROSS_COMPILE changed from \
198+
"$(saved_cross)" to \
199+
to "$(CROSS_COMPILE)". \
200+
Use "make mrproper" to fix it up)
201+
endif
202+
endif
203+
else
204+
CROSS_COMPILE := $(saved_cross)
205+
endif
206+
207+
ifneq ($(ARCH),)
208+
ifneq ($(saved_arch),)
209+
ifneq ($(saved_arch),$(ARCH))
210+
$(error ARCH changed from \
211+
"$(saved_arch)" to "$(ARCH)". \
212+
Use "make mrproper" to fix it up)
213+
endif
214+
endif
215+
else
216+
ifneq ($(saved_arch),)
217+
ARCH := $(saved_arch)
218+
else
219+
ARCH := $(SUBARCH)
220+
endif
221+
endif
185222

186223
# Architecture as present in compile.h
187224
UTS_MACHINE := $(ARCH)
@@ -315,6 +352,7 @@ OBJCOPY = $(CROSS_COMPILE)objcopy
315352
OBJDUMP = $(CROSS_COMPILE)objdump
316353
AWK = awk
317354
GENKSYMS = scripts/genksyms/genksyms
355+
INSTALLKERNEL := installkernel
318356
DEPMOD = /sbin/depmod
319357
KALLSYMS = scripts/kallsyms
320358
PERL = perl
@@ -353,7 +391,8 @@ KERNELVERSION = $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
353391

354392
export VERSION PATCHLEVEL SUBLEVEL KERNELRELEASE KERNELVERSION
355393
export ARCH SRCARCH CONFIG_SHELL HOSTCC HOSTCFLAGS CROSS_COMPILE AS LD CC
356-
export CPP AR NM STRIP OBJCOPY OBJDUMP MAKE AWK GENKSYMS PERL UTS_MACHINE
394+
export CPP AR NM STRIP OBJCOPY OBJDUMP
395+
export MAKE AWK GENKSYMS INSTALLKERNEL PERL UTS_MACHINE
357396
export HOSTCXX HOSTCXXFLAGS LDFLAGS_MODULE CHECK CHECKFLAGS
358397

359398
export KBUILD_CPPFLAGS NOSTDINC_FLAGS LINUXINCLUDE OBJCOPYFLAGS LDFLAGS
@@ -444,6 +483,11 @@ ifeq ($(config-targets),1)
444483
include $(srctree)/arch/$(SRCARCH)/Makefile
445484
export KBUILD_DEFCONFIG KBUILD_KCONFIG
446485

486+
# save ARCH & CROSS_COMPILE settings
487+
$(shell mkdir -p include/generated && \
488+
echo $(ARCH) > include/generated/kernel.arch && \
489+
echo $(CROSS_COMPILE) > include/generated/kernel.cross)
490+
447491
config: scripts_basic outputmakefile FORCE
448492
$(Q)mkdir -p include/linux include/config
449493
$(Q)$(MAKE) $(build)=scripts/kconfig $@
@@ -571,6 +615,9 @@ KBUILD_CFLAGS += $(call cc-option,-fno-strict-overflow)
571615
# revert to pre-gcc-4.4 behaviour of .eh_frame
572616
KBUILD_CFLAGS += $(call cc-option,-fno-dwarf2-cfi-asm)
573617

618+
# conserve stack if available
619+
KBUILD_CFLAGS += $(call cc-option,-fconserve-stack)
620+
574621
# Add user supplied CPPFLAGS, AFLAGS and CFLAGS as the last assignments
575622
# But warn user when we do so
576623
warn-assign = \
@@ -591,12 +638,12 @@ endif
591638

592639
# Use --build-id when available.
593640
LDFLAGS_BUILD_ID = $(patsubst -Wl$(comma)%,%,\
594-
$(call ld-option, -Wl$(comma)--build-id,))
641+
$(call cc-ldoption, -Wl$(comma)--build-id,))
595642
LDFLAGS_MODULE += $(LDFLAGS_BUILD_ID)
596643
LDFLAGS_vmlinux += $(LDFLAGS_BUILD_ID)
597644

598645
ifeq ($(CONFIG_STRIP_ASM_SYMS),y)
599-
LDFLAGS_vmlinux += -X
646+
LDFLAGS_vmlinux += $(call ld-option, -X,)
600647
endif
601648

602649
# Default kernel image to build when no specific target is given.
@@ -980,11 +1027,6 @@ prepare0: archprepare FORCE
9801027
# All the preparing..
9811028
prepare: prepare0
9821029

983-
# Leave this as default for preprocessing vmlinux.lds.S, which is now
984-
# done in arch/$(ARCH)/kernel/Makefile
985-
986-
export CPPFLAGS_vmlinux.lds += -P -C -U$(ARCH)
987-
9881030
# The asm symlink changes when $(ARCH) changes.
9891031
# Detect this and ask user to run make mrproper
9901032
# If asm is a stale symlink (point to dir that does not exist) remove it

arch/arm/Makefile

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ LDFLAGS_vmlinux :=-p --no-undefined -X
1414
ifeq ($(CONFIG_CPU_ENDIAN_BE8),y)
1515
LDFLAGS_vmlinux += --be8
1616
endif
17-
CPPFLAGS_vmlinux.lds = -DTEXT_OFFSET=$(TEXT_OFFSET)
17+
1818
OBJCOPYFLAGS :=-O binary -R .note -R .note.gnu.build-id -R .comment -S
1919
GZFLAGS :=-9
2020
#KBUILD_CFLAGS +=-pipe
@@ -279,7 +279,7 @@ define archhelp
279279
echo ' (supply initrd image via make variable INITRD=<path>)'
280280
echo ' install - Install uncompressed kernel'
281281
echo ' zinstall - Install compressed kernel'
282-
echo ' Install using (your) ~/bin/installkernel or'
283-
echo ' (distribution) /sbin/installkernel or'
282+
echo ' Install using (your) ~/bin/$(INSTALLKERNEL) or'
283+
echo ' (distribution) /sbin/$(INSTALLKERNEL) or'
284284
echo ' install to $$(INSTALL_PATH) and run lilo'
285285
endef

arch/arm/boot/install.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
#
2222

2323
# User may have a custom install script
24-
if [ -x ~/bin/${CROSS_COMPILE}installkernel ]; then exec ~/bin/${CROSS_COMPILE}installkernel "$@"; fi
25-
if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then exec /sbin/${CROSS_COMPILE}installkernel "$@"; fi
24+
if [ -x ~/bin/${INSTALLKERNEL} ]; then exec ~/bin/${INSTALLKERNEL} "$@"; fi
25+
if [ -x /sbin/${INSTALLKERNEL} ]; then exec /sbin/${INSTALLKERNEL} "$@"; fi
2626

2727
if [ "$(basename $2)" = "zImage" ]; then
2828
# Compressed install

arch/arm/kernel/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
# Makefile for the linux kernel.
33
#
44

5-
AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
5+
CPPFLAGS_vmlinux.lds := -DTEXT_OFFSET=$(TEXT_OFFSET)
6+
AFLAGS_head.o := -DTEXT_OFFSET=$(TEXT_OFFSET)
67

78
ifdef CONFIG_DYNAMIC_FTRACE
89
CFLAGS_REMOVE_ftrace.o = -pg

arch/arm/kernel/init_task.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
2424
*
2525
* The things we do for performance..
2626
*/
27-
union thread_union init_thread_union
28-
__attribute__((__section__(".data.init_task"))) =
29-
{ INIT_THREAD_INFO(init_task) };
27+
union thread_union init_thread_union __init_task_data =
28+
{ INIT_THREAD_INFO(init_task) };
3029

3130
/*
3231
* Initial task structure.

arch/avr32/kernel/init_task.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
1818
/*
1919
* Initial thread structure. Must be aligned on an 8192-byte boundary.
2020
*/
21-
union thread_union init_thread_union
22-
__attribute__((__section__(".data.init_task"))) =
23-
{ INIT_THREAD_INFO(init_task) };
21+
union thread_union init_thread_union __init_task_data =
22+
{ INIT_THREAD_INFO(init_task) };
2423

2524
/*
2625
* Initial task structure.

arch/avr32/mm/init.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@
2424
#include <asm/setup.h>
2525
#include <asm/sections.h>
2626

27-
#define __page_aligned __attribute__((section(".data.page_aligned")))
28-
2927
DEFINE_PER_CPU(struct mmu_gather, mmu_gathers);
3028

31-
pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned;
29+
pgd_t swapper_pg_dir[PTRS_PER_PGD] __page_aligned_data;
3230

3331
struct page *empty_zero_page;
3432
EXPORT_SYMBOL(empty_zero_page);

arch/blackfin/Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ define archhelp
155155
echo '* vmImage.gz - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.gz)'
156156
echo ' vmImage.lzma - Kernel-only image for U-Boot (arch/$(ARCH)/boot/vmImage.lzma)'
157157
echo ' install - Install kernel using'
158-
echo ' (your) ~/bin/$(CROSS_COMPILE)installkernel or'
159-
echo ' (distribution) PATH: $(CROSS_COMPILE)installkernel or'
158+
echo ' (your) ~/bin/$(INSTALLKERNEL) or'
159+
echo ' (distribution) PATH: $(INSTALLKERNEL) or'
160160
echo ' install to $$(INSTALL_PATH)'
161161
endef

0 commit comments

Comments
 (0)