Skip to content
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

Open source composition of Edition 3 #1063

Open
kennystrawnmusic opened this issue Nov 4, 2021 · 29 comments
Open

Open source composition of Edition 3 #1063

kennystrawnmusic opened this issue Nov 4, 2021 · 29 comments
Labels
help wanted We could use help for this issue/pull request!
Milestone

Comments

@kennystrawnmusic
Copy link
Contributor

Progress on the third edition is likely to go much faster if everyone is able to contribute. Although I’ve heard that work on the third edition is indeed in progress, there’s so far nothing visible (yet) — a “work-in-progress” branch of the repository where pre-release contribution to the third edition would be possible would at least get more contributors on board, and the more possible contributors, the faster the development of the third edition of the book would go.

@phil-opp
Copy link
Owner

Thanks for the suggestion and for offering to help!

Right now, the main blocker is that I'm still not satisfied with the new build system. In its current state, we wouldn't be able to use the default cargo build/cargo test/cargo run commands anymore and instead use alias commands (e.g. cargo kbuild) to pass the --target and -Zbuild-std arguments. Another drawback is that we would not be able to use the upcoming artifact dependencies feature of cargo.

The best solution for this is to support more .cargo/config settings in Cargo.toml files too, as I proposed on the internals forum. In order to support cargo build etc. with our new build system, we would need to set the following options in our Cargo.toml:

I know that implementing these in cargo isn't an easy task, but it would help very much in bringing the third edition forward.

@phil-opp phil-opp added the help wanted We could use help for this issue/pull request! label Nov 14, 2021
@phil-opp phil-opp added this to the edition-3 milestone Nov 14, 2021
@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Nov 16, 2021

Submitted rust-lang/cargo#10084 as a fix for the showstopper that you mention — rearranges some code around so that the -Zbuild-std check waits until after generate_targets() is already run. Although rustfmt fails on it, builds on all platforms are successful. Hopefully this solves the problem.

@phil-opp
Copy link
Owner

Thanks a lot for looking into this!

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Jan 20, 2022

I would make the point that target.runner isn’t as critical as build-std in Cargo.toml because it can already be set in .vscode/settings.json which allows you to just click the “Run” button from VS Code and open it in QEMU that way. That is, of course, after installing the Rust plugin for VS Code and going on to rustup component add rust-analyzer-preview as the backend.

@kennystrawnmusic
Copy link
Contributor Author

Posted a video to my YouTube channel explaining how to get the VS Code option up and running as an alternative just in case the team decides not to move -Zbuild-std into Cargo.toml as Alex Crichton’s skepticism might indicate.

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Feb 5, 2022

Alright, since I kind of figured out how to design a logger on my own without the need for Edition 3-Post-3, I've decided to publish my own logger as a standalone crate for other kernels to use in the meantime. Should help speed up Post 3 by a lot.

@Lioncat2002
Copy link

yo was wondering how long we got till the publishing of edition 3?

@kennystrawnmusic
Copy link
Contributor Author

yo was wondering how long we got till the publishing of edition 3?

There is an edition-3 repository branch but it hasn’t been updated since January 27 (and I have submitted a few pull requests to that branch myself that have yet to be considered for merging).

@bjorn3
Copy link
Contributor

bjorn3 commented Jul 14, 2022

@phil-opp is still working on a redesign of the bootloader crate: rust-osdev/bootloader#232 This redesign is blocking the 3rd edition.

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Dec 13, 2022

@phil-opp is still working on a redesign of the bootloader crate: rust-osdev/bootloader#232 This redesign is blocking the 3rd edition.

So that new version of the bootloader has been released; now what? Still no commits to the edition-3 branch in 11 months.

@phil-opp
Copy link
Owner

Now that the new bootloader version is ready, I can finally start to write the new posts. I plan to continue my work on the edition-3 branch and I'll comment here once I have some drafts ready. Then I would appreciate some testing and proofreading!

Note that I'm only working on this project in my spare time, so I can't give you a time estimate.

@asensio-project
Copy link

Hello @phil-opp, in the first post on the section Disabling the standard library, there is an incoherent text: and the --edition 2018 flag specifies that we want to use the [2021 edition](https://doc.rust-lang.org/nightly/edition-guide/rust-2021/index.html) of Rust for our crate..

I think that you should change --edition 2018 to --edition 2021.

@phil-opp
Copy link
Owner

phil-opp commented Jan 2, 2023

Good catch, thanks! Fixed in 96c8aaf.

@kennystrawnmusic
Copy link
Contributor Author

Post 2 still uses bootloader 0.10 — so the first thing that needs to happen is updating that post to use 0.11 instead. With an already existing migration guide, shouldn't be too difficult, and I'll definitely be glad to help with any drafts of the updated Post 2 here.

@phil-opp
Copy link
Owner

phil-opp commented Jan 5, 2023

Yes, this is the next step on my list. I try to get to it this weekend.

@Lioncat2002
Copy link

Lioncat2002 commented Jan 9, 2023

Hello! By when can we expect the post 3 for edition 3?
Since it looks like there is no more a blocker of the bootloader crate👀

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Jan 10, 2023

Hello! By when can we expect the post 3 for edition 3?
Since it looks like there is no more a blocker of the bootloader crate👀

Post 2 has to be rewritten first because bootloader 0.11 introduces some breaking changes and it was written for 0.10 originally. Biggest change is configuration, which in 0.11 is now in the kernel's source code itself instead of Cargo.toml — see lines 94-113 of my kernel's main.rs file for an example. Another big change in 0.11 is the entry_point! macro, which you now pass a reference to that very configuration structure as an argument to.

Also, you can now choose which firmware type (BIOS, UEFI, or both) to support instead of needing to always support everything. I've got mine in UEFI-only mode (similar to systemd-boot) since it's been more than 10 years since all systems sold on store shelves began shipping with UEFI out of the box.

As for supporting screen output, I've got a crate for that so it shouldn't be difficult either.

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Jan 13, 2023

Not there yet of course but when @phil-opp gets to the embedded_graphics post (last in the series) I have a (warning: untested) reference implementation that might be worth looking at.

@kennystrawnmusic
Copy link
Contributor Author

Another important change worth making would be to this post: document how to depend on bootloader-x86_64-common as a way to speed up custom UEFI loader creation

@kennystrawnmusic
Copy link
Contributor Author

Documentation on how to load an initrd using the bootloader crate would also be welcome.

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Jan 25, 2023

Hello! By when can we expect the post 3 for edition 3?
Since it looks like there is no more a blocker of the bootloader crate👀

Update: it's now possible to depend on the logger provided by bootloader-x86_64-common for framebuffer logging — even easier approach than the one I had earlier

@kennystrawnmusic
Copy link
Contributor Author

kennystrawnmusic commented Jan 26, 2023

Using pull request #1187 to fix edition-3-post-2. Should make it much easier.

kennystrawnmusic added a commit to kennystrawnmusic/blog_os that referenced this issue Jan 26, 2023
kennystrawnmusic added a commit to kennystrawnmusic/blog_os that referenced this issue Jan 26, 2023
@emanuele-em
Copy link

emanuele-em commented Feb 23, 2023

@phil-opp I write a writer that use bootloader 0.11 and pixel-based framebuffer (noto_sans_mono_bitmap) based on the code inside the bootloader crate. I can help with the code of post-03 if you want

@kennystrawnmusic
Copy link
Contributor Author

Merging rust-osdev/bootloader#360 might be an important step here given that it fixes what could become a potential showstopper if left alone

kennystrawnmusic added a commit to kennystrawnmusic/blog_os that referenced this issue May 9, 2023
@kennystrawnmusic
Copy link
Contributor Author

Submitted pull request #1223 to get the ball rolling

@kennystrawnmusic
Copy link
Contributor Author

Finally figured out why #1223 was failing the Zola integration; seems the "more" and "TOC" comments are critical for the build process in that case. Completely green on the CI now, so should be ready to merge.

@Abelkrijgtalles
Copy link

Question about the embedded_graphics crate in edition 3 post 3: When implementing Display, the rust compiler throws a hell of a lot of errors (see log.txt). What version is used in that post?
Files:
log.txt
cargotomlkernel.txt
cargotomlmain.txt
code.txt

@phil-opp
Copy link
Owner

@Abelkrijgtalles That post is still work-in-progress and still contains some code examples that I just wrote down without testing. In your case, the issue seems to be that the struct is named FrameBuffer instead of Framebuffer. You can also check out the post-3.3 branch, which contains the code for this post.

@Abelkrijgtalles
Copy link

Thank you! I'm looking out to the release of edition 3!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted We could use help for this issue/pull request!
Projects
None yet
Development

No branches or pull requests

7 participants