source: trunk/target/linux/brcm63xx/image/Makefile @ 14850

Last change on this file since 14850 was 14850, checked in by florian, 8 years ago

[brcm63xx] add support for AGPF-S0 (Pirelli Alice Gate VoIP 2 Plus Wi-Fi) #4366

  • Property svn:eol-style set to native
File size: 3.8 KB
Line 
1#
2# Copyright (C) 2006 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
10LOADADDR = 0x80010000           # RAM start + 16M
11KERNEL_ENTRY = $(LOADADDR)      # Newer kernels add a jmp to the kernel_entry at the start of the binary
12RAMSIZE = 0x01000000            # 64MB
13
14LOADER_MAKEOPTS= \
15                KDIR=$(KDIR) \
16                LOADADDR=$(LOADADDR) \
17                KERNEL_ENTRY=$(KERNEL_ENTRY) \
18                RAMSIZE=$(RAMSIZE)
19
20define trxalign/jffs2-128k
21-a 0x20000
22endef
23define trxalign/jffs2-64k
24-a 0x10000
25endef
26define trxalign/squashfs
27-a 1024
28endef
29
30define Image/Build/CFE
31        # Generate the tagged image
32        $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
33                -o $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin \
34                -b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR)
35#               -b $(2) -c $(3) -e $(KERNEL_ENTRY) -l $(LOADADDR)
36
37        $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin)
38endef
39
40define Image/Build/CFEAGPF
41        # Generate the tagged image
42        $(STAGING_DIR_HOST)/bin/imagetag -i $(KDIR)/vmlinux.lzma.cfe -f $(KDIR)/root.$(1) \
43                -o $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin \
44                -b $(2) -c $(3) -e $(LOADADDR) -l $(LOADADDR) \
45                -v 8 -m IMAGE -k 131072
46        $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin)
47endef
48
49define Image/Build/RedBoot
50        cp $(KDIR)/vmlinux.elf $(BIN_DIR)/openwrt-$(1)-vmlinux.elf
51        gzip -9 -c $(KDIR)/vmlinux > $(KDIR)/vmlinux.bin.gz
52        $(STAGING_DIR_HOST)/bin/lzma e $(KDIR)/vmlinux $(KDIR)/vmlinux.bin.l7
53        dd if=$(KDIR)/vmlinux.bin.l7 of=$(BIN_DIR)/openwrt-$(1)-vmlinux.lzma bs=65536 conv=sync
54        dd if=$(KDIR)/vmlinux.bin.gz of=$(BIN_DIR)/openwrt-$(1)-vmlinux.gz bs=65536 conv=sync
55endef
56
57define Image/Build/CFEOLD
58        $(TOPDIR)/scripts/brcmImage.pl -t -p    \
59                -b $(2) -c $(3)                 \
60                -k $(KDIR)/vmlinux.lzma.cfe     \
61                -r $(KDIR)/root.$(1)            \
62                -o $(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin
63endef
64
65define Build/Clean
66        $(MAKE) -C lzma-loader clean
67endef
68
69define Image/Prepare
70        # Standard LZMA kernel
71        cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
72
73        # CFE is a LZMA nazi! It took me hours to find out the parameters!
74        # Also I think lzma has a bug cause it generates different output depending on
75        # if you use stdin / stdout or not. Use files instead of stdio here, cause
76        # otherwise CFE will complain and not boot the image.
77        $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma.tmp
78
79        # Strip out the length, CFE doesn't like this
80        dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe bs=5 count=1
81        dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
82        rm -f $(KDIR)/vmlinux.lzma.tmp
83
84        # Build the LZMA loader
85        rm -f $(KDIR)/loader.gz
86        $(MAKE) -C lzma-loader \
87                BUILD_DIR="$(KDIR)" \
88                TARGET="$(KDIR)" \
89                clean install
90
91        echo -ne "\\x00" >> $(KDIR)/loader.gz
92        rm -f $(KDIR)/fs_mark
93        touch $(KDIR)/fs_mark
94        $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
95endef
96
97define Image/Build
98        $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
99        dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-root.$(1) bs=128k conv=sync
100        $(call Image/Build/CFE,$(1),96345GW2,6345)
101        $(call Image/Build/CFE,$(1),96348GW,6348)
102        # Neufbox4
103        $(call Image/Build/CFE,$(1),96358VW,6358)
104        # Comtrend 536
105        $(call Image/Build/CFE,$(1),96348GW-11,6348)
106        # Davolink DV201AMR
107        $(call Image/Build/CFEOLD,$(1),DV201AMR,6348)
108        # USR 9108
109        $(call Image/Build/CFE,$(1),96348GW-A,6348)
110        # DG834GT
111        $(call Image/Build/CFE,$(1),96348GW-10,6348)
112        # Sagem F@ST2404
113        $(call Image/Build/CFE,$(1),F@ST2404,6348)
114        # Inventel Livebox
115        $(call Image/Build/RedBoot,livebox)
116        # Pirelli Alice Gate VoIP 2 Plus Wi-Fi AGPF-S0
117        $(call Image/Build/CFEAGPF,$(1),AGPF-S0,6358)
118endef
119
120$(eval $(call BuildImage))
Note: See TracBrowser for help on using the repository browser.