Skip to contentSkip to conversation

kconfig: Move CONFIG_SYS_HZ and CONFIG_USE_PRIVATE_LIBGCC, bug fixes

PATCH Superseded Masahiro Yamada 4 participants 13 messages Sep 26, 2014 – Oct 8, 2014

Subsystems (7)
Arm (32-bit) x86 Kbuild Library code +3 more subsystems

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover kconfig: Move CONFIG_SYS_HZ and CONFIG_USE_PRIVATE_LIBGCC, bug fixes

Masahiro Yamada (7):
kconfig: move CONFIG_SYS_HZ to lib/Kconfig
x86: set CONFIG_USE_PRIVATE_LIBGCC to y
kbuild: drop CONFIG_USE_PRIVATE_LIBGCC=<path/to/libgcc> syntax
kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig
kbuild: fix a bug of the u-boot-spl link rule
kconfig: invoke silentoldconfig if spl,tpl/.config is updated
mips: enable CONFIG_USE_PRIVATE_LIBGCC by default

 Makefile                                |  4 ----
 README                                  |  7 -------
 arch/Kconfig                            |  5 +++++
 arch/arm/cpu/armv7/tegra-common/Kconfig |  3 +++
 arch/mips/Kconfig                       |  3 +++
 arch/x86/Kconfig                        |  3 +++
 arch/x86/config.mk                      |  3 ---
 arch/x86/include/asm/config.h           |  1 +
 arch/x86/lib/Makefile                   |  6 +++---
 include/config_fallbacks.h              |  4 ----
 include/configs/cm_fx6.h                |  1 -
 include/configs/edb93xx.h               |  1 -
 include/configs/ks2_evm.h               |  1 -
 include/configs/ls1021aqds.h            |  1 -
 include/configs/ls1021atwr.h            |  1 -
 include/configs/ls2085a_common.h        |  2 --
 include/configs/sunxi-common.h          |  2 --
 include/configs/tegra-common.h          |  4 ----
 include/configs/tqma6.h                 |  1 -
 lib/Kconfig                             | 19 +++++++++++++++++++
 lib/time.c                              |  4 ----
 scripts/Makefile.spl                    |  8 ++++----
 scripts/multiconfig.sh                  | 15 +++++++++++++++
 23 files changed, 56 insertions(+), 43 deletions(-)
Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/7 kconfig: move CONFIG_SYS_HZ to lib/Kconfig

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h (but some boards still have redundant definitions).

This commit moves the definition and the document in README to Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000, the sanity check in lib/time.c can be removed.

---

 README                           | 7 -------
 include/config_fallbacks.h       | 4 ----
 include/configs/cm_fx6.h         | 1 -
 include/configs/edb93xx.h        | 1 -
 include/configs/ks2_evm.h        | 1 -
 include/configs/ls1021aqds.h     | 1 -
 include/configs/ls1021atwr.h     | 1 -
 include/configs/ls2085a_common.h | 2 --
 include/configs/sunxi-common.h   | 2 --
 include/configs/tqma6.h          | 1 -
 lib/Kconfig                      | 8 ++++++++
 lib/time.c                       | 4 ----
 12 files changed, 8 insertions(+), 25 deletions(-)
README +0 -7
index 766e9e0..a698d19 100644
@@ -611,13 +611,6 @@ The following options need to be configured:
 		exists, unlike the similar options in the Linux kernel. Do not
 		set these options unless they apply!
 
-- CPU timer options:
-		CONFIG_SYS_HZ
-
-		The frequency of the timer returned by get_timer().
-		get_timer() must operate in milliseconds and this CONFIG
-		option must be set to 1000.
-
 - Linux Kernel Interface:
 		CONFIG_CLOCKS_IN_MHZ
 
include/config_fallbacks.h +0 -4
index 76818f6..7d8daa2 100644
@@ -79,10 +79,6 @@
 #define CONFIG_SYS_PROMPT	"=> "
 #endif
 
-#ifndef CONFIG_SYS_HZ
-#define CONFIG_SYS_HZ		1000
-#endif
-
 #ifndef CONFIG_FIT_SIGNATURE
 #define CONFIG_IMAGE_FORMAT_LEGACY
 #endif
include/configs/cm_fx6.h +0 -1
index 10d02b4..26731e9 100644
@@ -19,7 +19,6 @@
 #define CONFIG_MX6
 #define CONFIG_SYS_LITTLE_ENDIAN
 #define CONFIG_MACH_TYPE		4273
-#define CONFIG_SYS_HZ			1000
 
 /* Display information on boot */
 #define CONFIG_DISPLAY_CPUINFO
include/configs/edb93xx.h +0 -1
index 37bdcc0..47a8420 100644
@@ -89,7 +89,6 @@
 #define CONFIG_EP93XX		1		/* in a Cirrus Logic 93xx SoC */
 
 #define CONFIG_SYS_CLK_FREQ	14745600	/* EP93xx has a 14.7456 clock */
-#define CONFIG_SYS_HZ		1000		/* decr freq: 1 ms ticks */
 #undef CONFIG_USE_IRQ				/* Don't need IRQ/FIQ */
 
 /* Monitor configuration */
include/configs/ks2_evm.h +0 -1
index 51926f7..137d9b0 100644
@@ -23,7 +23,6 @@
 #define CONFIG_ARMV7
 #define CONFIG_ARCH_CPU_INIT
 #define CONFIG_SYS_ARCH_TIMER
-#define CONFIG_SYS_HZ			1000
 #define CONFIG_SYS_TEXT_BASE		0x0c001000
 #define CONFIG_SPL_TARGET		"u-boot-spi.gph"
 #define CONFIG_SYS_DCACHE_OFF
include/configs/ls1021aqds.h +0 -1
index 657e3b6..0d84f1e 100644
@@ -357,7 +357,6 @@ unsigned long get_board_ddr_clk(void);
 #define CONFIG_SYS_MEMTEST_END		0x9fffffff
 
 #define CONFIG_SYS_LOAD_ADDR		0x82000000
-#define CONFIG_SYS_HZ			1000
 
 /*
  * Stack sizes
include/configs/ls1021atwr.h +0 -1
index 45b2272..1f4a716 100644
@@ -259,7 +259,6 @@
 #define CONFIG_SYS_MEMTEST_END		0x9fffffff
 
 #define CONFIG_SYS_LOAD_ADDR		0x82000000
-#define CONFIG_SYS_HZ			1000
 
 /*
  * Stack sizes
include/configs/ls2085a_common.h +0 -2
index 2bd5a47..8f0877f 100644
@@ -176,8 +176,6 @@
 
 #define CONFIG_NR_DRAM_BANKS		2
 
-#define CONFIG_SYS_HZ			1000
-
 #define CONFIG_HWCONFIG
 #define HWCONFIG_BUFFER_SIZE		128
 
include/configs/sunxi-common.h +0 -2
index 1d947d7..0c117bc 100644
@@ -105,8 +105,6 @@
 /* standalone support */
 #define CONFIG_STANDALONE_LOAD_ADDR	0x42000000
 
-#define CONFIG_SYS_HZ			1000
-
 /* baudrate */
 #define CONFIG_BAUDRATE			115200
 
include/configs/tqma6.h +0 -1
index 2705d2c..d97a961 100644
@@ -450,7 +450,6 @@
 #define CONFIG_SYS_BARGSIZE		CONFIG_SYS_CBSIZE
 
 #define CONFIG_SYS_LOAD_ADDR		CONFIG_LOADADDR
-#define CONFIG_SYS_HZ			1000
 
 #define CONFIG_CMDLINE_EDITING
 #define CONFIG_STACKSIZE		(128u * SZ_1K)
lib/Kconfig +8 -0
index 88e5da7..a889c22 100644
@@ -8,4 +8,12 @@ config CC_OPTIMIZE_LIBS_FOR_SPEED
 
 	  If unsure, say N.
 
+config SYS_HZ
+	int
+	default 1000
+	help
+	  The frequency of the timer returned by get_timer().
+	  get_timer() must operate in milliseconds and this option must be
+	  set to 1000.
+
 endmenu
lib/time.c +0 -4
index c7b0264..5ebd1be 100644
@@ -10,10 +10,6 @@
 #include <div64.h>
 #include <asm/io.h>
 
-#if CONFIG_SYS_HZ != 1000
-#warning "CONFIG_SYS_HZ must be 1000 and should not be defined by platforms"
-#endif
-
 #ifndef CONFIG_WD_PERIOD
 # define CONFIG_WD_PERIOD	(10 * 1000 * 1000)	/* 10 seconds default */
 #endif
Signature · 1 line
1.9.1
#2 lore raw

PATCH 1/7 kconfig: move CONFIG_SYS_HZ to lib/Kconfig

Quoted 8 lines · Masahiro Yamada

CONFIG_SYS_HZ is always defined as 1000 in config_fallbacks.h (but some boards still have redundant definitions).

This commit moves the definition and the document in README to Kconfig. Since lib/Kconfig can assure that CONFIG_SYS_HZ is 1000, the sanity check in lib/time.c can be removed.

Nice,

Best regards,
Marek Vasut

#3 lore raw

PATCH 2/7 x86: set CONFIG_USE_PRIVATE_LIBGCC to y

In reply to Masahiro Yamada

The motivation of this commit is to change CONFIG_USE_PRIVATE_LIBGCC to a boolean macro so we can move it to Kconfig.

In the current implementation, there are two forms of syntax for this macro:

- CONFIG_USE_PRIVATE_LIBGCC=y
- CONFIG_USE_PRIVATE_LIBGCC=<path/to/private/libgcc>

The latter is only used by x86 architecture.
With a little bit refactoring, it can be converted to the former.

---

 arch/x86/config.mk            | 3 ---
 arch/x86/include/asm/config.h | 3 +++
 arch/x86/lib/Makefile         | 6 +++---
 3 files changed, 6 insertions(+), 6 deletions(-)
arch/x86/config.mk +0 -3
index 3106079..3e7fedb 100644
@@ -28,6 +28,3 @@ PLATFORM_LDFLAGS += --emit-relocs -Bsymbolic -Bsymbolic-functions -m elf_i386
 LDFLAGS_FINAL += --gc-sections -pie
 LDFLAGS_FINAL += --wrap=__divdi3 --wrap=__udivdi3
 LDFLAGS_FINAL += --wrap=__moddi3 --wrap=__umoddi3
-
-export NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
-CONFIG_USE_PRIVATE_LIBGCC := arch/x86/lib
arch/x86/include/asm/config.h +3 -0
index f06a15c..6827424 100644
@@ -8,4 +8,7 @@
 #define _ASM_CONFIG_H_
 
 #define CONFIG_SYS_GENERIC_BOARD
+
+#define CONFIG_USE_PRIVATE_LIBGCC
+
 #endif
arch/x86/lib/Makefile +3 -3
index f7303ab..25b672a 100644
@@ -20,9 +20,9 @@ obj-$(CONFIG_SYS_X86_TSC_TIMER)	+= tsc_timer.o
 obj-$(CONFIG_VIDEO_VGA)	+= video.o
 obj-$(CONFIG_CMD_ZBOOT)	+= zimage.o
 
-LIBGCC := $(notdir $(NORMAL_LIBGCC))
-extra-y := $(LIBGCC)
+extra-$(CONFIG_USE_PRIVATE_LIBGCC) := lib.a
 
+NORMAL_LIBGCC = $(shell $(CC) $(PLATFORM_CPPFLAGS) -print-libgcc-file-name)
 OBJCOPYFLAGS := --prefix-symbols=__normal_
-$(obj)/$(LIBGCC): $(NORMAL_LIBGCC) FORCE
+$(obj)/lib.a: $(NORMAL_LIBGCC) FORCE
 	$(call if_changed,objcopy)
Signature · 1 line
1.9.1
#4 lore raw

PATCH 2/7 x86: set CONFIG_USE_PRIVATE_LIBGCC to y

Quoted 6 lines · Masahiro Yamada

The motivation of this commit is to change CONFIG_USE_PRIVATE_LIBGCC to a boolean macro so we can move it to Kconfig.

In the current implementation, there are two forms of syntax for this macro:

Quoted 8 lines

- CONFIG_USE_PRIVATE_LIBGCC=y
- CONFIG_USE_PRIVATE_LIBGCC=<path/to/private/libgcc>

The latter is only used by x86 architecture.
With a little bit refactoring, it can be converted to the former.

Tested on link (Chromebook Pixel)

#5 lore raw

PATCH 3/7 kbuild: drop CONFIG_USE_PRIVATE_LIBGCC=<path/to/libgcc> syntax

In reply to Masahiro Yamada

Now CONFIG_USE_PRIVATE_LIBGCC is only used as a boolean macro. Remove CONFIG_USE_PRIVATE_LIBGCC=<path/to/libgcc> syntax.

---

 Makefile | 4 ----
 1 file changed, 4 deletions(-)
Makefile +0 -4
index 6221113..d506b2e 100644
@@ -670,13 +670,9 @@ u-boot-main := $(libs-y)
 
 
 # Add GCC lib
-ifdef CONFIG_USE_PRIVATE_LIBGCC
 ifeq ($(CONFIG_USE_PRIVATE_LIBGCC),y)
 PLATFORM_LIBGCC = arch/$(ARCH)/lib/lib.a
 else
-PLATFORM_LIBGCC = -L $(CONFIG_USE_PRIVATE_LIBGCC) -lgcc
-endif
-else
 PLATFORM_LIBGCC := -L $(shell dirname `$(CC) $(c_flags) -print-libgcc-file-name`) -lgcc
 endif
 PLATFORM_LIBS += $(PLATFORM_LIBGCC)
Signature · 1 line
1.9.1
#7 lore raw

PATCH 4/7 kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

In reply to Masahiro Yamada

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86. Those architectures should "select" HAVE_PRIVATE_LIBGCC and CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture. Move the definition from header files to Kconfig.

Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Tom Warren <[email protected]>

---

 arch/Kconfig                            |  5 +++++
 arch/arm/cpu/armv7/tegra-common/Kconfig |  3 +++
 arch/x86/Kconfig                        |  3 +++
 arch/x86/include/asm/config.h           |  2 --
 include/configs/tegra-common.h          |  4 ----
 lib/Kconfig                             | 11 +++++++++++
 6 files changed, 22 insertions(+), 6 deletions(-)
arch/Kconfig +5 -0
index bf26764..f63cc5a 100644
@@ -7,6 +7,7 @@ config ARC
 
 config ARM
 	bool "ARM architecture"
+	select HAVE_PRIVATE_LIBGCC
 	select SUPPORT_OF_CONTROL
 
 config AVR32
@@ -24,6 +25,7 @@ config MICROBLAZE
 
 config MIPS
 	bool "MIPS architecture"
+	select HAVE_PRIVATE_LIBGCC
 
 config NDS32
 	bool "NDS32 architecture"
@@ -36,6 +38,7 @@ config OPENRISC
 
 config PPC
 	bool "PowerPC architecture"
+	select HAVE_PRIVATE_LIBGCC
 
 config SANDBOX
 	bool "Sandbox"
@@ -43,12 +46,14 @@ config SANDBOX
 
 config SH
 	bool "SuperH architecture"
+	select HAVE_PRIVATE_LIBGCC
 
 config SPARC
 	bool "SPARC architecture"
 
 config X86
 	bool "x86 architecture"
+	select HAVE_PRIVATE_LIBGCC
 	select SUPPORT_OF_CONTROL
 
 endchoice
arch/arm/cpu/armv7/tegra-common/Kconfig +3 -0
index bcae2d6..3ea6d76 100644
@@ -17,6 +17,9 @@ config TEGRA124
 
 endchoice
 
+config USE_PRIVATE_LIBGCC
+	default y if SPL_BUILD
+
 config SYS_CPU
 	default "arm720t" if SPL_BUILD
 	default "armv7" if !SPL_BUILD
arch/x86/Kconfig +3 -0
index ff9935a..0dba8ac 100644
@@ -4,6 +4,9 @@ menu "x86 architecture"
 config SYS_ARCH
 	default "x86"
 
+config USE_PRIVATE_LIBGCC
+	default y
+
 choice
 	prompt "Target select"
 
arch/x86/include/asm/config.h +0 -2
index 6827424..dd1329e 100644
@@ -9,6 +9,4 @@
 
 #define CONFIG_SYS_GENERIC_BOARD
 
-#define CONFIG_USE_PRIVATE_LIBGCC
-
 #endif
include/configs/tegra-common.h +0 -4
index 834b3d5..c7b2778 100644
@@ -152,10 +152,6 @@
 #define CONFIG_SPL_SERIAL_SUPPORT
 #define CONFIG_SPL_GPIO_SUPPORT
 
-#ifdef CONFIG_SPL_BUILD
-# define CONFIG_USE_PRIVATE_LIBGCC
-#endif
-
 #define CONFIG_SYS_GENERIC_BOARD
 
 /* Misc utility code */
lib/Kconfig +11 -0
index a889c22..8460439 100644
@@ -8,6 +8,17 @@ config CC_OPTIMIZE_LIBS_FOR_SPEED
 
 	  If unsure, say N.
 
+config HAVE_PRIVATE_LIBGCC
+	bool
+
+config USE_PRIVATE_LIBGCC
+	bool "Use private libgcc"
+	depends on HAVE_PRIVATE_LIBGCC
+	help
+	  This option allows you to use the built-in libgcc implementation
+	  of U-boot instead of the one privided by the compiler.
+	  If unsure, say N.
+
 config SYS_HZ
 	int
 	default 1000
Signature · 1 line
1.9.1
#8 lore raw

PATCH 4/7 kconfig: move CONFIG_USE_PRIVATE_LIBGCC to Kconfig

Quoted 11 lines · Masahiro Yamada

The private libgcc is supported only on ARM, MIPS, PowerPC, SH, x86. Those architectures should "select" HAVE_PRIVATE_LIBGCC and CONFIG_USE_PRIVATE_LIBGCC should depend on it.

Currently, this option is enabled on Tegra boards and x86 architecture. Move the definition from header files to Kconfig.

Cc Simon Glass <[email protected]>
Cc Stephen Warren <[email protected]>
Cc Tom Warren <[email protected]>

For the x86 bits:

Tested on link (Chromebook Pixel)

#9 lore raw

PATCH 5/7 kbuild: fix a bug of the u-boot-spl link rule

In reply to Masahiro Yamada

cmd_u-boot-spl includes $(PLATFORM_LIBS) which changes when CONFIG_USE_PRIVATE_GCC is updated. The u-boot-spl image should be re-linked if any prerequisite is newer than it or the command line has changed.
$(call, if_changed,...) should be used instead of $(call cmd,...).

---

 scripts/Makefile.spl | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
scripts/Makefile.spl +4 -4
index 88c01d1..7afe437 100644
@@ -216,13 +216,13 @@ $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin
 endif
 
 quiet_cmd_u-boot-spl = LD      $@
-      cmd_u-boot-spl = cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
+      cmd_u-boot-spl = (cd $(obj) && $(LD) $(LDFLAGS) $(LDFLAGS_$(@F)) \
 		       $(patsubst $(obj)/%,%,$(u-boot-spl-init)) --start-group \
 		       $(patsubst $(obj)/%,%,$(u-boot-spl-main)) --end-group \
-		       $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN)
+		       $(PLATFORM_LIBS) -Map $(SPL_BIN).map -o $(SPL_BIN))
 
-$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds
-	$(call cmd,u-boot-spl)
+$(obj)/$(SPL_BIN): $(u-boot-spl-init) $(u-boot-spl-main) $(obj)/u-boot-spl.lds FORCE
+	$(call if_changed,u-boot-spl)
 
 $(sort $(u-boot-spl-init) $(u-boot-spl-main)): $(u-boot-spl-dirs) ;
 
Signature · 1 line
1.9.1
#10 lore raw

PATCH 6/7 kconfig: invoke silentoldconfig if spl, tpl/.config is updated

In reply to Masahiro Yamada

When spl/.config is updated by "make spl/menuconfig" or friends, spl/include/config/auto.conf, spl/include/generated/autoconf.h and some other files must be updated by "make silentoldconfig".

There is no hook for SPL in the top Makefile, so this commit touches .config when spl/.config is updated to invoke silentoldconfig. Likewise for TPL.

---

 scripts/multiconfig.sh | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
scripts/multiconfig.sh +15 -0
index b5185a8..d128bee 100644
@@ -297,9 +297,24 @@ do_others () {
 	else
 		objdir=${1%/*}
 		check_enabled_subimage $1 $objdir
+
+		if [ -f "$objdir/$KCONFIG_CONFIG" ]; then
+			timestamp_before=$(stat --printf="%Y" \
+						$objdir/$KCONFIG_CONFIG)
+		fi
 	fi
 
 	run_make_config $target $objdir
+
+	if [ "$timestamp_before" -a -f "$objdir/$KCONFIG_CONFIG" ]; then
+		timestamp_after=$(stat --printf="%Y" $objdir/$KCONFIG_CONFIG)
+
+		if [ "$timestamp_after" -gt "$timestamp_before" ]; then
+			# $objdir/.config has been updated.
+			# touch .config to invoke "make silentoldconfig"
+			touch $KCONFIG_CONFIG
+		fi
+	fi
 }
 
 progname=$(basename $0)
Signature · 1 line
1.9.1
#11 lore raw

PATCH 7/7 mips: enable CONFIG_USE_PRIVATE_LIBGCC by default

In reply to Masahiro Yamada

Without the private libgcc, we need a full multilib toolchain with different libgcc or multiple toolchains to build all BE/LE and hard-float/soft-float variants of MIPS boards. That is not feasible.

This commit allows us to build all the MIPS boards with a single kernel.org toolchain:

https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
x86_64-gcc-4.9.0-nolibc_mips-linux.tar.xz

This change would be reasonable for most users. If necessary, you can disable this option via "make menuconfig" or friends.

Cc Daniel Schwierzeck <[email protected]>

---

 arch/mips/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
arch/mips/Kconfig +3 -0
index 7686b77..9b72bab 100644
@@ -4,6 +4,9 @@ menu "MIPS architecture"
 config SYS_ARCH
 	default "mips"
 
+config USE_PRIVATE_LIBGCC
+	default y
+
 choice
 	prompt "Target select"
 
Signature · 1 line
1.9.1
#12 lore raw

PATCH 7/7 mips: enable CONFIG_USE_PRIVATE_LIBGCC by default

Quoted 13 lines · Masahiro Yamada

Without the private libgcc, we need a full multilib toolchain with different libgcc or multiple toolchains to build all BE/LE and hard-float/soft-float variants of MIPS boards. That is not feasible.

This commit allows us to build all the MIPS boards with a single kernel.org toolchain:

https://www.kernel.org/pub/tools/crosstool/files/bin/x86_64/4.9.0/
x86_64-gcc-4.9.0-nolibc_mips-linux.tar.xz

This change would be reasonable for most users. If necessary, you can disable this option via "make menuconfig" or friends.

Quoted 7 lines
Cc Daniel Schwierzeck <[email protected]>

---

 arch/mips/Kconfig | 3 +++
 1 file changed, 3 insertions(+)
Signature · 1 line
- Daniel