• Nye Liu's avatar
    initramfs: add option to preserve mtime from initramfs cpio images · 889d51a1
    Nye Liu authored
    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: default avatarNye Liu <nyet@nyet.org>
    Cc: Al Viro <viro@zeniv.linux.org.uk>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
    889d51a1
initramfs.c 12.7 KB