Skip to content
Snippets Groups Projects
  1. Jan 31, 2024
    • Masahiro Yamada's avatar
      kconfig: initialize sym->curr.tri to 'no' for all symbol types again · bfef491d
      Masahiro Yamada authored
      Geert Uytterhoeven reported that commit 4e244c10 ("kconfig: remove
      unneeded symbol_empty variable") changed the default value of
      CONFIG_LOG_CPU_MAX_BUF_SHIFT from 12 to 0.
      
      As it turned out, this is an undefined behavior because sym_calc_value()
      stopped setting the sym->curr.tri field for 'int', 'hex', and 'string'
      symbols.
      
      This commit restores the original behavior, where 'int', 'hex', 'string'
      symbols are interpreted as false if used in boolean contexts.
      
      CONFIG_LOG_CPU_MAX_BUF_SHIFT will default to 12 again, irrespective
      of CONFIG_BASE_SMALL. Presumably, this is not the intended behavior,
      as already reported [1], but this is another issue that should be
      addressed by a separate patch.
      
      [1]: https://lore.kernel.org/all/f6856be8-54b7-0fa0-1d17-39632bf29ada@oracle.com/
      
      
      
      Fixes: 4e244c10 ("kconfig: remove unneeded symbol_empty variable")
      Reported-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Closes: https://lore.kernel.org/all/CAMuHMdWm6u1wX7efZQf=2XUAHascps76YQac6rdnQGhc8nop_Q@mail.gmail.com/
      
      
      Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      bfef491d
    • Jose Ignacio  Tornos Martinez's avatar
      kbuild: rpm-pkg: simplify installkernel %post · 358de8b4
      Jose Ignacio Tornos Martinez authored
      The new installkernel application that is now included in systemd-udev
      package allows installation although destination files are already present
      in the boot directory of the kernel package, but is failing with the
      implemented workaround for the old installkernel application from grubby
      package.
      
      For the new installkernel application, as Davide says:
      <<The %post currently does a shuffling dance before calling installkernel.
      This isn't actually necessary afaict, and the current implementation
      ends up triggering downstream issues such as
      https://github.com/systemd/systemd/issues/29568
      
      
      This commit simplifies the logic to remove the shuffling. For reference,
      the original logic was added in commit 3c9c7a14("rpm-pkg: add %post
      section to create initramfs and grub hooks").>>
      
      But we need to keep the old behavior as well, because the old installkernel
      application from grubby package, does not allow this simplification and
      we need to be backward compatible to avoid issues with the different
      packages.
      
      Mimic Fedora shipping process and store vmlinuz, config amd System.map
      in the module directory instead of the boot directory. In this way, we will
      avoid the commented problem for all the cases, because the new destination
      files are not going to exist in the boot directory of the kernel package.
      
      Replace installkernel tool with kernel-install tool, because the latter is
      more complete.
      
      Besides, after installkernel tool execution, check to complete if the
      correct package files vmlinuz, System.map and config files are present
      in /boot directory, and if necessary, copy manually for install operation.
      In this way, take into account if  files were not previously copied from
      /usr/lib/kernel/install.d/* scripts and if the suitable files for the
      requested package are present (it could be others if the rpm files were
      replace with a new pacakge with the same release and a different build).
      
      Tested with Fedora 38, Fedora 39, RHEL 9, Oracle Linux 9.3,
      openSUSE Tumbleweed and openMandrive ROME, using dnf/zypper and rpm tools.
      
      cc: stable@vger.kernel.org
      Co-Developed-by: default avatarDavide Cavalca <dcavalca@meta.com>
      Signed-off-by: default avatarJose Ignacio Tornos Martinez <jtornosm@redhat.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      358de8b4
    • Masahiro Yamada's avatar
      modpost: avoid using the alias attribute · cda5f94e
      Masahiro Yamada authored
      Aiden Leong reported modpost fails to build on macOS since commit
      16a473f6 ("modpost: inform compilers that fatal() never returns"):
      
        scripts/mod/modpost.c:93:21: error: aliases are not supported on darwin
      
      Nathan's research indicates that Darwin seems to support weak aliases
      at least [1]. Although the situation might be improved in future Clang
      versions, we can achieve a similar outcome without relying on it.
      
      This commit makes fatal() a macro of error() + exit(1) in modpost.h, as
      compilers recognize that exit() never returns.
      
      [1]: https://github.com/llvm/llvm-project/issues/71001
      
      
      
      Fixes: 16a473f6 ("modpost: inform compilers that fatal() never returns")
      Reported-by: default avatarAiden Leong <aiden.leong@aibsd.com>
      Closes: https://lore.kernel.org/all/d9ac2960-6644-4a87-b5e4-4bfb6e0364a8@aibsd.com/
      
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cda5f94e
  2. Jan 27, 2024
  3. Jan 21, 2024
  4. Jan 20, 2024
  5. Jan 19, 2024
    • Li Zhijian's avatar
      coccinelle: device_attr_show: Adapt to the latest Documentation/filesystems/sysfs.rst · 68ea60a7
      Li Zhijian authored
      
      Adapt description, warning message and MODE=patch according to the latest
      Documentation/filesystems/sysfs.rst:
      > show() should only use sysfs_emit() or sysfs_emit_at() when formatting
      > the value to be returned to user space.
      
      After this patch:
      When MODE=report,
       $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=report
       <...snip...>
       drivers/hid/hid-picolcd_core.c:304:8-16: WARNING: please use sysfs_emit or sysfs_emit_at
       drivers/hid/hid-picolcd_core.c:259:9-17: WARNING: please use sysfs_emit or sysfs_emit_at
      
      When MODE=patch,
       $ make coccicheck COCCI=scripts/coccinelle/api/device_attr_show.cocci M=drivers/hid/hid-picolcd_core.c MODE=patch
       <...snip...>
       diff -u -p a/drivers/hid/hid-picolcd_core.c b/drivers/hid/hid-picolcd_core.c
       --- a/drivers/hid/hid-picolcd_core.c
       +++ b/drivers/hid/hid-picolcd_core.c
       @@ -255,10 +255,12 @@ static ssize_t picolcd_operation_mode_sh
        {
               struct picolcd_data *data = dev_get_drvdata(dev);
      
       -       if (data->status & PICOLCD_BOOTLOADER)
       -               return snprintf(buf, PAGE_SIZE, "[bootloader] lcd\n");
       -       else
       -               return snprintf(buf, PAGE_SIZE, "bootloader [lcd]\n");
       +       if (data->status & PICOLCD_BOOTLOADER) {
       +               return sysfs_emit(buf, "[bootloader] lcd\n");
       +       }
       +       else {
       +               return sysfs_emit(buf, "bootloader [lcd]\n");
       +       }
        }
      
        static ssize_t picolcd_operation_mode_store(struct device *dev,
       @@ -301,7 +303,7 @@ static ssize_t picolcd_operation_mode_de
        {
               struct picolcd_data *data = dev_get_drvdata(dev);
      
       -       return snprintf(buf, PAGE_SIZE, "hello world\n");
       +       return sysfs_emit(buf, "hello world\n");
        }
      
        static ssize_t picolcd_operation_mode_delay_store(struct device *dev,
      
      CC: Julia Lawall <Julia.Lawall@inria.fr>
      CC: Nicolas Palix <nicolas.palix@imag.fr>
      CC: cocci@inria.fr
      Signed-off-by: default avatarLi Zhijian <lizhijian@fujitsu.com>
      68ea60a7
  6. Jan 17, 2024
  7. Jan 12, 2024
  8. Jan 10, 2024
  9. Jan 05, 2024
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: do not search for 'scripts' directory under arch/ · 358c3f8c
      Masahiro Yamada authored
      
      The 'scripts' directory was searched under arch/${SRCARCH} to copy
      arch/ia64/scripts, but commit cf8e8658 ("arch: Remove Itanium
      (IA-64) architecture") removed arch/ia64/ entirely.
      
      There is another 'scripts' directory in arch/um/, but this script
      is never executed with SRCARCH=um because UML does not support the
      linux-headers package.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      358c3f8c
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: use build ID instead of debug link for dbg package · 16c36f88
      Masahiro Yamada authored
      
      There are two ways of managing separate debug info files:
      
       [1] The executable contains the .gnu_debuglink section, which specifies
           the name and the CRC of the separate debug info file.
      
       [2] The executable contains a build ID, and the corresponding debug info
           file is placed in the .build-id directory.
      
      We could do both, but the former, which 'make deb-pkg' currently does,
      results in complicated installation steps because we need to manually
      strip the debug sections, create debug links, and re-sign the modules.
      Besides, it is not working with module compression.
      
      This commit abandons the approach [1], and instead opts for [2].
      
      Debian kernel commit de26137e2a9f ("Drop not needed extra step to add
      debug links") also stopped adding debug links.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      16c36f88
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: use more debhelper commands in builddeb · 5e73758b
      Masahiro Yamada authored
      
      Commit 36862e14 ("kbuild: deb-pkg: use dh_listpackages to know
      enabled packages") started to require the debhelper tool suite.
      
      Use more dh_* commands in create_package():
      
       - dh_installdocs to install copyright
       - dh_installchangelogs to install changelog
       - dh_compress to compress changelog
       - dh_fixperms to replace the raw chmod command
       - dh_gencontrol to replace the raw dpkg-gencontrol command
       - dh_md5sums to record the md5sum of included files
       - dh_builddeb to replace the raw dpkg-deb command
      
      Set DEB_RULES_REQUIRES_ROOT to 'no' in case debian/rules is executed
      directly.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      5e73758b
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: remove unneeded '-f $srctree/Makefile' in debian/rules · 68e262f8
      Masahiro Yamada authored
      
      This is unneeded because the Makefile in the output directory wraps
      the top-level Makefile in the srctree.
      
      Just run $(MAKE) irrespective of the build location.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      68e262f8
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: allow to run debian/rules from output directory · eaf80f7f
      Masahiro Yamada authored
      
      'make O=... deb-pkg' creates the debian directory in the output
      directory. However, currently it is impossible to run debian/rules
      created in the separate output directory.
      
      This commit delays the $(srctree) expansion by escaping '$' and by
      quoting the entire command, making it possible to run debian/rules in
      the output directory.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      eaf80f7f
    • Masahiro Yamada's avatar
      kbuild: deb-pkg: set DEB_* variables if debian/rules is directly executed · 159956f3
      Masahiro Yamada authored
      
      Since commit 491b146d ("kbuild: builddeb: Eliminate debian/arch
      use"), direct execution of debian/rules results in the following error:
      
        dpkg-architecture: error: unknown option 'DEB_HOST_MULTIARCH'
      
      The current code:
      
        dpkg-architecture -a$DEB_HOST_ARCH -qDEB_HOST_MULTIARCH
      
      ... does not look sensible because:
      
       - For this code to work correctly, DEB_HOST_ARCH must be pre-defined,
         which is true when the packages are built via dpkg-buildpackage.
         In this case, DEB_HOST_MULTIARCH is also likely defined, hence there
         is no need to query DEB_HOST_MULTIARCH in the first place.
      
       - If DEB_HOST_MULTIARCH is undefined, DEB_HOST_ARCH is likely undefined
         too. So, you cannot query DEB_HOST_MULTIARCH in this way. This is
         mostly the case where debian/rules is directly executed.
      
      When debian/rules is directly executed, querying DEB_HOST_MUCHARCH is
      not enough because we need to know DEB_{BUILD,HOST}_GNU_TYPE as well.
      
      All DEB_* variables are defined when the package build is initiated by
      dpkg-buildpackage, but otherwise, let's call dpkg-architecture to set
      all DEB_* environment variables.
      
      This requires dpkg 1.20.6 or newer because --print-format option
      was added in dpkg commit 7c54fa2b232e ("dpkg-architecture: Add a
      --print-format option").
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Reviewed-by: default avatarNicolas Schier <n.schier@avm.de>
      159956f3
  10. Jan 04, 2024
  11. Jan 03, 2024
  12. Dec 31, 2023
  13. Dec 29, 2023
Loading