Skip to content
Snippets Groups Projects
  1. Feb 24, 2021
  2. Jan 22, 2021
  3. Jul 31, 2020
  4. Jul 27, 2020
    • Al Viro's avatar
      unexport linux/elfcore.h · 1e6b57d6
      Al Viro authored
      
      It's unusable from userland - it uses elf_gregset_t, which is not
      provided by exported headers.  glibc has it in sys/procfs.h, but
      the same file defines struct elf_prstatus, so linux/elfcore.h can't
      be included once sys/procfs.h has been pulled.  Same goes for uclibc
      and dietlibc simply doesn't have elf_gregset_t defined anywhere.
      
      IOW, no userland source is including that thing.
      
      Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
      1e6b57d6
  5. May 17, 2020
    • Masahiro Yamada's avatar
      bpfilter: match bit size of bpfilter_umh to that of the kernel · 9371f86e
      Masahiro Yamada authored
      
      bpfilter_umh is built for the default machine bit of the compiler,
      which may not match to the bit size of the kernel.
      
      This happens in the scenario below:
      
      You can use biarch GCC that defaults to 64-bit for building the 32-bit
      kernel. In this case, Kbuild passes -m32 to teach the compiler to
      produce 32-bit kernel space objects. However, it is missing when
      building bpfilter_umh. It is built as a 64-bit ELF, and then embedded
      into the 32-bit kernel.
      
      The 32-bit kernel and 64-bit umh is a bad combination.
      
      In theory, we can have 32-bit umh running on 64-bit kernel, but we do
      not have a good reason to support such a usecase.
      
      The best is to match the bit size between them.
      
      Pass -m32 or -m64 to the umh build command if it is found in
      $(KBUILD_CFLAGS). Evaluate CC_CAN_LINK against the kernel bit-size.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      9371f86e
  6. May 12, 2020
    • Masahiro Yamada's avatar
      kbuild: use -MMD instead of -MD to exclude system headers from dependency · 30a77297
      Masahiro Yamada authored
      
      This omits system headers from the generated header dependency.
      
      System headers are not updated unless you upgrade the compiler. Nor do
      they contain CONFIG options, so fixdep does not need to parse them.
      
      Having said that, the effect of this optimization will be quite small
      because the kernel code generally does not include system headers
      except <stdarg.h>. Host programs include a lot of system headers,
      but there are not so many in the kernel tree.
      
      At first, keeping system headers in .*.cmd files might be useful to
      detect the compiler update, but there is no guarantee that <stdarg.h>
      is included from every file. So, I implemented a more reliable way in
      the previous commit.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      30a77297
  7. Apr 11, 2020
  8. Mar 25, 2020
  9. Mar 17, 2020
    • Eugeniy Paltsev's avatar
      initramfs: restore default compression behavior · 785d74ec
      Eugeniy Paltsev authored
      
      Even though INITRAMFS_SOURCE kconfig option isn't set in most of
      defconfigs it is used (set) extensively by various build systems.
      Commit f26661e1 ("initramfs: make initramfs compression choice
      non-optional") has changed default compression mode. Previously we
      compress initramfs using available compression algorithm. Now
      we don't use any compression at all by default.
      It significantly increases the image size in case of build system
      chooses embedded initramfs. Initially I faced with this issue while
      using buildroot.
      
      As of today it's not possible to set preferred compression mode
      in target defconfig as this option depends on INITRAMFS_SOURCE
      being set. Modification of all build systems either doesn't look
      like good option.
      
      Let's instead rewrite initramfs compression mode choices list
      the way that "INITRAMFS_COMPRESSION_NONE" will be the last option
      in the list. In that case it will be chosen only if all other
      options (which implements any compression) are not available.
      
      Signed-off-by: default avatarEugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      785d74ec
  10. Feb 03, 2020
    • Masahiro Yamada's avatar
      initramfs: do not show compression mode choice if INITRAMFS_SOURCE is empty · d4e9056d
      Masahiro Yamada authored
      Since commit ddd09bcc ("initramfs: make compression options not
      depend on INITRAMFS_SOURCE"), Kconfig asks the compression mode for
      the built-in initramfs regardless of INITRAMFS_SOURCE.
      
      It is technically simpler, but pointless from a UI perspective,
      Linus says [1].
      
      When INITRAMFS_SOURCE is empty, usr/Makefile creates a tiny default
      cpio, which is so small that nobody cares about the compression.
      
      This commit hides the Kconfig choice in that case. The default cpio
      is embedded without compression, which was the original behavior.
      
      [1]: https://lkml.org/lkml/2020/2/1/160
      
      
      
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d4e9056d
    • Masahiro Yamada's avatar
      kbuild: rename hostprogs-y/always to hostprogs/always-y · 5f2fb52f
      Masahiro Yamada authored
      
      In old days, the "host-progs" syntax was used for specifying host
      programs. It was renamed to the current "hostprogs-y" in 2004.
      
      It is typically useful in scripts/Makefile because it allows Kbuild to
      selectively compile host programs based on the kernel configuration.
      
      This commit renames like follows:
      
        always       ->  always-y
        hostprogs-y  ->  hostprogs
      
      So, scripts/Makefile will look like this:
      
        always-$(CONFIG_BUILD_BIN2C) += ...
        always-$(CONFIG_KALLSYMS)    += ...
            ...
        hostprogs := $(always-y) $(always-m)
      
      I think this makes more sense because a host program is always a host
      program, irrespective of the kernel configuration. We want to specify
      which ones to compile by CONFIG options, so always-y will be handier.
      
      The "always", "hostprogs-y", "hostprogs-m" will be kept for backward
      compatibility for a while.
      
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      5f2fb52f
  11. Jan 15, 2020
  12. Jan 14, 2020
  13. Jan 06, 2020
  14. Jan 03, 2020
    • Masahiro Yamada's avatar
      gen_initramfs_list.sh: fix 'bad variable name' error · cc976614
      Masahiro Yamada authored
      
      Prior to commit 858805b3 ("kbuild: add $(BASH) to run scripts with
      bash-extension"), this shell script was almost always run by bash since
      bash is usually installed on the system by default.
      
      Now, this script is run by sh, which might be a symlink to dash. On such
      distributions, the following code emits an error:
      
        local dev=`LC_ALL=C ls -l "${location}"`
      
      You can reproduce the build error, for example by setting
      CONFIG_INITRAMFS_SOURCE="/dev".
      
          GEN     usr/initramfs_data.cpio.gz
        ./usr/gen_initramfs_list.sh: 131: local: 1: bad variable name
        make[1]: *** [usr/Makefile:61: usr/initramfs_data.cpio.gz] Error 2
      
      This is because `LC_ALL=C ls -l "${location}"` contains spaces.
      Surrounding it with double-quotes fixes the error.
      
      Fixes: 858805b3 ("kbuild: add $(BASH) to run scripts with bash-extension")
      Reported-by: default avatarJory A. Pratt <anarchy@gentoo.org>
      Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
      cc976614
  15. Dec 09, 2019
  16. Dec 05, 2019
    • Masahiro Yamada's avatar
      arch: sembuf.h: make uapi asm/sembuf.h self-contained · 0fb9dc28
      Masahiro Yamada authored
      Userspace cannot compile <asm/sembuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/sembuf.h.s
        In file included from <command-line>:32:0:
        usr/include/asm/sembuf.h:17:20: error: field `sem_perm' has incomplete type
          struct ipc64_perm sem_perm; /* permissions .. see ipc.h */
                            ^~~~~~~~
        usr/include/asm/sembuf.h:24:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t sem_otime; /* last semop time */
          ^~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:25:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused1;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:26:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t sem_ctime; /* last change time */
          ^~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:27:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused2;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:29:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t sem_nsems; /* no. of semaphores in array */
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:30:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused3;
          ^~~~~~~~~~~~~~~~
        usr/include/asm/sembuf.h:31:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused4;
          ^~~~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <asm/ipcbuf.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-3-yamada.masahiro@socionext.com
      
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0fb9dc28
    • Masahiro Yamada's avatar
      arch: msgbuf.h: make uapi asm/msgbuf.h self-contained · 9ef0e004
      Masahiro Yamada authored
      Userspace cannot compile <asm/msgbuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/msgbuf.h.s
        In file included from usr/include/asm/msgbuf.h:6:0,
                         from <command-line>:32:
        usr/include/asm-generic/msgbuf.h:25:20: error: field `msg_perm' has incomplete type
          struct ipc64_perm msg_perm;
                            ^~~~~~~~
        usr/include/asm-generic/msgbuf.h:27:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_stime; /* last msgsnd time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:28:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_rtime; /* last msgrcv time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:29:2: error: unknown type name `__kernel_time_t'
          __kernel_time_t msg_ctime; /* last change time */
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:41:2: error: unknown type name `__kernel_pid_t'
          __kernel_pid_t msg_lspid; /* pid of last msgsnd */
          ^~~~~~~~~~~~~~
        usr/include/asm-generic/msgbuf.h:42:2: error: unknown type name `__kernel_pid_t'
          __kernel_pid_t msg_lrpid; /* last receive pid */
          ^~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <asm/ipcbuf.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-2-yamada.masahiro@socionext.com
      
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9ef0e004
    • Masahiro Yamada's avatar
      arch: ipcbuf.h: make uapi asm/ipcbuf.h self-contained · 5b009673
      Masahiro Yamada authored
      Userspace cannot compile <asm/ipcbuf.h> due to some missing type
      definitions.  For example, building it for x86 fails as follows:
      
          CC      usr/include/asm/ipcbuf.h.s
        In file included from usr/include/asm/ipcbuf.h:1:0,
                         from <command-line>:32:
        usr/include/asm-generic/ipcbuf.h:21:2: error: unknown type name `__kernel_key_t'
          __kernel_key_t  key;
          ^~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:22:2: error: unknown type name `__kernel_uid32_t'
          __kernel_uid32_t uid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:23:2: error: unknown type name `__kernel_gid32_t'
          __kernel_gid32_t gid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:24:2: error: unknown type name `__kernel_uid32_t'
          __kernel_uid32_t cuid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:25:2: error: unknown type name `__kernel_gid32_t'
          __kernel_gid32_t cgid;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:26:2: error: unknown type name `__kernel_mode_t'
          __kernel_mode_t  mode;
          ^~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:28:35: error: `__kernel_mode_t' undeclared here (not in a function)
          unsigned char  __pad1[4 - sizeof(__kernel_mode_t)];
                                           ^~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:31:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused1;
          ^~~~~~~~~~~~~~~~
        usr/include/asm-generic/ipcbuf.h:32:2: error: unknown type name `__kernel_ulong_t'
          __kernel_ulong_t __unused2;
          ^~~~~~~~~~~~~~~~
      
      It is just a matter of missing include directive.
      
      Include <linux/posix_types.h> to make it self-contained, and add it to
      the compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191030063855.9989-1-yamada.masahiro@socionext.com
      
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5b009673
    • Masahiro Yamada's avatar
      linux/scc.h: make uapi linux/scc.h self-contained · 1a18374f
      Masahiro Yamada authored
      Userspace cannot compile <linux/scc.h>
      
          CC      usr/include/linux/scc.h.s
        In file included from <command-line>:32:0:
        usr/include/linux/scc.h:20:20: error: `SIOCDEVPRIVATE' undeclared here (not in a function)
          SIOCSCCRESERVED = SIOCDEVPRIVATE,
                            ^~~~~~~~~~~~~~
      
      Include <linux/sockios.h> to make it self-contained, and add it to the
      compile-test coverage.
      
      Link: http://lkml.kernel.org/r/20191108055809.26969-1-yamada.masahiro@socionext.com
      
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1a18374f
  17. Nov 14, 2019
    • Masahiro Yamada's avatar
      kbuild: move headers_check rule to usr/include/Makefile · 7ecaf069
      Masahiro Yamada authored
      
      Currently, some sanity checks for uapi headers are done by
      scripts/headers_check.pl, which is wired up to the 'headers_check'
      target in the top Makefile.
      
      It is true compiling headers has better test coverage, but there
      are still several headers excluded from the compile test. I like
      to keep headers_check.pl for a while, but we can delete a lot of
      code by moving the build rule to usr/include/Makefile.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      7ecaf069
    • Masahiro Yamada's avatar
      kbuild: remove header compile test · fcbb8461
      Masahiro Yamada authored
      There are both positive and negative options about this feature.
      At first, I thought it was a good idea, but actually Linus stated a
      negative opinion (https://lkml.org/lkml/2019/9/29/227
      
      ). I admit it
      is ugly and annoying.
      
      The baseline I'd like to keep is the compile-test of uapi headers.
      (Otherwise, kernel developers have no way to ensure the correctness
      of the exported headers.)
      
      I will maintain a small build rule in usr/include/Makefile.
      Remove the other header test functionality.
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      fcbb8461
  18. Nov 11, 2019
  19. Oct 05, 2019
  20. Sep 25, 2019
    • Masahiro Yamada's avatar
      netfilter: ebtables: use __u8 instead of uint8_t in uapi header · 20ff1cb5
      Masahiro Yamada authored
      When CONFIG_UAPI_HEADER_TEST=y, exported headers are compile-tested to
      make sure they can be included from user-space.
      
      Currently, linux/netfilter_bridge/ebtables.h is excluded from the test
      coverage. To make it join the compile-test, we need to fix the build
      errors attached below.
      
      For a case like this, we decided to use __u{8,16,32,64} variable types
      in this discussion:
      
        https://lkml.org/lkml/2019/6/5/18
      
      
      
      Build log:
      
        CC      usr/include/linux/netfilter_bridge/ebtables.h.s
      In file included from <command-line>:32:0:
      ./usr/include/linux/netfilter_bridge/ebtables.h:126:4: error: unknown type name ‘uint8_t’
          uint8_t revision;
          ^~~~~~~
      ./usr/include/linux/netfilter_bridge/ebtables.h:139:4: error: unknown type name ‘uint8_t’
          uint8_t revision;
          ^~~~~~~
      ./usr/include/linux/netfilter_bridge/ebtables.h:152:4: error: unknown type name ‘uint8_t’
          uint8_t revision;
          ^~~~~~~
      
      Signed-off-by: default avatarMasahiro Yamada <yamada.masahiro@socionext.com>
      Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
      20ff1cb5
  21. Sep 24, 2019
  22. Aug 29, 2019
  23. Jul 23, 2019
Loading