Stripping the kernel

Strip the kernel version that we put into the disk image, but keep the
debug symbols in a separate file for GDB.
This commit is contained in:
Justin C. Miller
2019-02-13 23:58:45 -08:00
parent 3bcd83f5a3
commit ec20e9f3d9

View File

@@ -128,6 +128,15 @@ rule makefat
cp $srcroot/assets/diskbase.img $out; $ cp $srcroot/assets/diskbase.img $out; $
mcopy -s -D o -i $out@@1M $builddir/fatroot/* ::/ mcopy -s -D o -i $out@@1M $builddir/fatroot/* ::/
rule strip
description = Stripping $name
command = $
cp $in $out; $
objcopy --only-keep-debug $out $out.debug; $
strip -g $out; $
objcopy --add-gnu-debuglink=$out.debug $out
{% for target in targets %} {% for target in targets %}
subninja {{ target }}/target.ninja subninja {{ target }}/target.ninja
{% endfor %} {% endfor %}
@@ -146,7 +155,10 @@ build $
build $builddir/flash.img : cp $srcroot/assets/ovmf/x64/OVMF.fd build $builddir/flash.img : cp $srcroot/assets/ovmf/x64/OVMF.fd
name = flash.img name = flash.img
build $builddir/fatroot/popcorn.elf : cp $builddir/host/popcorn.elf build $builddir/popcorn.elf | $builddir/popcorn.elf.debug : strip $builddir/host/popcorn.elf
name = kernel
build $builddir/fatroot/popcorn.elf : cp $builddir/popcorn.elf
name = kernel to FAT image name = kernel to FAT image
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi