Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I locally host the webbrowser Virtual Machine here: http://bellard.org/jslinux/

I don't know much of Javascript, and I want to host the web browser integrated Linux (which can be found here). Reason being I am not always connected to the net, would like to know how it works. No disrespect of the author's license intended.

I tried copying sources of the three files (term.js, cpux86.js and the HTML file itself) into a folder, and running the HTML, and it doesn't work.

Any way around to make it work?
Also: if it doesn't work, why is it? The directory structure is copied by me and is almost the same.

PS: I also used Javascript deobfuscator addon for Firefox, but that did not help much either. I did indent all the code to make it more readable, but it's still not understandable :P

like image 544
Anuj More Avatar asked May 17 '11 14:05

Anuj More


People also ask

How do I paste into JSLinux?

To paste data, right click on the terminal cursor to show the contextual menu and select "Paste". Alternatively, you can use the "Paste" command in the navigator global menu.


2 Answers

The JS code itself is not a "Linux clone", it's a propper x86 Virtual Machine loading a Linux kernel.

As such you need at least the file containing the compiled Linux kernel for it to work correctly.

Checking the source shows that (at least) 3 files are loadded from cpux86.js, which are: vmlinux26.bin (the Linux kernel), root.bin (probably the root file system) and linuxstart.bin (this seems to be the bootloader).

like image 89
Joachim Sauer Avatar answered Nov 02 '22 12:11

Joachim Sauer


These are the files you will need:

  • http://bellard.org/jslinux/linuxstart.bin
  • http://bellard.org/jslinux/vmlinux26.bin
  • http://bellard.org/jslinux/root.bin
  • http://bellard.org/jslinux/cpux86.js
  • http://bellard.org/jslinux/term.js

Throw them in along with this file into a folder and you're good to go:

<html>
<head>
<title>Javascript PC Emulator</title>
<style>
.term {
    font-family: courier,fixed,swiss,sans-serif;
    font-size: 14px;
    color: #f0f0f0;
    background: #000000;
}

.termReverse {
    color: #000000;
    background: #00ff00;
}
#note {
    font-size: 12px;
}
#copyright {
    font-size: 10px;
}

</style>
</head>
<body onload="start()">
<script src="term.js"></script>
<script src="cpux86.js"></script>
<div id="copyright">&copy; 2011 Fabrice Bellard - <a href="tech.html">Technical notes</a></div>
</body>

</html>
like image 40
Marcelo Mason Avatar answered Nov 02 '22 12:11

Marcelo Mason