Show HN: My from-scratch OS kernel that runs DOOM

(github.com)

133 points | by UnmappedStack 5 hours ago

11 comments

  • donnachangstein 3 hours ago
    A few months work by one guy and already more capable than the Hurd.

    Imagine what you could accomplish given 35 years.

    • dxroshan 1 hour ago
      > A few months work by one guy and already more capable than the Hurd

      It is no way capable than Hurd. It is a cool project though. Have you used Hurd recently? It can run a modern desktop.

      • donnachangstein 1 hour ago
        I searched YouTube for actual evidence of Hurd booting to a desktop and only found two videos of Hurd freezing during boot, and a third video of RMS explaining to a very confused convention attendee that he's "never installed GNU slash lynn-ox" because he could just ask someone else to do it.

        No videos of Hurd running Doom either, but anyone is welcome to create one and share.

        • gertop 24 minutes ago
          Hurd is for sure a failed project and it can't realistically run a modern desktop as claimed, but it's more capable than you give it credit for. For example, see:

          https://www.debian.org/ports/hurd/

    • UnmappedStack 3 hours ago
      Haha not quite at the point Hurd has gotten. I'd be very happy if I could last that long on one project though, I have a tendency to get bored after a few months sadly.
      • parl_match 2 hours ago
        > Haha not quite at the point Hurd has gotten

        that's true, you've only shipped to one computer, while they've shipped to dozens!

  • badmonster 21 minutes ago
    Very cool project! How are you handling process isolation and scheduling in TacOS?
  • planck_tonne 4 hours ago
    Hi, congratulations! You must be feeling proud. Nice choice of proof of concept (DOOM).

    Sorry to disappoint you but all I have are some noob questions.

    What would be the steps to run this on a laptop? I take it that after building it there would be a process similar to, say, setting up dual-boot in a Windows PC? (Whoa I'm asking a stranger on the Internet how to run dangerous software on my computer...)

    If one wanted to undertake such a project, do you have any recommendations of textbooks or other reading material? I had some OS & related courses in university (I'm EE, so computer-adjacent), but they were all very abstract / high level / conceptually-focused. I'd love something more concrete. It doesn't have to be x64.

    • UnmappedStack 3 hours ago
      Not disappointed at all to answer! Running it on my laptop was literally just formatting a USB with the ISO and booting from the USB.

      I would recommend checking out https://osdev.wiki to start out if you want to write a kernel, as well as reading relevant specifications (such as Intel Developer Manual and the specs for any drivers you write). I don't really know much about non-x86 kernel dev but most of the concepts are the same as far as I know, just different technical implementations. There's a link to a discord server on the project's readme, there are some very smart people in there who I'm sure would be more than happy to help you out.

    • lolinder 1 hour ago
      Meta comment, but I'm pretty disappointed that this got downvoted so much. You're asking some good questions that prompted useful answers and showed sincere interest in someone's work. Don't get discouraged by the downvotes, keep learning!
      • owebmaster 1 hour ago
        Not being upvoted to the top doesn't mean downvoted. Your negativity is baseless.
        • lolinder 1 hour ago
          The funny thing about meta comments is that they can change the status quo that they're commenting on (that is, in fact, part of their purpose), and once they've made the change they seem pointless to those who come later.

          At the time of commenting this comment was totally grayed out at the bottom. That's a pretty dour welcome for a new user to a community that's ostensibly interested in anything that gratifies curiosity.

          • defrost 53 minutes ago
            Completely fair point.

            I've vouched several green user comments in the past six hours that had been flagged and gone to dead for no apparent reason, the GP comment you spoke for was one that others had kicked to dead ( usually I'm flagging obvious spam comments straight to dead ).

  • waschl 1 hour ago
    Welcome to the club! Did almost the same and really enjoyed the serenity of doing something which never will end up in a product

    https://jakobbr.eu/2024/08/19/writing-my-own-x86_64-operatin...

  • andrewmcwatters 2 hours ago
    From-scratch kernel straight to DOOM is some top-tier hacker cred stuff. You must be very happy with it running on real hardware. Very cool.
  • pkoird 5 hours ago
    Really really love the name.
    • aoki 4 hours ago
      In the fine tradition of Nachos and Pintos! (Still waiting on Burritos - which would obviously have to be based on functional programming principles - and Churros.)
      • khazhoux 3 hours ago
        Burritos are just monoids in the category of endotacos.
        • Octoth0rpe 2 hours ago
          welp I think I found my favorite comment ever.
  • KerbalNo15 5 hours ago
    This is so cool
  • thewileyone 3 hours ago
    Dude, I'm impressed cause I don't the energy to build my own OS kernel!

    But here's a wacky idea. Just set it up so that the OS only runs DOOM as default. Boots directly into Qemu and runs DOOM, nothing to select or change. Maybe something you could fold other games into so that they can run off a USB boot loader. Might be appealing to people who don't want to install or compromise their base setup.

    • UnmappedStack 3 hours ago
      I could probably do that. The init program, which is a userspace program called by the kernel which spawns everything else, currently enters the shell but it'd be quite simple to make it just boot into Doom immediately. It's still not quite stable enough for actual usage, but it is able to boot off a USB at the moment, yes.
  • gitroom 4 hours ago
    Dude, getting Doom to run on your own kernel is epic - I gotta try building some wild stuff like this someday
    • UnmappedStack 4 hours ago
      Yeah definitely an achievement I'm happy with. I've got a bit of refactoring to do, ANSI parsing etc then I'd like to port more - perhaps even Vim (or another portable Vim-like editor called Dim)
      • edoceo 3 hours ago
        Could you explain more about why you'd need to port things? If you have a libc, shouldn't it "just work"? Do you have to scatter #define or #ifdef all over? What about if you wanted to support Golang? Would you have to implement a bunch of syscall?
        • UnmappedStack 3 hours ago
          Well, the LibC is still quite small, and the syscalls aren't really compatible with Linux. A lot of things to port, for example Vim, require system libraries such as ncurses which need syscalls that aren't in the LibC. I don't really need many #ifdefs, at least not for most things, as it's a more or less posix-based libc.
  • vadivlkumar 2 hours ago
    [dead]