fix unnecessary kernel package recompile
[openwrt.git] / include / image.mk
1 #
2 # Copyright (C) 2006 OpenWrt.org
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
8
9 ifneq ($(CONFIG_BIG_ENDIAN),y)
10 JFFS2OPTS := --pad --little-endian --squash
11 SQUASHFS_OPTS := -le
12 else
13 JFFS2OPTS := --pad --big-endian --squash
14 SQUASHFS_OPTS := -be
15 endif
16
17 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
18 ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
19 define Image/mkfs/jffs2
20 rm -rf $(BUILD_DIR)/root/jffs
21
22 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $(KDIR)/root.jffs2-64k -d $(BUILD_DIR)/root
23 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $(KDIR)/root.jffs2-128k -d $(BUILD_DIR)/root
24
25 # add End-of-Filesystem markers
26 echo -ne '\xde\xad\xc0\xde' >> $(KDIR)/root.jffs2-64k
27 echo -ne '\xde\xad\xc0\xde' >> $(KDIR)/root.jffs2-128k
28
29 $(call Image/Build,jffs2-64k)
30 $(call Image/Build,jffs2-128k)
31 endef
32 endif
33
34 ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y)
35 define Image/mkfs/squashfs
36 @mkdir -p $(BUILD_DIR)/root/jffs
37 $(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS)
38 $(call Image/Build,squashfs)
39 endef
40 endif
41
42 ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y)
43 define Image/mkfs/tgz
44 tar -zcf $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-rootfs.tgz --owner=root --group=root -C $(BUILD_DIR)/root/ .
45 endef
46 endif
47
48
49 endif
50
51
52 ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS),y)
53 E2SIZE=$(shell echo $$(($(CONFIG_TARGET_ROOTFS_SIZE)*1024)))
54
55 define Image/mkfs/ext2
56 $(STAGING_DIR)/bin/genext2fs -q -b $(E2SIZE) -I 1500 -d $(BUILD_DIR)/root/ $(KDIR)/root.ext2
57 $(call Image/Build,ext2)
58 endef
59 endif
60
61
62 define Image/mkfs/prepare/default
63 find $(BUILD_DIR)/root -type f -not -perm +0100 -not -name 'ssh_host*' | xargs chmod 0644
64 find $(BUILD_DIR)/root -type f -perm +0100 | xargs chmod 0755
65 find $(BUILD_DIR)/root -type d | xargs chmod 0755
66 mkdir -p $(BUILD_DIR)/root/tmp
67 chmod 0777 $(BUILD_DIR)/root/tmp
68 endef
69
70 define Image/mkfs/prepare
71 $(call Image/mkfs/prepare/default)
72 endef
73
74 define BuildImage
75 compile:
76 $(call Build/Compile)
77
78 install:
79 $(call Image/Prepare)
80 $(call Image/mkfs/prepare)
81 $(call Image/BuildKernel)
82 $(call Image/mkfs/jffs2)
83 $(call Image/mkfs/squashfs)
84 $(call Image/mkfs/tgz)
85 $(call Image/mkfs/ext2)
86
87 clean:
88 $(call Build/Clean)
89 endef
90
91 compile-targets:
92 install-targets:
93 clean-targets:
94
95 download:
96 prepare:
97 compile: compile-targets
98 install: compile install-targets
99 clean: clean-targets
This page took 0.046626 seconds and 5 git commands to generate.