Writing an OS in Rust - Part 1 - A Freestanding Rust Binary

Поділитися
Вставка
  • Опубліковано 16 лис 2024
  • This is my version of Philipp Oppermann's "BlogOS". It's a baremetal operating system that can boot off of a USB stick on any BIOS-compatible machine, which is pretty amazing. I'm going to be following the whole blog, one video at a time, and running the OS using QEMU instead of booting a physical machine. Just to keep things simple.
    Full playlist: • Rust OS
    Livestream: / unclescientist
    This first video goes through the basics of creating a standalone (or "freestanding" to use the terminnoloy in the blog post) executable in Rust, eschewing the rust startup code, the libc requirement, and even the rust standard library.
    See os.phil-opp.com/
    #rust #rustos #blogos #rustlang

КОМЕНТАРІ • 55

  • @SkyyySi
    @SkyyySi 2 роки тому +106

    It's kinda odd to me that a video about writing an OS from scratch is this relaxing to watch

    • @UncleScientist
      @UncleScientist  2 роки тому +36

      I’ll have to work on my ASMR voice

    • @jirehla-ab1671
      @jirehla-ab1671 4 місяці тому

      ​Are intel amd cpus only designed for uefi, or can they be adapted to other alternatives from uefi & legacy bios? ​@@UncleScientist

    • @UncleScientist
      @UncleScientist  4 місяці тому +1

      @@jirehla-ab1671 uefi is a specification, so it's not tied to a particular cpu

  • @foggy5249
    @foggy5249 2 роки тому +53

    Yt algorithm blessed me to find this channel

    • @looc1612
      @looc1612 2 роки тому +1

      Yt algorithm blessed me to find this channel

  • @local-admin
    @local-admin Рік тому +9

    I’m going to have many long nights with these videos. Wish me luck.

  • @Otakutaru
    @Otakutaru Рік тому +4

    Everything, from your channel profile, to your voice, workspace and skills. Zen 10/10

  • @fancywaifu9821
    @fancywaifu9821 2 роки тому +9

    Im so glad i found someone going over this website in a video. I'm not a very good reader so having someone talk over it is super helpful!

    • @monkie-dev8000
      @monkie-dev8000 Рік тому +3

      ye, same. (ye = yes/yeah a internet slang term for an expression of "yes" commonly used among gen z)

  • @someghosts
    @someghosts 2 роки тому +4

    Perfect background video to have on while I write mediocre js

  • @lordmelbury7174
    @lordmelbury7174 Рік тому +1

    Comment to feed the algo. Great video for an OG who want to dabble in Rust + OS ! Thank you for all the hard work and great documentation. Much appreciated.

  • @RuslanKovtun
    @RuslanKovtun 2 роки тому +3

    Comment to make youtube happy. Good luck.

  • @Yadobler
    @Yadobler 2 роки тому +6

    Oh my you're a madlad

  • @joelkomieter6557
    @joelkomieter6557 4 місяці тому +1

    I really enjoyed this

  • @theroboman727
    @theroboman727 2 роки тому +6

    1:51 they are doing that and its called relibc

  • @elotfreelancing1791
    @elotfreelancing1791 2 роки тому +1

    Nice, finally found this.

  • @magibai
    @magibai 23 дні тому

    Came by to check the comment section to remind myself that there are people just immune to suffering of this world.

  • @looc1612
    @looc1612 2 роки тому +1

    you are my god now

  • @stevemojang8736
    @stevemojang8736 2 роки тому +5

    what a chad

  • @valhalla_dev
    @valhalla_dev Рік тому +2

    ah shit now I'm gonna have to do this

  • @edgymarshmellow8493
    @edgymarshmellow8493 2 роки тому +3

    Note: if you do use an arm system you could technically get away with using the first step most likely; otherwise you’d need to remake your own version to work for the new Apple chipsets…

    • @vikramvikram3726
      @vikramvikram3726 Рік тому

      Can't it be cross compiled ? I know this might be stupid but im new to it

    • @sunrisexoxo220
      @sunrisexoxo220 Рік тому

      @@vikramvikram3726 Arm and x86 are both different so he have to make for arm as well

  • @TigerGaming-kp9yn
    @TigerGaming-kp9yn Місяць тому +1

    how did you manage this with no assembly at all

  • @manuelsuarez7521
    @manuelsuarez7521 3 місяці тому

    amazing!

  • @vishalkulkarni3977
    @vishalkulkarni3977 Рік тому +1

    nice music

  • @ДенисРуцкий-у9с
    @ДенисРуцкий-у9с 2 роки тому +3

    What is the difference beetwen cargo new and cargo new --bin?

    • @UncleScientist
      @UncleScientist  2 роки тому +5

      The "--bin" argument is default, so "cargo new xyzzy" by default creates a binary project. See doc.rust-lang.org/cargo/commands/cargo-new.html for more details

    • @ДенисРуцкий-у9с
      @ДенисРуцкий-у9с 2 роки тому

      @@UncleScientist thanks

  • @edbertkwesi4931
    @edbertkwesi4931 Рік тому

    glad ibfound you really powerful mehn u the best

  • @maxdignitas3698
    @maxdignitas3698 2 роки тому +2

    When you ran `cargo build --target !$`, can you help me understand what `!$` means?

    • @UncleScientist
      @UncleScientist  2 роки тому +10

      Yeah, it's not exactly google-friendly. The "!$" means "replace me with the last item from the previous command. In this case, my previous command was "rustup target thumbv7em-non-eabihf", so that means !$ was replaced by "thumbv7em-non-eabihf". If you look at the line immediately following where I entered "cargo build --target !$", you'll see the *actual* cargo build line that the command saw. See zsh.sourceforge.io/Doc/Release/Expansion.html under section 14.1.3 for more details

    • @maxdignitas3698
      @maxdignitas3698 2 роки тому +1

      @@UncleScientist Thanks for the clear explanation! Makes sense now! (And, yes…not so Google-friendly indeed 😅)

  • @raphaelmorgan2307
    @raphaelmorgan2307 Рік тому +2

    if you don't want to type out the target every time, you can just create a script file and put the command in there instead, then run that script instead of cargo build
    e.g. I created a batch file in the OS directory called "cargo.bat" (bc I'm on windows) that says "cargo build --target thumbv7em-none-eabihf" and now in cmd.exe, in the OS directory, I type "build.bat" instead of "cargo build"
    and I did the same with the run command

    • @sanvi4236
      @sanvi4236 Рік тому

      also, you can add a ".cargo/config.toml" off your main working directory, that allows you to set some defaults when running cargo build. i think the entry youd use for this is
      [build]
      target = "..."

  • @txrav8517
    @txrav8517 2 роки тому +1

    i am stuck in installing rust in my windows is there any tutorial you could give me to do it

    • @UncleScientist
      @UncleScientist  2 роки тому +1

      You should be able to install rust for windows using these instructions rustup.rs/

  • @cbbcbb6803
    @cbbcbb6803 Рік тому +1

    Can every operating system be rewritten in Rust?

  • @abhishekmurthy9643
    @abhishekmurthy9643 11 місяців тому

    might sound like an odd question... but can someone who doesnt know rust follow along with this?

    • @UncleScientist
      @UncleScientist  11 місяців тому +1

      it's not really a rust teaching book, but if you know the basics of programming, you shouldnt' have any problem following along

    • @abhishekmurthy9643
      @abhishekmurthy9643 11 місяців тому

      Thank you! @@UncleScientist

  • @Accanfo
    @Accanfo 2 місяці тому

    Goood

  • @AdamPoniatowski
    @AdamPoniatowski 2 роки тому

    might as well contribute to redox OS, instead of writing it up from scratch

    • @UncleScientist
      @UncleScientist  2 роки тому +6

      this stream was more about learning how OS's work than creating an actual OS, but thanks for the tip about redox - i checked it out and it looks interesting. maybe i could stream a PR for it at some point

  • @heater5979
    @heater5979 2 роки тому

    Great content, well presented. Would be much better without the irritating background music. If it were not for that I would subscribe.

    • @UncleScientist
      @UncleScientist  2 роки тому

      Appreciate the feedback - some of the videos are music-free, so maybe you would enjoy those?

    • @heater5979
      @heater5979 2 роки тому

      @@UncleScientist Ok, cool. I will continue to follow.

  • @lilsamura1396
    @lilsamura1396 10 місяців тому

    good video, i want to donate

    • @UncleScientist
      @UncleScientist  10 місяців тому

      Thanks! I don’t have anything set up for donations outside of twitch, but I very much appreciate the support

  • @RoamingAdhocrat
    @RoamingAdhocrat 2 роки тому +1

    `eh_personality` means "Canadian"

  • @dominik6647
    @dominik6647 2 роки тому

    p̶r̶o̶m̶o̶s̶m̶

  • @bdeas
    @bdeas Рік тому

    SPEAK LOUDER

  • @looc1612
    @looc1612 2 роки тому +3

    Yt algorithm blessed me to find this channel