瀏覽代碼

Improve TARGETS handling for bootloaders and kernel

As the kernel and bootloaders do not use the normal BR2_PACKAGE_*
Kconfig options, their target name was not automatically added to the
global TARGETS variable. Each bootloader .mk and the linux.mk had to
add their own target manually to TARGETS, and the package
infrastructure was making tests on non-existing Kconfig variables.

This commit improves the package infrastructure so that it looks at
BR2_PACKAGE_<pkg> for packages, BR2_TARGET_<pkg> for bootloaders and
at the special BR2_LINUX_KERNEL for the linux package.

This allows to simplify a little bit the bootloaders and linux .mk
files.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Peter Korsgaard <jacmet@sunsite.dk>
Thomas Petazzoni 14 年之前
父節點
當前提交
b0d446dee4

+ 0 - 8
boot/at91bootstrap/at91bootstrap.mk

@@ -31,19 +31,11 @@ endef
 
 
 $(eval $(call GENTARGETS,boot,at91bootstrap))
 $(eval $(call GENTARGETS,boot,at91bootstrap))
 
 
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP),y)
 ifeq ($(BR2_TARGET_AT91BOOTSTRAP),y)
-TARGETS+=at91bootstrap
-
 # we NEED a board name unless we're at make source
 # we NEED a board name unless we're at make source
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(AT91BOOTSTRAP_BOARD),)
 ifeq ($(AT91BOOTSTRAP_BOARD),)
 $(error No AT91Bootstrap board name set. Check your BR2_TARGET_AT91BOOTSTRAP_BOARD setting)
 $(error No AT91Bootstrap board name set. Check your BR2_TARGET_AT91BOOTSTRAP_BOARD setting)
 endif
 endif
 endif
 endif
-
 endif
 endif

+ 0 - 9
boot/at91dataflashboot/at91dataflashboot.mk

@@ -20,12 +20,3 @@ define AT91DATAFLASHBOOT_INSTALL_IMAGES_CMDS
 endef
 endef
 
 
 $(eval $(call GENTARGETS,boot,at91dataflashboot))
 $(eval $(call GENTARGETS,boot,at91dataflashboot))
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_TARGET_AT91DATAFLASHBOOT),y)
-TARGETS+=at91dataflashboot
-endif

+ 0 - 3
boot/barebox/barebox.mk

@@ -54,13 +54,10 @@ endif
 $(eval $(call GENTARGETS,boot,barebox))
 $(eval $(call GENTARGETS,boot,barebox))
 
 
 ifeq ($(BR2_TARGET_BAREBOX),y)
 ifeq ($(BR2_TARGET_BAREBOX),y)
-TARGETS+=barebox
-
 # we NEED a board defconfig file unless we're at make source
 # we NEED a board defconfig file unless we're at make source
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(BAREBOX_BOARD_DEFCONFIG),)
 ifeq ($(BAREBOX_BOARD_DEFCONFIG),)
 $(error No Barebox defconfig file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG setting)
 $(error No Barebox defconfig file. Check your BR2_TARGET_BAREBOX_BOARD_DEFCONFIG setting)
 endif
 endif
 endif
 endif
-
 endif
 endif

+ 0 - 9
boot/grub/grub.mk

@@ -83,12 +83,3 @@ define GRUB_UNINSTALL_TARGET_CMDS
 endef
 endef
 
 
 $(eval $(call AUTOTARGETS,boot,grub))
 $(eval $(call AUTOTARGETS,boot,grub))
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_TARGET_GRUB),y)
-TARGETS+=grub
-endif

+ 0 - 9
boot/syslinux/syslinux.mk

@@ -27,12 +27,3 @@ define SYSLINUX_INSTALL_IMAGES_CMDS
 endef
 endef
 
 
 $(eval $(call GENTARGETS,boot,syslinux))
 $(eval $(call GENTARGETS,boot,syslinux))
-
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
-ifeq ($(BR2_TARGET_SYSLINUX),y)
-TARGETS+=syslinux
-endif

+ 0 - 8
boot/uboot/uboot.mk

@@ -111,19 +111,11 @@ endef
 
 
 $(eval $(call GENTARGETS,boot,uboot))
 $(eval $(call GENTARGETS,boot,uboot))
 
 
-#############################################################
-#
-# Toplevel Makefile options
-#
-#############################################################
 ifeq ($(BR2_TARGET_UBOOT),y)
 ifeq ($(BR2_TARGET_UBOOT),y)
-TARGETS+=u-boot
-
 # we NEED a board name unless we're at make source
 # we NEED a board name unless we're at make source
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(UBOOT_BOARD_NAME),)
 ifeq ($(UBOOT_BOARD_NAME),)
 $(error NO U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting)
 $(error NO U-Boot board name set. Check your BR2_TARGET_UBOOT_BOARDNAME setting)
 endif
 endif
 endif
 endif
-
 endif
 endif

+ 0 - 5
linux/linux.mk

@@ -189,11 +189,6 @@ $(LINUX_DIR)/.stamp_initramfs_rebuilt: $(LINUX_DIR)/.stamp_target_installed $(LI
 # after it generated the initramfs list of files.
 # after it generated the initramfs list of files.
 linux-rebuild-with-initramfs linux26-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_initramfs_rebuilt
 linux-rebuild-with-initramfs linux26-rebuild-with-initramfs: $(LINUX_DIR)/.stamp_initramfs_rebuilt
 
 
-
-ifeq ($(BR2_LINUX_KERNEL),y)
-TARGETS+=linux
-endif
-
 # Checks to give errors that the user can understand
 # Checks to give errors that the user can understand
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(filter source,$(MAKECMDGOALS)),)
 ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)
 ifeq ($(BR2_LINUX_KERNEL_USE_DEFCONFIG),y)

+ 13 - 3
package/Makefile.package.in

@@ -522,10 +522,20 @@ $$($(2)_TARGET_UNINSTALL):		PKG=$(2)
 $$($(2)_TARGET_CLEAN):			PKG=$(2)
 $$($(2)_TARGET_CLEAN):			PKG=$(2)
 $$($(2)_TARGET_DIRCLEAN):		PKG=$(2)
 $$($(2)_TARGET_DIRCLEAN):		PKG=$(2)
 
 
+# Compute the name of the Kconfig option that correspond to the
+# package being enabled. We handle three cases: the special Linux
+# kernel case, the bootloaders case, and the normal packages case.
+ifeq ($(1),linux)
+$(2)_KCONFIG_VAR = BR2_LINUX_KERNEL
+else ifeq ($(4),boot)
+$(2)_KCONFIG_VAR = BR2_TARGET_$(2)
+else
+$(2)_KCONFIG_VAR = BR2_PACKAGE_$(2)
+endif
+
 # add package to the general list of targets if requested by the buildroot
 # add package to the general list of targets if requested by the buildroot
 # configuration
 # configuration
-
-ifeq ($$(BR2_PACKAGE_$(2)),y)
+ifeq ($$($$($(2)_KCONFIG_VAR)),y)
 
 
 TARGETS += $(1)
 TARGETS += $(1)
 
 
@@ -537,7 +547,7 @@ else ifeq ($$($(2)_SITE_METHOD),bzr)
 DL_TOOLS_DEPENDENCIES += bzr
 DL_TOOLS_DEPENDENCIES += bzr
 endif # SITE_METHOD
 endif # SITE_METHOD
 
 
-endif # BR2_PACKAGE_$(2)
+endif # $(2)_KCONFIG_VAR
 endef # GENTARGETS_INNER
 endef # GENTARGETS_INNER
 
 
 ################################################################################
 ################################################################################