8d05a1b8f1294c0dd5f6e21c1e4ff21f18889c18
[openwrt/svn-archive/archive.git] / target / linux / ixp4xx-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 UCODEFILE:=IPL_ixp400NpeLibrary-2_4.zip
11
12 ifneq ($(CONFIG_IXP4XX_INCLUDE_UCODE),)
13 define Require/npe-ucode
14 [ -f $(DL_DIR)/$(UCODEFILE) ]
15 endef
16 define Build/Compile/npe
17 $(MAKE) -C npe-ucode \
18 BUILD_DIR="$(KDIR)" \
19 TARGET="$(KDIR)" \
20 compile
21 endef
22 define Image/Build/slug
23 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
24 -L $(KDIR)/apex-nslu2-armeb.bin -m $(KDIR)/NPE-B \
25 -k $(BIN_DIR)/openwrt-nslu2-$(KERNEL)-zImage \
26 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img \
27 -p -o $(BIN_DIR)/openwrt-nslu2-$(KERNEL)-$(1).bin
28 endef
29 endif
30
31 define Build/Compile
32 $(MAKE) -C apex \
33 BUILD_DIR="$(KDIR)" \
34 TARGET="$(KDIR)" \
35 compile
36 $(call Build/Compile/npe)
37 endef
38
39 define Build/Clean
40 $(MAKE) -C apex clean
41 $(MAKE) -C npe-ucode clean
42 endef
43
44 define Image/Prepare
45 cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
46 endef
47
48 define Image/BuildKernel
49 cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-zImage
50 # $(shell BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh)
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)-$(KERNEL)-$(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)-$(KERNEL)-$(1).img bs=131072 conv=sync
64 $(call Image/Build/slug,$(1))
65 endef
66
67 define Image/Build/squashfs
68 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
69 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=131072 conv=sync
70 $(call Image/Build/slug,$(1))
71 endef
72
73 $(eval $(call BuildImage))
74
75 $(eval $(call Require,npe-ucode, \
76 You must manually download $(UCODEFILE) from \\\
77 http://www.intel.com/design/network/products/npfamily/ixp400_archives.htm \\\
78 and put it in $(DL_DIR). \\\
79 You will need to agree to the Intel Public License to do so - please do read it! \
80 ))