Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 77 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ default = ["video"]
video = []
serial = []
userspace = []
limine = []
multiboot = []

[dependencies]
acpi = "5.0.0"
Expand All @@ -25,9 +27,11 @@ chumsky = { version = "0.12.0", default-features = false }
geodate = { version = "0.5.0", default-features = false }
lazy_static = { version = "1.5.0", features = ["spin_no_std"] }
libm = "0.2.16"
limine = "0.6.3"
linked_list_allocator = "0.10.6"
littlewing = { version = "0.8.0", default-features = false }
miniz_oxide = "0.9.1"
multiboot2 = "0.24.1"
nom = { version = "8.0.0", default-features = false, features = ["alloc"] }
num-bigint = { version = "0.4.6", default-features = false }
num-traits = { version = "0.2.19", default-features = false }
Expand Down
37 changes: 33 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ user-nasm:
sh -c "printf '\x7FBIN' | cat - dsk/bin/{}.tmp > dsk/bin/{}"
rm dsk/bin/*.tmp

user-cargo-opts = --no-default-features --features userspace --release
user-cargo-opts = --release --no-default-features --features userspace

# FIXME: Userspace alloc panic when the default `lld` linker is used because it
# sets the entry point 0x200000 which is used by the kernel, so we use `ld` to
Expand All @@ -59,10 +59,11 @@ img = disk.img
$(img):
qemu-img create $(img) 32M

cargo-opts = --no-default-features --features $(output) --bin moros
cargo-opts = --bin moros
ifeq ($(mode),release)
cargo-opts += --release
endif
cargo-opts += --no-default-features --features $(output)

# Rebuild MOROS if the features list changed
image: $(img)
Expand All @@ -72,7 +73,7 @@ image: $(img)
dd conv=notrunc if=$(bin) of=$(img)

qemu-opts = -name "MOROS $$MOROS_VERSION" \
-m $(memory) -smp $(smp) -drive file=$(img),format=raw \
-m $(memory) -smp $(smp) \
-audiodev $(audio),id=a0 -machine pcspk-audiodev=a0 \
-audio driver=$(audio),model=$(snd) \
-netdev user,id=e0,hostfwd=tcp::8080-:80 -device $(nic),netdev=e0
Expand Down Expand Up @@ -108,13 +109,41 @@ endif
# > gdb target/x86_64-moros/debug/moros -ex "target remote :1234"

qemu:
qemu-system-x86_64 $(qemu-opts)
qemu-system-x86_64 $(qemu-opts) -hda $(img)

test:
cargo test --release --lib --no-default-features --features serial -- \
-m $(memory) -cpu core2duo -display none -serial stdio \
-device isa-debug-exit,iobase=0xF4,iosize=0x04

# Require llvm lld mtools
limine-setup:
cd tmp
wget https://github.com/Limine-Bootloader/Limine/releases/download/v11.3.1/limine-11.3.1.tar.gz
cd limine-11.3.1
./configure --enable-bios --enable-bios-cd
make
cd ..
cp limine-11.3.1/bin/limine-bios-cd.bin boot/limine/
cp limine-11.3.1/bin/limine-bios.sys boot/limine/

limine-proto = limine# limine, multiboot

limine-image: RUSTFLAGS = -C link-arg=-Ttmp/boot/$(limine-proto).ld -C link-arg=-z -C link-arg=norelro
limine-image:
cargo build $(cargo-opts),$(limine-proto)
cp target/x86_64-moros/release/moros tmp/boot/kernel.elf
find tmp/boot
cat tmp/boot/limine/limine.conf
xorriso -as mkisofs \
-b limine/limine-bios-cd.bin \
-no-emul-boot -boot-load-size 4 -boot-info-table \
--protective-msdos-label \
tmp/boot -o boot.img

limine-qemu:
qemu-system-x86_64 -cdrom boot.img $(qemu-opts)

website:
cd www && sh build.sh

Expand Down
4 changes: 4 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub fn init(memory_map: &MemoryMap, offset: u64) {
sys::pic::init(); // Enable interrupts
sys::serial::init();
sys::keyboard::init();

#[cfg(feature = "limine")]
return; // FIXME

sys::clk::init();

let v = option_env!("MOROS_VERSION").unwrap_or(env!("CARGO_PKG_VERSION"));
Expand Down
Loading