build system cleanup. move shared include files into $(TOPDIR)/include, move lzma...
[openwrt/svn-archive/archive.git] / openwrt / include / image.mk
1 include $(TOPDIR)/rules.mk
2
3 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
4
5 ifneq ($(CONFIG_BIG_ENDIAN),y)
6 JFFS2OPTS := --pad --little-endian --squash
7 SQUASHFS_OPTS := -le
8 else
9 JFFS2OPTS := --pad --big-endian --squash
10 SQUASHFS_OPTS := -be
11 endif
12
13 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
14 ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2),y)
15 define Image/mkfs/jffs2
16 rm -rf $(BUILD_DIR)/root/jffs
17
18 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x10000 -o $(KDIR)/root.jffs2-64k -d $(BUILD_DIR)/root
19 $(STAGING_DIR)/bin/mkfs.jffs2 $(JFFS2OPTS) -e 0x20000 -o $(KDIR)/root.jffs2-128k -d $(BUILD_DIR)/root
20
21 $(call Image/Build,jffs2-64k)
22 $(call Image/Build,jffs2-128k)
23 endef
24 endif
25
26 ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS),y)
27 define Image/mkfs/squashfs
28 @mkdir -p $(BUILD_DIR)/root/jffs
29 $(STAGING_DIR)/bin/mksquashfs-lzma $(BUILD_DIR)/root $(KDIR)/root.squashfs -nopad -noappend -root-owned $(SQUASHFS_OPTS)
30 $(call Image/Build,squashfs)
31 endef
32 endif
33
34 ifeq ($(CONFIG_TARGET_ROOTFS_TGZ),y)
35 define Image/mkfs/tgz
36 tar -zcf $(BIN_DIR)/openwrt-rootfs.tgz --owner=root --group=root -C $(BUILD_DIR)/root/ .
37 endef
38 endif
39 endif
40
41 define Image/mkfs/prepare/default
42 find $(BUILD_DIR)/root -type f -not -perm +0100 | xargs chmod 0644
43 find $(BUILD_DIR)/root -type f -perm +0100 | xargs chmod 0755
44 find $(BUILD_DIR)/root -type d | xargs chmod 0755
45 mkdir -p $(BUILD_DIR)/root/tmp
46 chmod 0777 $(BUILD_DIR)/root/tmp
47 endef
48
49 define Image/mkfs/prepare
50 $(call Image/mkfs/prepare/default)
51 endef
52
53 define BuildImage
54 compile:
55 $(call Build/Compile)
56
57 install:
58 $(call Image/Prepare)
59 $(call Image/mkfs/prepare)
60 $(call Image/BuildKernel)
61 $(call Image/mkfs/jffs2)
62 $(call Image/mkfs/squashfs)
63 $(call Image/mkfs/tgz)
64
65 clean:
66 $(call Build/Clean)
67 endef
68
69 compile-targets:
70 install-targets:
71 clean-targets:
72
73 source:
74 prepare:
75 compile: compile-targets
76 install: compile install-targets
77 clean: clean-targets