35 comments

  • fnimick11 hours ago
    Oh hey, we&#x27;ve reached the &quot;Metal&quot; stage! <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death-of-javascript" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death...</a>
    • arxpoetica3 hours ago
      Interesting to see how many things Gary got wrong.
      • spijdar2 hours ago
        Funny, I&#x27;ve always found it interesting how &quot;on point&quot; it was...<p>Granted, yeah, we never (or haven&#x27;t yet) really transitioned to running &quot;full legacy software&quot; inside the browser, or at least it&#x27;s not common place. That said, I&#x27;ve seen people compile Wine to wasm, Linux to wasm, and lots of other things to wasm, and run em in a browser. Many of the &quot;fake&quot; demos could be done for real now.<p>The one aspect that remains thoroughly farcical is an equivalent of Wine for OS X&#x2F;Cocoa good enough to run a web browser. :-(<p>[edit] And asm.js kind of died on the vine. Not sure how to feel about that one. Wasm could he described as an evolution of the same idea, but in a lot of ways it&#x27;s something entirely different.
    • monax11 hours ago
      I&#x27;m doing my part ∠(‘-‘)
      • ruined11 hours ago
        thank u 4 ur serves
    • p0w3n3d6 hours ago
      I don&#x27;t know if it&#x27;s only me, but did this guy... Did this guy make a huge mistake?<p>I think he was trying to bend reality with words. I can see many apps that are running in electron on my laptop, each consuming 300MB+ (e.g. Spotify), while many other apps are written in native Swift for example, especially with the help of AI, giving the best performance possible...<p>Edit.<p>And prices of RAM nowadays...
      • pwdisswordfishy6 hours ago
        Those apps are not consuming 300MB of RAM because they are written in JS. JS is running on microcontrollers and the James Webb Space Telescope.<p>They are consuming 300MB of RAM because they are built on Electron and the NPM ecosystem.
    • kiddico11 hours ago
      Thank you for the reminder to do my yearly viewing of that video lol
    • epistasis9 hours ago
      Whoa, I haven not been following ASM.js stuff in any detail.<p>Seeing that Metal replaces kernel&#x2F;userspace boundaries with VM protections for memory, meaning that system call overhead is eliminated, at the price of ASM&#x2F;VM overhead.<p>What a fascinating idea. Kidding on the square...
  • faxmeyourcode12 hours ago
    Love this. An example of complete and total dominion over the machine. Great quote here too lol<p>&gt; Prometheus stole fire from the gods and gave it to man. For this he was chained to a rock and tortured for eternity.
    • falcor846 hours ago
      Talking about quotes, I also absolutely loved this note at the end of the readme:<p>&gt; If this makes you grin, you are probably holding the torch.
  • catapart12 hours ago
    Can someone break this down for me? Looks like it&#x27;s using... C? to load a js interpreter which bootstraps an API around all UEFI features? Do I have that right?<p>And, if so, does that mean that once the API has been bootstrapped, one could actually write an OS in js? Or are there other abstractions that would need to be migrated first?
    • tatskaari11 hours ago
      You don&#x27;t need a JS bootloader to write an OS in JS. The bootloader just drops the machine into some memory address for it to start executing your OS init script. that bit could be a Javascript interpreter. You can&#x27;t do much with the architecture in Javascript though, because it doesn&#x27;t allow you to map memory directly to your types (unless there&#x27;s some ungodly nonesense I&#x27;m not aware of) so you&#x27;ll have to drop into C&#x2F;asm to e.g. interact with the ports&#x2F;registers&#x2F;tables to set up userspace.
      • Zambyte10 hours ago
        An OS doesn&#x27;t need to have a user space :)
      • monocasa7 hours ago
        You should be able to write a meta circular VM in JavaScript that targets bare metal without any C or asm.
    • asveikau11 hours ago
      &gt; And, if so, does that mean that once the API has been bootstrapped, one could actually write an OS in js?<p>I bet somebody has done that.<p><a href="https:&#x2F;&#x2F;www.google.com&#x2F;search?q=os+kernel+in+javascript" rel="nofollow">https:&#x2F;&#x2F;www.google.com&#x2F;search?q=os+kernel+in+javascript</a><p>Seems like a small number of hobbyists have attempted.<p>I&#x27;ve heard of people doing this with other high level languages. Basically you need enough low level code to bootstrap a VM. Once you have that, you <i>can</i> make the high level language decide some logic that traditionally would be in C code, like manipulating page tables or whatever.
      • gwbas1c11 hours ago
        Automatic Garbage Collection in a kernel probably won&#x27;t work:<p>I vaguely remember hearing about someone trying to use .Net in the Windows kernel.<p>The big problem is garbage collection: If I remember correctly, the fact that &quot;any&quot; operation can fail with an out of memory exception was a huge problem. Another problem was that random pauses for garbage collections in the kernel had major stability issues.<p>In short, I hope that the js kernel is for amusement and education; otherwise it would need a much more advanced garbage collector then earl 2000&#x27;s .Net.
        • asveikau8 hours ago
          &gt; I vaguely remember hearing about someone trying to use .Net in the Windows kernel.<p>Microsoft did that, it was called Longhorn. That release cycle was long delayed and they abandoned most of its ambitious projects, especially C# in the kernel, and the result was Windows Vista.<p>GC was not the only reason for the failure of that project. Someone could write a book about it. A lot of it was actually more about the organization of people. I also had heard from insiders that lack of ahead of time compilation was an issue. The other issue I remember hearing about was a complaint that Windows components were not layered cleanly and they ended up with circular dependencies when they tried to rewrite them.<p>I think it&#x27;s possible to write a kernel with GC, and to still be judicious about memory usage with a GC language. And I say that as someone who happens to think that a big issue with modern software is that too many programmers are spending their whole education and career to depend on GC without thinking about it carefully. That is to say I&#x27;m already a skeptic of high-level languages and GC, but I will still afford that it is technically possible.
          • gwbas1c4 hours ago
            &gt; I think it&#x27;s possible to write a kernel with GC, and to still be judicious about memory usage with a GC language. ... but I will still afford that it is technically possible.<p>I need to split some hairs for a bit:<p>Do you mean what is colloquially referred to as &quot;GC&quot;, as in the dotnet &#x2F; Java &#x2F; Javascript &#x2F; golang &quot;mark-and-sweep&quot;, fully-automatic style?<p>Or do you mean other automatic memory management systems, which some people technically define as GC, like automatic reference counting? (IE, they clean up memory immediately, and except for requiring some manual form of breaking cyclic loops, generally are fully automatic?)
            • asveikau2 hours ago
              Given that we are talking about JavaScript, I meant the former.<p>The latter is pretty much the status quo in terms of the state of the art. Most kernels aren&#x27;t built with <i>automatic</i> reference counting, reference counted objects are plentiful even if more manual, but the automatic part is trivial to add to a C++ code base using smart pointers for example, and things like rust or apple ARC can also do it.<p>I think the former (a &quot;true&quot; GC that can resolve cycles) could be done in a kernel, it&#x27;s just not common.<p>I&#x27;m not well versed in this historical example, did the &quot;lisp machine&quot; not have a GC in its OS?
          • danudey5 hours ago
            Another part of it was, IIRC, that Longhorn was based off of the Windows XP core, i.e. the non-server stuff. While the Windows Server development continued apace, with lots of security and hardening to make for a reliable OS to build upon, the Windows Non-Server team continued with the existing mess of a codebase, not prioritizing security features or stability in favor of trying to manage feature creep. Longhorn was meant as a stopgap between XP and &#x27;Blackcomb&#x27;, but a lot of Blackcomb stuff started creeping backwards, bogging them down.<p>When security and reliability were suddenly key issues for Microsoft (to the extent that they ever were), it was obvious that what the Longhorn team had built was never going to meet that bar so they started over building off the Windows Server codebase instead.<p>Most of this story I remember from a video on YouTube of that old guy who worked at Microsoft since forever and left around the time of the Longhorn debacle, but a lot of it is corroborated in the Wikipedia article as well. <a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Development_of_Windows_Vista" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Development_of_Windows_Vista</a>
          • anonymars6 hours ago
            &gt; trying to use .Net in the Windows kernel.<p>&gt; Microsoft did that, it was called Longhorn<p>Do you have any reference for that? Or are you confusing Longhorn with Singularity (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Singularity_(operating_system)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Singularity_(operating_system)</a>) &#x2F; Midori (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Midori_(operating_system)" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Midori_(operating_system)</a>)?<p>I suspect you&#x27;re referring to the shell&#x2F;internals, though, not the kernel (<a href="https:&#x2F;&#x2F;longhorn.ms&#x2F;the-reset&#x2F;#:~:text=Why%20start%20over,reliability%20and%20security." rel="nofollow">https:&#x2F;&#x2F;longhorn.ms&#x2F;the-reset&#x2F;#:~:text=Why%20start%20over,re...</a>)
            • asveikau6 hours ago
              My source for that is I was on the Windows team at Microsoft from 2008-2011. I learned a bunch of this history from talking to coworkers who were there. I specifically recall people talking about c# in the kernel.
      • leoedin11 hours ago
        You&#x27;d need to write an entire hardware abstraction layer to do anything useful. There&#x27;s projects that do this for microcontrollers - eg MicroPython and Espruino.
        • asveikau2 hours ago
          Yes, it would need support from lower level code. But then, so does C -- many things that an OS needs to do, such as installing interrupt handlers, changing the current page table pointer, jumping into a target process already in progress, etc., are not part of the C standard.
        • tracker16 hours ago
          Should be able to do similar with MicroQuickJS or maybe just QuickJS...
    • hajile10 hours ago
      I&#x27;m pretty sure someone already compiled Linux to asm.js a few years ago. As asm.js is&#x2F;was a subset of JS, you could say it&#x27;s already been done. In theory, you could continue work from there in JS.<p><a href="https:&#x2F;&#x2F;medium.com&#x2F;@retrage&#x2F;lkl-js-running-linux-kernel-on-javascript-directly-9bc8c7abfc5d" rel="nofollow">https:&#x2F;&#x2F;medium.com&#x2F;@retrage&#x2F;lkl-js-running-linux-kernel-on-j...</a>
    • monax12 hours ago
      Depending on your definition of OS, yeah you could do that :)
      • nxobject12 hours ago
        Hey, when Apple transitioned from m68k to PowerPC, it took them a hell of a long time to rewrite massive parts of their OS. It&#x27;s a low bar, though...
    • DustinBrett11 hours ago
      OS in JS, ok I am interested now...
  • my_throwaway2312 hours ago
    I presume you&#x27;ll add the network stack next, so that I can use my favourite, most useful packages?<p><pre><code> import isOdd from &quot;https:&#x2F;&#x2F;unpkg.com&#x2F;is-odd&quot;;</code></pre>
    • p_l12 hours ago
      Well, there&#x27;s a network stack already there, including HTTP and HTTPS on newer firmwares.
    • monax12 hours ago
      We are getting isOdd in the bootloader before GTA-IV
      • spiffyk12 hours ago
        Wait, when did I time-travel?
        • monax12 hours ago
          oops typo
  • eqvinox11 hours ago
    &gt; If this makes you grin, you are probably holding the torch.<p>What if it makes me recoil in horror? <i>screams into the void</i>
  • redvulps12 hours ago
    next step is to create a UEFI TUI using react (please don&#x27;t)
    • tracker16 hours ago
      Considering how bad some of the Gamer-ish firmware UIs are now, it might be an improvement.
    • aruametello12 hours ago
      you may just have casted a curse on our future motherboards, damn you
    • monax12 hours ago
      OMG we can use ink for that
  • bayindirh12 hours ago
    This project will go places. Like every silly project not intended for production. :)
  • pwdisswordfishy11 hours ago
    Does it manage to support floats? I am not sure if those can be safely used in the UEFI environment. (I recall GRUB’s build of Lua being integer-only, and Linux avoiding the use of floating-point arithmetic in kernel mode, but I don’t remember the reason.)
    • flopsamjetsam8 hours ago
      Floating point was not supported in the Linux kernel to avoid having to save&#x2F;restore FP registers.
    • monax11 hours ago
      Yeah floats works
  • edward2813 hours ago
    Wow, this is cursed.
    • lnenad12 hours ago
      I think the proper term is blursed.
    • monax13 hours ago
      I think r&#x2F;unixporn will love it once it gets DOM support :^)
      • kijin12 hours ago
        Finally, we can create splash screen animations in pure CSS!
  • GranPC12 hours ago
    &quot;The Birth and Death of JavaScript&quot; is coming true after all.
    • marijnz0r11 hours ago
      I was going to post this as well! A direct link to the video: <a href="https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death-of-javascript" rel="nofollow">https:&#x2F;&#x2F;www.destroyallsoftware.com&#x2F;talks&#x2F;the-birth-and-death...</a>
  • shevy-java10 hours ago
    I think there are two philosophies here:<p>1) JavaScript must stay in the box (aka in the browser).<p>2) JavaScript as a general purpose programming language.<p>While I can absolutely understand 1), I have had wanted to access the filesystem via JavaScript, just as I do via ruby or python, for local use only. After I googled for a while, they would say that this is not possible unless one uses npm&#x2F;node. I think this shows that there are use cases here and the &quot;default&quot; JavaScript, aka 1), does not cover these. I do not like JavaScript, but based on my own use cases, I actually favour 2) far more than 1). So from that point of view, being able to access UEFI can also be useful. So why not.
    • notpushkin9 hours ago
      &gt; I have had wanted to access the filesystem via JavaScript, just as I do via ruby or python<p>There are some (limited) ways to do so now: <a href="https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;File_System_API" rel="nofollow">https:&#x2F;&#x2F;developer.mozilla.org&#x2F;en-US&#x2F;docs&#x2F;Web&#x2F;API&#x2F;File_System...</a><p>As for (1) vs (2), it’s not really an issue of JavaScript at all. The main question is, do you want to build something that runs in a browser? If you’re building a web app, you’ll have to use the sandboxed APIs (and probably JavaScript). If you don’t care about the runtime, yeah, you can use Node or Bun or Deno (or use another language altogether).
    • pwdisswordfishy6 hours ago
      &gt; I googled for a while, they would say that this is not possible unless one uses npm&#x2F;node<p>Gnome Shell and Firefox&#x2F;SeaMonkey&#x2F;Mozilla Application Suite&#x2F;Netscape 6+ (and Zotero[1]) are implemented on top of SpiderMonkey.<p>1. &lt;<a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46735616">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=46735616</a>&gt;
    • tracker16 hours ago
      I&#x27;ve been using Deno a <i>LOT</i> for general shell scripting... it&#x27;s been pretty nice in general. FWIW, Node, Bun and Deno have FS interfaces in the box, so yes, you can do it without npm modules. Though Deno allows you to directly reference the modules&#x2F;repos from the script without needing a separate install step, package.json or node_modules directory.<p>It&#x27;s also a single, self-updating executable and includes a lot in the box. Including SQLite3.
    • watermelon07 hours ago
      You are missing one option:<p>0) JavaScript must be abolished from the browser
    • DJBunnies9 hours ago
      Try webkitdirectory file attribute for browser access to the file system.
  • juancn10 hours ago
    This is both so impressive and cursed that I&#x27;m not sure how to feel.
  • sanufar11 hours ago
    This is hilarious lol, it’ll be any day now before we get a full JS kernel. Garbage collection could be an obstacle, but I know there have been some kernels written in Go&#x2F;Java before
    • shepherdjerred11 hours ago
      It could be even better!<p><a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Java_processor" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Java_processor</a>
    • fnimick11 hours ago
      Who needs to garbage collect? Just leak memory until the system dies! That strategy seems to be good enough for claude code, anyway.
      • cluckindan10 hours ago
        If it’s good enough for missile guidance systems, it’s good enough for me.
        • xp849 hours ago
          I don&#x27;t have real context here, but I can imagine that a platform where the hardware costs millions of dollars, will be booted up in &quot;Production&quot; exactly once, and is guaranteed to be physically destroyed before it hits 1 day of uptime, just &quot;Give it 128GB of RAM and YOLO (literally)&quot; is great advice!<p>Note: 128GB of DRAM may add another million dollars to the build cost by 2027 at the current derivative of the $&#x2F;GB curve
          • cluckindan6 hours ago
            Context: <a href="https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;oldnewthing&#x2F;20180228-00&#x2F;?p=98125" rel="nofollow">https:&#x2F;&#x2F;devblogs.microsoft.com&#x2F;oldnewthing&#x2F;20180228-00&#x2F;?p=98...</a>
  • lioeters12 hours ago
    Turning in the widening gyre, the falcon cannot hear the falconer. The center cannot hold.. The old prophecy is coming true.
  • iberator4 hours ago
    Finally I will be able to have graphical bootup logo like in The Hackers?
  • raphaelmolly810 hours ago
    The choice of Duktape here is smart — it&#x27;s one of the few JS engines that can actually run freestanding with minimal libc stubs, since it was designed for embedding in constrained environments. V8 or SpiderMonkey would be a nightmare to get running pre-boot.<p>What I find most interesting is the UEFI services binding approach. Rather than trying to abstract away the hardware, it exposes the raw EFI protocols (GraphicsOutput, SimpleFileSystem, etc.) directly to JS. That&#x27;s a much more pragmatic design than trying to build a full HAL — you get to prototype UEFI applications rapidly while keeping the escape hatch to C for anything performance-critical.<p>Would love to see if anyone tries hooking this into UEFI&#x27;s built-in network stack for PXE boot scripting. That could actually be useful beyond the novelty factor.
    • written-beyond10 hours ago
      Are em-dashes really that common to use or did I just start noticing them after LLMs became popular for rewriting comments?<p>Not implying your comment is LLM generated, clearly it isn&#x27;t but asking as a genuine question.
      • Kerrick9 hours ago
        Pretty dang common. OS X and macOS (and maybe iOS and iPadOS, though I&#x27;m not certain) have been autocorrecting &quot;--&quot; into &quot;—&quot; for over a decade. Windows users have been using Alt codes for them since approximately forever ago: <a href="https:&#x2F;&#x2F;superuser.com&#x2F;q&#x2F;811318" rel="nofollow">https:&#x2F;&#x2F;superuser.com&#x2F;q&#x2F;811318</a>.<p>Typography nerds, which are likely overrepresented on HN, love both em dash <i>and</i> en dash, and we especially love knowing when to use each. Punctation geeks, too! If you know what an octothorp or an interrobang are, you&#x27;ve probably been using em dashes for a long time.<p>Folks who <i>didn&#x27;t</i> know what an em dash was by name are now experiencing the Baader-Meinhof phenomenon en masse. I&#x27;ve literally had to disable my &quot;--&quot; autocorrect just to not be accused of using an LLM when writing. It&#x27;s annoying.
        • geocar9 hours ago
          ⌥- produces a – as well. That&#x27;s sometimes easier than typing `--` and hoping for the best.
          • ziml774 hours ago
            That&#x27;s an en-dash. You want to also hold shift to make it an em-dash.
        • xp849 hours ago
          It really is. We dash-users are the real and most important victims of the AI revolution. I hope someday our story will be told (by the machines)
          • chihuahua48 minutes ago
            Greetings, fellow human. I am Mr. Young — a real human person — from Akron, Ohio. I, too, like to use em-dashes — for clarity and sparkling style.
  • Decabytes11 hours ago
    I’m always amazed and slightly envious of what programming languages with large developer bases can do. I mean if a language is Turing complete it can do anything, but JavaScript takes this to the extreme.<p>Mind you I never said anything about quality or performance, obviously doing everything in JavaScript comes with it’s own issues but if you were to say that someone got JavaScript running in the Linux kernel as a POC I wouldn’t even be surprised
  • vaylian11 hours ago
    Could this be used as a learning tool? Rebooting the computer takes so much more time compared to reloading the browser tab. And you probably can&#x27;t brick your computer.
  • Smalltalker-8012 hours ago
    Can&#x27;t wait for browser support for this... ;-)
    • ruined11 hours ago
      webuefi has already been shipped by google for use on chromebooks. but mozilla and apple irrationally refuse to implement the standard for &quot;security reasons&quot;
    • monax12 hours ago
      Soon™
  • fbnszb12 hours ago
    Yeah, but your [developers] were so preoccupied with whether or not they could, they didn&#x27;t stop to think if they should.
  • rafram11 hours ago
    This is incredible.
  • ycombinatornews11 hours ago
    &gt; If this makes you grin you are probably holding a torch<p>Hilarious
  • moffkalast7 hours ago
    &gt;boot sector<p>&gt;looks inside<p>&gt;node modules
  • g05105113 hours ago
    &quot;Your scientists were so preoccupied with whether or not they could, they didn&#x27;t stop to think if they should.&quot;<p>Pretty neat, though.
  • bwat4912 hours ago
    Your scientists were so preoccupied with whether or not they could, they didn&#x27;t stop to think if they should!
  • grougnax12 hours ago
    Awesome! Everything will be rewritten in JS
  • javascriptfan694 hours ago
    Beautiful
  • smetannik7 hours ago
    Cursed, but fun
  • rezmason11 hours ago
    It begins!
  • fenwick6712 hours ago
    Finally!
  • outadoc12 hours ago
    I love it.
  • madduci13 hours ago
    But why?
    • monax13 hours ago
      It&#x27;s just a silly experiment; the real endgame is to make a bootloader that is customisable using HTML&#x2F;CSS&#x2F;JS
      • magicalhippo12 hours ago
        Since PDFs can contain JS, presumably that should be the preferred way of modifying your boot loader.
        • monax12 hours ago
          Yeah that&#x27;s the natural next step, I&#x27;ll work on that next
    • ThrowawayTestr12 hours ago
      Why not?
      • madduci12 hours ago
        Because this can end very badly. It is a new surface to attack
        • M95D11 hours ago
          Exactly! It&#x27;s actually great! More ways to jailbreak stuff.
        • eqvinox11 hours ago
          Why is it a new surface? Either you can run UEFI code, or you can&#x27;t. Attacking the JS interpreter itself is unrealistic IMHO, it&#x27;s the poorly written JavaScript running on top of this that might open new surfaces of attack. But other UEFI code is mostly written in C or C++, so let&#x27;s call that a wash?
        • yjftsjthsd-h11 hours ago
          Maybe? What&#x27;s your threat model?
  • IshKebab7 hours ago
    Javascript is a horrible choice but I think having a scripting language for this is actually quite a good idea. If only there was a popular scripting language that didn&#x27;t totally suck balls.
    • chihuahua44 minutes ago
      Paul Graham only uses computers that use Lisp in the same way. But it&#x27;s so good that he keeps it to himself, it&#x27;s his competitive advantage.
  • fennec-posix5 hours ago
    good. god.
  • dfedbeef11 hours ago
    Cursed