• Mehmet Kayaalp's avatar
    UBUNTU: SAUCE: (noup) KEYS: Support for inserting a certificate into x86 bzImage · 5a08bbff
    Mehmet Kayaalp authored
    BugLink: http://bugs.launchpad.net/bugs/1558553
    
    The config option SYSTEM_EXTRA_CERTIFICATE reserves space in vmlinux file,
    which is compressed to create the self-extracting bzImage. This patch adds the
    capability of extracting the vmlinux, inserting the certificate, and
    repackaging the result into a bzImage.
    
    It only works if the resulting compressed vmlinux is smaller than the original.
    Otherwise re-linking would be required. To make the reserved space allocate
    actual space in bzImage, a null key is inserted into vmlinux before creating
    the bzImage:
    
    	make vmlinux
    	scripts/insert-sys-cert -b vmlinux -c /dev/null
    	make bzImage
    
    After null key insertion, the script populates the rest of the reserved space
    with random bytes, which have poor compression. After receiving a bzImage that
    is created this way, actual certificate can be inserted into the bzImage:
    
    	scripts/insert-sys-cert -s <System.map> -z <bzImage> -c <certfile>
    Signed-off-by: default avatarMehmet Kayaalp <mkayaalp@linux.vnet.ibm.com>
    Signed-off-by: default avatarTim Gardner <tim.gardner@canonical.com>
    5a08bbff
insert-sys-cert.c 13.1 KB