forked from metaverse/kernel-dev
Compare commits
2 Commits
46b80996f7
...
cfc961e5c3
Author | SHA1 | Date |
---|---|---|
pointer-to-bios | cfc961e5c3 | |
pointer-to-bios | 8d7e2b1a88 |
|
@ -0,0 +1,2 @@
|
|||
[build]
|
||||
target = ["x86_64-unknown-none"]
|
|
@ -1,5 +1,7 @@
|
|||
.vscode
|
||||
/test/metaverse.img
|
||||
*.o
|
||||
*.tfo
|
||||
*.map
|
||||
*.elf
|
||||
metaverse_kernel
|
||||
|
|
|
@ -1,16 +0,0 @@
|
|||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/include"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c17",
|
||||
"intelliSenseMode": "linux-gcc-x64",
|
||||
"configurationProvider": "ms-vscode.makefile-tools"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
{
|
||||
"C_Cpp.errorSquiggles": "disabled",
|
||||
"files.associations": {
|
||||
"*.s": "nasm",
|
||||
"LICENCE": "plaintext",
|
||||
"*.h": "c"
|
||||
},
|
||||
"rust-analyzer.imports.preferNoStd" : true,
|
||||
}
|
|
@ -5,9 +5,7 @@ edition = "2021"
|
|||
|
||||
[lib]
|
||||
crate-type = ["staticlib"]
|
||||
test = false
|
||||
|
||||
# 此Cargo.toml仅用于rust-analyzer识别rust部分的代码
|
||||
# 不应使用cargo编译
|
||||
|
||||
[target.'cfg(target_arch = "x86_64")']
|
||||
target = "x86_64-unknown-none"
|
||||
|
|
|
@ -156,6 +156,7 @@ void tty_disable(tty *ttyx);
|
|||
|
||||
typedef struct __tty_font_t
|
||||
{
|
||||
bool initialized;
|
||||
u16 char_width, char_height;
|
||||
u64 **font;
|
||||
} 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
|
||||
endif
|
||||
|
||||
ifndef ttyfont
|
||||
ttyfont = metamono
|
||||
endif
|
||||
|
||||
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}" \
|
||||
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"
|
||||
@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"
|
||||
|
@ -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"
|
||||
@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:
|
||||
@make -C kernel 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