define a shared IMG_PREFIX variable used as a basename for image files, it contains...
[openwrt/openwrt.git] / target / linux / avr32 / image / Makefile
1 #
2 # Copyright (C) 2007-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 ifneq ($(CONFIG_AVR32_UBOOT),)
11 define Build/Clean
12 $(MAKE) -C u-boot clean
13 endef
14
15 define Build/Compile
16 $(MAKE) -C u-boot compile
17 endef
18 endif
19
20 define Image/Prepare
21 cp $(LINUX_DIR)/arch/avr32/boot/images/uImage $(KDIR)/uImage
22 endef
23
24 define Image/BuildKernel
25 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
26
27 $(STAGING_DIR_HOST)/bin/lzma e $(LINUX_DIR)/arch/avr32/boot/images/vmlinux.bin $(KDIR)/vmlinux.lzma
28 mkimage -A avr32 -O linux -T kernel -a 0x10000000 -C lzma \
29 -e 0x90000000 \
30 -n 'OpenWrt Linux-$(LINUX_VERSION)' \
31 -d $(KDIR)/vmlinux.lzma $(KDIR)/uImage-lzma
32
33 cp $(KDIR)/uImage-lzma $(BIN_DIR)/$(IMG_PREFIX)-uImage-lzma
34 endef
35
36 define Image/Build
37 $(call Image/Build/$(1),$(1))
38 endef
39
40 define Image/Build/squashfs
41 $(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
42 ( \
43 dd if=$(KDIR)/uImage bs=1024k conv=sync; \
44 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
45 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
46 endef
47
48 define Image/Build/jffs2-64k
49 ( \
50 dd if=$(KDIR)/uImage bs=1024k conv=sync; \
51 dd if=$(KDIR)/root.$(1) bs=64k conv=sync; \
52 ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
53 endef
54
55 $(eval $(call BuildImage))