Boot Linux In Your Browser 393
An anonymous reader writes "Fabrice Bellard, the initiator of the QEMU emulator, wrote a PC emulator in JavaScript. You can now boot Linux in your browser, provided it is recent enough (Firefox 4 and Google Chrome 11 are reported to work)."
But... (Score:4, Funny)
...does it run BSD?
Fun guy (Score:5, Interesting)
Fabrice also wrote his own version of emacs [bellard.org] in his own realtime C compiler [bellard.org], and he also at one time held the record for calculating pi [bellard.org].
Re: (Score:2)
Re: (Score:3)
Re: (Score:3)
Fabrice is also the reason for Qemu, FFmpeg and LZEXE.
I hope he has a lot of kids :)
Re: (Score:2)
Funny! (Score:2)
This is very funny. A nice trick of which there may be some use. Suggestions?
Re: (Score:2)
This is the year ........ (Score:5, Funny)
.......... of Linux on the browser on the desktop.
iPhone (Score:2)
Re: (Score:2)
At this point it does not work (I just tried), unfortunately. But, I guess the answer to your question is; not happy at all.
Re: (Score:2)
Great, thanks.
Since you've pointed that out, we'll never see Firefox on the iPhone, since Firefox can run arbitrary code.
(For the sarcasm-impaired: I jest, but only a little.)
FWIW, it failed completely with the Dolphin browser on my OG Droid with CM 7.something. So no Linux-within-browser-within-Linux for me on my phone for now. (I am heartbroken.)
Re: (Score:2)
Don't try it unless you want to be zapped by Steve's orbiting death ray.
Uh oh... (Score:5, Funny)
Higgs Bogon? (Score:2)
Re: (Score:2)
Re: (Score:2)
Really, their poetry sucks, the pr0n has to be a war crime at best.
Re: (Score:2)
Either that, or the Hisss' bogon will be discovered.
FTFY. The next one to be discovered: herrr's bogon.
Not because of recursion... (Score:2)
...but because of ridiculousness. [viruscomix.com]
Ouch (Score:2)
Just had a scary thought:
Linux running inside Internet Explorer on a Windows Vista system! *shudder*
Re: (Score:2)
Re: (Score:2)
We're talking about MSIE.
To run this thing the browser probably needs to comply with some standard.
But does it run.. (Score:2)
Ooh, wait, I know....imagine a Beowulf cluster of nested linux-in-a-browsers.
<body background="natalie-portman-naked-and-petrified-covered-in-hot-grits.jpg">
Done before with MIPS (Score:2, Informative)
This has been done before with JSMIPS - a Javascript MIPS system with well-implemented JIT optimizations. :)
See http://codu.org/jsmips/system.html. Even runs vi pretty well
Finally (Score:4, Funny)
rm -rf
Re: (Score:2)
The real thing is more fun (Score:2)
Many years ago we had a loaner machine that had to be returned to the vendor because after we'd tested it our director decided we should buy a machine with a more politically correct logo on the front of the box. We had to remove all our files anyway, after copying them to other machines, so "why not rm -rf /".
It ran ok for a while, though once "ls" and "df" were gone it was a bit harder to tell how it was doing. "echo *" still worked fine, and eventually there wasn't much left but enough directory to hol
Mod Fabrice Bellard up! (Score:5, Insightful)
Re: (Score:2)
Is there somewhere I'm not looking?
Nice! (Score:2)
A tech-demo to be sure for the moment, as qemu is far slower than native (about 5-10% in my experience) and this may be even slower. Still, it is impressive and there are some things you can do well even with a slow Linux.
Re: (Score:2)
Re: (Score:2)
It's awesome to see a full x86 implementation in so little JS. This is a brilliant piece of work. I'm only saddened by the usage of a type of JavaScript that only works in FF4 and Chrome 11. It doesn't work in FF 3.6 or Chrome 12. Are these fragile JS features that only work in so few browsers really required to get this to work?
Vital Stats (Score:5, Informative)
~ # cat
processor : 0
vendor_id : GenuineIntel
cpu family : 5
model : 4
model name : Pentium MMX
stepping : 3
cache size : 0 KB
fdiv_bug : no
hlt_bug : no
f00f_bug : yes
coma_bug : no
fpu : no
fpu_exception : no
cpuid level : 1
wp : yes
flags
bogomips : 20.21
clflush size : 32
~ # cat
MemTotal: 30448 kB
MemFree: 26960 kB
Buffers: 2048 kB
Cached: 456 kB
SwapCached: 0 kB
Active: 2636 kB
Inactive: 64 kB
SwapTotal: 0 kB
SwapFree: 0 kB
Dirty: 8 kB
Writeback: 0 kB
AnonPages: 212 kB
Mapped: 324 kB
Slab: 700 kB
SReclaimable: 96 kB
SUnreclaim: 604 kB
PageTables: 36 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
CommitLimit: 15224 kB
Committed_AS: 456 kB
VmallocTotal: 1007592 kB
VmallocUsed: 0 kB
VmallocChunk: 1007592 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
Hugepagesize: 4096 kB
~ # top
Mem: 3472K used, 26976K free, 0K shrd, 2048K buff, 472K cached
CPU: 0.5% usr 0.3% sys 0.0% nic 87.2% idle 0.0% io 6.2% irq 5.5% sirq
Load average: 0.08 0.04 0.01 1/12 78
PID PPID USER STAT VSZ %MEM CPU %CPU COMMAND
78 75 root R 1136 3.7 0 12.7 top
75 1 root S 1156 3.8 0 0.0 sh
1 0 root S 1136 3.7 0 0.0
3 1 root SW< 0 0.0 0 0.0 [events/0]
4 1 root SW< 0 0.0 0 0.0 [khelper]
2 1 root SWN 0 0.0 0 0.0 [ksoftirqd/0]
5 1 root SW< 0 0.0 0 0.0 [kthread]
16 5 root SW< 0 0.0 0 0.0 [kblockd/0]
34 5 root SW< 0 0.0 0 0.0 [kswapd0]
35 5 root SW< 0 0.0
Re: (Score:2)
/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
~ # ls -a
.
~ # cat
cat
cat
top
echo $PATH
ls -a
cat
~ # cat hello.c
/* This C source can be compiled with:
tcc -o hello hello.c
*/
#include <tcclib.h>
int main(int argc, char **argv)
{
printf("Hello World\n");
return 0;
}
~ # tcc -o hello hello.c
~ # ls
Re: (Score:2)
bogomips : 20.21
Interesting. It's 20.21 bogomips on my system too - chrome on a linux netbook. What are you running it on?
Re: (Score:2)
Hmmm... Maybe that explains why your (obviously much more powerful) laptop gets the same virtual processor speed as my puny netbook! Win 7 + FF? Or maybe that's just what this VM reports no matter what...
Try Fedora 15. They've gone with Gnome 3, which freaked me out a bit at first, but i can live with it - and i know it's the way things are going so there's no point resisting, plus it will get better over the next few months no doubt.
Re: (Score:2)
guys, guys... it's Java remember.
No it's not, it's JavaScript - which is totally unrelated to Java!
Re: (Score:2)
Crap it is getting late.
Valid point sir as javascript may use as much memory as it deems necessary (and well the operating system allows)... and other factors,etc.
Good point sir! - (I am going to sleep now!)
More Experiments (Score:3)
Create a mounted loopback file system as ~/loopback.img, mounted to /mnt. Then copied hello.c to our mount point, unmounted it, and gzipped the image =D
# dd if=/dev/zero of=loopback.img bs=1000 count=400
400+0 records in
400+0 records out
400000 bytes (390.6KB) copied, 0.129992 seconds, 2.9MB/s
# mkfs.ext2 -F loopback.img
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
48 inodes, 390 blocks
19 blocks (5%) reser
x86 only? (Score:2)
qemu supports emulating various guest CPUs. Would a simpler instruction set make for faster in-browser emulation?
Re: (Score:2)
Bogomips (Score:2)
20.21 bogomips in Chrome 11.0.696.68 on my Samsung N140 netbook running Fedora 15 Linux.
Optimists among you (Score:3)
interesting (Score:2)
This will become interesting when I can run webkit or gecko inside IE.
Imagine... no more lousy cross-browser headaches...
sure, why not (Score:2)
http://www.deanliou.com/WinRG/ [deanliou.com]
Native clients and LLVM thoughts (Score:3)
When you think about it, most user land applications should be targetting a virtual machine. If Linux shipped with an LLVM runtime, all the userland apps could be built the once regardless of hardware and they would execute against the runtime. Behind the scenes the runtime would compile and cache a native binary on first invocation but it would be completely seamless and transparent to the user. Performance would be exactly the same as if the app had been natively compiled in the first place. The runtime could even be ported to Windows or OS X or QNX or some funky hypervisor from VMWare / Redhat whatever and be running over PPC, MIPS, ARM, x86 and they'd still run. The potential for this is enormous.
I get a feeling that Apple will soon have native LLVM support in OS X in preparation for their move to ARM and it would not surprise me if Windows got some kind of analog too. Therefore I wonder if it's time for Linux to be considering likewise.
Expanding Horizons (Score:2)
This really broadened and expanded my horizon. While this was of course theoretically feasible ever since any touring complete scripting was available for web browsers, someone actually DOING it and letting the world play around with it marks a considerable paradigm shift to me, regarding how virtualization is viewed. ... or how computers are viewed.
Because to me, computers have now become nothing more than web pages, nothing more than windows that you open somewhere, and then THAT is a computer, and indepe
Re: (Score:2)
That damn spellchecker fixed good Alan's name. Sorry, Mr. Turing.
Booting Linux (Score:5, Funny)
Didn't work for me. It got to a text thing with a flashing cursor but stopped there. I don't see my Ubuntu desktop or browser icon.
An OS inside of an OS inside of an OS... (Score:3)
If you die in any of it, you wake up in the outer most OS, unless you are trapped by the limbo exception handler, for which you are trapped forever.
Inception (Score:3)
I'm going to run Firefox inside Linux which is running inside Firefox. I'm going for Inception!!
Bypassing the need for Apple Appstore (Score:3)
This would be amazing if if had an eth0 interface with an SSH client.
That would mean that you could SSH to any of your servers from within Safari on an iPhone with no need for paid-for apps.
a few tech details (Score:3)
http://bellard.org/jslinux/cpux86.js [bellard.org] calls ya.load_binary() that makes XMLHttpRequest()s for "vmlinux26.bin", "root.bin", and "linuxstart.bin". For the latter two his HTTP server responds with root.bin.en.gz and linuxstart.bin.en.gz. After gunzip you can mount root.bin.en as a loopback ext2 filesystem to see the ramdisk FS contents; most binaries are hardlinks to the same 768kB BusyBox ELF 386 binary. I'm not sure what the 14,858 byte linuxstart.bin file is.
Re:The burning question. (Score:5, Interesting)
Like Everest, because it was there.
There was a GIF out several years back, which I haven't been able to find any time recently (and would love a pointer to) of some guy who had something like *19* hardware emulators running on one monitor simultaneously, in 4 or 5 separate stacks.
TRS-80, C-64, T/S-1000; everything you've ever seen an emulator for, he had running on Linux all at the same time; some hosting others.
Re: (Score:2)
Like Everest, because it was there.
There was a GIF out several years back, which I haven't been able to find any time recently (and would love a pointer to) of some guy who had something like *19* hardware emulators running on one monitor simultaneously, in 4 or 5 separate stacks.
TRS-80, C-64, T/S-1000; everything you've ever seen an emulator for, he had running on Linux all at the same time; some hosting others.
Dunno about that one, but here's Amit "Mac OS X Internals and MacFUSE" Singh running a large pile of x86 OSes on top of Virtual PC on a PowerBook [osxbook.com].
Re: (Score:2)
Re: (Score:2)
You can always do something like Mac OSX->Windows->Linux->Mac OSX until you get bored and/or your computer starts smoking
Re: (Score:2)
I had a NeXT Turbocolor running:
a DreamBox (Mac HW emulator), running UAE, and running some Amiga DOS emulator I fail to remember the name of, then running Gorillas in QBASIC.
Re: (Score:3)
Linux PC running Virtual Box --> Windows XP
I do run this on my Fedora 14 i7 laptop and don't have any issues with it, in fact XP on my machine boots in about 20 seconds although it still takes up to a minute before I can do anything. One really good feature of virtual MS Windows is the fact that I can recover in about 15 minutes so I don't care about virus protection although I am careful about which sites I connect to and because I am running a virtual machine there are very few sites need connect to, because I do all my web browsing on Firefox or
Re: (Score:2)
New type of virus vector of-course.
Re:The burning question. (Score:5, Informative)
I did it for fun, just because newer Javascript Engines are fast enough to do complicated things. Real use could be: Benchmarking of Javascript engines (how much time takes your Javascript engine to boot Linux ?). For this particular application, efficient handling of 32 bit signed and unsigned integers and of typed arrays is important. Client side processing using an x86 library, for example for cryptographic purposes. For such application, the x86 emulator can be modified to provide an API to load x86 dynamic libraries and to provide a js-ctypes like API to call the C/C++ functions from javascript. A more advanced version would allow to use old DOS PC software such as games.
Re:The burning question. (Score:5, Interesting)
Looking at the page code - it looks like he's written a generic x86 emulator in JS, and although booting Linux is undoubtably cool, has anyone tried to patch it to boot MS-DOS (or PC-DOS if you want to avoid any legality issues) ?
Just thinking about all those classic DOS apps that will never see the light of day otherwise.
-Jar
Re:The burning question. (Score:5, Funny)
So you can boot linux in your browser, then launch a browser, and boot linux in that browser....
Yo dawg, if you had a beowulf cluster, you could run kturtle all the way down.
Re: (Score:2)
</tongue_in_cheek>
Re: (Score:2)
Re: (Score:2)
You have a strange idea of "full powered".. running an x86 emulator inside a browser on an ARM based tablet? Yeesh.. you'd be far, far, far better getting something like a port of GIMP.
Re: (Score:2)
Re: (Score:3)
I'm not sure I'd call that "fun" exactly, probably more like "excruciating" - but I would find it funny viewing this page in Chrome running on Windows running in Chrome running on Linux running in Firefox running on Windows running in Chrome running on Linux..
Re:Yo dawg, (Score:5, Funny)
Yo dawg, JavaScript and the JVM have less to do with each other than an Orthodox rabbi and a porkchop.
Re: (Score:3)
less to do with each other than an Orthodox rabbi and a porkchop.
This will now replace 'What does X have to do with the price of tea in China' in my daily conversation. You almost got a beverage spray from me because this bit of wit.
Re: (Score:2)
You can run X in this thing? OMFG!!!
Re: (Score:2)
Re: (Score:2)
Are there network devices? You could compile vnc server and access the X remotely.
Re:Yo dawg, (Score:4, Funny)
Yo dawg, we hear you liked Linux...
Yeah, but does it run Lin - hang on....
... Oh My God. It's penguins all the way down!
Re: (Score:2)
The days of programming a turtle are over!
Re: (Score:2)
We need to go deeper.
Re: (Score:2)
rm -rf /*
It blows up quite nicely.
Well, sort of nicely.
Re: (Score:2)
Re: (Score:2)
Re: (Score:2)
Executing ip gave me the following line -
BusyBox v1.18.3 (2011-05-14 13:22:58 CEST) multi-call binary.
so yeah, BusyBox. Pretty amazing implementation though.
Re: (Score:2)
& only prints as ". It still works the same. I did get an error about a bad function name with the classic fork bomb, so I had to change it to f(){ f|f & };f
Re: (Score:2)
Yes, it's busybox but you can still perfectly well make a fork bomb in it.
It appears it has a display bug and shows " in place of & but this still works correctly, like an & should.
HA-HA! My fork bomb just crashed it horribly!
Re: (Score:2)
Oddly, that's the first thing I did too. cd /; rm -rf *
To recover the system back to basics, I reloaded the browser.
Re: (Score:2)
Re: (Score:2)
Sure it is. What if somebody got Apache to run under it?
Re: (Score:2)
Or a browser? ...nah, Apache is more feasible.
Re: (Score:2)
Or a browser?
Compiling up lynx would probably be not too hard...
Re: (Score:2)
BECAUSE BILLY "FFUCKING" MAYSSS sayd it works!
He's dead, Jim!
Now, just get Michael on the plane and he can be done with Purgatory.
Running a browser in emacs? Reading /. ? (Score:2)
It's been too long since I've tried running a browser in emacs, so I don't remember how (and therefore I'm not using it to reply to this Slashdot thread :-), but emacs itself seems to be running fine. Can Slashdot run in an emacs browser?
Hmmm, networking's pretty limited. (Score:2)
"ifconfig -a" only shows lo0, and /dev/ doesn't have a lot of networking hardware to work with, in particular it doesn't look like there's an ethernet driver, and I doubt you could easily coerce a /dev/tty driver to go anywhere. But it's still cool.
Re: (Score:3)
None at all. (Score:2)
From TFA:
What's the use ?
I did it for fun, just because newer Javascript Engines are fast enough to do complicated things. Real use could be:
Of these, I suppose the benchmark is the really useful part. I suppose it'd make a nice fallback for Google's Native Client [google.com], which seems like a much better approach for using an x86 library if you need it -- and after all, if you have an x86 library, it's probably portable to x86_64, ppc, arm, etc. Old DOS games are probably better handled by DOSbox, though I guess it would be cool if someone got that to work.
It is cool as a tech demo, and as a benchmark, but I don't really see it being useful.
Re:Nice (Score:5, Insightful)
Bellard wrote FF-Mpeg, Qemu, and now this. I have no words to express my admiration for his talent.
Re: (Score:3)
Yes, but there are already PC emulators that will run in Java and export their display data to glue code that allows a plug-in to display the window in your browser.
Fixed that for you. Java Applets do not "run in your browser," nor does Flash; that is an illusion. These are entire platforms that run programs, and can export the display independently; your browser provides a windowing manager for them, like Sawfish.
Re: (Score:2)
Poor form
i really hope that you're joking. I really do. But this is the internet, so I can't tell. In case you're not joking: you do better.
Re: (Score:2)
The only answer that would not surprise me would be "a university/PhD grant."
Unlikely that he's doing a PhD, given thathe was a student in '95.
Do I detect a hint of scorn in your voice along the lines of "what a complete waste of time, only an academic could possible do something so useless?". Perhaps I'm imagining things, but the sentiment comes up quite frequently on slashdot.
Re: (Score:2)
It could be a lament that, despite the advance of technology, most people are having to work more rather than fewer hours.
The West has enough that everyone should be able to get by on a four day week at most, leaving the rest for education, voluntary work and leisure. Work such as this.
Unfortunately, only a few privileged positions - such as those of sufficiently advanced academics - get so much time to focus their mind on what they want. The world should be more like academia in this respect.
Re: (Score:2)
FF4 is hopeless over RDP. FF3 is reasonably pleasant. What's the bug?
Re: (Score:2)
Prolly hardware acceleration.
Tools-options-advanced-general-browsing,
[ ] use hardware acceleration
Totally fucked up the menus for me. But even after switching it off, it works nicely fast.
Re: (Score:2)
It's not obfuscated, it's condensed to run faster. Also, it's a x86 emulator, it's pretty much obfuscated for 99.99999999999999999999999999% of humans.