1 #############################################################
3 # linksys and openwrt tools
5 #############################################################
7 LINKSYS_TGZ_SITE
=http
://openwrt.openbsd-geek.de
8 LINKSYS_KERNEL_INCLUDE
=$(BUILD_DIR
)/linksys-kernel
10 # shared library stuff extracted from linksys firmware GPL sourcetree
11 # WRT54GS_3_37_2_1109_US
12 LINKSYS_SHARED_TGZ
=linksys-shared.
tar.gz
13 LINKSYS_SHARED_DIR
=$(BUILD_DIR
)/linksys-shared
14 LINKSYS_SHARED_TARGET_BINARY
:=usr
/lib
/libshared.so
16 $(DL_DIR
)/$(LINKSYS_SHARED_TGZ
):
17 $(WGET
) -P
$(DL_DIR
) $(LINKSYS_TGZ_SITE
)/$(LINKSYS_SHARED_TGZ
)
19 $(LINKSYS_SHARED_DIR
)/.source
: $(DL_DIR
)/$(LINKSYS_SHARED_TGZ
)
20 zcat
$(DL_DIR
)/$(LINKSYS_SHARED_TGZ
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
21 touch
$(LINKSYS_SHARED_DIR
)/.source
23 $(TARGET_DIR
)/$(LINKSYS_SHARED_TARGET_BINARY
): $(LINKSYS_SHARED_DIR
)/.source
24 $(SED
) 's/#include.*/#include <cy_conf.h>/g;' $(LINKSYS_SHARED_DIR
)/utils.h
25 $(MAKE
) -C
$(LINKSYS_SHARED_DIR
) -f Makefile-openwrt \
26 INSTALLDIR
=$(TARGET_DIR
) \
27 CC
=$(TARGET_CC
) LD
=$(TARGET_CROSS
)ld STRIP
="$(STRIP)" \
28 CFLAGS
="$(TARGET_CFLAGS) -I$(LINKSYS_KERNEL_INCLUDE)/include \
29 -I$(LINKSYS_KERNEL_INCLUDE) -Wall -I." \
32 linksys-shared
: $(TARGET_DIR
)/$(LINKSYS_SHARED_TARGET_BINARY
)
35 -$(MAKE
) -C
$(LINKSYS_SHARED_DIR
) clean
38 # nvram tool extracted from linksys firmware GPL sourcetree
39 # WRT54GS_3_37_2_1109_US
40 LINKSYS_NVRAM_TGZ
=linksys-nvram.
tar.gz
41 LINKSYS_NVRAM_DIR
=$(BUILD_DIR
)/linksys-nvram
42 LINKSYS_NVRAM_TARGET_BINARY
:=usr
/sbin
/nvram
44 $(DL_DIR
)/$(LINKSYS_NVRAM_TGZ
):
45 $(WGET
) -P
$(DL_DIR
) $(LINKSYS_TGZ_SITE
)/$(LINKSYS_NVRAM_TGZ
)
47 $(LINKSYS_NVRAM_DIR
)/.source
: $(DL_DIR
)/$(LINKSYS_NVRAM_TGZ
)
48 zcat
$(DL_DIR
)/$(LINKSYS_NVRAM_TGZ
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
49 touch
$(LINKSYS_NVRAM_DIR
)/.source
51 $(TARGET_DIR
)/$(LINKSYS_NVRAM_TARGET_BINARY
): $(LINKSYS_NVRAM_DIR
)/.source
52 $(MAKE
) -C
$(LINKSYS_NVRAM_DIR
) INSTALLDIR
=$(TARGET_DIR
) \
53 CC
=$(TARGET_CC
) LD
=$(TARGET_CROSS
)ld STRIP
="$(STRIP)" \
54 CFLAGS
="$(TARGET_CFLAGS) -I. -I$(LINKSYS_KERNEL_INCLUDE)/include \
55 -I$(LINKSYS_KERNEL_INCLUDE) -I$(LINKSYS_SHARED_DIR) -Wall" install
57 linksys-nvram
: $(TARGET_DIR
)/$(LINKSYS_NVRAM_TARGET_BINARY
)
60 -$(MAKE
) -C
$(LINKSYS_NVRAM_BUILD_DIR
) clean
62 # wlconf tool extracted from linksys firmware GPL sourcetree
63 # WRT54GS_3_37_2_1109_US
64 LINKSYS_WLCONF_TGZ
=linksys-wlconf.
tar.gz
65 LINKSYS_WLCONF_DIR
=$(BUILD_DIR
)/linksys-wlconf
66 LINKSYS_WLCONF_TARGET_BINARY
:=usr
/sbin
/wlconf
68 $(DL_DIR
)/$(LINKSYS_WLCONF_TGZ
):
69 $(WGET
) -P
$(DL_DIR
) $(LINKSYS_TGZ_SITE
)/$(LINKSYS_WLCONF_TGZ
)
71 $(LINKSYS_WLCONF_DIR
)/.source
: $(DL_DIR
)/$(LINKSYS_WLCONF_TGZ
)
72 zcat
$(DL_DIR
)/$(LINKSYS_WLCONF_TGZ
) |
tar -C
$(BUILD_DIR
) $(TAR_OPTIONS
) -
73 touch
$(LINKSYS_WLCONF_DIR
)/.source
75 $(TARGET_DIR
)/$(LINKSYS_WLCONF_TARGET_BINARY
): $(LINKSYS_WLCONF_DIR
)/.source
76 $(MAKE
) -C
$(LINKSYS_WLCONF_DIR
) INSTALLDIR
=$(TARGET_DIR
) \
77 CC
=$(TARGET_CC
) LD
=$(TARGET_CROSS
)ld STRIP
="$(STRIP)" \
78 CFLAGS
="$(TARGET_CFLAGS) -I. -I$(LINKSYS_KERNEL_INCLUDE)/include \
79 -I$(LINKSYS_KERNEL_INCLUDE) \
80 -I$(LINKSYS_SHARED_DIR) \
81 -I$(LINKSYS_NVRAM_DIR) \
82 -Wall -DOPENWRT_WLCONF" \
83 LDFLAGS
="-lnvram -lshared -L$(BUILD_DIR)/linksys-shared -L$(BUILD_DIR)/linksys-nvram" \
86 linksys-wlconf
: $(TARGET_DIR
)/$(LINKSYS_WLCONF_TARGET_BINARY
)
89 -$(MAKE
) -C
$(LINKSYS_WLCONF_BUILD_DIR
) clean
93 OPENWRT_MTD_SOURCE
=package
/openwrt
/mtd.c
94 OPENWRT_MTD_TARGET_BINARY
:=sbin
/mtd
96 $(TARGET_DIR
)/$(OPENWRT_MTD_TARGET_BINARY
):
97 $(TARGET_CC
) -o
$(TARGET_DIR
)/$(OPENWRT_MTD_TARGET_BINARY
) $(OPENWRT_MTD_SOURCE
)
99 openwrt-mtd
: $(TARGET_DIR
)/$(OPENWRT_MTD_TARGET_BINARY
)
102 OPENWRT_TRX_SOURCE
=package
/openwrt
/trx.c
103 OPENWRT_TRX_TARGET
=$(STAGING_DIR
)/bin
/trx
105 $(OPENWRT_TRX_TARGET
):
106 $(CC
) -o
$(OPENWRT_TRX_TARGET
) $(OPENWRT_TRX_SOURCE
)
108 openwrt-trx
: $(OPENWRT_TRX_TARGET
)
111 OPENWRT_ADDPATTERN_SOURCE
=package
/openwrt
/addpattern.c
112 OPENWRT_ADDPATTERN_TARGET
=$(STAGING_DIR
)/bin
/addpattern
114 $(OPENWRT_ADDPATTERN_TARGET
):
115 $(CC
) -o
$(OPENWRT_ADDPATTERN_TARGET
) $(OPENWRT_ADDPATTERN_SOURCE
)
117 openwrt-addpattern
: $(OPENWRT_ADDPATTERN_TARGET
)
119 openwrt
: linksys-shared linksys-nvram linksys-wlconf openwrt-mtd openwrt-trx openwrt-addpattern