Add support for Sagem F@ST2404 (#4332)
[openwrt/crisos.git] / target / linux / brcm63xx / image / Makefile
blob64fde3c5cb8aeef2ce47907388fd5b2e4c2e5fd1
1 #
2 # Copyright (C) 2006 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
10 LOADADDR = 0x80010000 # RAM start + 16M
11 KERNEL_ENTRY = $(LOADADDR) # Newer kernels add a jmp to the kernel_entry at the start of the binary
12 RAMSIZE = 0x01000000 # 64MB
14 LOADER_MAKEOPTS= \
15 KDIR=$(KDIR) \
16 LOADADDR=$(LOADADDR) \
17 KERNEL_ENTRY=$(KERNEL_ENTRY) \
18 RAMSIZE=$(RAMSIZE)
20 define trxalign/jffs2-128k
21 -a 0x20000
22 endef
23 define trxalign/jffs2-64k
24 -a 0x10000
25 endef
26 define trxalign/squashfs
27 -a 1024
28 endef
30 define 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)
37 $(call prepare_generic_squashfs,$(BIN_DIR)/openwrt-$(2)-$(1)-cfe.bin)
38 endef
40 define Build/Clean
41 $(MAKE) -C lzma-loader clean
42 endef
44 define Image/Prepare
45 # Standard LZMA kernel
46 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
48 # CFE is a LZMA nazi! It took me hours to find out the parameters!
49 # Also I think lzma has a bug cause it generates different output depending on
50 # if you use stdin / stdout or not. Use files instead of stdio here, cause
51 # otherwise CFE will complain and not boot the image.
52 $(STAGING_DIR_HOST)/bin/lzma e -d22 -fb64 -a1 $(KDIR)/vmlinux $(KDIR)/vmlinux.lzma.tmp
54 # Strip out the length, CFE doesn't like this
55 dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe bs=5 count=1
56 dd if=$(KDIR)/vmlinux.lzma.tmp of=$(KDIR)/vmlinux.lzma.cfe ibs=13 obs=5 skip=1 seek=1 conv=notrunc
57 rm -f $(KDIR)/vmlinux.lzma.tmp
59 # Build the LZMA loader
60 rm -f $(KDIR)/loader.gz
61 $(MAKE) -C lzma-loader \
62 BUILD_DIR="$(KDIR)" \
63 TARGET="$(KDIR)" \
64 clean install
66 echo -ne "\\x00" >> $(KDIR)/loader.gz
67 rm -f $(KDIR)/fs_mark
68 touch $(KDIR)/fs_mark
69 $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
71 endef
73 define Image/Build
74 $(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)
75 $(call Image/Build/CFE,$(1),96345GW2,6345)
76 $(call Image/Build/CFE,$(1),96348GW,6348)
77 # Neufbox4
78 $(call Image/Build/CFE,$(1),96358VW,6358)
79 # Comtrend 536
80 $(call Image/Build/CFE,$(1),96348GW-11,6348)
81 # DG834G
82 $(call Image/Build/CFE,$(1),96348GW-10,6348)
83 # Sagem F@ST2404
84 $(call Image/Build/CFE,$(1),F@ST2404,6348)
85 endef
87 $(eval $(call BuildImage))