From ec20e9f3d92aa30795eba362385cf50ec3d37fe2 Mon Sep 17 00:00:00 2001 From: "Justin C. Miller" Date: Wed, 13 Feb 2019 23:58:45 -0800 Subject: [PATCH] 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. --- scripts/templates/build.ninja.j2 | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/scripts/templates/build.ninja.j2 b/scripts/templates/build.ninja.j2 index 2c57dc6..309fb6f 100644 --- a/scripts/templates/build.ninja.j2 +++ b/scripts/templates/build.ninja.j2 @@ -128,6 +128,15 @@ rule makefat cp $srcroot/assets/diskbase.img $out; $ 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 %} subninja {{ target }}/target.ninja {% endfor %} @@ -146,7 +155,10 @@ build $ build $builddir/flash.img : cp $srcroot/assets/ovmf/x64/OVMF.fd 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 build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi