generate a built-in kernel font
This commit is contained in:
1 parent
e22b90b768
commit
610f30fae9
3 files changed
+250
-1
No files matched your search
+26
-1
@@ -4,6 +4,7 @@ configure do
|
||||
check_program "grub-mkstandalone"
|
||||
check_program "mformat", on_fail: "Install the mtools package"
|
||||
check_program "xorriso"
|
||||
check_cfg package: "freetype2", on_fail: "Install libfreetype-dev", use: "freetype"
|
||||
end
|
||||
|
||||
build do
|
||||
@@ -13,6 +14,8 @@ build do
|
||||
EFI_PART_SIZE = 8
|
||||
# HOS partition size (MiB)
|
||||
HOS_PART_SIZE = 4
|
||||
# Kernel default font size
|
||||
KFONT_SIZE = 12
|
||||
|
||||
class BiosImage < Builder
|
||||
def run(options)
|
||||
@@ -94,14 +97,36 @@ EOF
|
||||
end
|
||||
end
|
||||
|
||||
class FontGen < Builder
|
||||
def run(options)
|
||||
if @command
|
||||
finalize_command
|
||||
else
|
||||
@sources += ["build/fontgen"]
|
||||
command = %W[build/fontgen #{@sources.first} #{KFONT_SIZE} #{@target}]
|
||||
standard_command("FontGen <target>#{@target}<reset>", command, {})
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# FontGen Environment
|
||||
Environment.new(use: "freetype") do |env|
|
||||
env["CC"] = "gcc"
|
||||
env.Program("build/fontgen", glob("fontgen/**/*.c"))
|
||||
end
|
||||
|
||||
# Kernel Environment
|
||||
Environment.new do |env|
|
||||
env.add_builder(EfiImage)
|
||||
env.add_builder(BiosImage)
|
||||
env.add_builder(FontGen)
|
||||
env["CCFLAGS"] += %w[-ffreestanding -Wall]
|
||||
env["LDFLAGS"] += %w[-ffreestanding -nostdlib -T src/link.ld]
|
||||
env["LIBS"] += %w[gcc]
|
||||
env["OBJDUMP"] = "i686-elf-objdump"
|
||||
env.Program("^/hos.elf", glob("src/**/*.{S,c}"))
|
||||
env.FontGen("^/fontgen/fontgen.c", "font/Hack-Regular.ttf")
|
||||
env["CPPPATH"] += ["#{env.build_root}/fontgen"]
|
||||
env.Program("^/hos.elf", glob("src/**/*.{S,c}") + ["^/fontgen/fontgen.c"])
|
||||
env.depends("#{env.build_root}/hos.elf", "src/link.ld")
|
||||
env.Disassemble("^/hos.elf.txt", "^/hos.elf")
|
||||
env.EfiImage("build/hos-efi.img", %w[^/hos.elf])
|
||||
|
||||
Reference in new issue
Block a user