1 include $(TOPDIR
)/rules.mk
3 # Default target skeleton stuff, may be overridden
4 TARGET_SKEL_DIR
=default
/target_skeleton
9 $(BIN_DIR
)/openwrt-wrt54g-
$(1).bin
: $(BIN_DIR
)/openwrt-generic-
$(patsubst jffs2
,jffs2-4MB
,$(1)).trx
10 PATH
=$(TARGET_PATH
) addpattern
-2 -i
$$< -o
$$@
-g
11 $(SED
) "1s,^W54S,W54G," $$@
13 $(BIN_DIR
)/openwrt-wrt54gs-
$(1).bin
: $(BIN_DIR
)/openwrt-generic-
$(patsubst jffs2
,jffs2-8MB
,$(1)).trx
14 PATH
=$(TARGET_PATH
) addpattern
-2 -i
$$< -o
$$@
-g
16 ifeq ($(BR2_TARGET_WRT54G
),y
)
17 IMAGE_TARGETS
+= $(BIN_DIR
)/openwrt-wrt54g-
$(1).bin
19 ifeq ($(BR2_TARGET_WRT54GS
),y
)
20 IMAGE_TARGETS
+= $(BIN_DIR
)/openwrt-wrt54gs-
$(1).bin
24 $(BIN_DIR
)/openwrt-motorola-
$(1).bin
: $(BIN_DIR
)/openwrt-generic-
$(patsubst jffs2
,jffs2-8MB
,$(1)).trx
25 PATH
=$(TARGET_PATH
) motorola-bin
$$< $$@
27 ifeq ($(BR2_TARGET_MOTOROLA
),y
)
28 IMAGE_TARGETS
+= $(BIN_DIR
)/openwrt-motorola-
$(1).bin
32 # Enable loader and prepare kernel
33 ifeq ($(strip $(BR2_PACKAGE_LOADER
)),y
)
34 export LINUX_LOADER
=$(BUILD_DIR
)/lzmaldr
35 export LINUX_IMAGE
=$(BUILD_DIR
)/piggy.lzma
37 export LINUX_IMAGE
=$(BUILD_DIR
)/piggy.gz
40 $(BUILD_DIR
)/piggy.lzma
: $(LINUX_KERNEL
)
41 cat
$^ |
$(BUILD_DIR
)/lzma
/lzma e
-si
-so
-eos
> $@ ||
(rm -f
$@
&& false
)
43 $(BUILD_DIR
)/piggy.gz
: $(LINUX_KERNEL
)
44 cat
$^ | gzip
-c9
$^
> $@ ||
(rm -f
$@
&& false
)
49 ifeq ($(strip $(BR2_TARGET_ROOTFS_JFFS2
)),y
)
53 ifeq ($(strip $(BR2_TARGET_ROOTFS_SQUASHFS_LZMA
)),y
)
54 TARGET_DIRS
+= squashfs-lzma
57 $(foreach fs
,$(TARGET_FS
),$(eval
$(call IMAGE_template
,$(fs
))))
59 INSTALL_TARGET_DIRS
:=$(patsubst %,%-install,$(TARGET_DIRS
))
60 $(INSTALL_TARGET_DIRS
): image_clean
$(TARGET_DIR
)/etc
/sysconf
$(BIN_DIR
)
62 prepare
: $(patsubst %,%-prepare
,$(TARGET_DIRS
))
63 mkdir
-p
$(TARGET_DIR
)
64 if
[ -f
"$(TARGET_SKELETON)" ] ; then \
65 zcat
$(TARGET_SKELETON
) |
tar -C
$(BUILD_DIR
) -xf
-; \
67 if
[ -d
"$(TARGET_SKEL_DIR)" ] ; then \
68 cp
-a
$(TARGET_SKEL_DIR
)/* $(TARGET_DIR
)/; \
70 mkdir
-p
$(TARGET_DIR
)/jffs
71 mkdir
-p
$(TARGET_DIR
)/dev
72 mkdir
-p
$(TARGET_DIR
)/proc
73 mkdir
-p
$(TARGET_DIR
)/tmp
74 mkdir
-p
$(TARGET_DIR
)/lib
75 mkdir
-p
$(TARGET_DIR
)/usr
/lib
76 mkdir
-p
$(TARGET_DIR
)/usr
/bin
77 ln
-sf
/tmp
/resolv.conf
$(TARGET_DIR
)/etc
/resolv.conf
78 rm -rf
$(TARGET_DIR
)/var
79 ln
-sf
/tmp
$(TARGET_DIR
)/var
80 -find
$(TARGET_DIR
) -type d
-name CVS | xargs
rm -rf
81 -find
$(TARGET_DIR
) -type d
-name .svn | xargs
rm -rf
86 compile
: $(patsubst %,%-compile
,$(TARGET_DIRS
))
87 install: utils-install lzma-install
$(LINUX_IMAGE
) $(patsubst %,%-install,$(TARGET_DIRS
)) $(IMAGE_TARGETS
)
88 clean: $(patsubst %,%-clean,$(TARGET_DIRS
)) image_clean
91 rm -f
$(BIN_DIR
)/openwrt-
*
93 $(TARGET_DIR
)/etc
/sysconf
:
94 mkdir
-p
$(TARGET_DIR
)/etc
95 -grep \^BR2_SYSCONF
$(TOPDIR
)/.config
> $(TARGET_DIR
)/etc
/sysconf
98 $(MAKE
) -C
$(patsubst %-clean,%,$@
) clean
100 $(MAKE
) -C
$(patsubst %-prepare
,%,$@
) prepare
102 $(MAKE
) -C
$(patsubst %-compile
,%,$@
) compile
104 $(MAKE
) -C
$(patsubst %-install,%,$@
) install