History

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

Linus Torvalds committed 16 years ago

Commit c9e2a722 parents 9aca0e7 d63f6d116 files · +61 −163Browse files

Unified · Split

16 files
  1. Documentation/kbuild/makefiles.txt +7 −0
  2. Kbuild +2 −2
  3. Makefile +13 −20
  4. include/asm-generic/vmlinux.lds.h +2 −1
  5. init/initramfs.c +4 −5
  6. scripts/Makefile.clean +2 −0
  7. scripts/Makefile.lib +3 −1
  8. scripts/kallsyms.c +2 −6
  9. scripts/mod/modpost.c +4 −1
  10. scripts/setlocalversion +4 −2
  11. usr/Makefile +4 −2
  12. usr/initramfs_data.S +14 −7
  13. usr/initramfs_data.bz2.S +0 −29
  14. usr/initramfs_data.gz.S +0 −29
  15. usr/initramfs_data.lzma.S +0 −29
  16. usr/initramfs_data.lzo.S +0 −29
Documentation/kbuild/makefiles.txt+7−0
@@ -776,6 +776,13 @@ This will delete the directory debian, including all subdirectories. · 775 unmodified lines
776Kbuild will assume the directories to be in the same relative path as the776Kbuild will assume the directories to be in the same relative path as the
777Makefile if no absolute path is specified (path does not start with '/').777Makefile if no absolute path is specified (path does not start with '/').
778 778
779To exclude certain files from make clean, use the $(no-clean-files) variable.
780This is only a special case used in the top level Kbuild file:
781
782 Example:
783 #Kbuild
784 no-clean-files := $(bounds-file) $(offsets-file)
785
779Usually kbuild descends down in subdirectories due to "obj-* := dir/",786Usually kbuild descends down in subdirectories due to "obj-* := dir/",
780but in the architecture makefiles where the kbuild infrastructure787but in the architecture makefiles where the kbuild infrastructure
781is not sufficient this sometimes needs to be explicit.788is not sufficient this sometimes needs to be explicit.
Kbuild+2−2
@@ -95,5 +95,5 @@ PHONY += missing-syscalls · 94 unmodified lines
95missing-syscalls: scripts/checksyscalls.sh FORCE95missing-syscalls: scripts/checksyscalls.sh FORCE
96 $(call cmd,syscalls)96 $(call cmd,syscalls)
97 97
98# Delete all targets during make clean98# Keep these two files during make clean
99clean-files := $(addprefix $(objtree)/,$(filter-out $(bounds-file) $(offsets-file),$(targets)))99no-clean-files := $(bounds-file) $(offsets-file)
Makefile+13−20
@@ -1137,21 +1137,13 @@ MRPROPER_FILES += .config .config.old .version .old_version \ · 1136 unmodified lines
1137#1137#
1138clean: rm-dirs := $(CLEAN_DIRS)1138clean: rm-dirs := $(CLEAN_DIRS)
1139clean: rm-files := $(CLEAN_FILES)1139clean: rm-files := $(CLEAN_FILES)
1140clean-dirs := $(addprefix _clean_,$(srctree) $(vmlinux-alldirs) Documentation)1140clean-dirs := $(addprefix _clean_, . $(vmlinux-alldirs) Documentation)
1141 1141
1142PHONY += $(clean-dirs) clean archclean1142PHONY += $(clean-dirs) clean archclean
1143$(clean-dirs):1143$(clean-dirs):
1144 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)1144 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1145 1145
1146clean: archclean $(clean-dirs)1146clean: archclean
1147 $(call cmd,rmdirs)
1148 $(call cmd,rmfiles)
1149 @find . $(RCS_FIND_IGNORE) \
1150 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1151 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1152 -o -name '*.symtypes' -o -name 'modules.order' \
1153 -o -name modules.builtin -o -name '.tmp_*.o.*' \
1154 -o -name '*.gcno' \) -type f -print | xargs rm -f
1155 1147
1156# mrproper - Delete all generated files, including .config1148# mrproper - Delete all generated files, including .config
1157#1149#
@@ -1352,16 +1344,7 @@ $(clean-dirs): · 194 unmodified lines
1352 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)1344 $(Q)$(MAKE) $(clean)=$(patsubst _clean_%,%,$@)
1353 1345
1354clean: rm-dirs := $(MODVERDIR)1346clean: rm-dirs := $(MODVERDIR)
1355clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers \1347clean: rm-files := $(KBUILD_EXTMOD)/Module.symvers
1356 $(KBUILD_EXTMOD)/modules.order \
1357 $(KBUILD_EXTMOD)/modules.builtin
1358clean: $(clean-dirs)
1359 $(call cmd,rmdirs)
1360 $(call cmd,rmfiles)
1361 @find $(KBUILD_EXTMOD) $(RCS_FIND_IGNORE) \
1362 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1363 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1364 -o -name '*.gcno' \) -type f -print | xargs rm -f
1365 1348
1366help:1349help:
1367 @echo ' Building external modules.'1350 @echo ' Building external modules.'
@@ -1378,6 +1361,16 @@ prepare: ; · 10 unmodified lines
1378scripts: ;1361scripts: ;
1379endif # KBUILD_EXTMOD1362endif # KBUILD_EXTMOD
1380 1363
1364clean: $(clean-dirs)
1365 $(call cmd,rmdirs)
1366 $(call cmd,rmfiles)
1367 @find $(or $(KBUILD_EXTMOD), .) $(RCS_FIND_IGNORE) \
1368 \( -name '*.[oas]' -o -name '*.ko' -o -name '.*.cmd' \
1369 -o -name '.*.d' -o -name '.*.tmp' -o -name '*.mod.c' \
1370 -o -name '*.symtypes' -o -name 'modules.order' \
1371 -o -name modules.builtin -o -name '.tmp_*.o.*' \
1372 -o -name '*.gcno' \) -type f -print | xargs rm -f
1373
1381# Generate tags for editors1374# Generate tags for editors
1382# ---------------------------------------------------------------------------1375# ---------------------------------------------------------------------------
1383quiet_cmd_tags = GEN $@1376quiet_cmd_tags = GEN $@
include/asm-generic/vmlinux.lds.h+2−1
@@ -640,7 +640,8 @@ · 639 unmodified lines
640 . = ALIGN(4); \640 . = ALIGN(4); \
641 VMLINUX_SYMBOL(__initramfs_start) = .; \641 VMLINUX_SYMBOL(__initramfs_start) = .; \
642 *(.init.ramfs) \642 *(.init.ramfs) \
643 VMLINUX_SYMBOL(__initramfs_end) = .;643 . = ALIGN(8); \
644 *(.init.ramfs.info)
644#else645#else
645#define INIT_RAM_FS646#define INIT_RAM_FS
646#endif647#endif
init/initramfs.c+4−5
@@ -483,7 +483,8 @@ static int __init retain_initrd_param(char *str) · 482 unmodified lines
483}483}
484__setup("retain_initrd", retain_initrd_param);484__setup("retain_initrd", retain_initrd_param);
485 485
486extern char __initramfs_start[], __initramfs_end[];486extern char __initramfs_start[];
487extern unsigned long __initramfs_size;
487#include <linux/initrd.h>488#include <linux/initrd.h>
488#include <linux/kexec.h>489#include <linux/kexec.h>
489 490
@@ -570,8 +571,7 @@ static void __init clean_rootfs(void) · 80 unmodified lines
570 571
571static int __init populate_rootfs(void)572static int __init populate_rootfs(void)
572{573{
573 char *err = unpack_to_rootfs(__initramfs_start,574 char *err = unpack_to_rootfs(__initramfs_start, __initramfs_size);
574 __initramfs_end - __initramfs_start);
575 if (err)575 if (err)
576 panic(err); /* Failed to decompress INTERNAL initramfs */576 panic(err); /* Failed to decompress INTERNAL initramfs */
577 if (initrd_start) {577 if (initrd_start) {
@@ -585,8 +585,7 @@ static int __init populate_rootfs(void) · 7 unmodified lines
585 return 0;585 return 0;
586 } else {586 } else {
587 clean_rootfs();587 clean_rootfs();
588 unpack_to_rootfs(__initramfs_start,588 unpack_to_rootfs(__initramfs_start, __initramfs_size);
589 __initramfs_end - __initramfs_start);
590 }589 }
591 printk(KERN_INFO "rootfs image is not initramfs (%s)"590 printk(KERN_INFO "rootfs image is not initramfs (%s)"
592 "; looks like an initrd\n", err);591 "; looks like an initrd\n", err);
scripts/Makefile.clean+2−0
@@ -45,6 +45,8 @@ __clean-files := $(extra-y) $(always) \ · 44 unmodified lines
45 $(host-progs) \45 $(host-progs) \
46 $(hostprogs-y) $(hostprogs-m) $(hostprogs-)46 $(hostprogs-y) $(hostprogs-m) $(hostprogs-)
47 47
48__clean-files := $(filter-out $(no-clean-files), $(__clean-files))
49
48# as clean-files is given relative to the current directory, this adds50# as clean-files is given relative to the current directory, this adds
49# a $(obj) prefix, except for absolute paths51# a $(obj) prefix, except for absolute paths
50 52
scripts/Makefile.lib+3−1
@@ -120,7 +120,9 @@ _c_flags += $(if $(patsubst n%,, \ · 119 unmodified lines
120endif120endif
121 121
122ifdef CONFIG_SYMBOL_PREFIX122ifdef CONFIG_SYMBOL_PREFIX
123_cpp_flags += -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))123_sym_flags = -DSYMBOL_PREFIX=$(patsubst "%",%,$(CONFIG_SYMBOL_PREFIX))
124_cpp_flags += $(_sym_flags)
125_a_flags += $(_sym_flags)
124endif126endif
125 127
126 128
scripts/kallsyms.c+2−6
@@ -107,12 +107,8 @@ static int read_symbol(FILE *in, struct sym_entry *s) · 106 unmodified lines
107 107
108 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);108 rc = fscanf(in, "%llx %c %499s\n", &s->addr, &stype, str);
109 if (rc != 3) {109 if (rc != 3) {
110 if (rc != EOF) {110 if (rc != EOF && fgets(str, 500, in) == NULL)
111 /* skip line. sym is used as dummy to111 fprintf(stderr, "Read error or end of file.\n");
112 * shut of "warn_unused_result" warning.
113 */
114 sym = fgets(str, 500, in);
115 }
116 return -1;112 return -1;
117 }113 }
118 114
scripts/mod/modpost.c+4−1
@@ -1208,6 +1208,9 @@ static Elf_Sym *find_elf_symbol2(struct elf_info *elf, Elf_Addr addr, · 1207 unmodified lines
1208 * .cpuinit.data => __cpudata1208 * .cpuinit.data => __cpudata
1209 * .memexitconst => __memconst1209 * .memexitconst => __memconst
1210 * etc.1210 * etc.
1211 *
1212 * The memory of returned value has been allocated on a heap. The user of this
1213 * method should free it after usage.
1211*/1214*/
1212static char *sec2annotation(const char *s)1215static char *sec2annotation(const char *s)
1213{1216{
@@ -1230,7 +1233,7 @@ static char *sec2annotation(const char *s) · 16 unmodified lines
1230 strcat(p, "data ");1233 strcat(p, "data ");
1231 else1234 else
1232 strcat(p, " ");1235 strcat(p, " ");
1233 return r; /* we leak her but we do not care */1236 return r;
1234 } else {1237 } else {
1235 return strdup("");1238 return strdup("");
1236 }1239 }
scripts/setlocalversion+4−2
@@ -160,8 +160,10 @@ if test "$CONFIG_LOCALVERSION_AUTO" = "y"; then · 159 unmodified lines
160 # full scm version string160 # full scm version string
161 res="$res$(scm_version)"161 res="$res$(scm_version)"
162else162else
163 # apped a plus sign if the repository is not in a clean tagged163 # append a plus sign if the repository is not in a clean
164 # state and LOCALVERSION= is not specified164 # annotated or signed tagged state (as git describe only
165 # looks at signed or annotated tags - git tag -a/-s) and
166 # LOCALVERSION= is not specified
165 if test "${LOCALVERSION+set}" != "set"; then167 if test "${LOCALVERSION+set}" != "set"; then
166 scm=$(scm_version --short)168 scm=$(scm_version --short)
167 res="$res${scm:++}"169 res="$res${scm:++}"
usr/Makefile+4−2
@@ -18,13 +18,15 @@ suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA) = .lzma · 17 unmodified lines
18# Lzo18# Lzo
19suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo19suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO) = .lzo
20 20
21AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
22
21# Generate builtin.o based on initramfs_data.o23# Generate builtin.o based on initramfs_data.o
22obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o24obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
23 25
24# initramfs_data.o contains the compressed initramfs_data.cpio image.26# initramfs_data.o contains the compressed initramfs_data.cpio image.
25# The image is included using .incbin, a dependency which is not27# The image is included using .incbin, a dependency which is not
26# tracked automatically.28# tracked automatically.
27$(obj)/initramfs_data$(suffix_y).o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE29$(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
28 30
29#####31#####
30# Generate the initramfs cpio archive32# Generate the initramfs cpio archive
usr/initramfs_data.S+14−7
@@ -11,11 +11,7 @@ · 10 unmodified lines
11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
12 ld -m elf_i386 -r -o built-in.o initramfs_data.o12 ld -m elf_i386 -r -o built-in.o initramfs_data.o
13 13
14 initramfs_data.scr looks like this:14 For including the .init.ramfs sections, see include/asm-generic/vmlinux.lds.
15SECTIONS
16{
17 .init.ramfs : { *(.data) }
18}
19 15
20 The above example is for i386 - the parameters vary from architectures.16 The above example is for i386 - the parameters vary from architectures.
21 Eventually look up LDFLAGS_BLOB in an older version of the17 Eventually look up LDFLAGS_BLOB in an older version of the
@@ -25,6 +21,17 @@ SECTIONS · 3 unmodified lines
25 in the ELF header, as required by certain architectures.21 in the ELF header, as required by certain architectures.
26*/22*/
27 23
28.section .init.ramfs,"a"24#include <linux/stringify.h>
29.incbin "usr/initramfs_data.cpio"
30 25
26.section .init.ramfs,"a"
27__irf_start:
28.incbin __stringify(INITRAMFS_IMAGE)
29__irf_end:
30.section .init.ramfs.info,"a"
31.globl __initramfs_size
32__initramfs_size:
33#ifdef CONFIG_32BIT
34 .long __irf_end - __irf_start
35#else
36 .quad __irf_end - __irf_start
37#endif
usr/initramfs_data.bz2.S+0−29
@@ -1,29 +0,0 @@
1/*
2 initramfs_data includes the compressed binary that is the
3 filesystem used for early user space.
4 Note: Older versions of "as" (prior to binutils 2.11.90.0.23
5 released on 2001-07-14) dit not support .incbin.
6 If you are forced to use older binutils than that then the
7 following trick can be applied to create the resulting binary:
8
9
10 ld -m elf_i386 --format binary --oformat elf32-i386 -r \
11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
12 ld -m elf_i386 -r -o built-in.o initramfs_data.o
13
14 initramfs_data.scr looks like this:
15SECTIONS
16{
17 .init.ramfs : { *(.data) }
18}
19
20 The above example is for i386 - the parameters vary from architectures.
21 Eventually look up LDFLAGS_BLOB in an older version of the
22 arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
23
24 Using .incbin has the advantage over ld that the correct flags are set
25 in the ELF header, as required by certain architectures.
26*/
27
28.section .init.ramfs,"a"
29.incbin "usr/initramfs_data.cpio.bz2"
usr/initramfs_data.gz.S+0−29
@@ -1,29 +0,0 @@
1/*
2 initramfs_data includes the compressed binary that is the
3 filesystem used for early user space.
4 Note: Older versions of "as" (prior to binutils 2.11.90.0.23
5 released on 2001-07-14) dit not support .incbin.
6 If you are forced to use older binutils than that then the
7 following trick can be applied to create the resulting binary:
8
9
10 ld -m elf_i386 --format binary --oformat elf32-i386 -r \
11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
12 ld -m elf_i386 -r -o built-in.o initramfs_data.o
13
14 initramfs_data.scr looks like this:
15SECTIONS
16{
17 .init.ramfs : { *(.data) }
18}
19
20 The above example is for i386 - the parameters vary from architectures.
21 Eventually look up LDFLAGS_BLOB in an older version of the
22 arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
23
24 Using .incbin has the advantage over ld that the correct flags are set
25 in the ELF header, as required by certain architectures.
26*/
27
28.section .init.ramfs,"a"
29.incbin "usr/initramfs_data.cpio.gz"
usr/initramfs_data.lzma.S+0−29
@@ -1,29 +0,0 @@
1/*
2 initramfs_data includes the compressed binary that is the
3 filesystem used for early user space.
4 Note: Older versions of "as" (prior to binutils 2.11.90.0.23
5 released on 2001-07-14) dit not support .incbin.
6 If you are forced to use older binutils than that then the
7 following trick can be applied to create the resulting binary:
8
9
10 ld -m elf_i386 --format binary --oformat elf32-i386 -r \
11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
12 ld -m elf_i386 -r -o built-in.o initramfs_data.o
13
14 initramfs_data.scr looks like this:
15SECTIONS
16{
17 .init.ramfs : { *(.data) }
18}
19
20 The above example is for i386 - the parameters vary from architectures.
21 Eventually look up LDFLAGS_BLOB in an older version of the
22 arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
23
24 Using .incbin has the advantage over ld that the correct flags are set
25 in the ELF header, as required by certain architectures.
26*/
27
28.section .init.ramfs,"a"
29.incbin "usr/initramfs_data.cpio.lzma"
usr/initramfs_data.lzo.S+0−29
@@ -1,29 +0,0 @@
1/*
2 initramfs_data includes the compressed binary that is the
3 filesystem used for early user space.
4 Note: Older versions of "as" (prior to binutils 2.11.90.0.23
5 released on 2001-07-14) dit not support .incbin.
6 If you are forced to use older binutils than that then the
7 following trick can be applied to create the resulting binary:
8
9
10 ld -m elf_i386 --format binary --oformat elf32-i386 -r \
11 -T initramfs_data.scr initramfs_data.cpio.gz -o initramfs_data.o
12 ld -m elf_i386 -r -o built-in.o initramfs_data.o
13
14 initramfs_data.scr looks like this:
15SECTIONS
16{
17 .init.ramfs : { *(.data) }
18}
19
20 The above example is for i386 - the parameters vary from architectures.
21 Eventually look up LDFLAGS_BLOB in an older version of the
22 arch/$(ARCH)/Makefile to see the flags used before .incbin was introduced.
23
24 Using .incbin has the advantage over ld that the correct flags are set
25 in the ELF header, as required by certain architectures.
26*/
27
28.section .init.ramfs,"a"
29.incbin "usr/initramfs_data.cpio.lzo"