brcm63xx image generation cleanups (#3169)
[openwrt-10.03/.git] / target / linux / brcm63xx / 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         rm -f $(KDIR)/fs_mark
43         touch $(KDIR)/fs_mark
44         $(call prepare_generic_squashfs,$(KDIR)/fs_mark)
45 endef
46
47 define Image/Build
48 ifneq($(1),ext2)
49         $(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)
50 endif
51 endef
52
53 $(eval $(call BuildImage))