Ninja buildsystem produces working bootloader
This commit is contained in:
@@ -14,9 +14,9 @@ MODULES = {
|
|||||||
|
|
||||||
"makerd": program('src/tools/makerd', ["initrd", "kutil"], "makerd", ["native"]),
|
"makerd": program('src/tools/makerd', ["initrd", "kutil"], "makerd", ["native"]),
|
||||||
|
|
||||||
"nulldrv": program('src/drivers/nulldrv', [], "nulldrv", ["host"]),
|
"boot": program('src/boot', [], "boot.elf", ["boot"]),
|
||||||
|
|
||||||
"boot": program('src/boot', ["elf"], "boot.elf", ["host"]),
|
"nulldrv": program('src/drivers/nulldrv', [], "nulldrv", ["host"]),
|
||||||
"kernel": program('src/kernel', ["elf", "initrd", "kutil"], "popcorn.elf", ["host"]),
|
"kernel": program('src/kernel', ["elf", "initrd", "kutil"], "popcorn.elf", ["host"]),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -65,7 +65,7 @@ rule nasm
|
|||||||
|
|
||||||
rule exe
|
rule exe
|
||||||
description = Linking $name
|
description = Linking $name
|
||||||
command = $ld -o $out $in $libs
|
command = $ld $ldflags -o $out $in $libs
|
||||||
|
|
||||||
rule lib
|
rule lib
|
||||||
description = Archiving $name
|
description = Archiving $name
|
||||||
@@ -127,7 +127,7 @@ build $builddir/popcorn.fat : cp $srcroot/assets/ovmf/x64/OVMF.fd
|
|||||||
build $builddir/fatroot/popcorn.elf : cp $builddir/host/popcorn.elf
|
build $builddir/fatroot/popcorn.elf : cp $builddir/host/popcorn.elf
|
||||||
name = kernel to FAT image
|
name = kernel to FAT image
|
||||||
|
|
||||||
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/host/boot.efi
|
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi
|
||||||
name = bootloader to FAT image
|
name = bootloader to FAT image
|
||||||
|
|
||||||
build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
|
build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
{% block variables %}
|
{% block variables %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
|
||||||
cflags = $cflags $
|
ld = ld
|
||||||
|
cc = clang
|
||||||
|
cxx = clang++
|
||||||
|
|
||||||
|
ccflags = $ccflags $
|
||||||
-DKERNEL_FILENAME=L\"popcorn.elf\" $
|
-DKERNEL_FILENAME=L\"popcorn.elf\" $
|
||||||
-DGNU_EFI_USE_MS_ABI $
|
-DGNU_EFI_USE_MS_ABI $
|
||||||
-DHAVE_USE_MS_ABI $
|
-DHAVE_USE_MS_ABI $
|
||||||
@@ -12,8 +16,8 @@ cflags = $cflags $
|
|||||||
-fshort-wchar
|
-fshort-wchar
|
||||||
|
|
||||||
ldflags = $ldflags $
|
ldflags = $ldflags $
|
||||||
-shared $
|
-T ${srcroot}/src/arch/x86_64/boot.ld $
|
||||||
-T ${srcroot}/src/arch/x86_64/boot.ld
|
-shared
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
{{ super() }}
|
{{ super() }}
|
||||||
|
|
||||||
asflags = $asflags -I${srcroot}/src/kernel/
|
asflags = $asflags -I${srcroot}/src/kernel/
|
||||||
libs = $libs -lc
|
libs = $libs
|
||||||
ldflags = $ldflags -T ${srcroot}/src/arch/x86_64/kernel.ld
|
ldflags = $ldflags -T ${srcroot}/src/arch/x86_64/kernel.ld
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
35
scripts/templates/target.boot.ninja.j2
Normal file
35
scripts/templates/target.boot.ninja.j2
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
{% extends "target.default.ninja.j2" %}
|
||||||
|
|
||||||
|
{% block binaries %}
|
||||||
|
ld = ld
|
||||||
|
cc = clang
|
||||||
|
cxx = clang++
|
||||||
|
nasm = nasm
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
{% block variables %}
|
||||||
|
|
||||||
|
ccflags = $ccflags $
|
||||||
|
-ggdb $
|
||||||
|
-nostdlib $
|
||||||
|
-ffreestanding $
|
||||||
|
-nodefaultlibs $
|
||||||
|
-fno-builtin $
|
||||||
|
-mno-sse $
|
||||||
|
-fno-omit-frame-pointer $
|
||||||
|
-mno-red-zone
|
||||||
|
|
||||||
|
cxxflags = $cxxflags $
|
||||||
|
-nostdlibinc $
|
||||||
|
-isystem${srcroot}/sysroot/include/c++/v1 $
|
||||||
|
-fno-exceptions $
|
||||||
|
-fno-rtti
|
||||||
|
|
||||||
|
ldflags = $ldflags $
|
||||||
|
-g $
|
||||||
|
-nostdlib $
|
||||||
|
-znocombreloc $
|
||||||
|
-Bsymbolic $
|
||||||
|
-nostartfiles
|
||||||
|
|
||||||
|
{% endblock %}
|
||||||
@@ -35,7 +35,6 @@ ldflags = $ldflags $
|
|||||||
-nostdlib $
|
-nostdlib $
|
||||||
-nostartfiles $
|
-nostartfiles $
|
||||||
-znocombreloc $
|
-znocombreloc $
|
||||||
-Bsymbolic $
|
|
||||||
-nostartfiles
|
-nostartfiles
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|||||||
Reference in New Issue
Block a user