Blame view

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

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

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

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

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