at91bootstrap: add sama5d27_som1_eksd1_uboot as default defconfig
[openwrt/openwrt.git] / target / linux / at91 / image / Makefile
1 #
2 # Copyright (C) 2006-2013 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 KERNEL_LOADADDR := 0x20008000
11
12 define Build/at91-install-zImage
13 $(CP) $(KDIR)/zImage $@
14 endef
15
16 ifeq ($(SUBTARGET),sam9x)
17 include ./sam9x.mk
18 endif
19 ifeq ($(SUBTARGET),sama5)
20 include ./sama5.mk
21 endif
22
23 AT91_SD_BOOT_PARTSIZE:=64
24 FAT32_BLOCK_SIZE:=1024
25 FAT32_BLOCKS:=$(shell echo \
26 $$(($(AT91_SD_BOOT_PARTSIZE)*1024*1024/$(FAT32_BLOCK_SIZE))))
27
28 define Device/Default
29 $(Device/default-nand)
30 PROFILES := Default
31 FILESYSTEMS := squashfs ubifs ext4
32 DEVICE_DTS := $(1)
33 KERNEL_NAME := zImage
34 KERNEL_SIZE := 4096k
35 KERNEL := kernel-bin | append-dtb | lzma | uImage lzma
36 DTB_SIZE := 128k
37 endef
38
39 define Device/dtb
40 KERNEL := kernel-bin | lzma | uImage lzma
41 endef
42
43 define Build/at91-sdcard
44 $(if $(findstring ext4,$@), \
45 rm -f $@.boot
46 mkfs.fat -C $@.boot $(FAT32_BLOCKS)
47
48 mcopy -i $@.boot $(KDIR)/zImage ::zImage
49
50 $(foreach dts,$(DEVICE_DTS), \
51 mcopy -i $@.boot $(DTS_DIR)/$(dts).dtb \
52 ::$(dts).dtb)
53
54 mcopy -i $@.boot \
55 $(BIN_DIR)/u-boot-$(DEVICE_NAME:at91-%=%)_mmc/u-boot.bin \
56 ::u-boot.bin
57
58 $(if $(findstring at91-sama5d27_som1_ek,$@), \
59 mcopy -i $@.boot \
60 $(BIN_DIR)/at91bootstrap-$(DEVICE_NAME:at91-%=%)sd1_uboot/at91bootstrap.bin \
61 ::BOOT.bin,
62 mcopy -i $@.boot \
63 $(BIN_DIR)/at91bootstrap-$(DEVICE_NAME:at91-%=%)sd_uboot/at91bootstrap.bin \
64 ::BOOT.bin)
65
66 ./gen_at91_sdcard_img.sh \
67 $@.img \
68 $@.boot \
69 $(KDIR)/root.ext4 \
70 $(AT91_SD_BOOT_PARTSIZE) \
71 $(CONFIG_TARGET_ROOTFS_PARTSIZE)
72
73 gzip -nc9 $@.img > $@
74
75 rm -f $@.img $@.boot )
76 endef
77
78 define Device/evaluation-sdimage
79 IMAGES += sdcard.img.gz
80 IMAGE/sdcard.img.gz := at91-sdcard
81 endef
82
83 define Device/evaluation
84 KERNEL_INSTALL := 1
85 KERNEL_SUFFIX := -uImage
86 IMAGES := root.ubi
87 IMAGE/root.ubi := append-ubi
88 endef
89
90 define Device/evaluation-zImage
91 IMAGES += zImage
92 IMAGE/zImage := at91-install-zImage
93 endef
94
95 define Device/evaluation-dtb
96 $(Device/evaluation)
97 $(Device/dtb)
98 $(Device/evaluation-zImage)
99 IMAGES += dtb
100 IMAGE/dtb := install-dtb
101 endef
102
103 define Device/evaluation-fit
104 $(Device/evaluation)
105 KERNEL_SUFFIX := -fit-uImage.itb
106 KERNEL := kernel-bin | lzma | fit lzma $$(DTS_DIR)/$$(DEVICE_DTS).dtb
107 endef
108
109 define Device/production
110 UBINIZE_OPTS := -E 5
111 IMAGES := factory.bin
112 IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
113 endef
114
115 define Device/production-dtb
116 $(Device/production)
117 $(Device/dtb)
118 IMAGE/factory.bin := append-dtb | pad-to $$$$(DTB_SIZE) \
119 | append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
120 endef
121
122 $(eval $(call BuildImage))