ff3e501e47f96caa7e091e0dc51fde2d5777860f
[openwrt/svn-archive/archive.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/slug
11 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
12 -L $(BIN_DIR)/apex-nslu2-armeb.bin \
13 -k $(BIN_DIR)/openwrt-nslu2-zImage \
14 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(1).img \
15 -p -o $(BIN_DIR)/openwrt-nslu2-$(1).bin
16 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
17 -F -L $(BIN_DIR)/apex-nslu2-16mb-armeb.bin \
18 -k $(BIN_DIR)/openwrt-nslu2-zImage \
19 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(1).img \
20 -p -o $(BIN_DIR)/openwrt-nslu2-$(1)-16mb.bin
21 endef
22
23 define Build/Compile
24 mkdir -p $(BIN_DIR)
25 $(MAKE) -C apex \
26 BUILD_DIR="$(KDIR)" \
27 TARGET="$(BIN_DIR)" \
28 compile
29 endef
30
31 define Build/Clean
32 $(MAKE) -C apex clean
33 endef
34
35 define Image/Prepare
36 cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
37 endef
38
39 define Image/BuildKernel
40 cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-zImage
41 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh
42 endef
43
44 define Image/Build
45 $(call Image/Build/$(1),$(1))
46 endef
47
48 define Image/Build/jffs2-64k
49 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=65536 conv=sync
50 endef
51
52 define Image/Build/jffs2-128k
53 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync
54 $(call Image/Build/slug,$(1))
55 endef
56
57 define Image/Build/squashfs
58 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
59 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(1).img bs=131072 conv=sync
60 $(call Image/Build/slug,$(1))
61 endef
62
63 $(eval $(call BuildImage))