How to locally host the web browser virtual machine here: http://bellard.org/jslinux/

I don’t know much Javascript, and I want to host an integrated Linux browser (which can be found here ). The reason is that I am not always connected to the network, I would like to know how it works. No contempt of copyright is intended.

I tried to copy the sources of the three files ( term.js , cpux86.js and the HTML file itself) into the folder and run the HTML, and this will not work.

Anyway, to make it work?
Also: if this does not work, why? The directory structure is copied by me and almost the same.

PS: I also used the Javascript deobfuscator addon for Firefox, but that didn't help either. I indented all the code to make it more readable, but it is still not clear: P

+7
source share
4 answers

The JS code itself is not a "Linux clone", it is an operating system loading the propper x86 Linux server.

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

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

+1
source

These are the files you will need:

Drop them with this file into a folder, and you’ll go well:

 <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> 
+1
source

In addition to these answers, you can try to see how I host jslinux on a local server in my jsmodem project at http://github.com/ewiger/jsmodem (allows an Internet connection).

If you have python installed, just run the local web server as

 python -m SimpleHTTPServer 
+1
source

I did not check the page, but all you have to do is make sure that all the necessary resources are listed correctly. Js assets are referenced on the page, somewhere linux binaries from these scripts are loaded. You will have to dig through them, find and change the URLs accordingly.

As for figuring out how emulation works, etc., this project is a pretty hacked feat, so good luck :)

0
source

All Articles