ixp4xx/image: Initial support for fsg3 webupgrade images
[openwrt.git] / target / linux / ixp4xx / 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 define Image/Build/Linksys
11         BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
12                 -L $(BIN_DIR)/apex-$(2)-armeb.bin \
13                 -k $(BIN_DIR)/openwrt-$(2)-zImage \
14                 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(1).img \
15                 -p -o $(BIN_DIR)/openwrt-$(2)-$(1).bin
16         BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
17                 -F -L $(BIN_DIR)/apex-$(2)-16mb-armeb.bin \
18                 -k $(BIN_DIR)/openwrt-$(2)-zImage \
19                 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(1).img \
20                 -p -o $(BIN_DIR)/openwrt-$(2)-$(1)-16mb.bin
21 endef
22
23 define Image/Build/Freecom
24         $(INSTALL_DIR) $(TARGET_DIR)/boot
25         # TODO: Add special CMDLINE shim for webupgrade image here
26         $(CP) $(BIN_DIR)/openwrt-$(2)-zImage $(TARGET_DIR)/zImage
27         rm -rf $(TARGET_DIR)/{var,jffs,rom}
28         $(INSTALL_DIR) $(TARGET_DIR)/var
29         $(TAR) cfj $(BIN_DIR)/openwrt-$(2)-$(1).img --owner=root --group=root -C $(TARGET_DIR)/ .
30         $(STAGING_DIR_HOST)/bin/encode_crc $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img
31 endef
32
33 define Build/Compile
34         mkdir -p $(BIN_DIR)
35         $(MAKE) -C apex \
36                 BUILD_DIR="$(KDIR)" \
37                 TARGET="$(BIN_DIR)" \
38                 compile 
39 endef
40
41 define Build/Clean
42         $(MAKE) -C apex clean
43 endef
44
45 define Image/Prepare
46         cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
47 endef
48
49 define Image/BuildKernel
50         cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-zImage
51         BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh
52 endef
53
54 define Image/Build
55         $(call Image/Build/$(1),$(1))
56 endef
57
58 define Image/Build/jffs2-64k
59         dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=65536 conv=sync
60 endef
61
62 define Image/Build/jffs2-128k
63         dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync
64         $(call Image/Build/Linksys,$(1))
65         $(call Image/Build/Freecom,$(1),fsg3,$(1))
66 endef
67
68 define Image/Build/squashfs
69         $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
70         dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync
71         $(call Image/Build/Linksys,$(1),nslu2,$(1))
72         $(call Image/Build/Freecom,$(1),fsg3,$(1))
73 endef
74
75 $(eval $(call BuildImage))