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