Blame view

usr/Makefile 2.32 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

3ebe12439   Lasse Collin   decompressors: ad...
17
18
  # XZ
  suffix_$(CONFIG_INITRAMFS_COMPRESSION_XZ)     = .xz
2a2a400f6   Albin Tonnerre   initramfs: add su...
19
20
  # Lzo
  suffix_$(CONFIG_INITRAMFS_COMPRESSION_LZO)   = .lzo
6ae64e428   Hendrik Brueckner   initramfs: genera...
21
  AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
22
  # Generate builtin.o based on initramfs_data.o
6ae64e428   Hendrik Brueckner   initramfs: genera...
23
  obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
24

a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
25
  # initramfs_data.o contains the compressed initramfs_data.cpio image.
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
26
27
  # The image is included using .incbin, a dependency which is not
  # tracked automatically.
6ae64e428   Hendrik Brueckner   initramfs: genera...
28
  $(obj)/initramfs_data.o: $(obj)/initramfs_data.cpio$(suffix_y) FORCE
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29

d39a206bc   Sam Ravnborg   kbuild: rebuild i...
30
31
32
33
34
35
  #####
  # 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...
36
  			$(shell echo $(CONFIG_INITRAMFS_SOURCE)),-d)
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
37
38
  ramfs-args  := \
          $(if $(CONFIG_INITRAMFS_ROOT_UID), -u $(CONFIG_INITRAMFS_ROOT_UID)) \
ff5417107   Nickolay   kbuild: bugfix wi...
39
          $(if $(CONFIG_INITRAMFS_ROOT_GID), -g $(CONFIG_INITRAMFS_ROOT_GID))
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
40

a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
41
  # .initramfs_data.cpio.d is used to identify all files included
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
42
43
44
  # 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...
45
46
  ifneq ($(wildcard $(obj)/.initramfs_data.cpio.d),)
  	include $(obj)/.initramfs_data.cpio.d
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
47
  endif
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
48
49
  quiet_cmd_initfs = GEN     $@
        cmd_initfs = $(initramfs) -o $@ $(ramfs-args) $(ramfs-input)
3ebe12439   Lasse Collin   decompressors: ad...
50
  targets := initramfs_data.cpio.gz initramfs_data.cpio.bz2 initramfs_data.cpio.lzma initramfs_data.cpio.xz initramfs_data.cpio.lzo initramfs_data.cpio
58a2f7d85   Sam Ravnborg   kbuild: do not tr...
51
52
  # do not try to update files included in initramfs
  $(deps_initramfs): ;
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
53
  $(deps_initramfs): klibcdirs
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
54
55
  # We rebuild initramfs_data.cpio if:
  # 1) Any included file is newer then initramfs_data.cpio
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
56
  # 2) There are changes in which files are included (added or deleted)
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
57
  # 3) If gen_init_cpio are newer than initramfs_data.cpio
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
58
  # 4) arguments to gen_initramfs.sh changes
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
59
60
  $(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...
61
  	$(call if_changed,initfs)
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
62