From 90655746ca95964fe357f14bf8d83c8d7091a3ad Mon Sep 17 00:00:00 2001 From: greg Date: Sun, 25 Oct 2015 23:25:15 -0700 Subject: [PATCH] Rust kernel Following this post: http://blog.phil-opp.com/rust-os/multiboot-kernel.html#fn2 --- rust_boot.asm | 7 +++++++ rust_kernel.rs | 0 rust_kernel/Makefile | 20 ++++++++++++++++++++ rust_kernel/isofiles/boot/grub/grub.cfg | 8 ++++++++ rust_kernel/isofiles/boot/kernel.bin | Bin 0 -> 864 bytes rust_kernel/isofiles/kernel.bin | Bin 0 -> 864 bytes rust_kernel/linker.ld | 16 ++++++++++++++++ rust_kernel/multiboot2_header.asm | 14 ++++++++++++++ rust_kernel/rust_boot.asm | 9 +++++++++ rust_kernel/rust_kernel.rs | 0 10 files changed, 74 insertions(+) create mode 100644 rust_boot.asm create mode 100644 rust_kernel.rs create mode 100644 rust_kernel/Makefile create mode 100644 rust_kernel/isofiles/boot/grub/grub.cfg create mode 100755 rust_kernel/isofiles/boot/kernel.bin create mode 100755 rust_kernel/isofiles/kernel.bin create mode 100644 rust_kernel/linker.ld create mode 100644 rust_kernel/multiboot2_header.asm create mode 100644 rust_kernel/rust_boot.asm create mode 100644 rust_kernel/rust_kernel.rs diff --git a/rust_boot.asm b/rust_boot.asm new file mode 100644 index 0000000..09bb57b --- /dev/null +++ b/rust_boot.asm @@ -0,0 +1,7 @@ +global start + +section .text +bits 32 +start: + mov dword [0xb800], 0x2f4b2f4f + hlt diff --git a/rust_kernel.rs b/rust_kernel.rs new file mode 100644 index 0000000..e69de29 diff --git a/rust_kernel/Makefile b/rust_kernel/Makefile new file mode 100644 index 0000000..873ac03 --- /dev/null +++ b/rust_kernel/Makefile @@ -0,0 +1,20 @@ + +all: run_kernel + +kernel.bin: multiboot2_header.asm rust_boot.asm linker.ld + nasm -f elf64 multiboot2_header.asm + nasm -f elf64 rust_boot.asm + ld -n -o kernel.bin -T linker.ld multiboot2_header.o rust_boot.o + +os.iso: kernel.bin + cp kernel.bin isofiles/ + grub-mkrescue -o os.iso isofiles + +run_kernel: os.iso + qemu-system-x86_64 -hda os.iso + +.PHONY: clean +clean: + rm -f *.o + rm -f kernel.bin + rm -f os.iso diff --git a/rust_kernel/isofiles/boot/grub/grub.cfg b/rust_kernel/isofiles/boot/grub/grub.cfg new file mode 100644 index 0000000..7d1c964 --- /dev/null +++ b/rust_kernel/isofiles/boot/grub/grub.cfg @@ -0,0 +1,8 @@ + +set timeout=2 +set default=0 + +menuentry "my os" { + multiboot2 /boot/kernel.bin + boot +} diff --git a/rust_kernel/isofiles/boot/kernel.bin b/rust_kernel/isofiles/boot/kernel.bin new file mode 100755 index 0000000000000000000000000000000000000000..0732f804d20306dc9fea3494780847c631457810 GIT binary patch literal 864 zcmb<-^>JfjWMqH=CI&kO5Kln^BH{p{7#@HGp=<{R3kF682L?6}D@ z%uxX=U}TU$6W3>8V8CXMEdv9C02X^0a!YecGC|%liqA+*Oi3-$ODxW1fH32WOA?Dp zV4T#v6o#VG;*xlfYOpGZG}tAS64DF|AYU>t!3=`>3l`s?c!NoSXi#{8Xc$(6>Su!r zz`}O{l+O*NVHA4$5M*FrV1`K|(W{|sbtny^(Cr8D;cka1Vqjpn0c9V6(x5cV&cMI` bOM5VXapJIl2FPFr1_o!Sei#K6hH)7HZooZ@ literal 0 HcmV?d00001 diff --git a/rust_kernel/isofiles/kernel.bin b/rust_kernel/isofiles/kernel.bin new file mode 100755 index 0000000000000000000000000000000000000000..f199f57563d7df009415f24a0fcaa727916c36f2 GIT binary patch literal 864 zcmb<-^>JfjWMqH=CI&kO5Kln^BH{p{7#@HGp=<{R3kF682L?6h<^i2>$sm@vrOEDRt2!}u^7>`;*J z(acc+D_~@hKoi$zU|_&zjx7TNg8&wL8FEW=N-{ydGK$YgO-xBG(n~DPWq>f_i%SxV zN?@GSycC9_(&CbMkZQ0hh&0$GloHYm3?N@JFu@Fh`U@7{pm>8xfoM>8foK?3gz9I5 z3c$j50hG@JrC}6$`VeGbU|@zxBGGH0Y;`CNqtNXK@!@WVDPmw?xB+D!fYP8e%+A2T c084u?e{tfle+I~41_lOasD2m)6^3yc01