Blame view

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

a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
8
  # Bzip2
9ba4bcb64   P J P   initramfs: read C...
9
  suffix_$(CONFIG_RD_BZIP2)  = .bz2
a26ee60f9   Alain Knaff   bzip2/lzma: fix b...
10

ab76f3d77   Alain Knaff   bzip2/lzma: make ...
11
  # Lzma
9ba4bcb64   P J P   initramfs: read C...
12
  suffix_$(CONFIG_RD_LZMA)   = .lzma
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
13

3ebe12439   Lasse Collin   decompressors: ad...
14
  # XZ
9ba4bcb64   P J P   initramfs: read C...
15
  suffix_$(CONFIG_RD_XZ)     = .xz
3ebe12439   Lasse Collin   decompressors: ad...
16

2a2a400f6   Albin Tonnerre   initramfs: add su...
17
  # Lzo
9ba4bcb64   P J P   initramfs: read C...
18
19
20
21
22
23
24
  suffix_$(CONFIG_RD_LZO)    = .lzo
  
  # Lz4
  suffix_$(CONFIG_RD_LZ4)    = .lz4
  
  # Gzip
  suffix_$(CONFIG_RD_GZIP)   = .gz
2a2a400f6   Albin Tonnerre   initramfs: add su...
25

6ae64e428   Hendrik Brueckner   initramfs: genera...
26
  AFLAGS_initramfs_data.o += -DINITRAMFS_IMAGE="usr/initramfs_data.cpio$(suffix_y)"
d39a206bc   Sam Ravnborg   kbuild: rebuild i...
27
  # Generate builtin.o based on initramfs_data.o
6ae64e428   Hendrik Brueckner   initramfs: genera...
28
  obj-$(CONFIG_BLK_DEV_INITRD) := initramfs_data.o
1da177e4c   Linus Torvalds   Linux-2.6.12-rc2
29

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

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

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