Slashdot Mirror


Boot Linux In Your Browser

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)."

46 of 393 comments (clear)

  1. But... by Anonymous Coward · · Score: 4, Funny

    ...does it run BSD?

  2. Re:The burning question. by jra · · Score: 4, 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.

  3. Fun guy by Anonymous Coward · · Score: 5, Interesting

    Fabrice also wrote his own version of emacs in his own realtime C compiler, and he also at one time held the record for calculating pi.

    1. Re:Fun guy by wagnerrp · · Score: 2

      Emacs and C compilers? Pah! A virtual machine running in javascript is mad genius unheard of since using graphics cards as software driven DVB modulators.

    2. Re:Fun guy by mukund · · Score: 2

      Fabrice is also the reason for Qemu, FFmpeg and LZEXE.

      I hope he has a lot of kids :)

      --
      Banu
    3. Re:Fun guy by grewil · · Score: 2

      Both his emacs and his c-compiler are installed on that js/linux! Try commands qemacs and tcc.

  4. Re:The burning question. by yincrash · · Score: 4, Informative
    from his tech notes

    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.

  5. This is the year ........ by rust627 · · Score: 5, Funny

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

    --
    da da da dum indeed.
  6. Re:The burning question. by gandhi_2 · · Score: 4, 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.

  7. Re:Yo dawg, by Zontar+The+Mindless · · Score: 5, Funny

    Yo dawg, JavaScript and the JVM have less to do with each other than an Orthodox rabbi and a porkchop.

    --
    Il n'y a pas de Planet B.
  8. Uh oh... by Spykk · · Score: 4, Funny

    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.

  9. Higgs Bogon? by dutchwhizzman · · Score: 2

    Either that, or the Higgs bogon will be discovered.

    --
    I was promised a flying car. Where is my flying car?
  10. Re:Yo dawg, by grcumb · · Score: 3, 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!

    --
    Crumb's Corollary: Never bring a knife to a bun fight.
  11. Done before with MIPS by Anonymous Coward · · 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 :)

  12. Finally by sayfawa · · Score: 3, Funny

    Finally I have the courage to do a
    rm -rf /*

    --
    Free the Quark 3 from asymptotic confinement! Bring your charm! Don't get down! All colours and flavours welcome!
  13. Mod Fabrice Bellard up! by simoncpu+was+here · · Score: 5, Insightful

    +1 Brilliant

  14. Re:Yo dawg, by Aeternitas827 · · Score: 2

    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.

    --
    I don't post AC. I like my -1, Flamebaits. Trump/Sheen 2012 on the Batshit Insane ticket!
  15. Re:Yo dawg, by ynp7 · · Score: 2

    You can run X in this thing? OMFG!!!

  16. Vital Stats by modus_operandi · · Score: 5, Informative

    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

    --
    Well's all that ends.
    1. Re:Vital Stats by modus_operandi · · Score: 2

      ~ # 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 -l
      total 4
      -rwxr-xr-x    1 root     root          1908 May 17 07:01 hello
      -rw-r--r--    1 root     root           166 May 15 22:15 hello.c
      ~ # ./hello
      Hello World

      --
      Well's all that ends.
  17. Re:Yo dawg, by rusl · · Score: 2

    The days of programming a turtle are over!

    --
    Stupidity is its own reward.
  18. Optimists among you by Chrisq · · Score: 2

    Admit it - who else tried startx!

  19. Re:The burning question. by somersault · · Score: 2

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

    --
    which is totally what she said
  20. Re:The burning question. by Jaruzel · · Score: 4, 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

    --
    Together, We Can Make Slashdot Better. I Do NOT Mod ACs. - Check Me Out
  21. Native clients and LLVM thoughts by DrXym · · Score: 2
    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.

  22. Re:Javascript obfuscated by ubersoldat2k7 · · 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.

  23. Booting Linux by jez9999 · · Score: 4, 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.

  24. Re:The burning question. by YaHooL · · Score: 2

    Just thinking about all those classic DOS apps that will never see the light of day otherwise

    It might make you happy to know that you can already enjoy old classic DOS games on your machine by using DOSBox.

  25. Re:Nice by GPLHost-Thomas · · Score: 4, Insightful

    How can someone be so damned silly enough to think there's no use for it... Man, a FULL x86 EMULATOR written in Javascript! Possibilities are endless. The point isn't just to run Linux, but anything that is written in C, and that you want to run in your browser. ANYTHING. Running Linux is just a proof of concept.

    Bellard wrote FF-Mpeg, Qemu, and now this. I have no words to express my admiration for his talent.

  26. Running on Android by gurkmannen · · Score: 2

    This thing booted on my Android phone running Firefox 4 Mobile.

    Can't type anything though, as I can't get the virtual keyboard activated.

    However I also got 20.21 bogomips, which seems odd.

    --
    aka Gardener, aka ollej
  27. Re:The burning question. by donaldm · · Score: 2

    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 Chrome (latest version) running under Linux.

    In my case the only use for Win XP that I have found is to bring up the iTunes application for my wife's iPhone since Apple does not have a version for Linux (surprise, surprise). Fortunately I have an Android phone and so don't need the iTunes application so it is rare I need to virtual boot XP. Still when my wife wants to change some things on her iPhone I can boot in a separate session window or just switch to her account

    In my professional capacity I only use OpenOffice for MS Office documents when collaborating with customers and I have never found a reason to use MS Windows other than those rare applications that are so locked to MS Windows. Before people say "Games" I don't play PC games although I do have a PS3 which I do play games on. Of course my counter to "Games" in a profession capacity is you must have a very understanding workplace :)

    --
    There ain't no such thing as proprietary standards only proprietary formats. Standards are by definition open.
  28. Damn by casals · · Score: 2

    No man pages.

    --
    AT &F1DT0,T0800665544 - Real men, real help desk support.
  29. An OS inside of an OS inside of an OS... by microbee · · Score: 2

    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.

  30. Re:The burning question. by EdZep · · Score: 2

    The Linux, Virtualbox, XP setup also works for streaming Netflix.

  31. Re:Nice by bluefoxlucid · · Score: 2

    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.

  32. More Experiments by pinkushun · · Score: 2

    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%) reserved for the super user
      First data block=1
      Maximum filesystem blocks=262144
      1 block groups
      8192 blocks per group, 8192 fragments per group
      48 inodes per group

    # mount -o loop loopback.img /mnt

    # cp hello.c /mnt && ls -al /mnt
      drwxr-xr-x 3 root root 1024 May 17 14:21 .
      drwxr-xr-x 13 root root 1024 May 16 16:33 ..
      -rw-r--r-- 1 root root 166 May 17 14:21 hello.c
      drwxr-xr-x 2 root root 12288 May 17 14:19 lost+found

    # umount /mnt

    # gzip loopback.img
    # ls -lh
      -rwxr-xr-x 1 root root 1.9K May 17 14:14 a.out
      -rw-r--r-- 1 root root 166 May 15 22:15 hello.c
      -rw-r--r-- 1 root root 905 May 17 14:23 loopback.img.gz

  33. I'm working on something similar! by poizan42 · · Score: 2

    I haven't looked at his javascript yet, but from what I can read from the technical notes it's an x86 intepreter. I'm actually working on a pc emulator in javascript, but with a dynamic translator at its core.
    The project is hosted at github here: https://github.com/poizan42/jsx86

  34. Re:Running a browser in emacs? Reading /. ? by ais523 · · Score: 2

    Hi from Emacs. It seems to work quite well, although a lot of scrolling is needed in order to get past the boilerplate that's normally at the top and sides of the screen. (I had to try multiple backends; the Lynx backend kept logging me out, but this w3m backend works fine.) One slight bizarreness; when I went to write this comment, it opened up an editor for me to write the comment in - and perhaps surprisingly, given that the browser was running in Emacs, it opened in vim. Still inside Emacs, though. I've long been aware that it's possible to run vim from inside Emacs, but I hadn't thought that either vim users or Emacs users would be particularly inclined to try...

    --
    (1)DOCOMEFROM!2~.2'~#1WHILE:1<-"'?.1$.2'~'"':1/.1$.2'~#0"$#65535'"$"'"'&.1$.2'~'#0$#65535'"$#0'~#32767$#1"
  35. Works great in WebKit nightly as well. by CousinDave · · Score: 2

    But not the latest Safari.

    --
    It's too late to lose the weight you used to need to throw around.
  36. Inception by Andrewkov · · Score: 2

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

  37. This is fun by bhassel · · Score: 2

    Oh man, I have a strong desire to get apache running in this, just so I can have the web browser serving pages to itself =) We just need a network driver...

  38. tools by Vorpix · · Score: 2

    now where is network support, ssh, nmap and other tools that could make this actually useful to the roaming sysadmin?

    --
    frog blast the vent core
  39. Imagine... by the+grace+of+R'hllor · · Score: 2

    ... a beowulf cluster of tabs!

    Or is that joke a little too 20th century these days? Been out of touch with /.

  40. Bypassing the need for Apple Appstore by RichM · · Score: 2

    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.

  41. a few tech details by spage · · Score: 2

    http://bellard.org/jslinux/cpux86.js 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.

    --
    =S