bf4d721efc17458fd01a234eecd9fee7e14f42f1
[openwrt/openwrt.git] / package / boot / uboot-at91 / Makefile
1 #
2 # Copyright (C) 2016 Ben Whitten <ben.whitten@gmail.com>
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
10 PKG_NAME:=u-boot
11 PKG_VERSION:=2016.05
12 PKG_RELEASE:=1
13
14 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
15 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
16 PKG_SOURCE_URL:= \
17 http://mirror2.openwrt.org/sources \
18 ftp://ftp.denx.de/pub/u-boot
19 PKG_MD5SUM:=3a8613d753dfa707c937991a35404510
20
21 PKG_LICENSE:=GPL-2.0 GPL-2.0+
22 PKG_LICENSE_FILES:=Licenses/README
23
24 PKG_BUILD_PARALLEL:=1
25
26 include $(INCLUDE_DIR)/package.mk
27
28 define uboot/Default
29 TITLE:=
30 endef
31
32 define uboot/at91sam9m10g45ek_nandflash
33 TITLE:=U-Boot for the AT91SAM9M10G45-EK board (NandFlash)
34 endef
35
36 define uboot/at91sam9x5ek_nandflash
37 TITLE:=U-Boot for the AT91SAM9X5-EK board (NandFlash)
38 endef
39
40 UBOOTS := \
41 at91sam9m10g45ek_nandflash \
42 at91sam9x5ek_nandflash
43
44 define Package/uboot/template
45 define Package/uboot-at91-$(1)
46 SECTION:=boot
47 CATEGORY:=Boot Loaders
48 DEPENDS:=@TARGET_at91
49 TITLE:=$(2)
50 URL:=http://www.denx.de/wiki/U-Boot
51 VARIANT:=$(1)
52 MAINTAINER:=Ben Whitten <ben.whitten@gmail.com>
53 endef
54 endef
55
56 define BuildUBootPackage
57 $(eval $(uboot/Default))
58 $(eval $(uboot/$(1)))
59 $(call Package/uboot/template,$(1),$(TITLE))
60 endef
61
62 ifdef BUILD_VARIANT
63 $(eval $(call uboot/$(BUILD_VARIANT)))
64 UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT))
65 UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),lede-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin)
66 endif
67
68 define Build/Configure
69 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
70 $(UBOOT_CONFIG)_config
71 endef
72
73 define Build/Compile
74 +$(MAKE) $(PKG_JOBS) -C $(PKG_BUILD_DIR) \
75 CROSS_COMPILE=$(TARGET_CROSS) \
76 KCFLAGS="$(filter-out -fstack-protector, $(TARGET_CFLAGS))"
77 endef
78
79 define Package/uboot/install/default
80 $(INSTALL_DIR) $(BIN_DIR)/uboot-$(BOARD)-$(1)
81
82 $(CP) $(PKG_BUILD_DIR)/u-boot.bin \
83 $(BIN_DIR)/uboot-$(BOARD)-$(1)/u-boot.bin
84
85 $(CP) $(PKG_BUILD_DIR)/boot.bin \
86 $(BIN_DIR)/uboot-$(BOARD)-$(1)/boot.bin
87 endef
88
89 define Package/uboot/install/template
90 define Package/uboot-at91-$(1)/install
91 $(call Package/uboot/install/default,$(2))
92 endef
93 endef
94
95 $(foreach u,$(UBOOTS), \
96 $(eval $(call Package/uboot/install/template,$(u),$(u))) \
97 )
98
99 $(foreach u,$(UBOOTS), \
100 $(eval $(call BuildUBootPackage,$(u))) \
101 $(eval $(call BuildPackage,uboot-at91-$(u))) \
102 )