Ninja-based system now builds the disk images

This commit is contained in:
Justin C. Miller
2019-02-02 13:30:43 -08:00
parent 7e1933d79b
commit 73df20d195
11 changed files with 121 additions and 26 deletions

View File

@@ -2,6 +2,29 @@ ninja_required_version = 1.3
builddir = {{ buildroot }}
srcroot = {{ srcroot }}
warnflags = $
-Wformat=2 $
-Winit-self $
-Wfloat-equal $
-Winline $
-Wmissing-format-attribute $
-Wmissing-include-dirs $
-Wswitch $
-Wundef $
-Wdisabled-optimization $
-Wpointer-arith $
-Wno-attributes $
-Wno-sign-compare $
-Wno-multichar $
-Wno-div-by-zero $
-Wno-endif-labels $
-Wno-pragmas $
-Wno-format-extra-args $
-Wno-unused-result $
-Wno-deprecated-declarations $
-Wno-unused-function $
-Werror
ccflags = $
-I${srcroot}/src/include $
-I${srcroot}/src/include/x86_64 $
@@ -9,7 +32,8 @@ ccflags = $
-DVERSION_MINOR={{ version.minor }} $
-DVERSION_PATCH={{ version.patch }} $
-DVERSION_GITSHA=\"{{ version.sha }}\" $
-DGIT_VERSION=\"{{ version.major }}.{{ version.minor }}.{{ version.patch }}-{{ version.sha }}\"
-DGIT_VERSION=\"{{ version.major }}.{{ version.minor }}.{{ version.patch }}-{{ version.sha }}\" $
$warnflags
asflags = $
-DVERSION_MAJOR={{ version.major }} $
@@ -50,7 +74,35 @@ rule lib
rule regen
generator = true
description = Regenrating build files
command = {{ generator }} ${builddir}
command = {{ generator }} $builddir
rule cp
description = Copying $name
command = cp $in $out
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@@1024K $builddir/fatroot/* ::/
{% for target in targets %}
subninja {{ target }}/target.ninja
@@ -66,5 +118,27 @@ build $
{%- endfor %}
{{ generator }}
build $builddir/flash.img : cp $srcroot/assets/ovmf/x64/OVMF.fd
name = flash.img
build $builddir/popcorn.fat : cp $srcroot/assets/ovmf/x64/OVMF.fd
name = flash.img
build $builddir/fatroot/popcorn.elf : cp $builddir/host/popcorn.elf
name = kernel to FAT image
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/host/boot.efi
name = bootloader to FAT image
build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
${builddir}/native/makerd $
${builddir}/host/nulldrv
build $builddir/popcorn.img : makefat | $
$builddir/fatroot/initrd.img $
$builddir/fatroot/popcorn.elf $
$builddir/fatroot/efi/boot/bootx64.efi
name = popcorn.img
# vim: et ts=4 sts=4 sw=4