build system cleanup/restructuring as described in http://lists.openwrt.org/pipermail...
[openwrt/staging/chunkeey.git] / target / linux / adm5120eb-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 IMGNAME = $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)
11 LOADER_MAKE = $(NO_TRACE_MAKE) -C lzma-loader KDIR=$(KDIR)
12
13 define Image/Build/Loader
14 $(LOADER_MAKE) LOADER=loader-$(1).$(2) LOADER_DATA="" \
15 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
16 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
17 compile loader.$(2)
18 endef
19
20 define Build/Clean
21 $(LOADER_MAKE) clean
22 endef
23
24 define Image/Prepare
25 cat $(KDIR)/vmlinux | $(STAGING_DIR_HOST)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
26 endef
27
28 define trxalign/jffs2-128k
29 -a 0x20000
30 endef
31 define trxalign/jffs2-64k
32 -a 0x10000
33 endef
34 define trxalign/squashfs
35 -a 1024
36 endef
37
38 define Image/Build/TRX
39 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(3) -f $(KDIR)/vmlinux.lzma \
40 $(call trxalign/$(2)) -f $(KDIR)/root.$(2)
41 endef
42
43 define Image/Build/TRXNoloader
44 $(STAGING_DIR_HOST)/bin/trx -o $(1) -f $(KDIR)/vmlinux.lzma \
45 $(call trxalign/$(2)) -f $(KDIR)/root.$(2)
46 endef
47
48 define Image/Build/ZyXEL
49 $(call Image/Build/Loader,loader-$(2),gz,0x80500000,0)
50 $(call Image/Build/TRXNoloader,$(IMGNAME)-$(3)-$(2).trx,$(1))
51 #TODO: firmware generation tool needed
52 endef
53
54 define Image/Build
55 #FIXME: No firmware images yet
56 endef
57
58 define Image/Build/LZMAKernel
59 $(LOADER_MAKE) TARGET_DIR=$(BIN_DIR) \
60 LOADER=openwrt-$(BOARD)-$(KERNEL)-ramfs-lzma-$(1).$(2) \
61 LOADER_DATA=$(KDIR)/vmlinux.lzma \
62 LZMA_TEXT_START=$(3) LZMA_STARTUP_ORG=$(4) \
63 CONFIG_PASS_KARGS=$(5) CONFIG_BOARD=$(6) \
64 compile loader.$(2)
65 endef
66
67 define Image/Build/LZMAKernel/ZyXEL
68 $(call Image/Build/LZMAKernel,$(1),$(2),0x80500000,0,y,$(1))
69 endef
70
71 define Image/Build/Initramfs
72 # this line is here intentionally
73 ifeq ($(CONFIG_DEVEL),y)
74 $(call Image/Build/LZMAKernel/ZyXEL,p-334wt,bin)
75 $(call Image/Build/LZMAKernel/ZyXEL,p-335,bin)
76 endif
77 endef
78
79 $(eval $(call BuildImage))
80