-
Notifications
You must be signed in to change notification settings - Fork 215
Transitioning from bootimage to the new system #150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Bootimage is not deprecated yet, it's just that the newest bootloader version uses a different build approach (documented here. I'm currently working on updating the Writing an OS in Rust blog for the new version and I plan to create a migration guide too. The fundamental differences are:
|
I've read that, but I still am unsure on how I should migrate over.
…On 4/19/21, Philipp Oppermann ***@***.***> wrote:
Bootimage is not deprecated yet, it's just that the newest bootloader
version uses a different build approach ([documented
here](https://docs.rs/bootloader/0.10.1/bootloader/). I'm currently working
on updating the Writing an OS in Rust blog for the new version and I plan to
create a migration guide too. The fundamental differences are:
- New build system instead of `bootimage`.
- Pixel-based framebuffer instead of VGA text buffer.
- When using the new UEFI support, you need to use the APIC since the legacy
PIC is no longer supported.
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#150 (comment)
--
Signed,
Ethin D. Probst
|
Update: so I just re-read the documentation and it makes a bit more sense, but it still raises some questions, e.g.: where do I get "cargo-builder"? How do you go about writing one if that's necessary? (I was thinking of using something like cargo-make to automate that process a bit as well.) |
|
Oh, okay, I understand. Thank you! |
So I have one more question and then I should (maybe?) understand this properly. I'll give it a test drive at least. :-) For my config, I have: [unstable]
build-std = ["core", "compiler_builtins", "alloc"]
[build]
target = "x86_64-kernel-none.json"
[target.'cfg(target_os = "none")']
runner = "bootimage runner" And for my target config, I have: {
"llvm-target": "x86_64-kernel-none",
"data-layout": "e-m:e-i64:64-f80:128-n8:16:32:64-S128",
"arch": "x86_64",
"target-endian": "little",
"target-pointer-width": "64",
"target-c-int-width": "32",
"os": "none",
"executables": true,
"linker-flavor": "ld.lld",
"linker": "rust-lld",
"panic-strategy": "abort",
"disable-redzone": true,
"features": "-mmx,-sse,+soft-float"
} Do I alter the config.toml to look like so: [unstable]
build-std = ["core", "compiler_builtins", "alloc"]
[build]
target = "x86_64-kernel-none.json" And keep the target JSON and then run cargo build? So my build process, were I to automate it, might look like this?
If so, I could probably automate this with cargo-make. Not really sure how but that would be really nice. |
@ethindp Maybe this is what you want: https://gist.github.com/JonahHenriksson/f037c778881918ac57ee131e0a045735 |
@phil-opp Hey, how do we use the framebuffer? I tried writing to it, but get nothing. Is there something I need to enable or set before using it? Where would I go to learn more? The UEFI spec? |
@JonahHenriksson Writing to the memory area reported by the boot info should work. If it doesn't, that would be a bug. I also wanted to say sorry about the missing documentation around the new build system. I thought I would get to this earlier, but the latst few weeks have been busy for me. I try to create a small example for the build crate in the next few days. |
I actually have a question about this. Do I use standard characters
when I write to the GOP framebuffer, or can I use something more
elaborate like a TTF to render individual glyphs and then just write
the raw glyph renderings to the FB?
…On 5/16/21, Philipp Oppermann ***@***.***> wrote:
@JonahHenriksson Writing to the memory area reported by the boot info should
work. If it doesn't, that would be a bug.
I also wanted to say sorry about the missing documentation around the new
build system. I thought I would get to this earlier, but the latst few weeks
have been busy for me. I try to create a small example for the build crate
in the next few days.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#150 (comment)
--
Signed,
Ethin D. Probst
|
The framebuffers that bootloader v0.10 sets up are pixel-based (on both UEFI and BIOS systems). This means that you can (and need to) control each individual pixel, there is no such thing as the ASCII-aware VGA text buffer anymore. So to display text, you need to render it to pixels first. You can do that using full TTF rendering, or you can use some simpler bitmap font such as |
I didn't notice this until now -- thanks for that information! So, say I want to render the string "Hello!" using fontdue. So, would I do the following?
I've never done font rendering before so I've no idea what to do. |
@ethindp I haven't worked with fontdue yet, so I don't know any specifics. However, there are typically two high-level steps in font rendering: determining where the glyphs should be placed (e.g. dependent on the spacing between glyphs) and rendering each glyph. The |
Lol, came back to work on my OS project after finishing up my school work, and now I see what I did. I iterated though the range of the buffer, instead of the buffer itself, setting those values instead... 🤦♂️ |
@JonahHenriksson Your makefile is (sort-of) working. Its just not building the script properly -- cargo apparently still has that bug where it builds everything with the target specified in .cargo/config.toml. Removing that (sort-of) fixes the problem (though you then need to annotate each cargo command with --target) but then it fails to build the script because of -Z build-std. |
So I got it to work and its booting (sort-of). |
Are there plans for a definitive migration guide from bootloader 0.9 to 0.10? |
We now have migration guides available at https://github.com/rust-osdev/bootloader/tree/main/docs/migration. |
So, my kernel still uses the old bootimage building system, but that's now deprecated. However, I don't know how to (safely) transition from the old to the new system. So how do I go about doing this?
The text was updated successfully, but these errors were encountered: