A repository for a long-term OS project titled DasOS (named after the Greek for "forest")

Forgot to set correct entry point /face_palm

+48 -4
+6 -1
.cargo/config.toml
··· 1 1 [target.x86_64-unknown-none] 2 - rustflags = ["-C", "relocation-model=static"] 2 + rustflags = ["-C", "relocation-model=static"] 3 + 4 + [unstable] 5 + # enable the unstable artifact-dependencies feature 6 + # see https://doc.rust-lang.org/nightly/cargo/reference/unstable.html#artifact-dependencies 7 + bindeps = true
+1 -1
kernel/linker-x86_64.ld
··· 1 1 /* Tell the linker that we want an x86_64 ELF64 output file */ 2 2 OUTPUT_FORMAT(elf64-x86-64) 3 3 4 - ENTRY(entry_point_bsp) 4 + ENTRY(entry_point_from_limine) 5 5 6 6 /* Define the program headers we want so the bootloader gives us the right */ 7 7 /* MMU permissions; this also allows us to exert more control over the linking */
+10 -1
runner/Cargo.toml
··· 2 2 name = "runner" 3 3 version = "0.1.0" 4 4 edition = "2024" 5 - publish = false 5 + publish = false 6 + 7 + [build-dependencies.kernel] 8 + path = "../kernel" 9 + artifact = "bin" 10 + target = "x86_64-unknown-none" 11 + 12 + [profile.dev] 13 + debug = 2 14 + strip = false
+6
runner/build.rs
··· 7 7 let runner_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()); 8 8 // This folder contains Limine files such as `BOOTX64.EFI` 9 9 let limine_dir = PathBuf::from(env::var("LIMINE_PATH").unwrap()); 10 + // Cargo passes us the path to the kernel executable because it is an artifact dep 11 + let kernel_executable_file = env::var("CARGO_BIN_FILE_KERNEL").unwrap(); 10 12 11 13 // Symlink the out dir so we get a constant path to it 12 14 ensure_symlink(&out_dir, runner_dir.join("out_dir")).unwrap(); ··· 16 18 // We will use symlinks instead of copying to avoid unnecessary disk space used 17 19 let iso_dir = out_dir.join("iso_root"); 18 20 create_dir_all(&iso_dir).unwrap(); 21 + 22 + // symlink the kernel binary to `kernel` 23 + let kernel_dest = iso_dir.join("kernel"); 24 + ensure_symlink(&kernel_executable_file, &kernel_dest).unwrap(); 19 25 20 26 // Limine config will be in `limine.conf` 21 27 let limine_conf = iso_dir.join("limine.conf");
+4
runner/limine.conf
··· 1 + # The entry name that will be displayed in the boot menu. 2 + /DasOS 3 + protocol: limine 4 + kernel_path: boot():/kernel
+21 -1
runner/src/main.rs
··· 1 - use std::env; 1 + use std::{env, process::{self, Command}}; 2 2 3 3 fn main() { 4 4 let iso = env::var("ISO").unwrap(); 5 5 println!("ISO path: {iso:?}"); 6 + 7 + let ovmf = env::var("OVMF_PATH").unwrap(); 8 + 9 + // Qemu runs our OS in a virtual container 10 + let mut qemu = Command::new("qemu-system-x86_64"); 11 + 12 + // Specify the path to the ISO 13 + qemu.arg("-cdrom"); 14 + qemu.arg(env!("ISO")); 15 + // For UEFI on qemu, the path to OVMF.fd is needed 16 + qemu.arg("-bios").arg(ovmf); 17 + 18 + // Pass any args to qemu 19 + env::args().skip(1).for_each(|arg| { 20 + qemu.arg(arg); 21 + }); 22 + 23 + let exit_status = qemu.status().unwrap(); 24 + 25 + process::exit(exit_status.code().unwrap_or(-1)); 6 26 }