A Minimal Rust Kernel #998
Replies: 403 comments 155 replies
-
I'm not really a fan of using this magic utility to turn our blob of Rust into a bootable image. The parts in raw assembly in the first edition were a bit tedious but I liked how they gave us a deeper understanding about how the process worked. I hope that this utility won't be sticking around for the post on UEFI booting... |
Beta Was this translation helpful? Give feedback.
-
"They are designed to make the bootloader simple instead of the kernel. For example, the kernel needs to be linked with an adjusted default page size, because GRUB can't find the Multiboot header otherwise." WRONG! That is true of Multiboot2, a later standard which is less used and NOT multiboot-compatible. However, the actual Multiboot standard does not have that problem at all. |
Beta Was this translation helpful? Give feedback.
-
@Redrield Fair point. On the other hand we already used Apart from a less tedious start, the new bootloader gives us an opportunity for an even deeper understanding of the boot process than before: We're planning to write several posts on how the tool and the underlying bootloader works, in a similar fashion as the other posts (i.e. every line of code is in the post and you can follow along). Thus, we can hide the complexity at the beginning of the main post series and directly start with the more interesting part, but also provide resources to those who want to understand it all the way down. |
Beta Was this translation helpful? Give feedback.
-
@pixelherodev Huh? I was under the impression that Multiboot2 was the successor of Multiboot? Either way, Multiboot 1 is not a better solution for us since it does have other problems (if I remember correctly it does not support 64-bit ELF files at all). |
Beta Was this translation helpful? Give feedback.
-
Fair enough. Multiboot 2 is essentially the spiritual successor to multiboot IIRC.
I also remember multiboot being easier to get started with, but that's neither here nor there :p
Honestly, while I don't think ignoring multiboot was a good idea, I can understand why you did so.
|
Beta Was this translation helpful? Give feedback.
-
Yeah, there are clear tradeoffs in this case. I really like the idea behind multiboot, but the standard and the implementation not so much. I plan to add grub compatibility to the bootimage tool, so that you can boot it in a multi-OS setting too. |
Beta Was this translation helpful? Give feedback.
-
First of all, great tutorial, thanks a lot for the effort! |
Beta Was this translation helpful? Give feedback.
-
@FuzzyHerbivore Thanks a lot! I added a hint to the post in 5f195a8. |
Beta Was this translation helpful? Give feedback.
-
Disclaimer: I'm on Windows. There is a problem with running Also, converting to a VDI for VirtualBox doesn't seem to work. I get:
|
Beta Was this translation helpful? Give feedback.
-
@kyle I'm also using Windows with cargo 1.26.0 nightly and xargo 0.3.11. Are these the same versions for you? I'm stuck with building using xargo:
Using cargo 1.26.0 nightly and xargo 0.3.11. |
Beta Was this translation helpful? Give feedback.
-
@kylegalloway sorry |
Beta Was this translation helpful? Give feedback.
-
Feeling a little silly, still stuck on the above, but realised I was setting the path incorrectly. The following steps still fail:
These are always with the multiple input filenames provided error. Apologies for the multiple posts. |
Beta Was this translation helpful? Give feedback.
-
I pushed a new version of the bootloader yesterday, seems like this is the cause of the error. I reverted the change for now, so it should work again. Thanks for reporting!
Hmm, I have no idea about this error. I only found https://forum.lede-project.org/t/error-convert-img-to-vdi/152, which indicates that the image needs to be padded somehow before converting. |
Beta Was this translation helpful? Give feedback.
-
@AaronCoad Strange, I've never seen this error. Could you try it with |
Beta Was this translation helpful? Give feedback.
-
Hi, I have a little problem with bootimage.
But when I run it with --release flag everything works properly. Why could it happen? .S my host OS is Kubuntu 17.10 |
Beta Was this translation helpful? Give feedback.
-
Hi! I am running linux in a virtual machine. When I try to installl bootimage, the virtualbox crashes! |
Beta Was this translation helpful? Give feedback.
-
Hi, I followed the tutorial up to the kernel building step, however when I try to run
I'm running Windows 10 22H2 |
Beta Was this translation helpful? Give feedback.
-
Would be nice if the "next post" was linked to the next post. I'm binging your material at this point. Really emphasising and explaining in more detail, all that my lecturer covered in class. Thank you! |
Beta Was this translation helpful? Give feedback.
-
Hi, great tutorial! I am really enjoying it, but I running into the following problem: I am trying to run When I change the command to
= note: the
|
Beta Was this translation helpful? Give feedback.
-
hi I get this when I load install bootimage --target x86_64-specs.json This is how we put it in the json file I appreciate the following: PS E:\OS\blog_os> load boot image --target x86_64-specs.json Caused by: Kernel executable at note: run with environment variable |
Beta Was this translation helpful? Give feedback.
-
I have the same issue that others had already, just that sadly I didn't have any luck getting it to work. When trying to boot (either my own codebase or the post-02 branch of the repo) via QEMU I get a black screen and that's it. I don't get any errors in my terminal nor on screen and it seems that something happens right at the start (there's a flash where the text would be but it's too fast to see if it's the text or something else). QEMU version is 8.1.1 on an M2 Pro MacBook, latest Rust nightly version as of right now and bootimage 0.9.23. |
Beta Was this translation helpful? Give feedback.
-
I get a linking error when I run cargo build and I have no idea on how to solve it
|
Beta Was this translation helpful? Give feedback.
-
Hi guys. I also got a compilation error message but Rust has said i should try out this command:
Hope it helps another soul there. |
Beta Was this translation helpful? Give feedback.
-
Hi everyone, Can anyone guide me on how to boot the kernel using qemu-system-riscv64.exe? |
Beta Was this translation helpful? Give feedback.
-
Just a reminder that during this part, after running rustup component add rust-src, we need to also run rustup update to actually download to rust source code for recompile |
Beta Was this translation helpful? Give feedback.
-
Just a heads-up for anyone who is doing this, I am on Windows 11 and facing a lot of compilation errors due to |
Beta Was this translation helpful? Give feedback.
-
For those running QEMU on Windows 10 (and probably 11). I would recommend following the first 3mins of the video below to get it installed properly. Also, I had to run my terminal (or vscode) as an admin for it to recognize the command Installing QEMU video link In general, I would recommend comparing your files to the repository for this post if you get stuck |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi, i'm on a Kali Linux environment, i've compiled successfully the code, but when i ran the output image with QEMU, it showed me a kernel panic or something referred to panics, the error was on the file src/page_table.rs and i didnt found any of this, do some people got this error? |
Beta Was this translation helpful? Give feedback.
-
Ive fixed the problem: i'm a failure following the steps here, and i know everyone makes mistakes in their life, some video tutorials helped me and i'm glad now to have a Rust-based OS, thank you @phil-opp :) |
Beta Was this translation helpful? Give feedback.
-
This is a general purpose comment thread for the “A Minimal Rust Kernel” post.
Beta Was this translation helpful? Give feedback.
All reactions