31f941fc30ec24ddcba4c01f31879c190e305421
[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 install: $(BIN_DIR)/openwrt-wgt634u-$(KERNEL)-$(FSNAME).bin
45 endif
46 endif
47
48 ifeq ($(KERNEL),2.4)
49 FSNAME:=$(patsubst jffs2-%,jffs2,$(FS))
50
51 ifeq ($(FS),squashfs)
52 $(BIN_DIR)/openwrt-wap54g-$(FSNAME).trx: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
53 cp $< $@
54 echo -ne '\x01' >> $@
55
56 install: $(BIN_DIR)/openwrt-wap54g-$(FSNAME).trx
57 endif
58
59 ifneq ($(FS),jffs2-8MB)
60 $(BIN_DIR)/openwrt-wrt54g-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
61 $(STAGING_DIR)/bin/addpattern -4 -p W54G -v v4.20.6 -i $< -o $@ -g
62
63 $(BIN_DIR)/openwrt-wrt54gs_v4-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
64 $(STAGING_DIR)/bin/addpattern -4 -p W54s -v v1.05.0 -i $< -o $@ -g
65
66 install: $(BIN_DIR)/openwrt-wrt54g-$(FSNAME).bin $(BIN_DIR)/openwrt-wrt54gs_v4-$(FSNAME).bin
67 endif
68
69 ifneq ($(FS),jffs2-4MB)
70 $(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
71 $(STAGING_DIR)/bin/addpattern -4 -p W54S -v v4.70.6 -i $< -o $@ -g
72
73 install: $(BIN_DIR)/openwrt-wrt54gs-$(FSNAME).bin
74 endif
75
76 $(BIN_DIR)/openwrt-motorola-$(FS).bin: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
77 $(STAGING_DIR)/bin/motorola-bin $< $@
78 install: $(BIN_DIR)/openwrt-motorola-$(FS).bin
79 endif
80
81 ifeq ($(IB),)
82 clean: lzma-loader-clean
83 prepare: lzma-loader-prepare
84 compile: lzma-loader-compile
85 else
86 clean:
87 prepare:
88 compile:
89 endif
90 install: $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(FS).trx
91 install-ib:
92 mkdir -p $(IB_DIR)/staging_dir_$(ARCH)/bin
93 cp -fpR $(STAGING_DIR)/bin/addpattern $(STAGING_DIR)/bin/trx $(STAGING_DIR)/bin/motorola-bin $(IB_DIR)/staging_dir_$(ARCH)/bin
94 mkdir -p $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)
95 cp -fpR $(BUILD_DIR)/loader.gz $(IB_DIR)/build_$(ARCH)/
96 cp -fpR $(KDIR)/vmlinux.lzma $(IB_DIR)/build_$(ARCH)/linux-$(KERNEL)-$(BOARD)/