Want to read Slashdot from your mobile device? Point it at m.slashdot.org and keep reading!

 



Forgot your password?
typodupeerror
×
Linux

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)."
This discussion has been archived. No new comments can be posted.

Boot Linux In Your Browser

Comments Filter:
  • But... (Score:4, Funny)

    by Anonymous Coward on Tuesday May 17, 2011 @12:16AM (#36149538)

    ...does it run BSD?

  • Fun guy (Score:5, Interesting)

    by Anonymous Coward on Tuesday May 17, 2011 @12:27AM (#36149610)

    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].

  • This is very funny. A nice trick of which there may be some use. Suggestions?

  • by rust627 ( 1072296 ) on Tuesday May 17, 2011 @12:32AM (#36149654)

    .......... of Linux on the browser on the desktop.

  • I wonder how happy Apple would be about you running Linux on your iPhone browser.
    • by Zo0ok ( 209803 )

      At this point it does not work (I just tried), unfortunately. But, I guess the answer to your question is; not happy at all.

    • Don't try it unless you want to be zapped by Steve's orbiting death ray.

  • Uh oh... (Score:5, Funny)

    by Spykk ( 823586 ) on Tuesday May 17, 2011 @12:37AM (#36149694)
    Well, I'm off to tie up a few loose ends. It's only a matter of time before he gets X running in there. After that someone will try running firefox. Shortly after that someone will direct that copy of firefox to the link posted in the summary and then the universe will end.
  • Just had a scary thought:
    Linux running inside Internet Explorer on a Windows Vista system! *shudder*

  • Wait, crap.

    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">
  • by Anonymous Coward

    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)

    by sayfawa ( 1099071 ) on Tuesday May 17, 2011 @01:00AM (#36149814)
    Finally I have the courage to do a
    rm -rf /*
    • You are brilliant, sir! (I'd mod you up, but had already commented in this thread.)
    • 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

  • by simoncpu was here ( 1601629 ) on Tuesday May 17, 2011 @01:25AM (#36149958)
    +1 Brilliant
    • It is brilliant, no question, but I was interesting in looking at the source but it seems to be obfuscated. I figured this was to compress it, but I've looked around and can't find the source anywhere.

      Is there somewhere I'm not looking?
  • 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.

    • by Zsub ( 1365549 )
      Like slacking off while your code's compiling?
    • 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)

    by modus_operandi ( 315148 ) on Tuesday May 17, 2011 @01:59AM (#36150192) Journal
    Let's see what this baby has under the hood:

    ~ # cat /proc/cpuinfo
    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 /proc/meminfo
    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 /bin/sh /sbin/init
    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
    • ~ # echo $PATH
      /bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
      ~ # ls -a
      . .. .ash_history hello.c
      ~ # cat .ash_history
      cat /proc/meminfo
      cat /proc/cpuinfo
      top
      echo $PATH
      ls -a
      cat .ash_history
      ~ # 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
    • bogomips : 20.21

      Interesting. It's 20.21 bogomips on my system too - chrome on a linux netbook. What are you running it on?

    • 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

  • qemu supports emulating various guest CPUs. Would a simpler instruction set make for faster in-browser emulation?

    • Yeah, this was my first thought too - z80/6502 emulation should be a lot simpler and faster than x86 and could be quite useful.
  • 20.21 bogomips in Chrome 11.0.696.68 on my Samsung N140 netbook running Fedora 15 Linux.

  • by Chrisq ( 894406 ) on Tuesday May 17, 2011 @03:14AM (#36150570)
    Admit it - who else tried startx!
  • This will become interesting when I can run webkit or gecko inside IE.

    Imagine... no more lousy cross-browser headaches...

  • people have been able to run windows in a browser for a long time now, its about time Linux got this feature too...

    http://www.deanliou.com/WinRG/ [deanliou.com]
  • by DrXym ( 126579 ) on Tuesday May 17, 2011 @04:26AM (#36150838)
    In theory you could do the same with Google's native client and you'd get close to native speeds too. I don't think it will be too long before we see games, utilities etc all built with Native Client and runnable with a click from the browser. It would be pretty interesting to see what comes of it.

    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.

  • 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

  • by jez9999 ( 618189 ) on Tuesday May 17, 2011 @05:00AM (#36151038) Homepage Journal

    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.

  • by microbee ( 682094 ) on Tuesday May 17, 2011 @07:51AM (#36152194)

    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.

  • by Andrewkov ( 140579 ) on Tuesday May 17, 2011 @10:43AM (#36154368)

    I'm going to run Firefox inside Linux which is running inside Firefox. I'm going for Inception!!

  • by RichM ( 754883 ) on Tuesday May 17, 2011 @02:57PM (#36158062) Homepage

    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.

  • by spage ( 73271 ) <spage@@@skierpage...com> on Tuesday May 17, 2011 @05:23PM (#36159530)

    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.

Function reject.

Working...