Define target specific ramdisk images for testing (Gabor Juhos)
[openwrt/svn-archive/archive.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 LOADER_MAKE = $(MAKE) -C lzma-loader KDIR=$(KDIR)
11
12 define CompileLoader
13 $(LOADER_MAKE) LOADER=$(1) LOADER_DATA="" \
14 LZMA_TEXT_START=$(2) LZMA_STARTUP_ORG=$(3) \
15 compile
16 endef
17
18 define CompileLZMAKernel
19 $(LOADER_MAKE) LOADER=vmlinux-lzma-$(1) LOADER_DATA=$(KDIR)/vmlinux.lzma \
20 LZMA_TEXT_START=$(2) LZMA_STARTUP_ORG=$(3) \
21 compile
22 endef
23
24 define Build/Clean
25 $(LOADER_MAKE) clean
26 endef
27
28 define Image/Prepare
29 cat $(KDIR)/vmlinux | $(STAGING_DIR)/bin/lzma e -si -so -eos -lc1 -lp2 -pb2 > $(KDIR)/vmlinux.lzma
30 ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y)
31 $(call CompileLoader,zyxel,0x80500000,0)
32 else
33 $(call CompileLZMAKernel,zyxel,0x80500000,0)
34 endif
35 endef
36
37 define trxalign/jffs2-128k
38 -a 0x20000
39 endef
40 define trxalign/jffs2-64k
41 -a 0x10000
42 endef
43 define trxalign/squashfs
44 -a 1024
45 endef
46
47 define Image/Build/ZyXEL
48 $(CP) $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-noloader.trx $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(3)-$(2).trx
49 endef
50
51 define Image/Build
52 $(STAGING_DIR)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1)-noloader.trx -f $(KDIR)/vmlinux.lzma $(call trxalign/$(1)) -f $(KDIR)/root.$(1)
53 ifneq ($(1),jffs2-128K)
54 #FIXME: firware images yet
55 endif
56 endef
57
58 define Image/Build/LZMAKernel
59 $(CP) $(KDIR)/loader-vmlinux-lzma-$(2).$(3) \
60 $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-vmlinux-lzma-$(1).$(3)
61 endef
62
63 define Image/Build/Initramfs
64 $(call Image/Build/LZMAKernel,p-334wt,zyxel,bin)
65 $(call Image/Build/LZMAKernel,p-335wt,zyxel,bin)
66 endef
67
68 $(eval $(call BuildImage))
69