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