Annotation of /trunk/mkinitrd-magellan/klibc/usr/Kbuild
Parent Directory | Revision Log
Revision 532 -
(hide annotations)
(download)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File size: 2649 byte(s)
Sat Sep 1 22:45:15 2007 UTC (16 years, 8 months ago) by niro
File size: 2649 byte(s)
-import if magellan mkinitrd; it is a fork of redhats mkinitrd-5.0.8 with all magellan patches and features; deprecates magellan-src/mkinitrd
1 | niro | 532 | # |
2 | # kbuild file for usr/ - including initramfs image and klibc | ||
3 | # | ||
4 | |||
5 | CONFIG_KLIBC := 1 | ||
6 | |||
7 | include-subdir := include | ||
8 | klibc-subdir := klibc | ||
9 | usr-subdirs := kinit utils dash gzip | ||
10 | subdir- := $(include-subdir) $(klibc-subdir) $(usr-subdirs) | ||
11 | |||
12 | usr-subdirs := $(addprefix _usr_,$(usr-subdirs)) | ||
13 | klibc-subdir := $(addprefix _usr_,$(klibc-subdir)) | ||
14 | |||
15 | # Klibc binaries | ||
16 | ifdef CONFIG_KLIBC | ||
17 | |||
18 | # .initramfs_data.cpio.gz.d is used to identify all files included | ||
19 | # in initramfs and to detect if any files are added/removed. | ||
20 | # Removed files are identified by directory timestamp being updated | ||
21 | # The dependency list is generated by gen_initramfs.sh -l | ||
22 | ifneq ($(wildcard $(obj)/.initramfs_data.cpio.gz.d),) | ||
23 | include $(obj)/.initramfs_data.cpio.gz.d | ||
24 | endif | ||
25 | |||
26 | # build klibc library before the klibc programs | ||
27 | # build klibc programs before cpio.gz | ||
28 | .PHONY: initramfs $(usr-subdirs) $(klibc-subdir) $(include-subdir) | ||
29 | initramfs: $(usr-subdirs) $(klibc-subdir) $(include-subdir) | ||
30 | $(deps_initramfs): $(usr-subdirs) $(klibc-subdir) $(include-subdir) | ||
31 | |||
32 | $(usr-subdirs): $(klibc-subdir) | ||
33 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) | ||
34 | |||
35 | $(klibc-subdir): $(include-subdir) | ||
36 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) | ||
37 | |||
38 | $(include-subdir): | ||
39 | $(Q)$(MAKE) $(klibc)=$(src)/$(patsubst _usr_%,%,$(@)) | ||
40 | endif | ||
41 | |||
42 | |||
43 | # Generate builtin.o based on initramfs_data.o | ||
44 | obj-y := initramfs_data.o | ||
45 | |||
46 | # initramfs_data.o contains the initramfs_data.cpio.gz image. | ||
47 | # The image is included using .incbin, a dependency which is not | ||
48 | # tracked automatically. | ||
49 | $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio.gz FORCE | ||
50 | |||
51 | ##### | ||
52 | # Generate the initramfs cpio archive | ||
53 | |||
54 | hostprogs-y := gen_init_cpio | ||
55 | ginitramfs := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh | ||
56 | ramfs-def := $(srctree)/$(src)/initramfs.default | ||
57 | ramfs-input := $(shell echo $(CONFIG_INITRAMFS_SOURCE)) | ||
58 | ramfs-input := $(if $(ramfs-input), $(ramfs-input), $(ramfs-def)) | ||
59 | |||
60 | ramfs-args := \ | ||
61 | $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \ | ||
62 | $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID)) | ||
63 | |||
64 | quiet_cmd_initfs = GEN $@ | ||
65 | cmd_initfs = $(ginitramfs) -o $@ $(ramfs-args) $(ramfs-input) | ||
66 | |||
67 | targets := initramfs_data.cpio.gz | ||
68 | # We rebuild initramfs_data.cpio.gz if: | ||
69 | # 1) Any included file is newer then initramfs_data.cpio.gz | ||
70 | # 2) There are changes in which files are included (added or deleted) | ||
71 | # 3) If gen_init_cpio are newer than initramfs_data.cpio.gz | ||
72 | # 4) arguments to gen_initramfs.sh changes | ||
73 | $(obj)/initramfs_data.cpio.gz: $(obj)/gen_init_cpio $(deps_initramfs) initramfs | ||
74 | $(Q)$(ginitramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.gz.d | ||
75 | $(call if_changed,initfs) |