From ebf482379c979cfeafb715a290255d98740437c0 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 23 Jan 2022 17:59:49 +0100 Subject: [PATCH] Minor improvements --- .../edition-3/posts/02-booting/index.md | 19 ++++++++++++++++-- .../edition-3/posts/02-booting/qemu-gray.png | Bin 0 -> 5478 bytes 2 files changed, 17 insertions(+), 2 deletions(-) create mode 100644 blog/content/edition-3/posts/02-booting/qemu-gray.png diff --git a/blog/content/edition-3/posts/02-booting/index.md b/blog/content/edition-3/posts/02-booting/index.md index b53094e1..71ac48fd 100644 --- a/blog/content/edition-3/posts/02-booting/index.md +++ b/blog/content/edition-3/posts/02-booting/index.md @@ -575,9 +575,11 @@ Even though most systems support a framebuffer, some might not. The [`BootInfo`] [`Option`]: https://doc.rust-lang.org/std/option/enum.Option.html [`if let`]: https://doc.rust-lang.org/reference/expressions/if-expr.html#if-let-expressions -The [`FrameBuffer`] type provides two methods: The [`info`] method returns a [`FrameBufferInfo`] instance with all kinds of information about the framebuffer format, including the pixel type and the screen resolution. The [`buffer`] method returns the actual framebuffer content in form of a mutable byte [slice]. +The [`FrameBuffer`] type provides two methods: The `info` method returns a [`FrameBufferInfo`] instance with all kinds of information about the framebuffer format, including the pixel type and the screen resolution. The `buffer` method returns the actual framebuffer content in form of a mutable byte [slice]. [`FrameBuffer`]: https://docs.rs/bootloader/0.10.1/bootloader/boot_info/struct.FrameBuffer.html +[`FrameBufferInfo`]: https://docs.rs/bootloader/0.10.1/bootloader/boot_info/struct.FrameBufferInfo.html +[slice]: https://doc.rust-lang.org/std/primitive.slice.html We will look into programming the framebuffer in detail in the next post. For now, let's just try setting the whole screen to some color. For this, we just set every pixel in the byte slice to some fixed value: @@ -599,7 +601,7 @@ While it depends on the pixel color format how these values are interpreted, the After running `cargo kbuild` and then our `boot` script again, we can boot the new version in QEMU. We see that our guess that the whole screen would turn gray was right: -TODO: QEMU screenshot +![QEMU showing a gray screen](qemu-gray.png) We finally see some output from our own little kernel! @@ -627,6 +629,19 @@ TODO ### Booting on Real Hardware +To boot on real hardware, you first need to write either the `bootimage-uefi-blog_os.img` or the `bootimage-bios-blog_os.img` disk image to an USB stick. This deletes everything on the stick, so be careful. The actual steps to do this depend on your operating system. + +#### Linux + +#### Windows + +On Windows, you can use the [Rufus] tool, which is developed as an open-source project [on GitHub][rufus-github]. After downloading it you can directly run it, there's no installation necessary. In the interface, you select the USB stick you want to write to + +[Rufus]: https://rufus.ie/ +[rufus-github]: https://github.com/pbatard/rufus + +#### macOS + TODO ## Support for `cargo run` diff --git a/blog/content/edition-3/posts/02-booting/qemu-gray.png b/blog/content/edition-3/posts/02-booting/qemu-gray.png new file mode 100644 index 0000000000000000000000000000000000000000..b814104cbc30dd77922064061096dee283d3a21a GIT binary patch literal 5478 zcmeAS@N?(olHy`uVBq!ia0y~yU^Zc3U~1uDV_;yoc)orc0|Ns~v6E*A2L}g74M$1` z1B0lnr;B4q#hkZyqdTsa?mzzVy-%c}t;p_WhfXbG_I0|MC^gIIGG9>Hrj#zdCCpQn zh?O+(iHNk6%@h!H4Geb^c$$$F(6TW4Wrj;vkg)5@m6p~8$(m=+?7OjhtNizf^D~TX z>%M)iitYV>KY#82^0ligcmI2BAIg9ggoIv>duP9Bm0S4L`>S3xJd|f=VE7?^H9Yix zWT^D&SN3hc7AUfx?US`;`*$ROfq|iV?b4;G9&0bz9C>b?B%j8}z;Gk_zu6RDXWm&C ze;aTxFdVpNRi-h!P0FPHcDo}31H-p#6QojBI6eji$AS1v4_>1y3qZQwb4W2TD1_x) zC@CqqvMKfSw;k86Uk`u#_U+e$?DBuMI=^i`GLw!x`L|EN#&CSi}*URtMUXQrHr?U8N{r|tE7hT1#rcRFyD}H`% z?Of|}vupLgUM}DDd|vgdL)`jnRR#3BwX1IZ{j|2Ru`w$@e|`DA%H?TiXN3kY z_glMq{k~lrx35~YefxH~x*rc`SrjJ47M)Zz&Aztg)ytQX)4nHPTH<;2)~zURaXpzW z-;PP=UpXosA9Gx$_{;+DbN@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