• Dmitry Safonov's avatar
    gen_init_cpio: Apply mtime supplied by user to all file types · f3b2306b
    Dmitry Safonov authored
    Currently gen_init_cpio -d <timestamp> is applied to symlinks,
    directories and special files. These files are created by
    gen_init_cpio from their description. Without <timestamp> option
    current time(NULL) is used. And regular files that go in initramfs
    are created before cpio generation, so their mtime(s) are preserved.
    
    This is usually not an issue as reproducible builds should rebuild
    everything in the distribution, including binaries, configs and whatever
    other regular files may find their way into kernel's initramfs.
    
    On the other hand, gen_initramfs.sh usage claims:
    >	-d <date>      Use date for all file mtime values
    
    Ar Arista initramfs files are managed with version control system
    that preserves mtime. Those are configs, boot parameters, init scripts,
    version files, platform-specific files, probably some others, too.
    
    While it's certainly possible to work this around by copying the file
    into temp directory and adjusting mtime prior to gen_init_cpio call,
    I don't see why it needs workarounds.
    
    The intended user of -d <date> option is the one that needs to create
    a reproducible build, see commit a8b8017c ("initramfs: Use
    KBUILD_BUILD_TIMESTAMP for generated entries"). If a user wants
    the build reproduction, they use -d <date>, which can be set on all
    types of files, without surprising exceptions and workarounds.
    Let's KISS here and just apply the time that user specified
    with -d option.
    Based-on-a-patch-by: default avatarBaptiste Covolato <baptiste@arista.com>
    Link: https://lore.kernel.org/lkml/20181025215133.20138-1-baptiste@arista.com/Signed-off-by: default avatarDmitry Safonov <dima@arista.com>
    Signed-off-by: default avatarMasahiro Yamada <masahiroy@kernel.org>
    f3b2306b
gen_init_cpio.c 14.7 KB