define a shared IMG_PREFIX variable used as a basename for image files, it contains...
[openwrt/openwrt.git] / target / linux / at91 / image / Makefile
1 #
2 # Copyright (C) 2006-2010 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 Build/Clean
11 $(MAKE) -C dfboot clean
12 $(MAKE) -C u-boot clean
13 endef
14
15 define Build/Compile
16 $(MAKE) -C dfboot compile
17 $(MAKE) -C u-boot compile
18 $(KDIR)/u-boot-1.1.4/tools/ubparams
19 cp params $(KDIR)
20 endef
21
22 define Image/Prepare
23 cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
24 cp $(KDIR)/dfboot/dfboot.bin $(KDIR)/dfboot.bin
25 cp $(KDIR)/dfboot/dfbptest.bin $(KDIR)/dfbptest.bin
26 cp $(KDIR)/u-boot-1.1.4/u-boot.bin $(KDIR)/u-boot.bin
27 dd if=$(KDIR)/u-boot.bin of=$(KDIR)/u-boot.block bs=100k count=1 conv=sync
28 cat $(KDIR)/u-boot.block $(KDIR)/params > $(KDIR)/u-boot.full
29 endef
30
31 define Image/BuildKernel
32 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
33 endef
34
35 define Image/Build
36 dd if=$(KDIR)/uImage of=$(KDIR)/uImage.block bs=8448 conv=sync
37 dd if=$(KDIR)/root.squashfs of=$(KDIR)/root.block bs=8448 conv=sync
38 cat $(KDIR)/uImage.block $(KDIR)/root.block > $(KDIR)/knlroot.bin
39 $(STAGING_DIR_HOST)/bin/trx -o $(BIN_DIR)/$(IMG_PREFIX).trx -f $(KDIR)/dfboot.bin -f$(KDIR)/u-boot.full -f$(KDIR)/knlroot.bin
40 cp $(KDIR)/dfbptest.bin $(BIN_DIR)
41 $(call Image/Build/$(1),$(1))
42 endef
43
44 $(eval $(call BuildImage))