mirror of
https://github.com/torvalds/linux.git
synced 2024-12-25 12:21:37 +00:00
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
This commit is contained in:
commit
c9e2a72ff1
@ -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
|
||||
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/",
|
||||
but in the architecture makefiles where the kbuild infrastructure
|
||||
is not sufficient this sometimes needs to be explicit.
|
||||
|
4
Kbuild
4
Kbuild
@ -95,5 +95,5 @@ PHONY += missing-syscalls
|
||||
missing-syscalls: scripts/checksyscalls.sh FORCE
|
||||
$(call cmd,syscalls)
|
||||
|
||||
# Delete all targets during make clean
|
||||
clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets)))
|
||||
# Keep these two files during make clean
|
||||
no-clean-files := $(bounds-file) $(offsets-file)
|
||||
|
33
Makefile
33
Makefile
@ -1137,21 +1137,13 @@ MRPROPER_FILES += .config .config.old .version .old_version \
|
||||
#
|
||||
clean: rm-dirs := $(CLEAN_DIRS)
|
||||
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
|
||||
$(clean-dirs):
|
||||
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
||||
|
||||
clean: archclean $(clean-dirs)
|
||||
$(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
|
||||
clean: archclean
|
||||
|
||||
# mrproper - Delete all generated files, including .config
|
||||
#
|
||||
@ -1352,16 +1344,7 @@ $(clean-dirs):
|
||||
$(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
|
||||
|
||||
clean: rm-dirs := $(MODVERDIR)
|
||||
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
|
||||
clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
|
||||
|
||||
help:
|
||||
@echo ' Building external modules.'
|
||||
@ -1378,6 +1361,16 @@ prepare: ;
|
||||
scripts: ;
|
||||
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
|
||||
# ---------------------------------------------------------------------------
|
||||
quiet_cmd_tags = GEN $@
|
||||
|
@ -640,7 +640,8 @@
|
||||
. = ALIGN(4); \
|
||||
VMLINUX_SYMBOL(__initramfs_start) = .; \
|
||||
*(.init.ramfs) \
|
||||
VMLINUX_SYMBOL(__initramfs_end) = .;
|
||||
. = ALIGN(8); \
|
||||
*(.init.ramfs.info)
|
||||
#else
|
||||
#define INIT_RAM_FS
|
||||
#endif
|
||||
|
@ -483,7 +483,8 @@ static int __init retain_initrd_param(char *str)
|
||||
}
|
||||
__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/kexec.h>
|
||||
|
||||
@ -570,8 +571,7 @@ static void __init clean_rootfs(void)
|
||||
|
||||
static int __init populate_rootfs(void)
|
||||
{
|
||||
char *err = unpack_to_rootfs(__initramfs_start,
|
||||
__initramfs_end - __initramfs_start);
|
||||
char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
|
||||
if (err)
|
||||
panic(err); /* Failed to decompress INTERNAL initramfs */
|
||||
if (initrd_start) {
|
||||
@ -585,8 +585,7 @@ static int __init populate_rootfs(void)
|
||||
return 0;
|
||||
} else {
|
||||
clean_rootfs();
|
||||
unpack_to_rootfs(__initramfs_start,
|
||||
__initramfs_end - __initramfs_start);
|
||||
unpack_to_rootfs(__initramfs_start, __initramfs_size);
|
||||
}
|
||||
printk(KERN_INFO "rootfs image is not initramfs (%s)"
|
||||
"; looks like an initrd\n", err);
|
||||
|
@ -45,6 +45,8 @@ __clean-files := $(extra-y) $(always) \
|
||||
$(host-progs) \
|
||||
$(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
|
||||
# a $(obj) prefix, except for absolute paths
|
||||
|
||||
|
@ -120,7 +120,9 @@ _c_flags += $(if $(patsubst n%,, \
|
||||
endif
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
@ -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);
|
||||
if (rc != 3) {
|
||||
if (rc != EOF) {
|
||||
/* skip line. sym is used as dummy to
|
||||
* shut of "warn_unused_result" warning.
|
||||
*/
|
||||
sym = fgets(str, 500, in);
|
||||
}
|
||||
if (rc != EOF && fgets(str, 500, in) == NULL)
|
||||
fprintf(stderr, "Read error or end of file.\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
@ -1208,6 +1208,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr,
|
||||
* .cpuinit.data => __cpudata
|
||||
* .memexitconst => __memconst
|
||||
* 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)
|
||||
{
|
||||
@ -1230,7 +1233,7 @@ static char *sec2annotation(const char *s)
|
||||
strcat(p, "data ");
|
||||
else
|
||||
strcat(p, " ");
|
||||
return r; /* we leak her but we do not care */
|
||||
return r;
|
||||
} else {
|
||||
return strdup("");
|
||||
}
|
||||
|
@ -160,8 +160,10 @@ if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then
|
||||
# full scm version string
|
||||
res="$res$(scm_version)"
|
||||
else
|
||||
# apped a plus sign if the repository is not in a clean tagged
|
||||
# state and LOCALVERSION= is not specified
|
||||
# append a plus sign if the repository is not in a clean
|
||||
# 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
|
||||
scm=$(scm_version --short)
|
||||
res="$res${scm:++}"
|
||||
|
@ -18,13 +18,15 @@ suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma
|
||||
# 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
|
||||
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.
|
||||
# The image is included using .incbin, a dependency which is not
|
||||
# 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
|
||||
|
@ -11,11 +11,7 @@
|
||||
-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) }
|
||||
}
|
||||
For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
|
||||
|
||||
The above example is for i386 - the parameters vary from architectures.
|
||||
Eventually look up LDFLAGS_BLOB in an older version of the
|
||||
@ -25,6 +21,17 @@ SECTIONS
|
||||
in the ELF header, as required by certain architectures.
|
||||
*/
|
||||
|
||||
.section .init.ramfs,"a"
|
||||
.incbin "usr/initramfs_data.cpio"
|
||||
#include <linux/stringify.h>
|
||||
|
||||
.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
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
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"
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
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"
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
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"
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
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"
|
Loading…
Reference in New Issue
Block a user