99761c6da56616e0222d5057470a5995e9a7d973
[openwrt/svn-archive/archive.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 KDIR_TMP:=$(KDIR)/tmp
11
12 ifneq ($(CONFIG_AVR32_UBOOT),)
13 define Build/Clean
14 $(MAKE) -C u-boot clean
15 endef
16
17 define Build/Compile
18 $(MAKE) -C u-boot compile
19 endef
20 endif
21
22 define Image/BuildKernel
23 -mkdir -p $(KDIR_TMP)
24 cp $(KDIR)/uImage $(BIN_DIR)/$(IMG_PREFIX)-uImage
25
26 $(STAGING_DIR_HOST)/bin/lzma e $(LINUX_DIR)/arch/avr32/boot/images/vmlinux.bin $(KDIR)/vmlinux.lzma
27 mkimage -A avr32 -O linux -T kernel -a 0x10000000 -C lzma \
28 -e 0x90000000 \
29 -n 'OpenWrt Linux-$(LINUX_VERSION)' \
30 -d $(KDIR)/vmlinux.lzma $(KDIR)/uImage-lzma
31
32 cp $(KDIR)/uImage-lzma $(BIN_DIR)/$(IMG_PREFIX)-uImage-lzma
33 endef
34
35 define Image/Build
36 $(call Image/Build/$(1),$(1))
37 endef
38
39 define Image/Build/squashfs
40 ( \
41 cat $(KDIR)/uImage-lzma; \
42 cat $(KDIR)/root.squashfs; \
43 ) > $(KDIR_TMP)/avr32-squahsfs.img
44 padjffs2 $(KDIR_TMP)/avr32-squahsfs.img 64
45 dd if=$(KDIR_TMP)/avr32-squahsfs.img of=$(BIN_DIR)/$(IMG_PREFIX)-$(1).img bs=64k conv=sync
46 endef
47
48 define Image/Build/jffs2-64k
49 ( \
50 dd if=$(KDIR)/uImage-lzma bs=64k 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))