2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 include $(INCLUDE_DIR
)/prereq.mk
9 include $(INCLUDE_DIR
)/kernel.mk
10 KDIR
:=$(BUILD_DIR
)/linux-
$(KERNEL
)-$(BOARD
)
12 ifneq ($(CONFIG_BIG_ENDIAN
),y
)
13 JFFS2OPTS
:= --pad
--little-endian
--squash
16 JFFS2OPTS
:= --pad
--big-endian
--squash
20 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS
),y
)
21 ifeq ($(CONFIG_TARGET_ROOTFS_JFFS2
),y
)
22 define Image
/mkfs
/jffs2
23 rm -rf
$(BUILD_DIR
)/root
/jffs
25 $(STAGING_DIR
)/bin
/mkfs.jffs2
$(JFFS2OPTS
) -e
0x10000 -o
$(KDIR
)/root.jffs2-64k
-d
$(BUILD_DIR
)/root
26 $(STAGING_DIR
)/bin
/mkfs.jffs2
$(JFFS2OPTS
) -e
0x20000 -o
$(KDIR
)/root.jffs2-128k
-d
$(BUILD_DIR
)/root
28 # add End-of-Filesystem markers
29 echo
-ne
'\xde\xad\xc0\xde' >> $(KDIR
)/root.jffs2-64k
30 echo
-ne
'\xde\xad\xc0\xde' >> $(KDIR
)/root.jffs2-128k
32 $(call Image
/Build
,jffs2-64k
)
33 $(call Image
/Build
,jffs2-128k
)
37 ifeq ($(CONFIG_TARGET_ROOTFS_SQUASHFS
),y
)
38 define Image
/mkfs
/squashfs
39 @mkdir
-p
$(BUILD_DIR
)/root
/jffs
40 $(STAGING_DIR
)/bin
/mksquashfs-lzma
$(BUILD_DIR
)/root
$(KDIR
)/root.squashfs
-nopad
-noappend
-root-owned
$(SQUASHFS_OPTS
)
41 $(call Image
/Build
,squashfs
)
45 ifeq ($(CONFIG_TARGET_ROOTFS_TGZ
),y
)
47 tar -zcf
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(KERNEL
)-rootfs.tgz
--owner
=root
--group
=root
-C
$(BUILD_DIR
)/root
/ .
55 ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS
),y
)
56 E2SIZE
=$(shell echo
$$(($(CONFIG_TARGET_ROOTFS_FSPART
)*1024)))
58 define Image
/mkfs
/ext2
59 $(STAGING_DIR
)/bin
/genext2fs
-q
-b
$(E2SIZE
) -I
1500 -d
$(BUILD_DIR
)/root
/ $(KDIR
)/root.ext2
60 $(call Image
/Build
,ext2
)
65 define Image
/mkfs
/prepare
/default
66 find
$(BUILD_DIR
)/root
-type f
-not
-perm
+0100 -not
-name
'ssh_host*' | xargs chmod
0644
67 find
$(BUILD_DIR
)/root
-type f
-perm
+0100 | xargs chmod
0755
68 find
$(BUILD_DIR
)/root
-type d | xargs chmod
0755
69 mkdir
-p
$(BUILD_DIR
)/root
/tmp
70 chmod
0777 $(BUILD_DIR
)/root
/tmp
73 define Image
/mkfs
/prepare
74 $(call Image
/mkfs
/prepare
/default
)
83 $(call Image
/mkfs
/prepare
)
84 $(call Image
/BuildKernel
)
85 $(call Image
/mkfs
/jffs2
)
86 $(call Image
/mkfs
/squashfs
)
87 $(call Image
/mkfs
/tgz
)
88 $(call Image
/mkfs
/ext2
)
100 compile
: compile-targets
101 install: compile install-targets