thepowersgang / rust-barebones-kernel Goto Github PK
View Code? Open in Web Editor NEWA barebones framework for a rust kernel.
License: The Unlicense
A barebones framework for a rust kernel.
License: The Unlicense
It might be because the kernel is in UEFI mode, but if you know some way to get VGA Text Mode to work please tell me.
Hi
When running make I get the following error
x86_64-none-elf-as -o .obj/amd64/start.o arch/amd64/start.S
make: x86_64-none-elf-as: Command not found
Makefile:75: recipe for target '.obj/amd64/start.o' failed
make: *** [.obj/amd64/start.o] Error 127
I realized this is the name given in the Makefile to as:
ifeq ($(ARCH),amd64)
LD := x86_64-none-elf-ld
AS := x86_64-none-elf-as
OBJDUMP := x86_64-none-elf-objdump
OBJCOPY := x86_64-none-elf-objcopy
else ifeq ($(ARCH),x86)
LD := i686-elf-ld
AS := i686-elf-as
OBJDUMP := i686-elf-objdump
else
$(error Unknown architecture $(ARCH))
endif
If I change the Makefile ot set the name of the tools, the make process continues normally
LD := ld
AS := as
OBJDUMP := objdump
OBJCOPY := objcopy
I'm trying to pass the multiboot header (or pointer) into the kmain function by using push. Everytime I try the compiler complains that I can't push 32-bit registers on to a 64-bit stack, is there a workaround or fix to this?
llvm_asm has been deprecated in new version and I've tried to figure out how to switch to the new formatting but I just can't seem to do it. Is there any way you could help?
when i try to build i got first error regarding "make: x86_64-none-elf-as: Command not found" which got around by changing makefile "make: x86_64-none-elf-as" to "make: x86_64-elf-as" but then got another one : http://termbin.com/bg8n
After applying the patch for float point in libcore, the make process generates this error:
as -o .obj/amd64/start.o arch/amd64/start.S
rustc -O --cfg arch__amd64 --target=arch/amd64/target.json --cfg disable_float -C soft-float -o .obj/amd64/libcore.rlib --crate-type=lib --emit=link,dep-info ../libcore/lib.rs
warning: ignoring specified output filename because multiple outputs were requested
../libcore/num/mod.rs:1474:9: 1474:38 error: unresolved import `num::dec2flt::ParseFloatError`. Could not find `dec2flt` in `num` [E0432]
../libcore/num/mod.rs:1474 pub use num::dec2flt::ParseFloatError;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../libcore/num/mod.rs:1474:9: 1474:38 help: run `rustc --explain E0432` to see a detailed explanation
error: aborting due to previous error
Makefile:65: recipe for target '.obj/amd64/libcore.rlib' failed
make: *** [.obj/amd64/libcore.rlib] Error 101
Just curious, why is it necessary to use libcore & rust nightly?
I can't compile the kernel for this reason.
rustc -O --cfg arch__amd64 --target=arch/amd64/target.json --cfg disable_float -C soft-float -o .obj/amd64/libcore.rlib --crate-type=lib --emit=link,dep-info ../libcore/lib.rs
../libcore/option.rs:172:10: 172:11 error: expected type, found `#`
../libcore/option.rs:172 Some(#[cfg_attr(not(stage0), stable(feature = "rust1", since = "1.0.0"))] T)
^
Makefile:72: recipe for target '.obj/amd64/libcore.rlib' failed
make: *** [.obj/amd64/libcore.rlib] Error 101
Everything seemed fine but I got this error. I used TRIPLE = make
This seems to have nothing to do with that though.
I know that 1.0 nightly is recommended but I wanted to try 1.2 nightly. Get the following:
x86_64-elf-ld -o ../kernel.amd64.bin -T arch/amd64/link.ld -Map .obj/amd64/map.txt --gc-sections -z max-page-size=0x1000 .obj/amd64/start.o .obj/amd64/kernel.o .obj/amd64/libcore.rlib
.obj/amd64/kernel.o: In function `fmt::Write::write_fmt::Adapter$LT$$u27$a$C$$u20$T$GT$.Write::write_fmt::h12553647585220172932':
main.0.rs:(.text._ZN3fmt5Write9write_fmt36Adapter$LT$$u27$a$C$$u20$T$GT$.Write9write_fmt21h12553647585220172932E+0x5a): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
.obj/amd64/kernel.o: In function `fmt::_$RF$$u27$a$u20$T.Display::fmt::h317396037922038184':
main.0.rs:(.text._ZN3fmt25_$RF$$u27$a$u20$T.Display3fmt19h317396037922038184E+0x1c): undefined reference to `fmt::str.Display::fmt::h2af2fe2576bb6edfMGN'
.obj/amd64/kernel.o: In function `kmain':
main.0.rs:(.text.kmain+0x127): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
main.0.rs:(.text.kmain+0x13c): undefined reference to `fmt::num::i32.fmt..Display::fmt::h3c80d6522088f321zaM'
main.0.rs:(.text.kmain+0x204): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
main.0.rs:(.text.kmain+0x2a9): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
main.0.rs:(.text.kmain+0x37d): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
main.0.rs:(.text.kmain+0x422): undefined reference to `fmt::write::he06a9e58235fa9d6i5M'
make: *** [../kernel.amd64.bin] Error 1
If I remove the calls to log!
everything compiles and runs. New to Rust and would like to try and get this compiling with 1.2 as a way to start learning Rust. Any ideas?
I've tried to build kernel like in your README
, but with some differences.
Firstly, I've tried to do make
, but it fails with this error:
rustc -O --cfg arch__amd64 --target=arch/amd64/target.json --cfg disable_float -C soft-float -o .obj/amd64/libcore.rlib --crate-type=lib --emit=link,dep-info ../libcore/lib.rs
warning: ignoring specified output filename because multiple outputs were requested
LLVM ERROR: SSE register return with SSE disabled
Makefile:61: recipe for target '.obj/amd64/libcore.rlib' failed
make: *** [.obj/amd64/libcore.rlib] Error 1
So, I decided to apply patch from the root of repo (libcore_nofp.patch
). It also fails:
patching file clone.rs
patching file default.rs
patching file fmt/mod.rs
patching file intrinsics.rs
patching file lib.rs
patching file num/flt2dec/decoder.rs
Hunk #1 succeeded at 12 with fuzz 2.
patching file num/mod.rs
Hunk #1 succeeded at 94 (offset 1 line).
Hunk #2 FAILED at 1403.
1 out of 2 hunks FAILED -- saving rejects to file num/mod.rs.rej
patching file ops.rs
And if I built it with wrong-applied patch it says me about 12 errors like ../libcore/num/dec2flt/rawfp.rs:144:1: 189:2 error: the trait
num::Floatis not implemented for the type
f32[E0277]
I am using latest (today) nightly:
rustc --version
rustc 1.4.0-nightly (e2bebf32f 2015-08-14)
And libcore from rust-lang/rust
repo.
Could you fix the patch, please?
Replacing
log!("Hello world!\n");
with
log!("Hello world! {}\n", 1);
currently reboots the machine.
Looks to me like a triple fault is produced somehow. I have not investigated further. Doing
log!("Hello world! {}\n", "asdf");
seems to work tough.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.