TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Boot a linux kernel right inside your browser.

1820 pointsby neopanzabout 14 years ago

73 comments

nupark2about 14 years ago
This is demonstrative of the advantages of the new low-level APIs being added to JavaScript to work efficiently with binary data.<p>Fabrice uses this to implement an x86 interpreter -- it could not be done efficiently without typed arrays. However, it is still slow -- imagine what kind of advances could be made if a common bytecode was established that would be JIT'd by the JavaScript VM, and could be output directly by the emulator.<p><i>This</i> is why so many people want to see the browser execution environment offer more complete, low-level APIs instead of high-level APIs locked to HTML/CSS and legacy browser technology. Efficiently supporting high-performance, high-complexity systems such as an <i>x86 emulator</i> (or a video game, or custom font rendering, or even an application framework) absolutely require efficient low-level APIs.
评论 #2557604 未加载
评论 #2557387 未加载
评论 #2557448 未加载
评论 #2557191 未加载
评论 #2557027 未加载
评论 #2557348 未加载
评论 #2556290 未加载
jbkabout 14 years ago
After FFmpeg (used in all your TVs and gadgets, very likely), QEmu (used also by Xen and VBox and other), tcc and his IOCC entries, the DVB-T emission with an ATI card, Fabrice comes, once again with something crazy...<p>He is really impressive...
评论 #2555495 未加载
评论 #2555537 未加载
评论 #2555608 未加载
评论 #2555618 未加载
评论 #2555490 未加载
评论 #2555762 未加载
nkurzabout 14 years ago
I'm utterly dumbfounded. Not only does it boot, it's got emacs, and a compiler.<p><pre><code> Welcome to JS/Linux ~ # emacs test.c ~ # cat test.c void main(void) { printf("Hello World!\n"); } ~ # tcc test.c -o hello ~ # ./hello Hello World! </code></pre> [Edit: just realized that there is already a 'hello.c' in the directory that shows just this with better diction.]
评论 #2555509 未加载
评论 #2556176 未加载
shazowabout 14 years ago
I just forkbombed my browser. Nothing is sacred anymore.<p><pre><code> ~ # f(){ f|f &#38; };f sh: can't fork sh: can't fork sh: can't fork sh: can't fork ...</code></pre>
wildmXranatabout 14 years ago
Fabrice is one of my all time favorite software engineers. Reading his code, studying his methodologies and learning by copying has been a long time task for me.<p>My first encounter with his code was QEmu, when it was required to run the XO OLPC linux images. Society truly benefits when people like him are devoted in support of open source software.
elibenabout 14 years ago
Fabrice Bellard is truly impressive. There's a nice article about him, called "Fabrice Bellard: Portrait of a Superproductive programmer", here: <a href="http://www.softwarequalityconnection.com/2011/03/fabrice-bellard-portrait-of-a-superproductive-programmer/" rel="nofollow">http://www.softwarequalityconnection.com/2011/03/fabrice-bel...</a>
评论 #2555628 未加载
js4allabout 14 years ago
Unbelievable, this is like magic. I am totally impressed. It is a real linux instance. BTW. I see the hello.c file someone mentioned here. Have we all mounted the same disk image?<p>I see so many use cases for this, but I don't fully understand what is going on behind the scenes. Maybe someone can shed some light on it:<p><pre><code> 1) How is the disk emulated. Is it a local image, or is it running on the backend? 2) Is there a remote possibility to get the networking up and running? 3) Can the disk image be externally accessed to be customized?</code></pre>
评论 #2555552 未加载
sigilabout 14 years ago
This is completely awesome. When I saw <a href="http://cb.vu" rel="nofollow">http://cb.vu</a> a few years ago I thought hey, someone has finally done it, but that turned out to be a hack. Kudos to Bellard once again.<p>Nitpicking: the terminal emulation is messed up. It keeps resizing horizontally, and less gets confused. I'm sure the terminal emulator was fun to play with. A correct vt100 state machine implementation [1] would probably not be quite as fun [2]. There's a vt100.js library used by a couple projects that might improve things. [3]<p>[1] <a href="http://vt100.net/emu/dec_ansi_parser" rel="nofollow">http://vt100.net/emu/dec_ansi_parser</a><p>[2] <a href="http://vt100.net/emu/vt500_parser.png" rel="nofollow">http://vt100.net/emu/vt500_parser.png</a><p>[3] <a href="http://fzort.org/bi/o.php" rel="nofollow">http://fzort.org/bi/o.php</a>
评论 #2555596 未加载
评论 #2557037 未加载
评论 #2555824 未加载
swahabout 14 years ago
And you are very proud of your Javascript templating library.
antirezabout 14 years ago
I admire Fabrice a lot, he is a programming hero for me. However it is not true that he is not interested in money, for instance the QEMU module performing the run-time code translation to go fast was not released for free in order to earn from this. I don't know if he managed to earn or not from QEMU in the end, but IMHO that of selling the module to final user was not the right strategy, when QEMU was started and became famous, "virtualization" was an huge buzz and interest for many companies, so many ways to make money from this.<p>Also this new code is not released under a free license, so by default as far he is not sure what he's going to do with the code the "open source way" is not the default. This is not a critique. I think Fabrice Bellard is a genius, but as an observer he seems interested in making a profit from his work like many other programmers.<p>Instead subjectively I've to admit today I no longer consider the GPL a completely free license, but this is another matter and may be related not to earning but to the meaning "free software" has for you. For me it is as simple as letting people to do everything with your code. IMHO the BSD license turns out to be better both for users AND for you to earn from your product later.
评论 #2561230 未加载
评论 #2561216 未加载
m0th87about 14 years ago
The emulator code is <i>just</i> 86 kb, and it isn't even aggressively minified!<p><a href="http://bellard.org/jslinux/cpux86.js" rel="nofollow">http://bellard.org/jslinux/cpux86.js</a>
评论 #2557483 未加载
aristidbabout 14 years ago
If it doesn't work for you on Chrome 12, this is probably the reason: "it does not work with Chrome 12 beta. As far as I know, it is a bug in the browser"<p>From <a href="http://bellard.org/jslinux/tech.html" rel="nofollow">http://bellard.org/jslinux/tech.html</a>
neopanzabout 14 years ago
Not sure how long ago he posted this. This guy never ceases to amaze me. He's the Grigori Perelman of Hackerdom.
评论 #2555441 未加载
评论 #2555588 未加载
评论 #2555447 未加载
michaelfabout 14 years ago
This is the most amazing thing I've ever seen in my browser.
sagarunabout 14 years ago
I just did 'rm -rf /' then ctrl+D on the terminal. Kernel Panic! Very nicely done! Technical notes here <a href="http://bellard.org/jslinux/tech.html" rel="nofollow">http://bellard.org/jslinux/tech.html</a>
delinkaabout 14 years ago
Cloud VPS in the browser. ("Please standby while we create a browser tab for your new instance...")<p>"The browser as the operating."<p>Someone <i>must</i> buzzword the hell out of this and then create a new startup based on it.
nlabout 14 years ago
~ # tcc -o hello hello.c<p>~ # ./hello<p>Hello World<p>That is just too impressive for me to process.
vessenesabout 14 years ago
My favorite bit:<p># cat /proc/cpuinfo<p>...<p>f00f bug: yes<p>#<p>Hah!<p>20 bogomips by the way, at least on Chrome on a MacBook Pro.<p>I sense a whole new era of browser performance testing..
评论 #2555461 未加载
评论 #2555528 未加载
评论 #2556706 未加载
spydumabout 14 years ago
I don't know why it's so amusing, but the network stack is fully functional for loopback. Fire up telnetd, and telnet back to yourself. telnetd -l /bin/sh -p 23 telnet 127.0.0.1 23 plenty of other services: httpd.. what a hoot.
wicknicksabout 14 years ago
He even ported his tcc compiler to it. Brilliant! I wonder if we could tap into the device file system. Given the increasing number of sensors in mobile phones and no standard way of reading from them, a linux like interface would be awesome.<p><pre><code> int main (int argc, char **argv) { int f = open("/dev/android_accelerometer"); double ax = f.read(); double ay = f.read(); double az = f.read(); printf ("Current 3d acceleration: %d %d %d", ax, ay, az); return 0; }</code></pre>
petdogabout 14 years ago
<p><pre><code> ~ # cat over.c main () { int i = 0x00ffffff; while (i &#62; 0) i--; } ~ # tcc over.c -o out ~ # time ./out real 0m 13.58s user 0m 13.57s sys 0m 0.01s </code></pre> I love this stuff.
brudgersabout 14 years ago
&#62;<i>"I did it for fun, just because..."</i><p>Easily the best hack I've seen on HN.
shykesabout 14 years ago
Any volunteers to wrap a websocket transport in an network interface driver? :)
评论 #2555598 未加载
评论 #2559090 未加载
spiffworksabout 14 years ago
It even has an incomplete version of Emacs. Emacs!
评论 #2555763 未加载
maverhickabout 14 years ago
When fabrice opens the browser, the kernel compiles itself.
zwischenzugabout 14 years ago
If anything deserves a HackerNews circle jerk, this is it.
sreanabout 14 years ago
Feel bad to miss out on this as I am on FF 3.6. But this remind reminded me of a service from a long time ago. Dont remember their name, this was some 10 years ago. But they used to provide a KDE desktop via the browser as a java applet. It was not terribly snappy, but quite surprisingly usable. Any one remembers this ?
评论 #2555630 未加载
评论 #2555782 未加载
评论 #2556981 未加载
kmilabout 14 years ago
Fabris should put donate button on the page! I would happily donate to thank him for his great contribution to the Open Source and pushing boundaries of what possible to do with modern technology. thank U Fabris :)
mikeytown2about 14 years ago
Anyone know how to get the network working? ping/wget don't work. But seriously, this is pretty flippin sweet!
评论 #2555456 未加载
评论 #2555455 未加载
评论 #2555701 未加载
wslhabout 14 years ago
Now I can buy a Chromebook :-)
评论 #2558518 未加载
gmosxabout 14 years ago
Didn't know about this guy! Unbelievable track record of consistently releasing groundbreaking software. Oh, and the x86 js emulator is cool too! made my day!
Aissenabout 14 years ago
Anyone know why he used 2.6.20 ? I tried compiling a 2.6.38.6, but it doesn't boot. It's stopped at "Starting Linux" and CPU stays at 100% all the time.
评论 #2556038 未加载
pbhjpbhjabout 14 years ago
Anyone else wondering if they're now part of this guys compile/render farm!?
rman666about 14 years ago
<p><pre><code> ~ # httpd ~ # telnet 127.0.0.1 80 get / http/1.0 HTTP/1.0 404 Not Found Content-type: text/html Date: Tue, 17 May 2011 20:10:52 GMT Connection: close &#60;HTML&#62;&#60;HEAD&#62;&#60;TITLE&#62;404 Not Found&#60;/TITLE&#62;&#60;/HEAD&#62; &#60;BODY&#62;&#60;H1&#62;404 Not Found&#60;/H1&#62; The requested URL was not found &#60;/BODY&#62;&#60;/HTML&#62; Connection closed by foreign host ~ # </code></pre> Coolness!
tmachinecharmerabout 14 years ago
There is EMACS TOO!!! This is insane. I am going mad with happiness. I really really have tears in my eyes.
SomeIdiotabout 14 years ago
So any interesting ideas for what this can be used for?
评论 #2556369 未加载
评论 #2557408 未加载
terminusabout 14 years ago
Neat. You can mount sysfs like so:<p><pre><code> # mkdir /sys; mount -t sysfs /sys /sys </code></pre> That would allow you to look at the emulated hardware that is present. Looks like only virtual devices are present -- ram, loopback network etc.<p>Makes sense to me. The MVP here is cpu emulation.
gabi38about 14 years ago
How is this thing loads the kernel? I've read the <a href="http://bellard.org/jslinux/tech.html" rel="nofollow">http://bellard.org/jslinux/tech.html</a> but it doesn't say, Does it loads it over the net or what?
评论 #2555917 未加载
angusgrabout 14 years ago
I'm sad the source has been compressed so there's no easy human-readable View Source, like there was on the VAX emulator that came up a few weeks ago. :( Still awe-inspiring, though. :)
评论 #2555646 未加载
评论 #2556017 未加载
评论 #2555644 未加载
ayanbabout 14 years ago
92.3 KB minified for the two JavaScript files.<p>wow!
albertzeyerabout 14 years ago
Actually I thought about doing the same via LLVM and Emscripten. This seems like he emulates x86. Which is probably less hackish but also slower.
vsajkoabout 14 years ago
boots in firefox on android although you can't type anything. I am amazed
anc2020about 14 years ago
Awesome<p><pre><code> cd / rm -rf ./* echo *</code></pre>
mark-rabout 14 years ago
If you have a programmers.stackexchange.com account, you might want to put a vote in here: <a href="http://programmers.stackexchange.com/questions/47197/are-there-any-famous-one-man-army-programmers/47240#47240" rel="nofollow">http://programmers.stackexchange.com/questions/47197/are-the...</a>
josepsanzcampabout 14 years ago
I tested the JS/Linux with google chrome 12 (beta and gnu/linux) with a new vmlinux26.bin and root.bin compiled using the 2.6.30 kernel with buildroot and work as expected (fine).<p>I don't know what is the problem of the original 2.6.20 linux kernel with JS/Linux but with this new compilation work perfectly.
asadotzlerabout 14 years ago
Twice as fast in Firefox as in Chrome.
swahabout 14 years ago
How long until you see the prompt?
geekzgaloreabout 14 years ago
<a href="http://www.softwarequalityconnection.com/2011/03/fabrice-bellard-portrait-of-a-superproductive-programmer/" rel="nofollow">http://www.softwarequalityconnection.com/2011/03/fabrice-bel...</a>
cfqabout 14 years ago
I saw this and thought "how does it know who I am?":<p>io scheduler cfq registered (default)
jjmabout 14 years ago
This is hot! Needs logging facility too but otherwise I'm blown away!
rakkhiabout 14 years ago
This looks awesome! I'm just starting to learn ruby and was going to look today on whether there was a way to run it in a browser very easily. Wonder if this is the answer
评论 #2555818 未加载
评论 #2555893 未加载
评论 #2555859 未加载
losoabout 14 years ago
wow, it is projects like this that get the imagination going and makes you feel bad for putting off a problem set that might have frustrated you at the time.
whatwhatwhatabout 14 years ago
Can i run Node.js on this?<p>/evil grin
评论 #2556053 未加载
tcarnellabout 14 years ago
Awesome - so could you run a web-server from within the browser? Would it be possible to connect to an instance of jslinux remotely?
ramidarigazabout 14 years ago
Woohoo! Kernel panic! Haven't seen one of those in... well... forever. (Newbie here)<p>Edit: This is <i>damn</i> cool.
vecterabout 14 years ago
Could someone write a program that would cause a stack overflow, compile it with tcc, and run it?
tectonicabout 14 years ago
Why is it that whenever I play with a temporary Linux install, I always end up typing "rm -rf /"?
hacklyabout 14 years ago
This reminds me of <a href="http://uni.xkcd.com/" rel="nofollow">http://uni.xkcd.com/</a>
mrpixelabout 14 years ago
Now let's mass-email Bellard to coax him into publishing an open-source version. :)
senthilnayagamabout 14 years ago
this can be a good tool to for students to learn basic linux commands<p>/usr/bin has many goodies<p>vi, top, ps, grep, awk
baneabout 14 years ago
<i>A more advanced version would allow to use old DOS PC software such as games.</i><p>well I'm sold.
评论 #2556316 未加载
plainOldTextabout 14 years ago
I believe this submission got the highest number of upvotes in HN history.
braindead_inabout 14 years ago
Looks so similar to Linux booted on an embedded device. Nostalgia.
josepsanzcampabout 14 years ago
What license do you want use to publish this job???
评论 #2557527 未加载
blackmanabout 14 years ago
now I'm wondering how hard it would be to write a commodore 64 or nes emulator in javascript to embed games in webpages?
wonginator1221about 14 years ago
Well, It's a great way to try out rm -rf /
dendoryabout 14 years ago
Fun command to use:<p>reboot -f
评论 #2556374 未加载
benihanaabout 14 years ago
First thing I did after booting?<p><pre><code> alias ll='ls -lh'</code></pre>
quattrofanabout 14 years ago
but not in my android browser apparently
awazabout 14 years ago
interesting!
EGregabout 14 years ago
this is some crazy shit
thristianabout 14 years ago
The page was near-unreadable for me because the CSS uses the font stack "courier,fixed,swiss,sans-serif", and courier is just too thin and wispy against a black background. I opened Firebug and changed the CSS declaration to be "monospace" and then all was right with the world.<p>That said, it's a phenomenal achievement, and should be a great way for websites to demonstrate command-line tools to people. :)<p>(also: browsers let you store more information with DOM Local Storage than you could in a cookie; If you could expose that to Linux as a block device...)
Qerubabout 14 years ago
<p><pre><code> ERROR: your browser is too old to run JS/Linux. You should use a recent browser such as Firefox 4.x or Google Chrome. </code></pre> No, it isn't. Stop using user-agent matching and start using JavaScript feature detection instead.
评论 #2555593 未加载
评论 #2556932 未加载