• Andrew Morton's avatar
    [PATCH] Fix sprintf modifiers in usr/gen_init_cpio.c for cygwin · 499104b6
    Andrew Morton authored
    From: Pragnesh Sampat <pragnesh.sampat@timesys.com>
    
    The file initramfs_data.cpio is slightly different when generated on
    cygwin, compared to linux, which causes the kernel to panic with the
    message "no cpio magic" (See Documentation/early-userspace/README).
    
    The problem in cpio generation is due to the difference in sprintf
    modifiers on cygwin.  The code uses "%08ZX" for strlen of a device node.
    printf man pages discourages "Z" and has 'z' instead.  Both of these are
    not available on cygwin sprintf (at least some versions of cygwin).  The
    net result of all of this is that the generated file literally contains
    "ZX" and then the strlen after that and messes up that 110 offset etc.  The
    file is 516 bytes long on the system that I tested and on linux it is 512
    bytes.
    
    The fix below just uses "%08X" for that field.
    499104b6
gen_init_cpio.c 4.35 KB