Files
jsix/scripts/templates/build.ninja.j2
2019-04-18 00:28:23 -07:00

88 lines
2.2 KiB
Django/Jinja

{% extends "build.base.j2" %}
{% block variables %}
{{ super() }}
ccflags = $ccflags $
-I${srcroot}/src/include $
-I${srcroot}/src/include/x86_64 $
-fcolor-diagnostics
{% endblock %}
{% block baserules %}
{{ super() }}
rule makerd
description = Making init ramdisk
command = $builddir/native/makerd $in $out
rule makeefi
description = Converting $name
command = objcopy $
-j .text $
-j .sdata $
-j .data $
-j .dynamic $
-j .dynsym $
-j .rel $
-j .rela $
-j .reloc $
--target=efi-app-x86_64 $
$in $out
rule makefat
description = Creating $name
command = $
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
{% endblock %}
{% block extra %}
build $builddir/ovmf_vars.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars.fd
name = ovmf_vars.fd
build $builddir/ovmf_vars_d.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars_d.fd
name = ovmf_vars_d.fd
build $builddir/popcorn.elf | $builddir/popcorn.elf.debug : strip $builddir/host/popcorn.elf
name = kernel
build $builddir/popcorn.dump : dump $builddir/host/popcorn.elf
name = kernel
build $builddir/popcorn.elf-gdb.py : cp ${srcroot}/assets/debugging/popcorn.elf-gdb.py
name = kernel debug python scripts
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
name = bootloader to FAT image
build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
${builddir}/native/makerd $
${builddir}/user/nulldrv
build $builddir/popcorn.img : makefat | $
$builddir/fatroot/initrd.img $
$builddir/fatroot/popcorn.elf $
$builddir/fatroot/efi/boot/bootx64.efi
name = popcorn.img
default $
$builddir/ovmf_vars.fd $
$builddir/ovmf_vars_d.fd $
$builddir/popcorn.dump $
$builddir/popcorn.elf-gdb.py $
$builddir/popcorn.img
{% endblock %}
# vim: ft=ninja et ts=4 sts=4 sw=4