2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2010-05-30 22:46:45 +02:00
|
|
|
#
|
2013-06-06 23:54:12 +02:00
|
|
|
# barebox
|
2010-05-30 22:46:45 +02:00
|
|
|
#
|
2013-06-06 23:54:13 +02:00
|
|
|
################################################################################
|
2010-05-30 22:46:45 +02:00
|
|
|
|
2016-04-24 11:18:44 +02:00
|
|
|
################################################################################
|
|
|
|
# inner-barebox-package -- generates the KConfig logic and make targets needed
|
|
|
|
# to support a barebox package. All barebox packages are built from the same
|
2016-04-24 11:18:45 +02:00
|
|
|
# source (origin, version and patches). The remainder of the package
|
|
|
|
# configuration is unique to each barebox package.
|
|
|
|
#
|
|
|
|
# argument 1 is the uppercase package name (used for variable name-space)
|
2016-04-24 11:18:44 +02:00
|
|
|
################################################################################
|
|
|
|
|
|
|
|
define inner-barebox-package
|
2011-09-17 22:23:08 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_VERSION = $$(call qstrip,$$(BR2_TARGET_BAREBOX_VERSION))
|
2016-04-24 11:18:44 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$($(1)_VERSION),custom)
|
2011-09-17 22:23:08 +02:00
|
|
|
# Handle custom Barebox tarballs as specified by the configuration
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_TARBALL = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_TARBALL_LOCATION))
|
|
|
|
$(1)_SITE = $$(patsubst %/,%,$$(dir $$($(1)_TARBALL)))
|
|
|
|
$(1)_SOURCE = $$(notdir $$($(1)_TARBALL))
|
2016-04-24 11:18:44 +02:00
|
|
|
else ifeq ($$(BR2_TARGET_BAREBOX_CUSTOM_GIT),y)
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_SITE = $$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_GIT_REPO_URL))
|
|
|
|
$(1)_SITE_METHOD = git
|
2011-09-17 22:23:08 +02:00
|
|
|
else
|
|
|
|
# Handle stable official Barebox versions
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_SOURCE = barebox-$$($(1)_VERSION).tar.bz2
|
2019-01-11 22:52:35 +01:00
|
|
|
$(1)_SITE = https://www.barebox.org/download
|
2011-09-17 22:23:08 +02:00
|
|
|
endif
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_DEPENDENCIES = host-lzop
|
2017-03-30 15:43:32 +02:00
|
|
|
$(1)_LICENSE = GPL-2.0 with exceptions
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_LICENSE_FILES = COPYING
|
2012-08-18 11:25:37 +02:00
|
|
|
|
2016-05-06 07:46:04 +02:00
|
|
|
$(1)_CUSTOM_EMBEDDED_ENV_PATH = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_EMBEDDED_ENV_PATH))
|
|
|
|
|
2016-04-24 11:18:44 +02:00
|
|
|
ifneq ($$(call qstrip,$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR)),)
|
2016-04-24 11:18:45 +02:00
|
|
|
define $(1)_APPLY_CUSTOM_PATCHES
|
2016-04-24 11:18:44 +02:00
|
|
|
$$(APPLY_PATCHES) $$(@D) \
|
|
|
|
$$(BR2_TARGET_BAREBOX_CUSTOM_PATCH_DIR) \*.patch
|
2011-09-17 22:23:08 +02:00
|
|
|
endef
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_POST_PATCH_HOOKS += $(1)_APPLY_CUSTOM_PATCHES
|
2011-09-17 22:23:08 +02:00
|
|
|
endif
|
2011-07-05 21:53:59 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_INSTALL_IMAGES = YES
|
|
|
|
ifneq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
|
|
|
|
$(1)_INSTALL_TARGET = NO
|
2011-07-05 21:53:59 +02:00
|
|
|
endif
|
|
|
|
|
2016-04-24 11:18:44 +02:00
|
|
|
ifeq ($$(KERNEL_ARCH),i386)
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_ARCH = x86
|
2016-04-24 11:18:44 +02:00
|
|
|
else ifeq ($$(KERNEL_ARCH),x86_64)
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_ARCH = x86
|
2016-04-24 11:18:44 +02:00
|
|
|
else ifeq ($$(KERNEL_ARCH),powerpc)
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_ARCH = ppc
|
2016-08-12 16:31:52 +02:00
|
|
|
else ifeq ($$(KERNEL_ARCH),arm64)
|
|
|
|
$(1)_ARCH = arm
|
2010-05-30 22:46:45 +02:00
|
|
|
else
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_ARCH = $$(KERNEL_ARCH)
|
2010-05-30 22:46:45 +02:00
|
|
|
endif
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_MAKE_FLAGS = ARCH=$$($(1)_ARCH) CROSS_COMPILE="$$(TARGET_CROSS)"
|
|
|
|
$(1)_MAKE_ENV = $$(TARGET_MAKE_ENV)
|
2012-11-03 07:05:10 +01:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(BR2_TARGET_$(1)_USE_DEFCONFIG),y)
|
|
|
|
$(1)_KCONFIG_DEFCONFIG = $$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))_defconfig
|
|
|
|
else ifeq ($$(BR2_TARGET_$(1)_USE_CUSTOM_CONFIG),y)
|
|
|
|
$(1)_KCONFIG_FILE = $$(call qstrip,$$(BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE))
|
2012-11-03 07:05:10 +01:00
|
|
|
endif
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
$(1)_KCONFIG_FRAGMENT_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_CONFIG_FRAGMENT_FILES))
|
|
|
|
$(1)_KCONFIG_EDITORS = menuconfig xconfig gconfig nconfig
|
|
|
|
$(1)_KCONFIG_OPTS = $$($(1)_MAKE_FLAGS)
|
2010-05-30 22:46:45 +02:00
|
|
|
|
2019-07-02 22:13:41 +02:00
|
|
|
$(1)_KCONFIG_DEPENDENCIES = \
|
|
|
|
$(BR2_BISON_HOST_DEPENDENCY) \
|
|
|
|
$(BR2_FLEX_HOST_DEPENDENCY)
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
|
|
|
|
define $(1)_BUILD_BAREBOXENV_CMDS
|
2016-04-24 11:18:44 +02:00
|
|
|
$$(TARGET_CC) $$(TARGET_CFLAGS) $$(TARGET_LDFLAGS) -o $$(@D)/bareboxenv \
|
|
|
|
$$(@D)/scripts/bareboxenv.c
|
2011-07-05 21:53:59 +02:00
|
|
|
endef
|
|
|
|
endif
|
2010-05-30 22:46:45 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(BR2_TARGET_$(1)_CUSTOM_ENV),y)
|
|
|
|
$(1)_ENV_NAME = $$(notdir $$(call qstrip,\
|
|
|
|
$$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)))
|
|
|
|
define $(1)_BUILD_CUSTOM_ENV
|
2016-04-24 11:18:44 +02:00
|
|
|
$$(@D)/scripts/bareboxenv -s \
|
2016-04-24 11:18:45 +02:00
|
|
|
$$(call qstrip, $$(BR2_TARGET_$(1)_CUSTOM_ENV_PATH)) \
|
|
|
|
$$(@D)/$$($(1)_ENV_NAME)
|
2013-01-28 11:10:34 +01:00
|
|
|
endef
|
2016-04-24 11:18:45 +02:00
|
|
|
define $(1)_INSTALL_CUSTOM_ENV
|
|
|
|
cp $$(@D)/$$($(1)_ENV_NAME) $$(BINARIES_DIR)
|
2013-01-28 11:10:34 +01:00
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2016-05-06 07:46:04 +02:00
|
|
|
ifneq ($$($(1)_CUSTOM_EMBEDDED_ENV_PATH),)
|
|
|
|
define $(1)_KCONFIG_FIXUP_CMDS
|
|
|
|
$$(call KCONFIG_ENABLE_OPT,CONFIG_DEFAULT_ENVIRONMENT,$$(@D)/.config)
|
|
|
|
$$(call KCONFIG_SET_OPT,CONFIG_DEFAULT_ENVIRONMENT_PATH,"$$($(1)_CUSTOM_EMBEDDED_ENV_PATH)",$$(@D)/.config)
|
|
|
|
endef
|
|
|
|
endif
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
define $(1)_BUILD_CMDS
|
|
|
|
$$($(1)_BUILD_BAREBOXENV_CMDS)
|
|
|
|
$$(TARGET_MAKE_ENV) $$(MAKE) $$($(1)_MAKE_FLAGS) -C $$(@D)
|
|
|
|
$$($(1)_BUILD_CUSTOM_ENV)
|
2011-07-05 21:53:59 +02:00
|
|
|
endef
|
2010-05-30 22:46:45 +02:00
|
|
|
|
2017-06-21 09:03:53 +02:00
|
|
|
$(1)_IMAGE_FILES = $$(call qstrip,$$(BR2_TARGET_$(1)_IMAGE_FILE))
|
2016-04-24 11:18:43 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
define $(1)_INSTALL_IMAGES_CMDS
|
2017-06-21 09:03:53 +02:00
|
|
|
if test -n "$$($(1)_IMAGE_FILES)"; then \
|
|
|
|
cp -L $$(foreach image,$$($(1)_IMAGE_FILES),$$(@D)/$$(image)) $$(BINARIES_DIR) ; \
|
2016-04-24 11:18:44 +02:00
|
|
|
elif test -h $$(@D)/barebox-flash-image ; then \
|
|
|
|
cp -L $$(@D)/barebox-flash-image $$(BINARIES_DIR)/barebox.bin ; \
|
2012-11-22 03:35:11 +01:00
|
|
|
else \
|
2016-04-24 11:18:44 +02:00
|
|
|
cp $$(@D)/barebox.bin $$(BINARIES_DIR);\
|
2012-11-22 03:35:11 +01:00
|
|
|
fi
|
2016-04-24 11:18:45 +02:00
|
|
|
$$($(1)_INSTALL_CUSTOM_ENV)
|
2011-07-05 21:53:59 +02:00
|
|
|
endef
|
2010-05-30 22:46:45 +02:00
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(BR2_TARGET_$(1)_BAREBOXENV),y)
|
|
|
|
define $(1)_INSTALL_TARGET_CMDS
|
2016-04-24 11:18:44 +02:00
|
|
|
cp $$(@D)/bareboxenv $$(TARGET_DIR)/usr/bin
|
2011-07-05 21:53:59 +02:00
|
|
|
endef
|
|
|
|
endif
|
2011-02-06 21:40:19 +01:00
|
|
|
|
2015-07-13 12:32:02 +02:00
|
|
|
# Checks to give errors that the user can understand
|
|
|
|
# Must be before we call to kconfig-package
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(BR2_TARGET_$(1))$$(BR_BUILDING),yy)
|
2015-12-22 22:22:04 +01:00
|
|
|
# We must use the user-supplied kconfig value, because
|
2016-04-24 11:18:45 +02:00
|
|
|
# $(1)_KCONFIG_DEFCONFIG will at least contain the
|
2015-12-22 22:22:04 +01:00
|
|
|
# trailing _defconfig
|
2016-04-24 11:18:45 +02:00
|
|
|
ifeq ($$(or $$($(1)_KCONFIG_FILE),$$(call qstrip,$$(BR2_TARGET_$(1)_BOARD_DEFCONFIG))),)
|
|
|
|
$$(error No Barebox config. Check your BR2_TARGET_$(1)_BOARD_DEFCONFIG or BR2_TARGET_$(1)_CUSTOM_CONFIG_FILE settings)
|
2010-05-30 22:46:45 +02:00
|
|
|
endif
|
2010-09-28 14:43:25 +02:00
|
|
|
endif
|
2015-07-13 12:32:02 +02:00
|
|
|
|
2016-04-24 11:18:44 +02:00
|
|
|
$$(eval $$(kconfig-package))
|
|
|
|
|
|
|
|
endef
|
|
|
|
|
|
|
|
################################################################################
|
|
|
|
# barebox-package -- the target generator macro for barebox packages
|
|
|
|
################################################################################
|
|
|
|
|
2016-04-24 11:18:45 +02:00
|
|
|
barebox-package=$(call inner-barebox-package,$(call UPPERCASE,$(pkgname)))
|
2016-04-24 11:18:44 +02:00
|
|
|
|
2016-04-24 23:15:23 +02:00
|
|
|
include boot/barebox/barebox/barebox.mk
|
2016-04-24 23:15:24 +02:00
|
|
|
include boot/barebox/barebox-aux/barebox-aux.mk
|
2017-03-21 01:07:08 +01:00
|
|
|
|
|
|
|
ifeq ($(BR2_TARGET_BAREBOX)$(BR2_TARGET_BAREBOX_LATEST_VERSION),y)
|
|
|
|
BR_NO_CHECK_HASH_FOR += $(BAREBOX_SOURCE)
|
|
|
|
endif
|