c0239ea050c64f0986c9daf4ed5f702c2befd734
[openwrt.git] / target / linux / at91 / 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
8 include $(TOPDIR)/rules.mk
9 include $(INCLUDE_DIR)/image.mk
10
11 define Build/Clean
12         $(MAKE) -C dfboot clean
13         $(MAKE) -C u-boot clean
14 endef
15
16 define Build/Compile
17         $(MAKE) -C dfboot compile
18         $(MAKE) -C u-boot compile
19         $(KDIR)/u-boot-1.1.4/tools/ubparams
20         cp params $(KDIR)
21 endef
22
23 define Image/Prepare
24   cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
25         cp $(KDIR)/dfboot/dfboot.bin $(KDIR)/dfboot.bin
26         cp $(KDIR)/dfboot/dfbptest.bin $(KDIR)/dfbptest.bin
27         cp $(KDIR)/u-boot-1.1.4/u-boot.bin $(KDIR)/u-boot.bin
28         dd if=$(KDIR)/u-boot.bin of=$(KDIR)/u-boot.block bs=100k count=1 conv=sync
29         cat $(KDIR)/u-boot.block $(KDIR)/params > $(KDIR)/u-boot.full
30 endef
31
32 define Image/BuildKernel
33         cp $(KDIR)/uImage $(BIN_DIR)/openwrt-$(BOARD)-uImage
34 endef
35
36 define Image/Build
37         dd if=$(KDIR)/uImage of=$(KDIR)/uImage.block bs=8448 conv=sync
38         dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.block bs=8448 conv=sync
39         cat $(KDIR)/uImage.block $(KDIR)/root.block > $(KDIR)/knlroot.bin
40         $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/openwrt-$(BOARD).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
41         cp $(KDIR)/dfbptest.bin $(BIN_DIR)
42         $(call Image/Build/$(1),$(1))
43 endef
44
45 $(eval $(call BuildImage))