Fork of the vendor (Boundary Devices) u-boot for Reform 2, with minor tweaks. The goal is to migrate to mainstream u-boot or barebox ASAP. The main impediment so far is the 4GB RAM config.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

147 lines
4.5 KiB

  1. # SPDX-License-Identifier: GPL-2.0
  2. # This helper makefile is used for creating
  3. # - symbolic links (arch/$ARCH/include/asm/arch
  4. # - include/autoconf.mk, {spl,tpl}/include/autoconf.mk
  5. # - include/config.h
  6. #
  7. # When our migration to Kconfig is done
  8. # (= When we move all CONFIGs from header files to Kconfig)
  9. # this makefile can be deleted.
  10. __all: include/autoconf.mk include/autoconf.mk.dep
  11. ifeq ($(shell grep -q '^CONFIG_SPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
  12. __all: spl/include/autoconf.mk
  13. endif
  14. ifeq ($(shell grep -q '^CONFIG_TPL=y' include/config/auto.conf 2>/dev/null && echo y),y)
  15. __all: tpl/include/autoconf.mk
  16. endif
  17. include include/config/auto.conf
  18. include scripts/Kbuild.include
  19. # Need to define CC and CPP again here in case the top Makefile did not
  20. # include config.mk. Some architectures expect CROSS_COMPILE to be defined
  21. # in arch/$(ARCH)/config.mk
  22. CC = $(CROSS_COMPILE)gcc
  23. CPP = $(CC) -E
  24. include config.mk
  25. UBOOTINCLUDE := \
  26. -Iinclude \
  27. $(if $(KBUILD_SRC), -I$(srctree)/include) \
  28. -I$(srctree)/arch/$(ARCH)/include \
  29. -include $(srctree)/include/linux/kconfig.h
  30. c_flags := $(KBUILD_CFLAGS) $(KBUILD_CPPFLAGS) $(PLATFORM_CPPFLAGS) \
  31. $(UBOOTINCLUDE) $(NOSTDINC_FLAGS)
  32. quiet_cmd_autoconf_dep = GEN $@
  33. cmd_autoconf_dep = $(CC) -x c -DDO_DEPS_ONLY -M -MP $(c_flags) \
  34. -MQ include/config/auto.conf $(srctree)/include/common.h > $@ || { \
  35. rm $@; false; \
  36. }
  37. include/autoconf.mk.dep: include/config.h FORCE
  38. $(call cmd,autoconf_dep)
  39. # We are migrating from board headers to Kconfig little by little.
  40. # In the interim, we use both of
  41. # - include/config/auto.conf (generated by Kconfig)
  42. # - include/autoconf.mk (used in the U-Boot conventional configuration)
  43. # The following rule creates autoconf.mk
  44. # include/config/auto.conf is grepped in order to avoid duplication of the
  45. # same CONFIG macros
  46. quiet_cmd_autoconf = GEN $@
  47. cmd_autoconf = \
  48. sed -n -f $(srctree)/tools/scripts/define2mk.sed $< | \
  49. while read line; do \
  50. if [ -n "${KCONFIG_IGNORE_DUPLICATES}" ] || \
  51. ! grep -q "$${line%=*}=" include/config/auto.conf; then \
  52. echo "$$line"; \
  53. fi \
  54. done > $@
  55. quiet_cmd_u_boot_cfg = CFG $@
  56. cmd_u_boot_cfg = \
  57. $(CPP) $(c_flags) $2 -DDO_DEPS_ONLY -dM $(srctree)/include/common.h > $@.tmp && { \
  58. grep 'define CONFIG_' $@.tmp > $@; \
  59. rm $@.tmp; \
  60. } || { \
  61. rm $@.tmp; false; \
  62. }
  63. u-boot.cfg: include/config.h FORCE
  64. $(call cmd,u_boot_cfg)
  65. spl/u-boot.cfg: include/config.h FORCE
  66. $(Q)mkdir -p $(dir $@)
  67. $(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD)
  68. tpl/u-boot.cfg: include/config.h FORCE
  69. $(Q)mkdir -p $(dir $@)
  70. $(call cmd,u_boot_cfg,-DCONFIG_SPL_BUILD -DCONFIG_TPL_BUILD)
  71. include/autoconf.mk: u-boot.cfg
  72. $(call cmd,autoconf)
  73. spl/include/autoconf.mk: spl/u-boot.cfg
  74. $(Q)mkdir -p $(dir $@)
  75. $(call cmd,autoconf)
  76. tpl/include/autoconf.mk: tpl/u-boot.cfg
  77. $(Q)mkdir -p $(dir $@)
  78. $(call cmd,autoconf)
  79. # include/config.h
  80. # Prior to Kconfig, it was generated by mkconfig. Now it is created here.
  81. define filechk_config_h
  82. (echo "/* Automatically generated - do not edit */"; \
  83. for i in $$(echo $(CONFIG_SYS_EXTRA_OPTIONS) | sed 's/,/ /g'); do \
  84. echo \#define CONFIG_$$i \
  85. | sed '/=/ {s/=/ /;q; } ; { s/$$/ 1/; }'; \
  86. done; \
  87. echo \#define CONFIG_BOARDDIR board/$(if $(VENDOR),$(VENDOR)/)$(BOARD);\
  88. echo \#include \<config_defaults.h\>; \
  89. echo \#include \<config_uncmd_spl.h\>; \
  90. echo \#include \<configs/$(CONFIG_SYS_CONFIG_NAME).h\>; \
  91. echo \#include \<asm/config.h\>; \
  92. echo \#include \<linux/kconfig.h\>; \
  93. echo \#include \<config_fallbacks.h\>;)
  94. endef
  95. include/config.h: scripts/Makefile.autoconf create_symlink FORCE
  96. $(call filechk,config_h)
  97. # symbolic links
  98. # If arch/$(ARCH)/mach-$(SOC)/include/mach exists,
  99. # make a symbolic link to that directory.
  100. # Otherwise, create a symbolic link to arch/$(ARCH)/include/asm/arch-$(SOC).
  101. PHONY += create_symlink
  102. create_symlink:
  103. ifdef CONFIG_CREATE_ARCH_SYMLINK
  104. ifneq ($(KBUILD_SRC),)
  105. $(Q)mkdir -p include/asm
  106. $(Q)if [ -d $(KBUILD_SRC)/arch/$(ARCH)/mach-$(SOC)/include/mach ]; then \
  107. dest=arch/$(ARCH)/mach-$(SOC)/include/mach; \
  108. else \
  109. dest=arch/$(ARCH)/include/asm/arch-$(if $(SOC),$(SOC),$(CPU)); \
  110. fi; \
  111. ln -fsn $(KBUILD_SRC)/$$dest include/asm/arch
  112. else
  113. $(Q)if [ -d arch/$(ARCH)/mach-$(SOC)/include/mach ]; then \
  114. dest=../../mach-$(SOC)/include/mach; \
  115. else \
  116. dest=arch-$(if $(SOC),$(SOC),$(CPU)); \
  117. fi; \
  118. ln -fsn $$dest arch/$(ARCH)/include/asm/arch
  119. endif
  120. endif
  121. PHONY += FORCE
  122. FORCE:
  123. .PHONY: $(PHONY)