mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 00:14:32 -08:00
Ninja buildsystem produces working bootloader
This commit is contained in:
@@ -14,9 +14,9 @@ MODULES = {
|
||||
|
||||
"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"]),
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ rule nasm
|
||||
|
||||
rule exe
|
||||
description = Linking $name
|
||||
command = $ld -o $out $in $libs
|
||||
command = $ld $ldflags -o $out $in $libs
|
||||
|
||||
rule lib
|
||||
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
|
||||
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
|
||||
|
||||
build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
|
||||
|
||||
@@ -2,7 +2,11 @@
|
||||
{% block variables %}
|
||||
{{ super() }}
|
||||
|
||||
cflags = $cflags $
|
||||
ld = ld
|
||||
cc = clang
|
||||
cxx = clang++
|
||||
|
||||
ccflags = $ccflags $
|
||||
-DKERNEL_FILENAME=L\"popcorn.elf\" $
|
||||
-DGNU_EFI_USE_MS_ABI $
|
||||
-DHAVE_USE_MS_ABI $
|
||||
@@ -12,8 +16,8 @@ cflags = $cflags $
|
||||
-fshort-wchar
|
||||
|
||||
ldflags = $ldflags $
|
||||
-shared $
|
||||
-T ${srcroot}/src/arch/x86_64/boot.ld
|
||||
-T ${srcroot}/src/arch/x86_64/boot.ld $
|
||||
-shared
|
||||
|
||||
{% endblock %}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{ super() }}
|
||||
|
||||
asflags = $asflags -I${srcroot}/src/kernel/
|
||||
libs = $libs -lc
|
||||
libs = $libs
|
||||
ldflags = $ldflags -T ${srcroot}/src/arch/x86_64/kernel.ld
|
||||
|
||||
{% 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 $
|
||||
-nostartfiles $
|
||||
-znocombreloc $
|
||||
-Bsymbolic $
|
||||
-nostartfiles
|
||||
|
||||
{% endblock %}
|
||||
|
||||
Reference in New Issue
Block a user