Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please document the process to create bootable install of Linux distro #128

Closed
olberger opened this issue Jan 30, 2017 · 9 comments
Closed

Comments

@olberger
Copy link

Could you document the way one may achieve a bootable install of a Linux distro, like what you did for arch ?

Thanks in advance.

@olberger
Copy link
Author

Trying to document my efforts, here's what I've tested. I've reused the basic.html config to start the emulator with:

var emulator = window.emulator = new V86Starter({
        memory_size: 128 * 1024 * 1024,
        vga_memory_size: 8 * 1024 * 1024,
        screen_container: document.getElementById("screen_container"),
        bios: {
            url: "../bios/seabios.bin",
        },
        vga_bios: {
            url: "../bios/vgabios.bin",
        },
        cdrom: {
            url: "../images/debian.iso",
        },
        network_relay_url: "wss://relay.widgetry.org/",
        autostart: true,
    });

where the debian.iso points to the Debian installer for i386's iso.

The installer runs.

Now, I'm stuck at configuring a target filesystem. But I guess running the installer inside the emulator isn't the only way, and I could try and deboostrap somehow. Still, it isn't clear to me how one creates the needed files and what to configure so as to load image that can be used for booting.

@copy
Copy link
Owner

copy commented Jan 30, 2017

Now, I'm stuck at configuring a target filesystem. But I guess running the installer inside the emulator isn't the only way, and I could try and deboostrap somehow. Still, it isn't clear to me how one creates the needed files and what to configure so as to load image that can be used for booting.

While it can be theoretically be done this way, I wouldn't recommend it. It is too slow, and JavaScript needs to keep the hard drive image in memory in order to save it.

Instead, install debian in another emulator and then load the installed image in v86. For example in qemu:

qemu-img create hd.img 4G
qemu-system-x86_64 -hda hd.img -cdrom debian-installer.iso -boot d

Make sure to create a raw disk image. The resulting hard disk image, hd.img, should be bootable in v86 with the code you've pasted (substituting cdrom for hda).

The Arch Linux image employs two optimisations (restoring from a state image and loading files via 9p), do you need more documentation for these?

@olberger
Copy link
Author

These last 2 elements would be quite helpful too. Thanks alot for the qemu hint. I'll try that and will report. Thx

@olberger
Copy link
Author

@copy The issue with that approach is that a 4G image won't load in my browser, I'm afraid. I guess the image could be shrunk, but I think there may be other options (that I'll investigate). In any case, any hints are much welcome.

@copy
Copy link
Owner

copy commented Jan 31, 2017

@copy The issue with that approach is that a 4G image won't load in my browser, I'm afraid. I guess the image could be shrunk, but I think there may be other options (that I'll investigate). In any case, any hints are much welcome.

If you specify a size and set async sectors will be loaded as needed:

        hda: {
            url: "http://localhost/v86-images/arch3.img",
            async: true,
            size: 8 * 1024 * 1024 * 1024,
        },

@copy
Copy link
Owner

copy commented Jan 31, 2017

These last 2 elements would be quite helpful too. Thanks alot for the qemu hint. I'll try that and will report. Thx

Saving/Restoring state is documented here and an example is here.

Using the 9p file system is documented here. This allows you to mount the file system in Linux. In order to boot from it, you need to remount the root file system to the 9p file system during boot. For Arch Linux, this is documented here. It might need some adoptions for Debian.

@copy
Copy link
Owner

copy commented Mar 4, 2017

Feel free to reopen if you have more questions.

@copy copy closed this as completed Mar 4, 2017
@oakes
Copy link

oakes commented Apr 15, 2017

Hello @copy , when creating an img file, does it need to contain a particular kind of file system? I can't tell what file system is used inside the examples.

@oakes
Copy link

oakes commented Apr 16, 2017

Nevermind, I made a disk image with Qemu and it seems to load.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants