Commit c9e2a72f authored by Linus Torvalds's avatar Linus Torvalds

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

* 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
  initramfs: Fix build break on symbol-prefixed archs
  initramfs: fix initramfs size calculation
  initramfs: generalize initramfs_data.xxx.S variants
  scripts/kallsyms: Enable error messages while hush up unnecessary warnings
  scripts/setlocalversion: update comment
  kbuild: Use a single clean rule for kernel and external modules
  kbuild: Do not run make clean in $(srctree)
  scripts/mod/modpost.c: fix commentary accordingly to last changes
  kbuild: Really don't clean bounds.h and asm-offsets.h
parents 9aca0e7c d63f6d1b
...@@ -776,6 +776,13 @@ This will delete the directory debian, including all subdirectories. ...@@ -776,6 +776,13 @@ This will delete the directory debian, including all subdirectories.
Kbuild will assume the directories to be in the same relative path as the Kbuild will assume the directories to be in the same relative path as the
Makefile if no absolute path is specified (path does not start with '/'). Makefile if no absolute path is specified (path does not start with '/').
To exclude certain files from make clean, use the $(no-clean-files) variable.
This is only a special case used in the top level Kbuild file:
Example:
#Kbuild
no-clean-files := $(bounds-file) $(offsets-file)
Usually kbuild descends down in subdirectories due to "obj-* := dir/", Usually kbuild descends down in subdirectories due to "obj-* := dir/",
but in the architecture makefiles where the kbuild infrastructure but in the architecture makefiles where the kbuild infrastructure
is not sufficient this sometimes needs to be explicit. is not sufficient this sometimes needs to be explicit.
......
...@@ -95,5 +95,5 @@ PHONY += missing-syscalls ...@@ -95,5 +95,5 @@ PHONY += missing-syscalls
missing-syscalls: scripts/checksyscalls.sh FORCE missing-syscalls: scripts/checksyscalls.sh FORCE
$(call cmd,syscalls) $(call cmd,syscalls)
# Delete all targets during make clean # Keep these two files during make clean
clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets))) no-clean-files := $(bounds-file) $(offsets-file)
...@@ -1137,21 +1137,13 @@ MRPROPER_FILES += .config .config.old .version .old_version \ ...@@ -1137,21 +1137,13 @@ MRPROPER_FILES += .config .config.old .version .old_version \
# #
clean: rm-dirs := $(CLEAN_DIRS) clean: rm-dirs := $(CLEAN_DIRS)
clean: rm-files := $(CLEAN_FILES) clean: rm-files := $(CLEAN_FILES)
clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation) clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation)
PHONY += $(clean-dirs) clean archclean PHONY += $(clean-dirs) clean archclean
$(clean-dirs): $(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
clean: archclean $(clean-dirs) clean: archclean
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find . $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name '*.gcno' \) -type f -print | xargs rm -f
# mrproper - Delete all generated files, including .config # mrproper - Delete all generated files, including .config
# #
...@@ -1352,16 +1344,7 @@ $(clean-dirs): ...@@ -1352,16 +1344,7 @@ $(clean-dirs):
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@) $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
clean: rm-dirs := $(MODVERDIR) clean: rm-dirs := $(MODVERDIR)
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \ clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
$(KBUILD_EXTMOD)/modules.order \
$(KBUILD_EXTMOD)/modules.builtin
clean: $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.gcno' \) -type f -print | xargs rm -f
help: help:
@echo ' Building external modules.' @echo ' Building external modules.'
...@@ -1378,6 +1361,16 @@ prepare: ; ...@@ -1378,6 +1361,16 @@ prepare: ;
scripts: ; scripts: ;
endif # KBUILD_EXTMOD endif # KBUILD_EXTMOD
clean: $(clean-dirs)
$(call cmd,rmdirs)
$(call cmd,rmfiles)
@find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
\( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
-o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
-o -name '*.symtypes' -o -name 'modules.order' \
-o -name modules.builtin -o -name '.tmp_*.o.*' \
-o -name '*.gcno' \) -type f -print | xargs rm -f
# Generate tags for editors # Generate tags for editors
# --------------------------------------------------------------------------- # ---------------------------------------------------------------------------
quiet_cmd_tags = GEN $@ quiet_cmd_tags = GEN $@
......
...@@ -640,7 +640,8 @@ ...@@ -640,7 +640,8 @@
. = ALIGN(4); \ . = ALIGN(4); \
VMLINUX_SYMBOL(__initramfs_start) = .; \ VMLINUX_SYMBOL(__initramfs_start) = .; \
*(.init.ramfs) \ *(.init.ramfs) \
VMLINUX_SYMBOL(__initramfs_end) = .; . = ALIGN(8); \
*(.init.ramfs.info)
#else #else
#define INIT_RAM_FS #define INIT_RAM_FS
#endif #endif
......
...@@ -483,7 +483,8 @@ static int __init retain_initrd_param(char *str) ...@@ -483,7 +483,8 @@ static int __init retain_initrd_param(char *str)
} }
__setup("retain_initrd", retain_initrd_param); __setup("retain_initrd", retain_initrd_param);
extern char __initramfs_start[], __initramfs_end[]; extern char __initramfs_start[];
extern unsigned long __initramfs_size;
#include <linux/initrd.h> #include <linux/initrd.h>
#include <linux/kexec.h> #include <linux/kexec.h>
...@@ -570,8 +571,7 @@ static void __init clean_rootfs(void) ...@@ -570,8 +571,7 @@ static void __init clean_rootfs(void)
static int __init populate_rootfs(void) static int __init populate_rootfs(void)
{ {
char *err = unpack_to_rootfs(__initramfs_start, char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
__initramfs_end - __initramfs_start);
if (err) if (err)
panic(err); /* Failed to decompress INTERNAL initramfs */ panic(err); /* Failed to decompress INTERNAL initramfs */
if (initrd_start) { if (initrd_start) {
...@@ -585,8 +585,7 @@ static int __init populate_rootfs(void) ...@@ -585,8 +585,7 @@ static int __init populate_rootfs(void)
return 0; return 0;
} else { } else {
clean_rootfs(); clean_rootfs();
unpack_to_rootfs(__initramfs_start, unpack_to_rootfs(__initramfs_start, __initramfs_size);
__initramfs_end - __initramfs_start);
} }
printk(KERN_INFO "rootfs image is not initramfs (%s)" printk(KERN_INFO "rootfs image is not initramfs (%s)"
"; looks like an initrd\n", err); "; looks like an initrd\n", err);
......
...@@ -45,6 +45,8 @@ __clean-files := $(extra-y) $(always) \ ...@@ -45,6 +45,8 @@ __clean-files := $(extra-y) $(always) \
$(host-progs) \ $(host-progs) \
$(hostprogs-y) $(hostprogs-m) $(hostprogs-) $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
__clean-files := $(filter-out $(no-clean-files), $(__clean-files))
# as clean-files is given relative to the current directory, this adds # as clean-files is given relative to the current directory, this adds
# a $(obj) prefix, except for absolute paths # a $(obj) prefix, except for absolute paths
......
...@@ -120,7 +120,9 @@ _c_flags += $(if $(patsubst n%,, \ ...@@ -120,7 +120,9 @@ _c_flags += $(if $(patsubst n%,, \
endif endif
ifdef CONFIG_SYMBOL_PREFIX ifdef CONFIG_SYMBOL_PREFIX
_cpp_flags += -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX)) _sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
_cpp_flags += $(_sym_flags)
_a_flags += $(_sym_flags)
endif endif
......
...@@ -107,12 +107,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) ...@@ -107,12 +107,8 @@ static int read_symbol(FILE *in, struct sym_entry *s)
rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str); rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
if (rc != 3) { if (rc != 3) {
if (rc != EOF) { if (rc != EOF && fgets(str, 500, in) == NULL)
/* skip line. sym is used as dummy to fprintf(stderr, "Read error or end of file.\n");
* shut of "warn_unused_result" warning.
*/
sym = fgets(str, 500, in);
}
return -1; return -1;
} }
......
...@@ -1208,6 +1208,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, ...@@ -1208,6 +1208,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
* .cpuinit.data => __cpudata * .cpuinit.data => __cpudata
* .memexitconst => __memconst * .memexitconst => __memconst
* etc. * etc.
*
* The memory of returned value has been allocated on a heap. The user of this
* method should free it after usage.
*/ */
static char *sec2annotation(const char *s) static char *sec2annotation(const char *s)
{ {
...@@ -1230,7 +1233,7 @@ static char *sec2annotation(const char *s) ...@@ -1230,7 +1233,7 @@ static char *sec2annotation(const char *s)
strcat(p, "data "); strcat(p, "data ");
else else
strcat(p, " "); strcat(p, " ");
return r; /* we leak her but we do not care */ return r;
} else { } else {
return strdup(""); return strdup("");
} }
......
...@@ -160,8 +160,10 @@ if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then ...@@ -160,8 +160,10 @@ if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
# full scm version string # full scm version string
res="$res$(scm_version)" res="$res$(scm_version)"
else else
# apped a plus sign if the repository is not in a clean tagged # append a plus sign if the repository is not in a clean
# state and LOCALVERSION= is not specified # annotated or signed tagged state (as git describe only
# looks at signed or annotated tags - git tag -a/-s) and
# LOCALVERSION= is not specified
if test "${LOCALVERSION+set}" != "set"; then if test "${LOCALVERSION+set}" != "set"; then
scm=$(scm_version --short) scm=$(scm_version --short)
res="$res${scm:++}" res="$res${scm:++}"
......
...@@ -18,13 +18,15 @@ suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma ...@@ -18,13 +18,15 @@ suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma
# Lzo # Lzo
suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo
AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
# Generate builtin.o based on initramfs_data.o # Generate builtin.o based on initramfs_data.o
obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
# initramfs_data.o contains the compressed initramfs_data.cpio image. # initramfs_data.o contains the compressed initramfs_data.cpio image.
# The image is included using .incbin, a dependency which is not # The image is included using .incbin, a dependency which is not
# tracked automatically. # tracked automatically.
$(obj)/initramfs_data$(suffix_y).o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
##### #####
# Generate the initramfs cpio archive # Generate the initramfs cpio archive
......
...@@ -11,11 +11,7 @@ ...@@ -11,11 +11,7 @@
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this: For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures. The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the Eventually look up LDFLAGS_BLOB in an older version of the
...@@ -25,6 +21,17 @@ SECTIONS ...@@ -25,6 +21,17 @@ SECTIONS
in the ELF header, as required by certain architectures. in the ELF header, as required by certain architectures.
*/ */
.section .init.ramfs,"a" #include <linux/stringify.h>
.incbin "usr/initramfs_data.cpio"
.section .init.ramfs,"a"
__irf_start:
.incbin __stringify(INITRAMFS_IMAGE)
__irf_end:
.section .init.ramfs.info,"a"
.globl __initramfs_size
__initramfs_size:
#ifdef CONFIG_32BIT
.long __irf_end - __irf_start
#else
.quad __irf_end - __irf_start
#endif
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.bz2"
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.gz"
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.lzma"
/*
initramfs_data includes the compressed binary that is the
filesystem used for early user space.
Note: Older versions of "as" (prior to binutils 2.11.90.0.23
released on 2001-07-14) dit not support .incbin.
If you are forced to use older binutils than that then the
following trick can be applied to create the resulting binary:
ld -m elf_i386 --format binary --oformat elf32-i386 -r \
-T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
ld -m elf_i386 -r -o built-in.o initramfs_data.o
initramfs_data.scr looks like this:
SECTIONS
{
.init.ramfs : { *(.data) }
}
The above example is for i386 - the parameters vary from architectures.
Eventually look up LDFLAGS_BLOB in an older version of the
arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
Using .incbin has the advantage over ld that the correct flags are set
in the ELF header, as required by certain architectures.
*/
.section .init.ramfs,"a"
.incbin "usr/initramfs_data.cpio.lzo"
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