04 Jan, 2012

1 commit


29 Oct, 2010

1 commit

  • * 'kbuild' of git://git.kernel.org/pub/scm/linux/kernel/git/mmarek/kbuild-2.6:
    initramfs: Fix build break on symbol-prefixed archs
    initramfs: fix initramfs size calculation
    initramfs: generalize initramfs_data.xxx.S variants
    scripts/kallsyms: Enable error messages while hush up unnecessary warnings
    scripts/setlocalversion: update comment
    kbuild: Use a single clean rule for kernel and external modules
    kbuild: Do not run make clean in $(srctree)
    scripts/mod/modpost.c: fix commentary accordingly to last changes
    kbuild: Really don't clean bounds.h and asm-offsets.h

    Linus Torvalds
     

27 Oct, 2010

1 commit

  • When calling syscall service routines in kernel, some of arguments should
    be user pointers but were missing __user markup on string literals. Add
    it. Removes some sparse warnings.

    Signed-off-by: Namhyung Kim
    Cc: Phillip Lougher
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Namhyung Kim
     

29 Sep, 2010

1 commit

  • The size of a built-in initramfs is calculated in init/initramfs.c by
    "__initramfs_end - __initramfs_start". Those symbols are defined in the
    linker script include/asm-generic/vmlinux.lds.h:

    #define INIT_RAM_FS \
    . = ALIGN(PAGE_SIZE); \
    VMLINUX_SYMBOL(__initramfs_start) = .; \
    *(.init.ramfs) \
    VMLINUX_SYMBOL(__initramfs_end) = .;

    If the initramfs file has an odd number of bytes, the "__initramfs_end"
    symbol points to an odd address, for example, the symbols in the
    System.map might look like:

    0000000000572000 T __initramfs_start
    00000000005bcd05 T __initramfs_end :
    540a9c: eb cf f0 78 00 24 stmg %r12,%r15,120(%r15),
    540aa2: c0 10 00 01 8a af larl %r1,572000
    540aa8: c0 c0 00 03 e1 2e larl %r12,5bcd04
    (Instead of 5bcd05)
    ...
    540abe: 1b c1 sr %r12,%r1

    To fix the problem, this patch introduces the global variable
    __initramfs_size, which is calculated in the "usr/initramfs_data.S" file.
    The populate_rootfs() function can then use the start marker of the
    .init.ramfs section and the value of __initramfs_size for loading the
    initramfs. Because the start marker and size is sufficient, the
    __initramfs_end symbol is no longer needed and is removed.

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

    Hendrik Brueckner
     

25 Apr, 2010

1 commit

  • The unpack routine fails to handle the decompress_method() returning
    unrecognised decompressor (compress_name == NULL). This results in the
    routine looping eventually oopsing on an out of bounds memory access.

    Note this bug is usually hidden, only triggering on trailing junk after
    one or more correct compressed blocks. The case of the compressed archive
    being complete junk is (by accident?) caught by the if (state != Reset)
    check because state is initialised to Start, but not updated due to the
    decompressor not having been called. Obviously if the junk is trailing a
    correctly decompressed buffer, state == Reset from the previous call to
    the decompressor.

    Signed-off-by: Phillip Lougher
    Reported-by: Aaro Koskinen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Phillip Lougher
     

07 Mar, 2010

1 commit


16 Dec, 2009

1 commit

  • The decompressors return error by calling a supplied error function, and/or
    by returning an error return value. The initramfs code, however, fails to
    check the exit code returned by the decompressor, and only checks the error
    status set by calling the error function.

    This patch adds a return code check and calls the error function.

    Signed-off-by: Phillip Lougher
    LKML-Reference:
    Signed-off-by: H. Peter Anvin

    Phillip Lougher
     

07 May, 2009

1 commit

  • With the removal of duplicate unpack_to_rootfs() (commit
    df52092f3c97788592ef72501a43fb7ac6a3cfe0) the messages displayed do not
    actually correspond to what the kernel is doing. In addition, depending
    if ramdisks are supported or not, the messages are not at all the same.

    So keep the messages more in sync with what is really doing the kernel,
    and only display a second message in case of failure. This also ensure
    that the printk message cannot be split by other printk's.

    Signed-off-by: Eric Piel
    Acked-by: H. Peter Anvin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Piel
     

14 Apr, 2009

2 commits

  • Change cb6ff208076b5f434db1b8c983429269d719cef5 ("NOMMU: Support XIP on
    initramfs") seems to have broken booting from initramfs with /sbin/init
    being a hardlink.

    It seems like the logic required for XIP on nommu, i.e. ftruncate to
    reported cpio header file size (body_len) is broken for hardlinks, which
    have a reported size of 0, and the truncate thus nukes the contents of the
    file (in my case busybox), making boot impossible and ending with runaway
    loop modprobe binfmt-0000 - and of course 0000 is not a valid binary
    format.

    My fix is to only call ftruncate if size is non-zero which fixes things
    for me, but I'm not certain whether this will break XIP for those files on
    nommu systems, although I would guess not.

    Signed-off-by: Randy Robertson
    Acked-by: David Howells
    Acked-by: Paul Mundt
    Acked-by: H. Peter Anvin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Robertson
     
  • init/initramfs.c:520: warning: 'clean_rootfs' defined but not used

    Signed-off-by: Nikanth Karthikesan
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nikanth Karthikesan
     

03 Apr, 2009

1 commit

  • initramfs uses printk without a linefeed, then does some work, then uses
    printk to finish the message off. However if some other code does a
    printk in between, then the messages get mixed together. Better for each
    message to be an independent line...

    Example of problem that this fixes:

    checking if image is initramfs...Switched to high resolution mode on CPU 1
    Switched to high resolution mode on CPU 0
    it is

    Signed-off-by: Simon Kitching
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Simon Kitching
     

29 Mar, 2009

2 commits

  • * git://git.kernel.org/pub/scm/linux/kernel/git/arjan/linux-2.6-async-for-30:
    fastboot: remove duplicate unpack_to_rootfs()
    ide/net: flip the order of SATA and network init
    async: remove the temporary (2.6.29) "async is off by default" code

    Fix up conflicts in init/initramfs.c manually

    Linus Torvalds
     
  • we check if initrd is initramfs first and then do the real unpack. The check
    isn't required, we can directly do unpack. If the initrd isn't an
    initramfs, we can remove the garbage. In my laptop, this saves 0.1s boot
    time.

    This patch penalizes non-initramfs initrd case, but nowadays, initramfs is
    the most widely used method for initrds.

    Signed-off-by: Shaohua Li
    Acked-by: Arjan van de Ven
    Signed-off-by: Ingo Molnar

    Li, Shaohua
     

15 Jan, 2009

1 commit

  • Impact: More consistent behaviour, avoid policy in the kernel

    Upgrade/downgrade initrd/initramfs decompression failure from
    inconsistently a panic or a KERN_ALERT message to a KERN_EMERG event.
    It is, however, possible do design a system which can recover from
    this (using the kernel builtin code and/or the internal initramfs),
    which means this is policy, not a technical necessity.

    A good way to handle this would be to have a panic-level=X option, to
    force a panic on a printk above a certain level. That is a separate
    patch, however.

    Signed-off-by: H. Peter Anvin

    H. Peter Anvin
     

13 Jan, 2009

1 commit


10 Jan, 2009

2 commits


09 Jan, 2009

1 commit


08 Jan, 2009

1 commit

  • Support XIP on files unpacked from the initramfs image on NOMMU systems. This
    simply requires the length of the file to be preset so that the ramfs fs can
    attempt to garner sufficient contiguous storage to store the file (NOMMU mmap
    can only map contiguous RAM).

    All the other bits to do XIP on initramfs files are present:

    (1) ramfs's truncate attempts to allocate a contiguous run of pages when a
    file is truncated upwards from nothing.

    (2) ramfs sets BDI on its files to indicate direct mapping is possible, and
    that its files can be mapped for read, write and exec.

    (3) NOMMU mmap() will use the above bits to determine that it can do XIP.
    Possibly this needs better controls, because it will _always_ try and do
    XIP.

    One disadvantage of this very simplistic approach is that sufficient space
    will be allocated to store the whole file, and not just the bit that would be
    XIP'd. To deal with this, though, the initramfs unpacker would have to be
    able to parse the file contents.

    Signed-off-by: David Howells
    Acked-by: Paul Mundt

    David Howells
     

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
     

05 Jan, 2009

1 commit

  • Impact: New code for initramfs decompression, new features

    This is the second part of the bzip2/lzma patch

    The bzip patch is based on an idea by Christian Ludwig, includes support for
    compressing the kernel with bzip2 or lzma rather than gzip. Both
    compressors give smaller sizes than gzip. Lzma's decompresses faster
    than bzip2.

    It also supports ramdisks and initramfs' compressed using these two
    compressors.

    The functionality has been successfully used for a couple of years by
    the udpcast project

    This version applies to "tip" kernel 2.6.28

    This part contains:
    - support for new compressions (bzip2 and lzma) in initramfs and
    old-style ramdisk
    - config dialog for kernel compression (but new kernel compressions
    not yet supported)

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

    Alain Knaff
     

17 Oct, 2008

1 commit

  • When unpacking the cpio into the initramfs, mtimes are not preserved by
    default. This patch adds an INITRAMFS_PRESERVE_MTIME option that allows
    mtimes stored in the cpio image to be used when constructing the
    initramfs.

    For embedded applications that run exclusively out of the initramfs, this
    is invaluable:

    When building embedded application initramfs images, its nice to know when
    the files were actually created during the build process - that makes it
    easier to see what files were modified when so we can compare the files
    that are being used on the image with the files used during the build
    process. This might help (for example) to determine if the target system
    has all the updated files you expect to see w/o having to check MD5s etc.

    In our environment, the whole system runs off the initramfs partition, and
    seeing the modified times of the shared libraries (for example) helps us
    find bugs that may have been introduced by the build system incorrectly
    propogating outdated shared libraries into the image.

    Similarly, many of the initializion/configuration files in /etc might be
    dynamically built by the build system, and knowing when they were modified
    helps us sanity check whether the target system has the "latest" files
    etc.

    Finally, we might use last modified times to determine whether a hot fix
    should be applied or not to the running ramfs.

    Signed-off-by: Nye Liu
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Nye Liu
     

26 Jul, 2008

1 commit

  • Inflate requires some dynamic memory allocation very early in the boot
    process and this is provided with a set of four functions:
    malloc/free/gzip_mark/gzip_release.

    The old inflate code used a mark/release strategy rather than implement
    free. This new version instead keeps a count on the number of outstanding
    allocations and when it hits zero, it resets the malloc arena.

    This allows removing all the mark and release implementations and unifying
    all the malloc/free implementations.

    The architecture-dependent code must define two addresses:
    - free_mem_ptr, the address of the beginning of the area in which
    allocations should be made
    - free_mem_end_ptr, the address of the end of the area in which
    allocations should be made. If set to 0, then no check is made on
    the number of allocations, it just grows as much as needed

    The architecture-dependent code can also provide an arch_decomp_wdog()
    function call. This function will be called several times during the
    decompression process, and allow to notify the watchdog that the system is
    still running. If an architecture provides such a call, then it must
    define ARCH_HAS_DECOMP_WDOG so that the generic inflate code calls
    arch_decomp_wdog().

    Work initially done by Matt Mackall, updated to a recent version of the
    kernel and improved by me.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Thomas Petazzoni
    Cc: Matt Mackall
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Mikael Starvik
    Cc: Jesper Nilsson
    Cc: Haavard Skinnemoen
    Cc: David Howells
    Cc: Ingo Molnar
    Cc: Thomas Gleixner
    Cc: Andi Kleen
    Cc: "H. Peter Anvin"
    Acked-by: Paul Mundt
    Acked-by: Yoshinori Sato
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Petazzoni
     

29 Apr, 2008

1 commit

  • Instead of using the malloc() and free() wrappers needed by the
    lib/inflate.c code for allocations, simply use kmalloc() and kfree() in the
    initramfs code. This is needed for a further lib/inflate.c-related cleanup
    patch that will remove the malloc() and free() functions.

    Take that opportunity to remove the useless kmalloc() return value
    cast.

    Based on work done by Matt Mackall.

    Signed-off-by: Thomas Petazzoni
    Signed-off-by: Matt Mackall
    Cc: Jan Engelhardt
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thomas Petazzoni
     

16 Mar, 2008

1 commit

  • This essentially reverts commit 71fc47a9adf8ee89e5c96a47222915c5485ac437
    ("ACPI: basic initramfs DSDT override support"), because the code simply
    isn't ready.

    It did ugly things to the init sequence to populate the rootfs image
    early, but that just ended up showing other problems with the whole
    approach. The fact is, the VFS layer simply isn't initialized this
    early, and the relevant ACPI code should either run much later, or this
    shouldn't be done at all.

    For 2.6.25, we'll just pick the latter option. We can revisit this
    concept later if necessary.

    Cc: Dave Hansen
    Cc: Tilman Schmidt
    Cc: Andrew Morton
    Cc: Thomas Renninger
    Cc: Eric Piel
    Cc: Len Brown
    Cc: Christoph Hellwig
    Cc: Markus Gaugusch
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

07 Feb, 2008

2 commits

  • The basics of DSDT from initramfs. In case this option is selected,
    populate_rootfs() is called a bit earlier to have the initramfs content
    available during ACPI initialization.

    This is a very similar path to the one available at
    http://gaugusch.at/kernel.shtml but with some update in the
    documentation, default set to No and the change of populate_rootfs() the
    "Jeff Mahony way" (which avoids reading the initramfs twice).

    Signed-off-by: Thomas Renninger
    Signed-off-by: Eric Piel
    Signed-off-by: Len Brown

    Markus Gaugusch
     
  • Given that init/Makefile includes initramfs.c in the build only if
    CONFIG_BLK_DEV_INITRD is defined, there seems to be no point checking for
    it yet again.

    Signed-off-by: Robert P. J. Day
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Robert P. J. Day
     

27 Jul, 2007

1 commit


12 Feb, 2007

1 commit

  • Add retain_initrd option to control freeing of initrd memory after
    extraction. By default, free memory as previously.

    The first boot will need to hold a copy of the in memory fs for the second
    boot. This image can be large (much larger than the kernel), hence we can
    save time when the memory loader is slow. Also, it reduces the memory
    footprint while extracting the first boot since you don't need another copy
    of the fs.

    Signed-off-by: Michael Neuling
    Cc: "Randy.Dunlap"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michael Neuling
     

12 Dec, 2006

1 commit


08 Dec, 2006

1 commit

  • It turns out that the "-c" option of cpio is highly unportable even between
    distros let alone unix variants, and may actually make the wrong type of
    cpio archive. I just wasted quite some time on this, and the kernel can
    detect this and warn about it (it's __init memory so it gets thrown away
    and thus there is no runtime overhead)

    Signed-off-by: Arjan van de Ven
    Cc: Al Viro
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

27 Jun, 2006

1 commit

  • This patch ensures that initramfs overwrites work correctly, even when dealing
    with device nodes of different types. Furthermore, when replacing a file
    which already exists, we must make very certain that we truncate the existing
    file.

    Signed-off-by: H. Peter Anvin
    Cc: Michael Neuling
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    H. Peter Anvin
     

16 May, 2006

1 commit

  • Copy the filenames of hardlinks when inserting them into the hash, since
    the "name" pointer may point to scratch space (name_buf). Not doing so
    results in corruption if the scratch space is later overwritten: the wrong
    file may be hardlinked, or, if the scratch space contains garbage, the link
    will fail and a 0-byte file will be created instead.

    Signed-off-by: Mark Huang
    Acked-by: Al Viro
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mark Huang
     

27 Mar, 2006

1 commit


26 Mar, 2006

1 commit

  • Initramfs initrd images do not need a ramdisk device, so remove this
    restriction in Kconfig. BLK_DEV_RAM=n saves about 13k on i386. Also
    without ramdisk device there's no need for "dry run", so initramfs unpacks
    much faster.

    People using cramfs, squashfs, or gzipped ext2/minix initrd images are
    probably smart enough not to turn off ramdisk support by accident.

    Cc: Al Viro
    Cc: Christoph Hellwig
    Cc: "H. Peter Anvin"
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Zdenek Pavlas
     

11 Feb, 2006

1 commit

  • It is possible that the reserved crashkernel region can be overlapped with
    initrd since the bootloader sets the initrd location. When the initrd
    region is freed, the second kernel memory will not be contiguous. The
    Kexec_load can cause an oops since there is no contiguous memory to write
    the second kernel or this memory could be used in the first kernel itself
    and may not be part of the dump. For example, on powerpc, the initrd is
    located at 36MB and the crashkernel starts at 32MB. The kexec_load caused
    panic since writing into non-allocated memory (after 36MB). We could see
    the similar issue even on other archs.

    One possibility is to move the initrd outside of crashkernel region. But,
    the initrd region will be freed anyway before the system is up. This patch
    fixes this issue and frees only regions that are not part of crashkernel
    memory in case overlaps.

    Signed-off-by: Haren Myneni
    Acked-by: "Eric W. Biederman"
    Cc: Vivek Goyal
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Haren Myneni
     

13 Sep, 2005

1 commit

  • Besides freeing initrd memory, also clear out the now dangling pointers to
    it, to make sure accidental late use attempts can be detected.

    Signed-off-by: Jan Beulich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Beulich
     

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