intermezzos / kernel Goto Github PK
View Code? Open in Web Editor NEWA hobby operating system, in Rust
Home Page: http://intermezzos.github.io/
License: Apache License 2.0
A hobby operating system, in Rust
Home Page: http://intermezzos.github.io/
License: Apache License 2.0
The Readme reads:
This project is dual licensed under Apache2/MIT. See the two LICENSE-* files for details.
But there is no such file in this repository. Maybe it was accidentally deleted? Would be good to re-add them.
In #9, I split up the makefile into a few steps, for Travis. But 'make' doesn't do the right thing, because I'm lazy and haven't made it do the right thing yet.
I'm trying to implement my own VGA driver myself.
I made a simple solution using a macro, like the example given at the end of the chapter kmain
, but I have a LOT of questions to perform myself in Rust :-)
Is an IRC/channel/group exists to discuss about that?
Thanks a lot!
that way we get safe initialization
We should be able to start a process and run it in user mode.
If I change src/lib.rs
like this:
let mut i = 0;
loop {
kprintln!("i {}", i);
i = i + 1;
}
It prints just fine, but when i hit a key, it doesn't resume printing.
Hi all, I decided to take a crack at getting this sucker working on os x. I went through and documented my steps in a script. @steveklabnik said an issue would be good to document this stuff so yay ๐.
Things the script does:
brew install
tools that it can like gmp
, mpfr
, libmpc
, autoconf
, and automake
binutils
, gcc
, objconv
grub
using the cross compilerThis works or at least doesn't error out obviously. I'm going to run through this process again when I have more time to see if there are any silent errors.
By changing the Makefile
a little to point at the ld
and grub-mkrescue
that you just made you should be able to run make
now. Nothing errors, but at this point nothing shows up after you have the kernel running.
Also I'm a super newbie at all of this stuff so I apologize if something is wrong. Also just a disclaimer the script above downloads and compiles stuff into your home dir. I suggest you read it or edit it if you want to change the dirs that it puts stuff in. They should be made configurable at some point.
I'll post here with any follow up I find.
Right now, we only implement ISRs with no error codes. We should also be able to handle the ones that push an error code.
https://github.com/Homebrew/brew/blob/master/share/doc/homebrew/Custom-GCC-and-cross-compilers.md
It would be super rad if we could provide a formula rather than just the install script.
The version of nasm packaged with debian stretch doesn't work, but the one with jessie does. It appears to be a change between nasm 2.11 and nasm 2.12, but working on both seems like a good idea.
When running rustup install nightly-2016-05-26
on macOS 10.12 with all updates applied, the command never exists.
It prints:
adrianbrink@ab-mbp:~|โ rustup install nightly-2016-05-26
info: syncing channel updates for 'nightly-2016-05-26-x86_64-apple-darwin'
info: downloading component 'rustc'
42.1 MiB / 42.1 MiB (100 %) 1.8 MiB/s ETA: 0 s
info: downloading component 'rust-std'
55.1 MiB / 55.1 MiB (100 %) 768.0 KiB/s ETA: 0 s
info: downloading component 'rust-docs'
6.5 MiB / 6.5 MiB (100 %) 1.0 MiB/s ETA: 0 s
info: downloading component 'cargo'
2.7 MiB / 2.7 MiB (100 %) 1.2 MiB/s ETA: 0 s
info: installing component 'rustc'
info: installing component 'rust-std'
info: installing component 'rust-docs'
info: installing component 'cargo'
And just hangs there forever. The same problem exists for nightly-2016-05-27
, which I guess means that it fails for this installation method.
Is there any quick fix for this, until rustup.rs fixes this.
I'm also going to raise an issue there.
The PIC crate is kind of a hack. It'd be nice to fix it up.
outb
/inb
@ketsuban has an example here: https://github.com/Ketsuban/finisterre
I think this would be a good idea before going to usermode, so cc #82
If anyone is interested in tackling this, please give it a try!
It doesn't mention that you need xargo
.
So I've spent a couple days struggling with this, but I finally found an answer that helped.
tl;dr If you're developing in an OS that has been booted on an EFI system, grub-mkrescue
assumes you want your image to have the EFI protections as well. In that case, you'll see a message about failing to boot from CDROM, specifically code 0009
. In that case, you need to install grub-pc-bin
and update your Makefile so the grub-mkrescue
line looks like:
grub-mkrescue /usr/lib/grub/i386-pc -o build/os.iso build/isofiles
Cheers!
@rasendubi has been doing interesting stuff:
https://github.com/rasendubi/bkernel/blob/master/build.rs
this might be a decent idea instead of the current "toss it in some directory" mess.
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/steve/src/intermezzOS/kernel/target/debug/deps/intermezzos-f72332709373820b.0.o" "-o" "/home/steve/src/intermezzOS/kernel/target/debug/deps/intermezzos-f72332709373820b" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/steve/src/intermezzOS/kernel/target/debug/deps" "-L" "/home/steve/src/intermezzOS/kernel/target/debug/build/intermezzos-ae49b6d4bcb27c57/out" "-L" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "boot" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "/home/steve/src/intermezzOS/kernel/target/debug/deps/libconsole.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-411f48d3.rlib" "/home/steve/src/intermezzOS/kernel/target/debug/deps/libspin-d054d2d05cd86dc1.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-411f48d3.rlib" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
= note: /usr/bin/ld: /home/steve/src/intermezzOS/kernel/target/debug/build/intermezzos-ae49b6d4bcb27c57/out/libboot.a(boot.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/home/steve/src/intermezzOS/kernel/target/debug/build/intermezzos-ae49b6d4bcb27c57/out/libboot.a(boot.o): error adding symbols: Bad value
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Wl,--as-needed" "-Wl,-z,noexecstack" "-m64" "-L" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "/home/steve/src/intermezzOS/kernel/target/debug/intermezzos-b45e4ac16f1d637d.0.o" "-o" "/home/steve/src/intermezzOS/kernel/target/debug/intermezzos-b45e4ac16f1d637d" "-Wl,--gc-sections" "-pie" "-nodefaultlibs" "-L" "/home/steve/src/intermezzOS/kernel/target/debug/deps" "-L" "/home/steve/src/intermezzOS/kernel/target/debug/build/intermezzos-ae49b6d4bcb27c57/out" "-L" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib" "-Wl,-Bstatic" "-Wl,-Bdynamic" "/home/steve/src/intermezzOS/kernel/target/debug/deps/librlibc-975886925ea7e4d8.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libtest-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libgetopts-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libterm-411f48d3.rlib" "/home/steve/src/intermezzOS/kernel/target/debug/deps/libintermezzos.rlib" "/home/steve/src/intermezzOS/kernel/target/debug/deps/libconsole.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libstd-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libpanic_unwind-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libunwind-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librand-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcollections-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liballoc_jemalloc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/liblibc-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/librustc_unicode-411f48d3.rlib" "/home/steve/src/intermezzOS/kernel/target/debug/deps/libspin-d054d2d05cd86dc1.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcore-411f48d3.rlib" "/home/steve/.multirust/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/x86_64-unknown-linux-gnu/lib/libcompiler_builtins-411f48d3.rlib" "-l" "dl" "-l" "pthread" "-l" "gcc_s" "-l" "pthread" "-l" "c" "-l" "m" "-l" "rt" "-l" "util"
= note: /usr/lib/gcc/x86_64-linux-gnu/6/../../../x86_64-linux-gnu/Scrt1.o: In function `_start':
(.text+0x20): undefined reference to `main'
collect2: error: ld returned 1 exit status
We don't currently have any unit tests here, so it's not a problem, but we should figure this out and fix it.
Someone on IRC told me that the PIC stuff would be fixed if we used gcc to assemble rather than nasm. Unsure though.
This works:
let hello = "Hi there Manish!";
But this doesn't:
let hello = "Hi there Manish";
I should fix this. Thanks for being a good test case, @Manishearth
IntermezzOS' Makefile calls "ld" but uses the generic name, which on many systems will be the default linker. We should instead be calling x86_64-pc-elf-ld
, the explicitly created (hopefully in a chapter in the book?) cross-linker.
What's the license for the code here?
add these instructions to the README: http://intermezzos.github.io/book/appendix/osx-install.html
make cargo
on macOS gives this error. this is because macOS has the wrong ld
(BSD), we need the GNU ld
.
error: linking with `cc` failed: exit code: 1
|
= note: "cc" "-Tlayout.ld" "-Wl,-n" "-nostartfiles" "-L" "/Users/ag_dubs/.xargo/lib/rustlib/x86_64-unknown-intermezzos-gnu/lib" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/intermezzos.0.o" "-o" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/intermezzos" "-Wl,--gc-sections" "-nodefaultlibs" "-L" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/deps" "-L" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/build/intermezzos-491f39d1c9fb19a5/out" "-L" "/Users/ag_dubs/.xargo/lib/rustlib/x86_64-unknown-intermezzos-gnu/lib" "-Wl,-Bstatic" "-Wl,--whole-archive" "-l" "boot" "-Wl,--no-whole-archive" "-Wl,-Bdynamic" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/deps/libkernel_context.rlib" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/deps/libvga.rlib" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/deps/librlibc-975886925ea7e4d8.rlib" "/Users/ag_dubs/intermezzOS/kernel/src/target/x86_64-unknown-intermezzos-gnu/release/deps/libspin-d054d2d05cd86dc1.rlib" "/Users/ag_dubs/.xargo/lib/rustlib/x86_64-unknown-intermezzos-gnu/lib/libcore.rlib"
= note: ld: unknown option: -n
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: aborting due to previous error
error: Could not compile `intermezzos`.
To learn more, run the command again with --verbose.
error: `cargo` process didn't exit successfully
make: *** [cargo] Error 101
Speaking with @steveklabnik we both came to the conclusion that only supporting a linux development environment is probably the best thing to do (at least to begin with). I've started trying to get the kernel running in a Linux Virtual Box VM using @ashleygwilliams Vagrantfile from a similar project (per @steveklabnik's suggestion). I've run into a few issues, which I'll hopefully have sorted out soon. I'll have a PR ready when I can find sometime through the holiday season obligations.
For CI purposes.
I'm concerned about how this works when we upgrade. See b294480 for details.
The serial port interface needs to be designed and implemented.
Identity paging has been completed, but that's not great. We should do actual paging. what kind is yet TBD.
To start filesystem support, get FAT32 going.
This has a bare-bones impl, but could be made much better.
for CI purposes.
I was just messing around a bit, trying to add a cursor back into the new VGA code on my fork, no issues running the code in QEMU, but definitely had issues trying to access VGA hardware registers in test code. I basically broke all VGA tests by causing SIGSEGVs (woo!).
Wondering what the options are for unit testing code that needs to work so close to metal...
In school we wrote components for PintOS, but all the testing was done by running executables in user space. This worked quite well, but its really system testing, not unit testing. Without writing the kernel code to be accommodating of unit testing (lots of traits? Passing around real & mock impls), I'm not seeing how to assert on some aspects of the kernel directly.
After completing Chapter 4.3 and running my code using make, QEMU starts flashing between:
SeaBIOS (version 1.7.4-20150827_223240-lgw01-56)
iPXE (http://ipxe.org) 00:03.0 C900 PCI2.10 PnP PMM+07FC10F0+07F210F0 C900
Booting from Hard Disk...
Boot failed: could not read the boot disk
Booting from Floppy...
Boot failed: could not read the boot disk
Booting from DVD/CD...
and
VGA Blank mode
What can I do to fix this?
It's not currently mentioned in the readme that you need xargo to build; this confused someone on IRC.
Run more than one user program at once.
Hey,
I am following this project with great interest. I wonder if there is any kind of schedule or a plan for the next chapters (because I want to start playing with osdev using this project when it gets to the printing to screen stuff and I want to schedule my other side projects now)
This is super off the wall, but intermezzOS through kvm would be amazing http://lwn.net/Articles/658511/
marking as "question" because who knows if we even want to do this
I can't seem to find a good way to cleanly shut down qemu. The docs I found here (http://wiki.qemu.org/download/qemu-doc.html) show a way to "Exit emulator", but this doesn't seem to work for me at least inside of the Vagrant VM. For now, I'm just using pgrep qemu | xargs kill -15
Current status: this has been implemented, but not yet written about in the book.
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.