Skip to content
  • Bruce Ashfield's avatar
    55dd1533
    arch/x86/boot: use prefix map to avoid embedded paths · 55dd1533
    Bruce Ashfield authored
    It was observed that the kernel embeds the path in the x86 boot
    artifacts.
    
    From https://bugzilla.yoctoproject.org/show_bug.cgi?id=13458
    
    :
    
    [
       If you turn on the buildpaths QA test, or try a reproducible build, you
       discover that the kernel image contains build paths.
    
       $ strings bzImage-5.0.19-yocto-standard |grep tmp/
       out of pgt_buf in
       /data/poky-tmp/reproducible/tmp/work-shared/qemux86-64/kernel-source/arch/x86/boot/compressed/kaslr_64.c!?
    
       But what's this in the top-level Makefile:
    
       $ git grep prefix-map
       Makefile:KBUILD_CFLAGS  += $(call
       cc-option,-fmacro-prefix-map=$(srctree)/=)
    
       So the __FILE__ shouldn't be using the full path.  However
       arch/x86/boot/compressed/Makefile has this:
    
       KBUILD_CFLAGS := -m$(BITS) -O2
    
       So that clears KBUILD_FLAGS, removing the -fmacro-prefix-map option.
    ]
    
    Other architectures do not clear the flags, but instead prune before
    adding boot or specific options. There's no obvious reason why x86 isn't
    doing the same thing (pruning vs clearing) and no build or boot issues
    have been observed.
    
    So we make x86 can do the same thing, and we no longer have embedded paths.
    
    Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
    55dd1533
    arch/x86/boot: use prefix map to avoid embedded paths
    Bruce Ashfield authored
    It was observed that the kernel embeds the path in the x86 boot
    artifacts.
    
    From https://bugzilla.yoctoproject.org/show_bug.cgi?id=13458
    
    :
    
    [
       If you turn on the buildpaths QA test, or try a reproducible build, you
       discover that the kernel image contains build paths.
    
       $ strings bzImage-5.0.19-yocto-standard |grep tmp/
       out of pgt_buf in
       /data/poky-tmp/reproducible/tmp/work-shared/qemux86-64/kernel-source/arch/x86/boot/compressed/kaslr_64.c!?
    
       But what's this in the top-level Makefile:
    
       $ git grep prefix-map
       Makefile:KBUILD_CFLAGS  += $(call
       cc-option,-fmacro-prefix-map=$(srctree)/=)
    
       So the __FILE__ shouldn't be using the full path.  However
       arch/x86/boot/compressed/Makefile has this:
    
       KBUILD_CFLAGS := -m$(BITS) -O2
    
       So that clears KBUILD_FLAGS, removing the -fmacro-prefix-map option.
    ]
    
    Other architectures do not clear the flags, but instead prune before
    adding boot or specific options. There's no obvious reason why x86 isn't
    doing the same thing (pruning vs clearing) and no build or boot issues
    have been observed.
    
    So we make x86 can do the same thing, and we no longer have embedded paths.
    
    Signed-off-by: default avatarBruce Ashfield <bruce.ashfield@gmail.com>
Loading