diff options
| author | Tianhao Wang <shrik3@riseup.net> | 2023-03-11 19:26:49 +0100 |
|---|---|---|
| committer | Tianhao Wang <shrik3@riseup.net> | 2023-03-11 19:26:49 +0100 |
| commit | 6ee191ced1cd9998caa4cca9531229ddd83840bb (patch) | |
| tree | 2439da0b2aed60f84b54ce78a3476ecf80cc92e9 /Makefile | |
| parent | aec1686102abc5c9099c198e7798bcb7c94b3402 (diff) | |
readme
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 22 |
1 files changed, 13 insertions, 9 deletions
@@ -1,4 +1,7 @@ # this is an prototype makefile with hardcodings.. +# Forgive the ugly code, but this make more sense +# for those (me included) who are not sure about +# the building process. # TODO reorganize... # @@ -9,26 +12,27 @@ bootdisk.iso : kernel cp kernel isofiles/boot/ grub-mkrescue /usr/lib/grub/i386-pc -o bootdisk.iso isofiles +# Link the rust library against the objects from asm code (currently only the startup.o), +# later we'll use wildcards kernel : rust_kernel startup.o - # ar -rcs ./target/x86_64_rustubs/debug/librustubs.a ./target/x86_64-rustubs/debug/librustubs.rlib - # ld -n --gc-sections -T sections -o kernel startup.o target/x86_64-rustubs/debug/librustubs.a ld -static -e startup -T sections -o ./kernel startup.o target/x86_64-rustubs/debug/librustubs.a +# install xbuild first. (cargo install xbuild) +# Compile the rust part: note that the the cargo crate is of type [staticlib], if you don't +# define this, the linker will have troubles, especially when we use a "no_std" build rust_kernel: - # cargo rustc --target=x86_64-rustubs.json -- -C link-arg=-nostartfiles --emit=obj - # cargo rustc --target=x86_64-rustubs.json -- -C link-arg=-nostartfiles --crate-type=staticlib - # xargo build --target=x86_64-rustubs cargo xbuild --target x86_64-rustubs.json +# need nasm startup.o: nasm -f elf64 -o startup.o src/arch/x86_64/asm/startup.s clean: cargo clean - rm bootdisk.iso - rm startup.o - rm system - rm isofiles/boot/system + rm -f bootdisk.iso + rm -f startup.o + rm -f kernel + rm -f isofiles/boot/kernel qemu: bootdisk.iso qemu-system-x86_64 -drive file=./bootdisk.iso,format=raw -k en-us |
