disable a totally braindead optimization in busybox that causes various applets to...
[openwrt/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 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 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/slugimage.pl \
29 -F -L $(KDIR)/apex-nslu2-armeb.bin -m $(KDIR)/NPE-B \
30 -k $(BIN_DIR)/openwrt-nslu2-$(KERNEL)-zImage \
31 -r rootfs:$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img \
32 -p -o $(BIN_DIR)/openwrt-nslu2-$(KERNEL)-$(1)-16mb.bin
33 endef
34 endif
35
36 define Build/Compile
37 $(MAKE) -C apex \
38 BUILD_DIR="$(KDIR)" \
39 TARGET="$(KDIR)" \
40 compile
41 $(call Build/Compile/npe)
42 endef
43
44 define Build/Clean
45 $(MAKE) -C apex clean
46 $(MAKE) -C npe-ucode clean
47 endef
48
49 define Image/Prepare
50 cp $(LINUX_DIR)/arch/arm/boot/zImage $(KDIR)/zImage
51 endef
52
53 define Image/BuildKernel
54 cp $(KDIR)/zImage $(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-zImage
55 # $(shell BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh)
56 BIN_DIR=$(BIN_DIR) $(TOPDIR)/scripts/arm-magic.sh
57 endef
58
59 define Image/Build
60 $(call Image/Build/$(1),$(1))
61 endef
62
63 define Image/Build/jffs2-64k
64 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=65536 conv=sync
65 endef
66
67 define Image/Build/jffs2-128k
68 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=131072 conv=sync
69 $(call Image/Build/slug,$(1))
70 endef
71
72 define Image/Build/squashfs
73 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
74 dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-$(BOARD)-$(KERNEL)-$(1).img bs=131072 conv=sync
75 $(call Image/Build/slug,$(1))
76 endef
77
78 $(eval $(call BuildImage))
79
80 $(eval $(call Require,npe-ucode, \
81 You must manually download $(UCODEFILE) from \\\
82 http://www.intel.com/design/network/products/npfamily/ixp400_archives.htm \\\
83 and put it in $(DL_DIR). \\\
84 You will need to agree to the Intel Public License to do so - please do read it! \
85 ))