25 Sep, 2019

1 commit

  • Since 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig")
    "make clean" leaves behind compressed initramfs images. Example:

    $ make defconfig
    $ sed -i 's|CONFIG_INITRAMFS_SOURCE=""|CONFIG_INITRAMFS_SOURCE="/tmp/ir.cpio"|' .config
    $ make olddefconfig
    $ make -s
    $ make -s clean
    $ git clean -ndxf | grep initramfs
    Would remove usr/initramfs_data.cpio.gz

    clean rules do not have CONFIG_* context so they do not know which
    compression format was used. Thus they don't know which files to delete.

    Tell clean to delete all possible compression formats.

    Once patched usr/initramfs_data.cpio.gz and friends are deleted by
    "make clean".

    Link: http://lkml.kernel.org/r/20190722063251.55541-1-gthelen@google.com
    Fixes: 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig")
    Signed-off-by: Greg Thelen
    Cc: Nicholas Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Greg Thelen
     

08 Jul, 2019

1 commit

  • Multiple people have suggested compile-testing UAPI headers to ensure
    they can be really included from user-space. "make headers_check" is
    obviously not enough to catch bugs, and we often leak unresolved
    references to user-space.

    Use the new header-test-y syntax to implement it. Please note exported
    headers are compile-tested with a completely different set of compiler
    flags. The header search path is set to $(objtree)/usr/include since
    exported headers should not include unexported ones.

    We use -std=gnu89 for the kernel space since the kernel code highly
    depends on GNU extensions. On the other hand, UAPI headers should be
    written in more standardized C, so they are compiled with -std=c90.
    This will emit errors if C++ style comments, the keyword 'inline', etc.
    are used. Please use C style comments (/* ... */), '__inline__', etc.
    in UAPI headers.

    There is additional compiler requirement to enable this test because
    many of UAPI headers include , , ,
    etc. directly or indirectly. You cannot use kernel.org pre-built
    toolchains [1] since they lack .

    I reused CONFIG_CC_CAN_LINK to check the system header availability.
    The intention is slightly different, but a compiler that can link
    userspace programs provide system headers.

    For now, a lot of headers need to be excluded because they cannot
    be compiled standalone, but this is a good start point.

    [1] https://mirrors.edge.kernel.org/pub/tools/crosstool/index.html

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Sam Ravnborg

    Masahiro Yamada
     

10 Dec, 2018

1 commit


22 Aug, 2018

1 commit


03 Nov, 2017

1 commit

  • This is a follow-up to commit 57ddfdaa9a72 ("initramfs: fix disabling of
    initramfs (and its compression)"). This particular commit fixed the use
    case where we build the kernel with an initramfs with no compression,
    and then we build the kernel with no initramfs.

    Now this still left us with the same case as described here:

    http://lkml.kernel.org/r/20170521033337.6197-1-f.fainelli@gmail.com

    not working with initramfs compression. This can be seen by the
    following steps/timestamps:

    https://www.spinics.net/lists/kernel/msg2598153.html

    .initramfs_data.cpio.gz.cmd is correct:

    cmd_usr/initramfs_data.cpio.gz := /bin/bash
    ./scripts/gen_initramfs_list.sh -o usr/initramfs_data.cpio.gz -u 1000 -g 1000 /home/fainelli/work/uclinux-rootfs/romfs /home/fainelli/work/uclinux-rootfs/misc/initramfs.dev

    and was generated the first time we did generate the gzip initramfs, so
    the command has not changed, nor its arguments, so we just don't call
    it, no initramfs cpio is re-generated as a consequence.

    The fix for this problem is just to properly keep track of the
    .initramfs_cpio_data.d file by suffixing it with the compression
    extension. This takes care of properly tracking dependencies such that
    the initramfs get (re)generated any time files are added/deleted etc.

    Link: http://lkml.kernel.org/r/20170930033936.6722-1-f.fainelli@gmail.com
    Fixes: db2aa7fd15e8 ("initramfs: allow again choice of the embedded initramfs compression algorithm")
    Fixes: 9e3596b0c653 ("kbuild: initramfs cleanup, set target from Kconfig")
    Signed-off-by: Florian Fainelli
    Cc: "Francisco Blas Izquierdo Riera (klondike)"
    Cc: Nicholas Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Florian Fainelli
     

02 Nov, 2017

1 commit

  • Many source files in the tree are missing licensing information, which
    makes it harder for compliance tools to determine the correct license.

    By default all files without license information are under the default
    license of the kernel, which is GPL version 2.

    Update the files which contain no license information with the 'GPL-2.0'
    SPDX license identifier. The SPDX identifier is a legally binding
    shorthand, which can be used instead of the full boiler plate text.

    This patch is based on work done by Thomas Gleixner and Kate Stewart and
    Philippe Ombredanne.

    How this work was done:

    Patches were generated and checked against linux-4.14-rc6 for a subset of
    the use cases:
    - file had no licensing information it it.
    - file was a */uapi/* one with no licensing information in it,
    - file was a */uapi/* one with existing licensing information,

    Further patches will be generated in subsequent months to fix up cases
    where non-standard license headers were used, and references to license
    had to be inferred by heuristics based on keywords.

    The analysis to determine which SPDX License Identifier to be applied to
    a file was done in a spreadsheet of side by side results from of the
    output of two independent scanners (ScanCode & Windriver) producing SPDX
    tag:value files created by Philippe Ombredanne. Philippe prepared the
    base worksheet, and did an initial spot review of a few 1000 files.

    The 4.13 kernel was the starting point of the analysis with 60,537 files
    assessed. Kate Stewart did a file by file comparison of the scanner
    results in the spreadsheet to determine which SPDX license identifier(s)
    to be applied to the file. She confirmed any determination that was not
    immediately clear with lawyers working with the Linux Foundation.

    Criteria used to select files for SPDX license identifier tagging was:
    - Files considered eligible had to be source code files.
    - Make and config files were included as candidates if they contained >5
    lines of source
    - File already had some variant of a license header in it (even if
    Reviewed-by: Philippe Ombredanne
    Reviewed-by: Thomas Gleixner
    Signed-off-by: Greg Kroah-Hartman

    Greg Kroah-Hartman
     

06 Jan, 2017

2 commits

  • Rather than keep a list of all possible compression types in the
    Makefile, set the target explicitly from Kconfig.

    Reviewed-by: Francisco Blas Izquierdo Riera (klondike)
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     
  • When using initramfs compression, the data file compression suffix
    gets quotes pulled in from Kconfig, e.g., initramfs_data.cpio".gz"
    which make does not match a target and causes rebuild.

    Fix this by filtering out quotes from the Kconfig string.

    Fixes: 35e669e1a254 ("initramfs: select builtin initram compression algorithm on KConfig instead of Makefile")
    Reviewed-by: Francisco Blas Izquierdo Riera (klondike)
    Signed-off-by: Nicholas Piggin
    Signed-off-by: Linus Torvalds

    Nicholas Piggin
     

15 Dec, 2016

1 commit


13 Nov, 2013

1 commit

  • When expert configuration option(CONFIG_EXPERT) is enabled, menuconfig
    offers a choice of compression algorithm to compress initial ramfs image;
    This choice is stored into CONFIG_RD_* variables. But usr/Makefile uses
    earlier INITRAMFS_COMPRESSION_* macros to build initial ramfs file. Since
    none of them is defined, resulting 'initramfs_data.cpio' file remains
    un-compressed.

    This patch updates the Makefile to use CONFIG_RD_* variables and adds
    support for LZ4 compression algorithm. Also updates the
    'gen_initramfs_list.sh' script to check whether a selected compression
    command is accessible or not. And fall-back to default gzip(1)
    compression when it is not.

    Signed-off-by: P J P
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    P J P
     

14 Jan, 2011

1 commit

  • This implements the API defined in which is
    used for kernel, initramfs, and initrd decompression. This patch together
    with the first patch is enough for XZ-compressed initramfs and initrd;
    XZ-compressed kernel will need arch-specific changes.

    The buffering requirements described in decompress_unxz.c are stricter
    than with gzip, so the relevant changes should be done to the
    arch-specific code when adding support for XZ-compressed kernel.
    Similarly, the heap size in arch-specific pre-boot code may need to be
    increased (30 KiB is enough).

    The XZ decompressor needs memmove(), memeq() (memcmp() == 0), and
    memzero() (memset(ptr, 0, size)), which aren't available in all
    arch-specific pre-boot environments. I'm including simple versions in
    decompress_unxz.c, but a cleaner solution would naturally be nicer.

    Signed-off-by: Lasse Collin
    Cc: "H. Peter Anvin"
    Cc: Alain Knaff
    Cc: Albin Tonnerre
    Cc: Phillip Lougher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Lasse Collin
     

29 Sep, 2010

1 commit

  • Remove initramfs_data.{lzo,lzma,gz,bz2}.S variants and use a common
    implementation in initramfs_data.S. The common implementation expects the
    file name of the initramfs to be defined in INITRAMFS_IMAGE.

    Change the Makefile to set the INITRAMFS_IMAGE define symbol according
    to the selected compression method.

    Signed-off-by: Hendrik Brueckner
    Cc: WANG Cong
    Acked-by: Michal Marek
    Acked-by: "H. Peter Anvin"
    Cc: Hendrik Brueckner
    Cc: Heiko Carstens
    Cc: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Michal Marek

    Hendrik Brueckner
     

28 May, 2010

1 commit


20 Sep, 2009

1 commit


01 Apr, 2009

1 commit


20 Feb, 2009

1 commit

  • Impact: Avoids silent environment dependency

    Make builtin initramfs compression an explicit configurable. The
    previous version would pick a compression based on the binaries which
    were installed on the system, which could lead to unexpected results.
    It is now explicitly configured, and not having the appropriate
    binaries installed on the build host is simply an error.

    Signed-off-by: Alain Knaff
    Signed-off-by: H. Peter Anvin

    Alain Knaff
     

07 Jan, 2009

1 commit

  • Impact: Resolves build failures in some configurations

    Makes it possible to disable CONFIG_RD_GZIP . In that case, the
    built-in initramfs will be compressed by whatever compressor is
    available (bzip2 or lzma) or left uncompressed if none is available.

    It also removes a couple of warnings which occur when no ramdisk
    compression at all is chosen.

    It also restores the select ZLIB_INFLATE in drivers/block/Kconfig
    which somehow came missing. This is needed to activate compilation of
    the stuff in zlib_deflate.

    Signed-off-by: Alain Knaff
    Signed-off-by: H. Peter Anvin

    Alain Knaff
     

12 Feb, 2007

1 commit

  • The file init/initramfs.c is always compiled and linked in the kernel
    vmlinux even when BLK_DEV_RAM and BLK_DEV_INITRD are disabled and the
    system isn't using any form of an initramfs or initrd. In this situation
    the code is only used to unpack a (static) default initial rootfilesystem.
    The current init/initramfs.c code. usr/initramfs_data.o compiles to a size
    of ~15 kbytes. Disabling BLK_DEV_RAM and BLK_DEV_INTRD shrinks the kernel
    code size with ~60 Kbytes.

    This patch avoids compiling in the code and data for initramfs support if
    CONFIG_BLK_DEV_INITRD is not defined. Instead of the initramfs code and
    data it uses a small routine in init/noinitramfs.c to setup an initial
    static default environment for mounting a rootfilesystem later on in the
    kernel initialisation process. The new code is: 164 bytes of size.

    The patch is separated in two parts:
    1) doesn't compile initramfs code when CONFIG_BLK_DEV_INITRD is not set
    2) changing all plaforms vmlinux.lds.S files to not reserve an area of
    PAGE_SIZE when CONFIG_BLK_DEV_INITRD is not set.

    [deweerdt@free.fr: warning fix]
    Signed-off-by: Jean-Paul Saman
    Cc: Al Viro
    Cc:
    Signed-off-by: Frederik Deweerdt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jean-Paul Saman
     

26 Nov, 2006

1 commit

  • Fix bug 7401.

    Handle more than one source dir or file list to the initramfs gen scripts.

    The Kconfig help for INITRAMFS_SOURCE claims that you can specify multiple
    space-separated sources in order to allow unprivileged users to build an
    image. There are two bugs in the current implementation that prevent this
    from working.

    First, we pass "file1 dir2" to the gen_initramfs_list.sh script, which it
    obviously can't open.

    Second, gen_initramfs_list.sh -l outputs multiple definitions for
    deps_initramfs -- one for each argument.

    Signed-off-by: Thomas Chou
    Cc: Sam Ravnborg
    Acked-by: Matthew Wilcox
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Chou
     

25 Sep, 2006

1 commit

  • Consistently decide when to rebuild a target across all of
    if_changed, if_changed_dep, if_changed_rule.
    PHONY targets are now treated alike (ignored) for all targets

    While add it make Kbuild.include almost readable by factoring out a few
    bits to some common variables and reuse this in Makefile.build.

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

08 Aug, 2006

1 commit

  • When a file supplied via CONFIG_INITRAMFS pointed to a file
    for which kbuild had a rule to compile it (foo.c => foo.o)
    then kbuild would compile the file before adding the
    file to the initramfs.

    Teach make that files included in initramfs shall not be updated by adding
    an 'empty command'. (See "Using Empty Commands" in info make).

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

10 Jun, 2006

1 commit


11 Apr, 2006

1 commit

  • initramfs.cpio.gz being build in usr/ and included in the
    kernel was not rebuild when the included files changed.

    To fix this the following was done:
    - let gen_initramfs.sh generate a list of files and directories included
    in the initramfs
    - gen_initramfs generate the gzipped cpio archive so we could simplify
    the kbuild file (Makefile)
    - utilising the kbuild infrastructure so when uid/gid root mapping changes
    the initramfs will be rebuild

    With this change we have a much more robust initramfs generation.

    Signed-off-by: Sam Ravnborg

    Sam Ravnborg
     

26 Jul, 2005

1 commit

  • Kbuild.include is a placeholder for definitions originally present in
    both the top-level Makefile and scripts/Makefile.build.
    There were a slight difference in the filechk definition, so the most videly
    used version was kept and usr/Makefile was adopted for this syntax.

    Signed-off-by: Sam Ravnborg
    ---

    Sam Ravnborg
     

17 Apr, 2005

1 commit

  • Initial git repository build. I'm not bothering with the full history,
    even though we have it. We can create a separate "historical" git
    archive of that later if we want to, and in the meantime it's about
    3.2GB when imported into git - space that would just make the early
    git days unnecessarily complicated, when we don't have a lot of good
    infrastructure for it.

    Let it rip!

    Linus Torvalds