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
)/kernel.mk
9 KDIR
:=$(BUILD_DIR
)/linux-
$(KERNEL
)-$(BOARD
)
11 ifneq ($(CONFIG_BIG_ENDIAN
),y
)
12 JFFS2OPTS
:= --pad
--little-endian
--squash
15 JFFS2OPTS
:= --pad
--big-endian
--squash
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
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
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
31 $(call Image
/Build
,jffs2-64k
)
32 $(call Image
/Build
,jffs2-128k
)
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
)
44 ifeq ($(CONFIG_TARGET_ROOTFS_TGZ
),y
)
46 tar -zcf
$(BIN_DIR
)/openwrt-
$(BOARD
)-$(KERNEL
)-rootfs.tgz
--owner
=root
--group
=root
-C
$(BUILD_DIR
)/root
/ .
54 ifeq ($(CONFIG_TARGET_ROOTFS_EXT2FS
),y
)
55 E2SIZE
=$(shell echo
$$(($(CONFIG_TARGET_ROOTFS_FSPART
)*1024)))
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
)
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
72 define Image
/mkfs
/prepare
73 $(call Image
/mkfs
/prepare
/default
)
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
)
99 compile
: compile-targets
100 install: compile install-targets