This commit is contained in:
parent
d9860e89a7
commit
64eb7ce836
8 changed files with 18 additions and 31 deletions
1
.clang-format
Normal file
1
.clang-format
Normal file
|
@ -0,0 +1 @@
|
||||||
|
ColumnLimit: 200
|
|
@ -12,6 +12,14 @@ jobs:
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
submodules: true
|
submodules: true
|
||||||
|
- name: Download Rust
|
||||||
|
run: |
|
||||||
|
curl -O ${{ vars.RUST_URL }}
|
||||||
|
mkdir rust
|
||||||
|
cd rust
|
||||||
|
unzip ../compiler.zip
|
||||||
|
- name: Link toolchain
|
||||||
|
run: . ~/.bashrc && rustup toolchain link x86_64-unknown-os rust
|
||||||
- name: Build
|
- name: Build
|
||||||
run: . ~/.bashrc && ./build.py
|
run: . ~/.bashrc && ./build.py
|
||||||
- name: Install cargo-deny
|
- name: Install cargo-deny
|
||||||
|
|
5
build.py
5
build.py
|
@ -18,7 +18,10 @@ def main():
|
||||||
|
|
||||||
components = ["init", "kernel", "loader"]
|
components = ["init", "kernel", "loader"]
|
||||||
for component in components:
|
for component in components:
|
||||||
cargo_cmd = f'cargo build {"--release" if target == "release" else ""}'
|
toolchain = "+x86_64-unknown-os"
|
||||||
|
if component == "kernel" or component == "loader":
|
||||||
|
toolchain = ""
|
||||||
|
cargo_cmd = f'cargo {toolchain} build {"--release" if target == "release" else ""}'
|
||||||
run_command(cargo_cmd, cwd=component)
|
run_command(cargo_cmd, cwd=component)
|
||||||
|
|
||||||
loader_path = f"target/x86_64-unknown-uefi/{target}/loader.efi"
|
loader_path = f"target/x86_64-unknown-uefi/{target}/loader.efi"
|
||||||
|
|
|
@ -1,3 +1,3 @@
|
||||||
[build]
|
[build]
|
||||||
target = "x86_64-unknown-none"
|
target = "x86_64-unknown-os"
|
||||||
rustflags = ["-C", "link-arg=-no-pie"]
|
rustflags = ["-C", "link-arg=-no-pie"]
|
||||||
|
|
|
@ -1,15 +1 @@
|
||||||
#![no_std]
|
fn main() {}
|
||||||
#![no_main]
|
|
||||||
use core::{arch::global_asm, panic::PanicInfo};
|
|
||||||
|
|
||||||
global_asm!(include_str!("start.s"), options(att_syntax));
|
|
||||||
|
|
||||||
#[no_mangle]
|
|
||||||
extern "C" fn main() -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[panic_handler]
|
|
||||||
fn panic(_info: &PanicInfo) -> ! {
|
|
||||||
loop {}
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
.text
|
|
||||||
|
|
||||||
.global _start
|
|
||||||
_start:
|
|
||||||
mov $stack, %rsp
|
|
||||||
call main
|
|
||||||
|
|
||||||
.section .bss
|
|
||||||
.align 16
|
|
||||||
.skip 0x10000
|
|
||||||
stack:
|
|
|
@ -66,10 +66,10 @@ global_asm!(include_str!("cpu/trampoline.s"), options(att_syntax));
|
||||||
global_asm!(include_str!("cpu/usermode.s"), options(att_syntax));
|
global_asm!(include_str!("cpu/usermode.s"), options(att_syntax));
|
||||||
|
|
||||||
#[cfg(debug_assertions)]
|
#[cfg(debug_assertions)]
|
||||||
const INIT_BINARY: &[u8] = include_bytes!("../../target/x86_64-unknown-none/debug/init");
|
const INIT_BINARY: &[u8] = include_bytes!("../../target/x86_64-unknown-os/debug/init");
|
||||||
|
|
||||||
#[cfg(not(debug_assertions))]
|
#[cfg(not(debug_assertions))]
|
||||||
const INIT_BINARY: &[u8] = include_bytes!("../../target/x86_64-unknown-none/release/init");
|
const INIT_BINARY: &[u8] = include_bytes!("../../target/x86_64-unknown-os/release/init");
|
||||||
|
|
||||||
#[no_mangle]
|
#[no_mangle]
|
||||||
extern "C" fn early_main(temp_loader_struct: *const LoaderStruct) -> ! {
|
extern "C" fn early_main(temp_loader_struct: *const LoaderStruct) -> ! {
|
||||||
|
|
|
@ -3,7 +3,7 @@ COMPONENTS:=dispatcher events executer hardware namespace parser resources table
|
||||||
CFILES:=$(foreach comp, $(COMPONENTS), $(wildcard ../acpica/source/components/$(comp)/*.c)) printf.c
|
CFILES:=$(foreach comp, $(COMPONENTS), $(wildcard ../acpica/source/components/$(comp)/*.c)) printf.c
|
||||||
OFILES:=$(patsubst %.c, %.o, $(CFILES))
|
OFILES:=$(patsubst %.c, %.o, $(CFILES))
|
||||||
CC:=clang
|
CC:=clang
|
||||||
CFLAGS:=--target=x86_64-elf -ffreestanding -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fstack-protector-strong -O2 -I. -I../acpica/source/include -DACPI_LIBRARY -D__linux__
|
CFLAGS:=--target=x86_64-elf -ffreestanding -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -mno-sse2 -fstack-protector-strong -Wall -Werror -O2 -I. -I../acpica/source/include -DACPI_LIBRARY -D__linux__
|
||||||
|
|
||||||
libacpica.a: $(OFILES)
|
libacpica.a: $(OFILES)
|
||||||
llvm-ar rcD $@ $^
|
llvm-ar rcD $@ $^
|
||||||
|
|
Loading…
Add table
Reference in a new issue