Blame view

usr/Makefile 2.1 KB
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
1
2
3
  #
  # kbuild file for usr/ - including initramfs image
  #
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
4

d39a206bc   Sam Ravnborg   kbuild: rebuild i...
5
  klibcdirs:;
48f1f0589   Sam Ravnborg   kbuild: consisten...
6
  PHONY += klibcdirs
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
7

0bc9f9e63   Robert P. J. Day   kbuild: correct i...
8
  # Gzip
ab76f3d77   Alain Knaff   bzip2/lzma: make ...
9
  suffix_$(CONFIG_INITRAMFS_COMPRESSION_GZIP)   = .gz
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
10
11
  
  # Bzip2
ab76f3d77   Alain Knaff   bzip2/lzma: make ...
12
  suffix_$(CONFIG_INITRAMFS_COMPRESSION_BZIP2)  = .bz2
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
13

ab76f3d77   Alain Knaff   bzip2/lzma: make ...
14
15
  # Lzma
  suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZMA)   = .lzma
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
16

d39a206bc   Sam Ravnborg   kbuild: rebuild i...
17
  # Generate builtin.o based on initramfs_data.o
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
18
  obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data$(suffix_y).o
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
19

a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
20
  # initramfs_data.o contains the compressed initramfs_data.cpio image.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
21
22
  # The image is included using .incbin, a dependency which is not
  # tracked automatically.
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
23
  $(obj)/initramfs_data$(suffix_y).o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24

d39a206bc   Sam Ravnborg   kbuild: rebuild i...
25
26
27
28
29
30
  #####
  # Generate the initramfs cpio archive
  
  hostprogs-y := gen_init_cpio
  initramfs   := $(CONFIG_SHELL) $(srctree)/scripts/gen_initramfs_list.sh
  ramfs-input := $(if $(filter-out "",$(CONFIG_INITRAMFS_SOURCE)), \
a26d79ca8   Thomas Chou   [PATCH] initramfs...
31
  			$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
32
33
  ramfs-args  := \
          $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
ff5417107   Nickolay   kbuild: bugfix wi...
34
          $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
35

a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
36
  # .initramfs_data.cpio.d is used to identify all files included
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
37
38
39
  # in initramfs and to detect if any files are added/removed.
  # Removed files are identified by directory timestamp being updated
  # The dependency list is generated by gen_initramfs.sh -l
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
40
41
  ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),)
  	include $(obj)/.initramfs_data.cpio.d
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
42
  endif
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
43
44
  quiet_cmd_initfs = GEN     $@
        cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
45
  targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio
58a2f7d85   Sam Ravnborg   kbuild: do not tr...
46
47
  # do not try to update files included in initramfs
  $(deps_initramfs): ;
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
48
  $(deps_initramfs): klibcdirs
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
49
50
  # We rebuild initramfs_data.cpio if:
  # 1) Any included file is newer then initramfs_data.cpio
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
51
  # 2) There are changes in which files are included (added or deleted)
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
52
  # 3) If gen_init_cpio are newer than initramfs_data.cpio
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
53
  # 4) arguments to gen_initramfs.sh changes
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
54
55
  $(obj)/initramfs_data.cpio$(suffix_y): $(obj)/gen_init_cpio $(deps_initramfs) klibcdirs
  	$(Q)$(initramfs) -l $(ramfs-input) > $(obj)/.initramfs_data.cpio.d
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
56
  	$(call if_changed,initfs)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
57