Adblock breaks this site

#!# A guide to using qemu OS emulator //FreeBSD

Discussion in 'Archives' started by 1ce, May 7, 2011.

  1. 1ce

    1ce Forum Addict
    Banned

    Joined:
    Mar 11, 2011
    Posts:
    261
    Referrals:
    1
    Sythe Gold:
    0
    #!# A guide to using qemu OS emulator //FreeBSD

    OK, first and foremost, you will be using ports, so if you need help on this see my ports guide:


    */
    An active internet connection
    Understanding of FreeBSD (at least a partial one)
    A *.iso image of the operating system you wish to install!
    /*


    Notice::
    Before command I will either use the characters '#' or '$'. Commands with '#' before them you need to do as root; commands with '$' in front of them need to be done as your non-root user.

    Right, first thing you should probably do is update ports so you have the latest versions of the software you are trying to install; to do that, do the following.

    # cd /usr/ports ; && portsnap fetch

    That will download a snapshot of the ports collection, now you just need to extract it by doing:

    # portsnap extract

    That will extract the snapshot of the latest ports directory into /usr/ports. You are now ready to install qemu. To install qemu do the following:

    #cd /usr/ports/emulators/qemu ; make install clean

    At the config menu, enable kqemu kernel accelerator, then install the rest of the program. This may take a while depending on your 'net connection and pc speed.

    --/ After that finishes.. /--

    qemu is a little different when it comes down to installing an operating system, So I suggest also installing:

    # cd /usr/ports/emulators/qtemu ; make install clean

    All qtemu is, is a gui frontend for qtemu. You are now ready to install your operating system. The easiest way to open qtemu is to go back to your shell and invoke it:

    $ qtemu

    And that yields:

    [​IMG]

    Then you simply use the wizard to setup the os of your choice, eventually you well get to this menu:


    [​IMG]

    In this menu you will see your setup menu, for what you wish to allow your operating system to use. Here is a summary of this menu:


    Memory // Memory allows you to select the ammount of RAM you want your guest machine to use.

    Hard Disk // This is the *.img file that you want to load. (ignore this)

    CDROM // This option allows you to load a disk image when you start your guest os. In this case you will be using your OS iso image. (since you will be installing from cdrom? Or you could use and actual disk if you wish by selecting that device out of the dropdown search menu.

    Floppy Disk // same thing as cdrom, ignore it if you don't have or wish to use a floppy drive.

    Network // Check the box to enable network use on your guest OS.

    Sound // Check the box to enable sound on your guest OS.

    Other // Ignore this.

    Right, click the start button at the top to install your operating system. Once it is finished you may return to your guest operating system 1 of 2 ways:

    */
    Run qtemu, (saves a list of previously used machines as tabs on the side) or select your guest os out of the hard disk sub menu in the menu.

    $ qemu /path/to/your/imagefile.img
    /*

    Your image file will be somewhere in ~/MyMachines/* If you only have 1 operating system, i.e windows you'll find it in: ~/MyMachines/Windows/whatever-you-called-it.img

    To return to the host OS simply hit cntrl + alt at the same time, and your focus will leave the guest os's window. Double click on it to return.

    That's all there is to it, you could shut down your operating system either by clicking shutdown in the your guest os's menu, hitting shutdown in qtemu if you're still using that, or you could just hit alt-f4. (when you're not in the guest os's window.)

    ------/ Extra Features for Qemu /------

    As it is better to use qemu from shell invoktion that is how I'll instruct you through this mini-sub-guide.

    1: Using kernel accelerator to make qemu faster::
    */
    First, since you compiled with kqemu support, (if not go reinstall qemu) check and see of the module is loaded into the kernel:

    # kldstat | grep kqemu

    If you got a result unload it now:

    # kldunload kqemu

    Weather you did or didn't get a result, unload the module because the accelerator that came with qemu blows chunks. Ok.. so now we grab a good one:

    # cd /usr/ports/emulators/kqemu-kmod-devel ; make install clean

    Note, there are 2 similar ports, kqemu-kmod and kqemu-kmod-devel, kqemu-kmod is NOT the right version required for qemu to use it so install kqemu-kmod-devel.

    When that is installed load the module with:

    # kldload kqemu

    Cool,.. it's all setup, to use the accelerator with qemu just invoke it with the -kernel-kqemu switch. Here is an example:

    $ qemu /usr/home/Ep1kMalware/MyMachines/Windows_XP/Windows_XP.img -kernel-kqemu -m 1G

    notice: '-m 1G' alters the ram you wish to load your guest os with, '-m' for memory and how much. Use ammount with 'G' or 'M' or 'K' according to how many gigs, megs, or kilabytes you want to use ram. I.E '-m 512M' is 512 megs of ram.

    If you are using an amd cpu you need to use qemu-system-x86_64. So an example for you would be:

    $ qemu-system-x86_64 /usr/home/Ep1kMalware/MyMachines/Windows_XP/Windows_XP.img -kernel-kqemu -m 1G

    That is all
    /*

    2:Changing cd images for qemu 'on the fly'.
    */

    Right,.. you don't need to install anything. When you have a guest os open press cntrl + alt + 2 and it will open a menu:

    Type 'info block' and you'll see some devices.
    The one you're looking for is an ide device with a cd letter attatched to it. Consult this image if you need help understanding:

    [​IMG]

    In my situation, and probably yours, it's ide1-cd0, so use 'change' to move it to another iso image. Here is an example:

    change ide1-cd0 /path/to/image.iso

    And that will change the content of your "disk drive". Press cntrl+alt+f1 to switch back to the guest OS.

    [​IMG]

    It works pretty well, you can run up 4 virtual drives/ disks with qemu. Simply use the 'change' option on the appropriate ide device.
    /*

    That's all for this guide


    Sincerely, 1ce​
     
  2. Divine blob

    Divine blob Guru

    Joined:
    Mar 14, 2007
    Posts:
    1,289
    Referrals:
    2
    Sythe Gold:
    0
    #!# A guide to using qemu OS emulator //FreeBSD

    Is it playable? Like, would I be getting decent FPS? As I've tried other emulators and got horrid FPS.
     
  3. 1ce

    1ce Forum Addict
    Banned

    Joined:
    Mar 11, 2011
    Posts:
    261
    Referrals:
    1
    Sythe Gold:
    0
    #!# A guide to using qemu OS emulator //FreeBSD

    Depends alot on the emulator and how you set it, you could be using the fastest computer in the world with the greatest emulator you could find, but it will run like shit if you give it 50k ram.

    ---

    But to answer your question, Yes, it is quite fast. Windows is a bit slow unless your run kqemu. Invoke qemu with kqemu kernel accelerator and it has very good fps.

    However nothing is without a downside, qemu's thorn is that it installs it's guest os (predominantly windows) pretty slow, like pentium 3 speed. Once the guest is installed use the accelerator and it's all pretty fast and zippy.
     
< blood drive donation | Fuck my life >


 
 
Adblock breaks this site