kumquat-buildroot/boot/at91bootstrap3/at91bootstrap3.mk

101 lines
3.8 KiB
Makefile
Raw Normal View History

################################################################################
#
# at91bootstrap3
#
################################################################################
AT91BOOTSTRAP3_VERSION = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_VERSION))
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
AT91BOOTSTRAP3_TARBALL = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION))
AT91BOOTSTRAP3_SITE = $(patsubst %/,%,$(dir $(AT91BOOTSTRAP3_TARBALL)))
AT91BOOTSTRAP3_SOURCE = $(notdir $(AT91BOOTSTRAP3_TARBALL))
BR_NO_CHECK_HASH_FOR += $(AT91BOOTSTRAP3_SOURCE)
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT),y)
AT91BOOTSTRAP3_SITE = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL))
AT91BOOTSTRAP3_SITE_METHOD = git
BR_NO_CHECK_HASH_FOR += $(AT91BOOTSTRAP3_SOURCE)
else
AT91BOOTSTRAP3_SITE = $(call github,linux4sam,at91bootstrap,$(AT91BOOTSTRAP3_VERSION))
endif
AT91BOOTSTRAP3_LICENSE = Atmel License
AT91BOOTSTRAP3_CPE_ID_VENDOR = linux4sam
AT91BOOTSTRAP3_CPE_ID_PRODUCT = at91bootstrap
AT91BOOTSTRAP3_INSTALL_IMAGES = YES
AT91BOOTSTRAP3_INSTALL_TARGET = NO
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_NEEDS_PYTHON3),y)
AT91BOOTSTRAP3_DEPENDENCIES += host-python3
endif
AT91BOOTSTRAP3_CUSTOM_PATCH_DIR = \
$(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_PATCH_DIR))
AT91BOOTSTRAP3_MAKE_OPTS = CROSS_COMPILE=$(TARGET_CROSS) DESTDIR=$(BINARIES_DIR)
ifneq ($(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR),)
define AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES
$(APPLY_PATCHES) $(@D) $(AT91BOOTSTRAP3_CUSTOM_PATCH_DIR) \*.patch
endef
AT91BOOTSTRAP3_POST_PATCH_HOOKS += AT91BOOTSTRAP3_APPLY_CUSTOM_PATCHES
endif
define AT91BOOTSTRAP3_BUILD_CMDS
$(MAKE) $(AT91BOOTSTRAP3_MAKE_OPTS) -C $(@D)
endef
define AT91BOOTSTRAP3_INSTALL_IMAGES_CMDS
boot/at91bootstrap3: add support for at91bootstrap 4.x series The project at https://github.com/linux4sam/at91bootstrap was until now releasing 3.x versions, which were packaged using boot/at91bootstrap3/ in Buildroot. Microchip has now started a new branch of at91bootstrap, called 4.x, which will only support the following devices: sam9x60, sama5d2, sama5d3, sama5d4, sama7g5. A number of older devices from Microchip will only be supported by the existing 3.x series. Therefore, we cannot simply remove support for the 3.x series, and allow using only the 4.x series. So what this commit does is extend the boot/at91bootstrap3 package to support building both 3.x and 4.x versions. In detail, this implies: * Having the BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION symbol point to the latest 4.x version. Indeed, we want BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION to really point to the latest upstream version, even if that means potential breakage for users. Users who want to use a fixed version of at91bootstrap should anyway not be using BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION. * Introduce BR2_TARGET_AT91BOOTSTRAP3_LATEST_VERSION_3X for users who would like to use the latest 3.x series. * Adjust the installation logic, as images to install are now in build/binaries/*.bin instead of binaries/*.bin. In order to not have to differentiate 3.x and 4.x, we simply use $(wildcard ...) to expand the list of files to install. * To make it clear that boot/at91bootstrap3 supports both 3.x and 4.x, we also update the prompt of the package. at911bootstrap does not carry a license file; so far we were using main.c as the license file, as it carries the license blurb. Now that we have a known alternate version, we would need a per-version hash for that file. However, this is a bit too cumbersome to handle, so just drop using main.c as the license file. When upstream introduces a proper license file, we can revisit the situation. Update the two defconfigs that were using the upstream 3.9.3 version; all other defconfigs are using custom tarballs or custom git trees. Signed-off-by: Eugen Hristev <eugen.hristev@microchip.com> [Thomas: while this patch is based on previous work by Eugen, it was reworked quite significantly.] Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com> [yann.morin.1998@free.fr: - drop main.c as license file, explain why - update the two defconfigs ] Signed-off-by: Yann E. MORIN <yann.morin.1998@free.fr>
2021-05-18 23:37:46 +02:00
cp $(wildcard $(@D)/build/binaries/*.bin $(@D)/binaries/*.bin) $(BINARIES_DIR)
endef
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG),y)
AT91BOOTSTRAP3_KCONFIG_DEFCONFIG = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG))_defconfig
else ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG),y)
AT91BOOTSTRAP3_KCONFIG_FILE = $(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE))
endif
AT91BOOTSTRAP3_KCONFIG_EDITORS = menuconfig xconfig gconfig
AT91BOOTSTRAP3_KCONFIG_OPTS = $(AT91BOOTSTRAP3_MAKE_OPTS)
# Checks to give errors that the user can understand
# Must be before we call to kconfig-package
ifeq ($(BR_BUILDING),y)
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_DEFCONFIG),y)
# We must use the user-supplied kconfig value, because
# AT91BOOTSTRAP3_KCONFIG_DEFCONFIG will at least contain
# the trailing _defconfig
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG)),)
$(error No at91bootstrap3 defconfig name specified, check your BR2_TARGET_AT91BOOTSTRAP3_DEFCONFIG setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_USE_CUSTOM_CONFIG),y)
ifeq ($(AT91BOOTSTRAP3_KCONFIG_FILE),)
$(error No at91bootstrap3 configuration file specified, check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_CONFIG_FILE setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_GIT),y)
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL)),)
$(error No custom at91bootstrap3 repository URL specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_URL setting)
endif
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION)),)
$(error No custom at91bootstrap3 repository version specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_REPO_VERSION setting)
endif
endif
ifeq ($(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL),y)
ifeq ($(call qstrip,$(BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION)),)
$(error No custom AT91Bootstrap3 tarball specified. Check your BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION setting)
endif # qstrip BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL_LOCATION
endif # BR2_TARGET_AT91BOOTSTRAP3_CUSTOM_TARBALL
endif # BR_BUILDING
$(eval $(kconfig-package))