Skip to content
Snippets Groups Projects
  1. Jun 25, 2022
  2. May 07, 2022
    • Masahiro Yamada's avatar
      kbuild: split the second line of *.mod into *.usyms · 9413e764
      Masahiro Yamada authored
      
      The *.mod files have two lines; the first line lists the member objects
      of the module, and the second line, if CONFIG_TRIM_UNUSED_KSYMS=y, lists
      the undefined symbols.
      
      Currently, we generate *.mod after constructing composite modules,
      otherwise, we cannot compute the second line. No prerequisite is
      required to print the first line.
      
      They are orthogonal. Splitting them into separate commands will ease
      further cleanups.
      
      This commit splits the list of undefined symbols out to *.usyms files.
      
      Previously, the list of undefined symbols ended up with a very long
      line, but now it has one symbol per line.
      
      Use sed like we did before commit 7d32358b ("kbuild: avoid split
      lines in .mod files").
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <nicolas@fjasle.eu>
      9413e764
  3. Jan 08, 2022
    • Masahiro Yamada's avatar
      kbuild: do not quote string values in include/config/auto.conf · 129ab0d2
      Masahiro Yamada authored
      
      The previous commit fixed up all shell scripts to not include
      include/config/auto.conf.
      
      Now that include/config/auto.conf is only included by Makefiles,
      we can change it into a more Make-friendly form.
      
      Previously, Kconfig output string values enclosed with double-quotes
      (both in the .config and include/config/auto.conf):
      
          CONFIG_X="foo bar"
      
      Unlike shell, Make handles double-quotes (and single-quotes as well)
      verbatim. We must rip them off when used.
      
      There are some patterns:
      
        [1] $(patsubst "%",%,$(CONFIG_X))
        [2] $(CONFIG_X:"%"=%)
        [3] $(subst ",,$(CONFIG_X))
        [4] $(shell echo $(CONFIG_X))
      
      These are not only ugly, but also fragile.
      
      [1] and [2] do not work if the value contains spaces, like
         CONFIG_X=" foo bar "
      
      [3] does not work correctly if the value contains double-quotes like
         CONFIG_X="foo\"bar"
      
      [4] seems to work better, but has a cost of forking a process.
      
      Anyway, quoted strings were always PITA for our Makefiles.
      
      This commit changes Kconfig to stop quoting in include/config/auto.conf.
      
      These are the string type symbols referenced in Makefiles or scripts:
      
          ACPI_CUSTOM_DSDT_FILE
          ARC_BUILTIN_DTB_NAME
          ARC_TUNE_MCPU
          BUILTIN_DTB_SOURCE
          CC_IMPLICIT_FALLTHROUGH
          CC_VERSION_TEXT
          CFG80211_EXTRA_REGDB_KEYDIR
          EXTRA_FIRMWARE
          EXTRA_FIRMWARE_DIR
          EXTRA_TARGETS
          H8300_BUILTIN_DTB
          INITRAMFS_SOURCE
          LOCALVERSION
          MODULE_SIG_HASH
          MODULE_SIG_KEY
          NDS32_BUILTIN_DTB
          NIOS2_DTB_SOURCE
          OPENRISC_BUILTIN_DTB
          SOC_CANAAN_K210_DTB_SOURCE
          SYSTEM_BLACKLIST_HASH_LIST
          SYSTEM_REVOCATION_KEYS
          SYSTEM_TRUSTED_KEYS
          TARGET_CPU
          UNUSED_KSYMS_WHITELIST
          XILINX_MICROBLAZE0_FAMILY
          XILINX_MICROBLAZE0_HW_VER
          XTENSA_VARIANT_NAME
      
      I checked them one by one, and fixed up the code where necessary.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      129ab0d2
    • Masahiro Yamada's avatar
      kbuild: do not include include/config/auto.conf from shell scripts · 7d153696
      Masahiro Yamada authored
      Richard Weinberger pointed out the risk of sourcing the kernel config
      from shell scripts [1], and proposed some patches [2], [3]. It is a good
      point, but it took a long time because I was wondering how to fix this.
      
      This commit goes with simple grep approach because there are only a few
      scripts including the kernel configuration.
      
      scripts/link_vmlinux.sh has references to a bunch of CONFIG options,
      all of which are boolean. I added is_enabled() helper as
      scripts/package/{mkdebian,builddeb} do.
      
      scripts/gen_autoksyms.sh uses 'eval', stating "to expand the whitelist
      path". I removed it since it is the issue we are trying to fix.
      
      I was a bit worried about the cost of invoking the grep command over
      again. I extracted the grep parts from it, and measured the cost. It
      was approximately 0.03 sec, which I hope is acceptable.
      
      [test code]
      
        $ cat test-grep.sh
        #!/bin/sh
      
        is_enabled() {
                grep -q "^$1=y" include/config/auto.conf
        }
      
        is_enabled CONFIG_LTO_CLANG
        is_enabled CONFIG_LTO_CLANG
        is_enabled CONFIG_STACK_VALIDATION
        is_enabled CONFIG_UNWINDER_ORC
        is_enabled CONFIG_FTRACE_MCOUNT_USE_OBJTOOL
        is_enabled CONFIG_VMLINUX_VALIDATION
        is_enabled CONFIG_FRAME_POINTER
        is_enabled CONFIG_GCOV_KERNEL
        is_enabled CONFIG_LTO_CLANG
        is_enabled CONFIG_RETPOLINE
        is_enabled CONFIG_X86_SMAP
        is_enabled CONFIG_LTO_CLANG
        is_enabled CONFIG_VMLINUX_MAP
        is_enabled CONFIG_KALLSYMS_ALL
        is_enabled CONFIG_KALLSYMS_ABSOLUTE_PERCPU
        is_enabled CONFIG_KALLSYMS_BASE_RELATIVE
        is_enabled CONFIG_DEBUG_INFO_BTF
        is_enabled CONFIG_KALLSYMS
        is_enabled CONFIG_DEBUG_INFO_BTF
        is_enabled CONFIG_BPF
        is_enabled CONFIG_BUILDTIME_TABLE_SORT
        is_enabled CONFIG_KALLSYMS
      
        $ time ./test-grep.sh
        real    0m0.036s
        user    0m0.027s
        sys     m0.009s
      
      [1]: https://lore.kernel.org/all/1919455.eZKeABUfgV@blindfold/
      [2]: https://lore.kernel.org/all/20180219092245.26404-1-richard@nod.at/
      [3]: https://lore.kernel.org/all/20210920213957.1064-2-richard@nod.at/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      7d153696
  4. Sep 02, 2021
  5. Feb 28, 2021
  6. Feb 11, 2021
  7. Mar 03, 2020
Loading