Skip to content

Commit

Permalink
Merge branch 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/gi…
Browse files Browse the repository at this point in the history
…t/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
  • Loading branch information
torvalds committed Oct 28, 2010
2 parents 9aca0e7 + d63f6d1 commit c9e2a72
Show file tree
Hide file tree
Showing 16 changed files with 61 additions and 163 deletions.
7 changes: 7 additions & 0 deletions Documentation/kbuild/makefiles.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions Kbuild
Original file line number Diff line number Diff line change
Expand Up @@ -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 changes: 13 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down Expand Up @@ -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.'
Expand All @@ -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 $@
Expand Down
3 changes: 2 additions & 1 deletion include/asm-generic/vmlinux.lds.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions init/initramfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down Expand Up @@ -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) {
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions scripts/Makefile.clean
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion scripts/Makefile.lib
Original file line number Diff line number Diff line change
Expand Up @@ -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


Expand Down
8 changes: 2 additions & 6 deletions scripts/kallsyms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
5 changes: 4 additions & 1 deletion scripts/mod/modpost.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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("");
}
Expand Down
6 changes: 4 additions & 2 deletions scripts/setlocalversion
Original file line number Diff line number Diff line change
Expand Up @@ -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:++}"
Expand Down
6 changes: 4 additions & 2 deletions usr/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 14 additions & 7 deletions usr/initramfs_data.S
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
29 changes: 0 additions & 29 deletions usr/initramfs_data.bz2.S

This file was deleted.

29 changes: 0 additions & 29 deletions usr/initramfs_data.gz.S

This file was deleted.

29 changes: 0 additions & 29 deletions usr/initramfs_data.lzma.S

This file was deleted.

29 changes: 0 additions & 29 deletions usr/initramfs_data.lzo.S

This file was deleted.

0 comments on commit c9e2a72

Please sign in to comment.