build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail...
[openwrt/staging/chunkeey.git] / target / linux / brcm63xx-2.6 / image / Makefile
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 #
7 include $(TOPDIR)/rules.mk
8 include $(INCLUDE_DIR)/image.mk
9
10 LOADADDR = 0x8108c8f4 # RAM start + 16M
11 KERNEL_ENTRY = 0x80100000 # Default kernel entry in arch/mips/Makefile
12 RAMSIZE = 0x01000000 # 64MB
13
14 LOADER_MAKEOPTS= \
15 KDIR=$(KDIR) \
16 LOADADDR=$(LOADADDR) \
17 KERNEL_ENTRY=$(KERNEL_ENTRY) \
18 RAMSIZE=$(RAMSIZE)
19
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
29
30 define Build/Clean
31 $(MAKE) -C lzma-loader clean
32 endef
33
34 define Image/Prepare
35 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
36 rm -f $(KDIR)/loader.gz
37 $(MAKE) -C lzma-loader \
38 BUILD_DIR="$(KDIR)" \
39 TARGET="$(KDIR)" \
40 clean install
41 echo -ne "\\x00" >> $(KDIR)/loader.gz
42 endef
43
44 define Image/Build
45 $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).trx -f $(KDIR)/loader.gz -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
46 endef
47
48 $(eval $(call BuildImage))