[build] Update to using pb 3

Updating the build to the new version of bonnibel. This also includes
some updates to make sure things keep working with LLVM 11.
This commit is contained in:
Justin C. Miller
2021-02-28 01:16:27 -08:00
parent e05e05b13a
commit 0ae489f49d
18 changed files with 535 additions and 424 deletions

65
configs/custom.ninja Normal file
View File

@@ -0,0 +1,65 @@
rule makest
description = Making symbol table
command = nm $in | ${source_root}/scripts/build_symbol_table.py $out
rule makefat
description = Creating $name
command = $
cp ${source_root}/assets/diskbase.img $out; $
mcopy -s -D o -i $out@@1M ${build_root}/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
build ${build_root}/ovmf_vars.fd : cp ${source_root}/assets/ovmf/x64/ovmf_vars.fd
name = ovmf_vars.fd
build ${build_root}/ovmf_vars_d.fd : cp ${source_root}/assets/ovmf/x64/ovmf_vars_d.fd
name = ovmf_vars_d.fd
build ${build_root}/jsix.elf | ${build_root}/jsix.elf.debug : strip ${build_root}/kernel/jsix.elf
name = kernel
build ${build_root}/jsix.dump : dump ${build_root}/kernel/jsix.elf
name = kernel
build ${build_root}/jsix.elf-gdb.py : cp ${source_root}/assets/debugging/jsix.elf-gdb.py
name = kernel debug python scripts
build ${build_root}/fatroot/jsix.elf : cp ${build_root}/jsix.elf
name = kernel to FAT image
build ${build_root}/fatroot/efi/boot/bootx64.efi : cp ${build_root}/boot/boot.efi
name = bootloader to FAT image
build ${build_root}/fatroot/nulldrv.elf : cp ${build_root}/user/nulldrv.elf
name = null driver to FAT image
build ${build_root}/fatroot/fb.elf : cp ${build_root}/user/fb.elf
name = fb driver to FAT image
build ${build_root}/fatroot/symbol_table.dat : makest ${build_root}/jsix.elf
build ${build_root}/jsix.img : makefat | $
${build_root}/fatroot/symbol_table.dat $
${build_root}/fatroot/nulldrv.elf $
${build_root}/fatroot/fb.elf $
${build_root}/fatroot/jsix.elf $
${build_root}/fatroot/efi/boot/bootx64.efi
name = jsix.img
default $
${build_root}/ovmf_vars.fd $
${build_root}/ovmf_vars_d.fd $
${build_root}/jsix.dump $
${build_root}/jsix.elf-gdb.py $
${build_root}/jsix.img
# vim: ft=ninja et ts=4 sts=4 sw=4

136
configs/debug.toml Normal file
View File

@@ -0,0 +1,136 @@
[targets.boot]
cc = "clang"
cxx = "clang++"
ld = "clang++"
ar = "ar"
nasm = "nasm"
objcopy = "objcopy"
ccflags = [
"${ccflags}",
"-I${source_root}/external",
"--target=x86_64-unknown-windows",
"-ffreestanding",
"-mno-red-zone",
"-fshort-wchar",
"-fno-omit-frame-pointer",
"-ggdb",
"-g3",
'-DKERNEL_FILENAME=L"jsix.elf"',
]
cxxflags = [
"${cxxflags}",
"-fno-exceptions",
"-fno-rtti",
]
ldflags = [
"${ldflags}",
"--target=x86_64-unknown-windows",
"-nostdlib",
"-Wl,-entry:efi_main",
"-Wl,-subsystem:efi_application",
"-fuse-ld=lld-link",
"-g"
]
[targets.kernel]
cc = "clang"
cxx = "clang++"
ld = "ld.lld"
ar = "ar"
nasm = "nasm"
objcopy = "objcopy"
asflags = [
"${asflags}",
"-I${source_root}/src/kernel/",
]
ccflags = [
"${ccflags}",
"--target=x86_64-unknown-elf",
"-I${source_root}/external",
"-nostdlib",
"-ffreestanding",
"-nodefaultlibs",
"-fno-builtin",
"-mno-sse",
"-fno-omit-frame-pointer",
"-mno-red-zone",
"-g",
"-mcmodel=large",
"-D__ELF__",
"-D__JSIX__",
"-isystem${source_root}/sysroot/include",
"-isystem${source_root}/src/libraries/libc/include",
"--sysroot='${source_root}/sysroot'"
]
cxxflags = [
"${cxxflags}",
"-fno-exceptions",
"-fno-rtti",
"-isystem${source_root}/sysroot/include/c++/v1"
]
ldflags = [
"${ldflags}",
"-T", "${source_root}/src/arch/x86_64/kernel.ld",
"-g",
"-nostdlib",
"-Bstatic",
"-z", "norelro",
"-z", "separate-code",
]
[targets.user]
cc = "clang"
cxx = "clang++"
ld = "ld.lld"
ar = "ar"
nasm = "nasm"
objcopy = "objcopy"
asflags = [
"${asflags}",
"-I${source_root}/src/kernel/",
]
ccflags = [
"${ccflags}",
"-nostdlib",
"-ffreestanding",
"-nodefaultlibs",
"-fno-builtin",
"-mno-sse",
"-fno-omit-frame-pointer",
"-mno-red-zone",
"-g",
"-mcmodel=large",
"-D__ELF__",
"-D__JSIX__",
"-isystem${source_root}/sysroot/include",
"-isystem${source_root}/src/libraries/libc/include",
"--sysroot='${source_root}/sysroot'"
]
cxxflags = [
"${cxxflags}",
"-fno-exceptions",
"-fno-rtti",
"-isystem${source_root}/sysroot/include/c++/v1"
]
ldflags = [
"${ldflags}",
"-g",
"-nostdlib",
"-Bstatic",
"--sysroot='${source_root}/sysroot'",
"-L", "${source_root}/sysroot/lib",
"-z", "separate-code",
]