forked from metaverse/kernel-dev
将字体移出内核代码
This commit is contained in:
parent
46b80996f7
commit
8d7e2b1a88
|
@ -1,5 +1,6 @@
|
||||||
/test/metaverse.img
|
/test/metaverse.img
|
||||||
*.o
|
*.o
|
||||||
|
*.tfo
|
||||||
*.map
|
*.map
|
||||||
*.elf
|
*.elf
|
||||||
metaverse_kernel
|
metaverse_kernel
|
||||||
|
|
|
@ -156,6 +156,7 @@ void tty_disable(tty *ttyx);
|
||||||
|
|
||||||
typedef struct __tty_font_t
|
typedef struct __tty_font_t
|
||||||
{
|
{
|
||||||
|
bool initialized;
|
||||||
u16 char_width, char_height;
|
u16 char_width, char_height;
|
||||||
u64 **font;
|
u64 **font;
|
||||||
} tty_font_t;
|
} tty_font_t;
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
#!/usr/bin/python
|
||||||
|
|
||||||
|
from io import TextIOWrapper
|
||||||
|
import sys
|
||||||
|
import struct
|
||||||
|
|
||||||
|
|
||||||
|
def main(infile: TextIOWrapper, outfile: TextIOWrapper):
|
||||||
|
size = infile.readline().strip().split(",")
|
||||||
|
size = (int(size[0].strip()), int(size[1].strip()))
|
||||||
|
outfile.write(struct.pack('q', size[0]))
|
||||||
|
outfile.write(struct.pack('q', size[1]))
|
||||||
|
for _ in range(62):
|
||||||
|
outfile.write(struct.pack('q', int(0)))
|
||||||
|
in_char = False
|
||||||
|
char_buffer = []
|
||||||
|
char_count = 0
|
||||||
|
for line in infile:
|
||||||
|
line = line.split("//")[0].strip()
|
||||||
|
if len(line) == 0:
|
||||||
|
continue
|
||||||
|
if line.startswith("{"):
|
||||||
|
char_buffer = []
|
||||||
|
line = line[1:]
|
||||||
|
in_char = True
|
||||||
|
if line.endswith("},"):
|
||||||
|
i = 0
|
||||||
|
for d in char_buffer:
|
||||||
|
outfile.write(struct.pack('q', d))
|
||||||
|
i += 1
|
||||||
|
while i < 64:
|
||||||
|
outfile.write(struct.pack('q', int(0)))
|
||||||
|
i += 1
|
||||||
|
char_count += 1
|
||||||
|
in_char = False
|
||||||
|
continue
|
||||||
|
if len(line) == 0:
|
||||||
|
continue
|
||||||
|
if in_char:
|
||||||
|
data = line.split(",")[0].strip()
|
||||||
|
data = int(data, 2)
|
||||||
|
char_buffer.append(data)
|
||||||
|
while char_count < 256:
|
||||||
|
for _ in range(64):
|
||||||
|
outfile.write(struct.pack('q', int(0)))
|
||||||
|
char_count += 1
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
if len(sys.argv) < 3:
|
||||||
|
print("tfgen: Input file and Output file needed.")
|
||||||
|
exit(1)
|
||||||
|
infile_name = sys.argv[1]
|
||||||
|
outfile_name = sys.argv[2]
|
||||||
|
with open(infile_name) as infile:
|
||||||
|
with open(outfile_name, "wb") as outfile:
|
||||||
|
main(infile, outfile)
|
16
src/Makefile
16
src/Makefile
|
@ -12,11 +12,15 @@ ifdef release
|
||||||
release = 1
|
release = 1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifndef ttyfont
|
||||||
|
ttyfont = metamono
|
||||||
|
endif
|
||||||
|
|
||||||
ALLOCATOR_MAGIC = $(shell "${SOURCE}/magicgen" | sha512sum | head -c 128 | md5sum | head -c 8)
|
ALLOCATOR_MAGIC = $(shell "${SOURCE}/magicgen" | sha512sum | head -c 128 | md5sum | head -c 8)
|
||||||
|
|
||||||
BUILD_ID = $(shell "${SOURCE}/magicgen" | sha512sum | head -c 128 | md5sum | head -c 4)
|
BUILD_ID = $(shell "${SOURCE}/magicgen" | sha512sum | head -c 128 | md5sum | head -c 8)
|
||||||
|
|
||||||
SUBOBJS = kernel/kernel.o libk/libk.o rust.o
|
SUBOBJS = kernel/kernel.o libk/libk.o rust.o font_file.o
|
||||||
|
|
||||||
DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}" PWD="${PWD}" \
|
DEFINES = ARCH="${ARCH}" ASM="${ASM}" ASMFLAGS="${ASMFLAGS}" SOURCE="${SOURCE}" PWD="${PWD}" \
|
||||||
ALLOCATOR_MAGIC="${ALLOCATOR_MAGIC}" BUILD_ID="${BUILD_ID}"
|
ALLOCATOR_MAGIC="${ALLOCATOR_MAGIC}" BUILD_ID="${BUILD_ID}"
|
||||||
|
@ -50,7 +54,7 @@ RUST_LIBS = "${RUSTLIB_PATH}/liballoc.rlib" "${RUSTLIB_PATH}/libcompiler_builtin
|
||||||
|
|
||||||
################################
|
################################
|
||||||
|
|
||||||
metaverse.elf: kernel libk rust metaverse.lds
|
metaverse.elf: kernel libk rust metaverse.lds font_file.o
|
||||||
@echo -e "\e[1;33mld\e[0m \e[1;32m$@\e[0m \e[34m<--\e[0m \e[32m${SUBOBJS}\e[0m"
|
@echo -e "\e[1;33mld\e[0m \e[1;32m$@\e[0m \e[34m<--\e[0m \e[32m${SUBOBJS}\e[0m"
|
||||||
@ld -T metaverse.lds -Map=metaverse.map -unresolved-symbols=ignore-all -o $@ ${SUBOBJS} ${RUST_LIBS} \
|
@ld -T metaverse.lds -Map=metaverse.map -unresolved-symbols=ignore-all -o $@ ${SUBOBJS} ${RUST_LIBS} \
|
||||||
2>&1 | "${SOURCE}/colorize" "warning:=yellow" "error:=red" "ld=lyellow"
|
2>&1 | "${SOURCE}/colorize" "warning:=yellow" "error:=red" "ld=lyellow"
|
||||||
|
@ -92,7 +96,11 @@ rust: postproc
|
||||||
@echo -e "\e[1m\e[33mrustc\e[0m \e[34m-->\e[0m \e[1m\e[32m$@.o\e[0m"
|
@echo -e "\e[1m\e[33mrustc\e[0m \e[34m-->\e[0m \e[1m\e[32m$@.o\e[0m"
|
||||||
@rustc ${RSCFLAGS} lib.rs -o rust.o
|
@rustc ${RSCFLAGS} lib.rs -o rust.o
|
||||||
|
|
||||||
|
font_file.o: ttyfonts/${ttyfont}.tfn
|
||||||
|
@"${SOURCE}/tfgen" $< font_file.tfo
|
||||||
|
@ld -r -b binary -o $@ font_file.tfo
|
||||||
|
|
||||||
clear:
|
clear:
|
||||||
@make -C kernel clear --no-print-directory ${DEFINES}
|
@make -C kernel clear --no-print-directory ${DEFINES}
|
||||||
@make -C libk clear --no-print-directory ${DEFINES}
|
@make -C libk clear --no-print-directory ${DEFINES}
|
||||||
@-rm metaverse.elf metaverse.map rust.o
|
@-rm metaverse.elf metaverse.map rust.o font_file.{o,tfo}
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue