source: branches/backfire/target/linux/ar7/image/Makefile @ 21208

Last change on this file since 21208 was 21208, checked in by nico, 7 years ago

[backfire] merge r20834, r20840, r20854 & r20855

File size: 3.6 KB
Line 
1#
2# Copyright (C) 2006-2010 OpenWrt.org
3#
4# This is free software, licensed under the GNU General Public License v2.
5# See /LICENSE for more information.
6#
7include $(TOPDIR)/rules.mk
8include $(INCLUDE_DIR)/image.mk
9
10DROP_SECTIONS:=.reginfo .mdebug .comment .note .pdr .options .MIPS.options
11OBJCOPY_SREC:=$(TARGET_CROSS)objcopy -S -O srec $(addprefix --remove-section=,$(DROP_SECTIONS))
12
13LOADADDR:=0x94600000
14KERNEL_ENTRY:=0x94100000
15RAMSTART:=0x94000000
16RAMSIZE:=0x00100000
17
18EVA_LOADADDR := 0x94100000
19
20LOADER_MAKEOPTS= \
21        KDIR=$(KDIR) \
22        LOADADDR=$(LOADADDR) \
23        KERNEL_ENTRY=$(KERNEL_ENTRY) \
24        RAMSTART=$(RAMSTART) \
25        RAMSIZE=$(RAMSIZE)
26
27CFLAGS := -D__KERNEL__ -Wall -Wstrict-prototypes -Wno-trigraphs -Os \
28        -fno-strict-aliasing -fno-common -fomit-frame-pointer -G 0 -mno-abicalls -fno-pic \
29        -pipe -mlong-calls -fno-common \
30        -mabi=32 -march=mips32 -Wa,-32 -Wa,-march=mips32 -Wa,-mips32 -Wa,--trap \
31        -DLOADADDR=$(LOADADDR)
32
33define Build/Clean
34        $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader $(LOADER_MAKEOPTS) clean
35endef
36
37define Image/Prepare
38        cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
39
40        $(MAKE) -C $(GENERIC_PLATFORM_DIR)/image/lzma-loader \
41                $(LOADER_MAKEOPTS) \
42                clean compile
43        $(OBJCOPY_SREC) $(KDIR)/loader.elf $(KDIR)/loader.srec
44        srec2bin $(KDIR)/loader.srec $(KDIR)/loader.bin
45endef
46
47define align/jffs2-64k
48bs=65536 conv=sync
49endef
50
51define align/jffs2-128k
52bs=131072 conv=sync
53endef
54
55define align/squashfs
56bs=65536 conv=sync
57endef
58
59define Image/Build/CyberTAN
60        (dd if=/dev/zero bs=16 count=1; cat $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin) | \
61                $(STAGING_DIR_HOST)/bin/addpattern -p $(3) -o $(BIN_DIR)/openwrt-$(2)-$(4)-code.bin
62endef
63
64#define Image/Build/sErCoMm
65#       cat sercomm/adam2.bin "$(BIN_DIR)/$(IMG_PREFIX)-$(1).bin" > "$(KDIR)/dgfw.tmp"
66#       dd if=sercomm/$(2) of="$(KDIR)/dgfw.tmp" bs=$$$$((0x3e0000 - 80)) seek=1 conv=notrunc
67#       $(STAGING_DIR_HOST)/bin/dgfirmware -f -w "$(BIN_DIR)/openwrt-$(2)-$(3).img" "$(KDIR)/dgfw.tmp"
68#       rm -f "$(KDIR)/dgfw.tmp"
69#endef
70
71define Image/Build/EVA
72        $(STAGING_DIR_HOST)/bin/lzma2eva $(EVA_LOADADDR) 0x$${shell $(TARGET_CROSS)nm $(KDIR)/linux-*/vmlinux | grep kernel_entry | cut -d' ' -f1} $(KDIR)/vmlinux.lzma $(KDIR)/loader.eva
73        dd if=$(KDIR)/loader.eva $(call align/$(1)) > $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(1).bin
74        cat $(KDIR)/root.$(1) >> $(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(1).bin
75        $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(KERNEL)-$(1).bin)
76endef
77
78define Image/Build
79        dd if=$(KDIR)/loader.bin $(call align/$(1)) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
80        cat $(KDIR)/root.$(1) >> $(BIN_DIR)/$(IMG_PREFIX)-$(1).bin
81        $(call prepare_generic_squashfs,$(BIN_DIR)/$(IMG_PREFIX)-$(1).bin)
82        $(call Image/Build/CyberTAN,$(1),AG1B,AG1B,$(1))
83        $(call Image/Build/CyberTAN,$(1),AG1A,AG1A,$(1))
84        $(call Image/Build/CyberTAN,$(1),WA21,WA21,$(1))
85        $(call Image/Build/CyberTAN,$(1),WA22,WA22,$(1))
86        $(call Image/Build/CyberTAN,$(1),WAG2,WAG2,$(1))
87        $(call Image/Build/CyberTAN,$(1),AG310,AV2A -b -r 1.0,$(1))
88        $(call Image/Build/CyberTAN,$(1),AG241v2,AG3A -b -r 2.0,$(1))
89        $(call Image/Build/CyberTAN,$(1),AG241v2b,AG3B -b -r 2.0,$(1))
90        $(call Image/Build/CyberTAN,$(1),AG241v1,AG3A -b,$(1))
91        $(call Image/Build/CyberTAN,$(1),WAG54GP2v1,ATWL -b,$(1))
92        $(call Image/Build/CyberTAN,$(1),WAG54GP2v2,CTWL -b,$(1))
93        $(call Image/Build/CyberTAN,$(1),WA31,WA31 -b,$(1))
94        $(call Image/Build/CyberTAN,$(1),WA32,WA32 -b,$(1))
95        $(call Image/Build/CyberTAN,$(1),WA7A,WA7A -b,$(1))
96        $(call Image/Build/CyberTAN,$(1),WA7B,WA7B -b,$(1))
97#       $(call Image/Build/sErCoMm,$(1),dg834,$(1))
98#       $(call Image/Build/sErCoMm,$(1),jdr454wb,$(1))
99        $(call Image/Build/EVA,$(1),EVA)
100endef
101
102$(eval $(call BuildImage))
Note: See TracBrowser for help on using the repository browser.