01a3cab32d3cfb6b7ad90203682761e1a43dfe75
[openwrt/svn-archive/archive.git] / openwrt / target / linux / image / brcm / Makefile
1 include $(TOPDIR)/rules.mk
2
3 KDIR:=$(BUILD_DIR)/linux-$(KERNEL)-$(BOARD)
4
5 lzma-loader-clean:
6 $(MAKE) -C lzma-loader clean
7
8 lzma-loader-prepare:
9 $(MAKE) -C lzma-loader prepare
10
11 lzma-loader-compile: lzma-loader-prepare
12 $(MAKE) -C lzma-loader compile
13
14 ifeq ($(IB),)
15 $(KDIR)/vmlinux.lzma: $(KDIR)/vmlinux
16 cat $^ | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $@ || (rm -f $@ && false)
17
18 $(KDIR)/loader.tmp.gz: compile
19 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/vmlinux.lzma
20 endif
21
22 ifeq ($(FS),jffs2-8MB)
23 TRXALIGN:=-a 0x20000
24 endif
25 ifeq ($(FS),jffs2-4MB)
26 TRXALIGN:=-a 0x10000
27 endif
28
29 $(KDIR)/loader.tmp.gz:
30 cp $(BUILD_DIR)/loader.gz $@
31 echo -ne "\\x00" >> $@
32
33 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx: $(KDIR)/loader.tmp.gz
34 $(STAGING_DIR)/bin/trx -o $@ $(KDIR)/loader.tmp.gz $(KDIR)/vmlinux.lzma $(TRXALIGN) $(KDIR)/root.$(FS)
35
36 ifeq ($(KERNEL),2.6)
37 FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
38
39 ifneq ($(FS),jffs2-4MB)
40 $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
41 dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync
42 cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@
43
44 $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
45 $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g
46
47 install: $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin
48
49 endif
50
51 ifneq ($(FS),jffs2-8MB)
52 $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
53 $(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g
54
55 $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
56 $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g
57
58 $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
59 $(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g
60
61 install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin
62
63 endif
64 endif
65
66 ifeq ($(KERNEL),2.4)
67 FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
68
69 ifeq ($(FS),squashfs)
70 $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
71 cp $< $@
72 echo -ne '\x01' >> $@
73
74 install: $(BIN_DIR)/openwrt-wap54g-$(KERNEL)-$(FSNAME).trx
75 endif
76
77 ifneq ($(FS),jffs2-8MB)
78 $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
79 $(STAGING_DIR)/bin/addpattern -4 -p W54F -v v1.99.5 -i $< -o $@ -g
80
81 $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
82 $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g
83
84 $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
85 $(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.2 -i $< -o $@ -g
86
87 install: $(BIN_DIR)/openwrt-wrt54g-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54g3g-$(KERNEL)-$(FSNAME).bin
88 endif
89
90 ifneq ($(FS),jffs2-4MB)
91 $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
92 dd if=$(BUILD_DIR)/loader.elf of=$@ bs=131072 conv=sync
93 cat $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx >> $@
94
95 $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
96 $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g
97
98 install: $(BIN_DIR)/openwrt-wrt54gs-$(KERNEL)-$(FSNAME).bin $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin
99 endif
100
101 $(BIN_DIR)/openwrt-motorola-$(KERNEL)-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
102 $(STAGING_DIR)/bin/motorola-bin $< $@
103 install: $(BIN_DIR)/openwrt-motorola-$(KERNEL)-$(FS).bin
104 endif
105
106 ifeq ($(IB),)
107 clean: lzma-loader-clean
108 prepare: lzma-loader-prepare
109 compile: lzma-loader-compile
110 else
111 clean:
112 prepare:
113 compile:
114 endif
115 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
116 install-ib:
117 mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
118 cp -fpR $(STAGING_DIR)/bin/addpattern $(STAGING_DIR)/bin/trx $(STAGING_DIR)/bin/motorola-bin $(IB_DIR)/staging_dir_$(ARCH)/bin
119 mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
120 cp -fpR $(BUILD_DIR)/loader.gz $(IB_DIR)/build_$(ARCH)/
121 cp -fpR $(BUILD_DIR)/loader.elf $(IB_DIR)/build_$(ARCH)/
122 cp -fpR $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/