Difference between revisions of "Small Virtual Machines"

From Lazarus wiki
Jump to navigationJump to search
Line 122: Line 122:
 
In the VM in a (user) terminal:<br/>
 
In the VM in a (user) terminal:<br/>
 
sudo apt-get install binutils<br/>
 
sudo apt-get install binutils<br/>
sudo apt-get install build-essential subversion unzip<br/>
+
sudo apt-get install build-essential mingw32-binutils subversion unzip<br/>
 
sudo apt-get install libgtk2.0-dev<br/>
 
sudo apt-get install libgtk2.0-dev<br/>
 
cd Downloads<br/>
 
cd Downloads<br/>

Revision as of 23:33, 15 September 2015

Overview

Shows how to create small ReactOS and Debian virtual machines using Qemu on Ubuntu, and then compile and run a Free Pascal program.

The small virtual machines should serve two purposes:
1) They show how a "standard PC" can be used to run a program. So if you are having problems running the program on your PC you can see how it works on a different PC.
2) If the small VM is easy to download and run then you can simply do that. The LevinUx stuff at the bottom of this wiki page shows how easy that could be.

ReactOS virtual machine

Built (on Ubuntu 14.04 on 5 Aug. 2015) a minimal i386 VM with QEMU with ReactOS 0.3.17.

Download from ReactOS ReactOS-0.3.17-REL-iso.zip (88MB) and unzip to get ReactOS-BootCD.iso (103MB)

qemu-img create -f qcow2 reactos0317.img 2G
qemu-system-i386 -m 512 -hda reactos0317.img -cdrom ReactOS-BootCD.iso -boot d -net nic,model=rtl8139 -net user

For the install just press <Enter> for everything. When it reboots (twice) don't hit any key so it won't boot from the CD.

Shut down ReactOS. The QEMU image file is 294MB.

Restart:
qemu-system-i386 -m 512 -hda reactos0317.img -boot c -net nic,model=rtl8139 -net user

To see that networking is working, in the VM double-click on the Command Prompt and run ipconfig.

Install 7-Zip in the ReactOS Applications Manager Tools section

Needs more work but getting there! In command prompt do:
cd \
md hello
cd hello
This whole line is a comment! dwnl http://downloads.sourceforge.net/gnuwin32/wget-1.11.4-1-setup.exe wgetsetup.exe didn't work [[1]]
This whole line is a comment! so I download and put here (which does work):
dwnl http://turbocontrol.com/wget-1.11.4-1-setup.exe wgetsetup.exe
wgetsetup
"c:\program files\gnuwin32\bin\wget" http://turbocontrol.com/HelloWorld-fpc-2.4.2.i386-win32.zip -O hello.zip
"c:\program files\7-zip\7zg" x hello
ppc386 hello
hello

"c:\program files\gnuwin32\bin\wget" https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/blob/master/bin/i386-win32/fpcup.exe?raw=true --no-check-certificate -O fpcup.exe
fpcup then y to continue
Downloads and runs svn.exe and get dialog "Unable To Locate Component" with the message "This application has failed to start because MSVCP60.dll was not found. Re-installing the application may fix this problem."

Install Microsoft Visual C++ 6 Redistributable Package in the ReactOS Applications Manager Libraries section
How get that to install?

No, you don't want to use ReactOS for your desktop operating system, but it might be good enough to use for some specific things (like putting in a small VM).

Debian console virtual machine

Built (on Ubuntu 14.04) a minimal i386 VM with QEMU with Debian (new version 8 release) Jessie.

Dowload from Debian debian-8.2.0-i386-netinst.iso (315 MB) and rename to debjes.iso

qemu-img create -f qcow2 debjes.img 2G
qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d

Networking worked without having to add other command line parameters! Remove the 2 default software collections (near the end of the install). The QEMU image file is about 1.0 GB.

In the VM:

add sudo (There are instruction near the bottom of this page: Control Pascal PicoScope)

sudo apt-get clean
sudo dd if=/dev/zero of=/mytempfile (note that this is very slow as it fills the entire 2G)
sudo rm -f /mytempfile
sudo halt

After this the new img file is 595 MB:
qemu-img convert -O qcow2 debjes.img debjesnew.img

Archive with 7z and the file is now 141 MB. Not very big for a nice new Debian console VM.

Make a backup copy then start like this (for kvm):
kvm -m 512 -hda debjesnew.img -boot c -enable-kvm -net nic -net user

In the VM do (see http://turbocontrol.com/helloworld.htm if needed):
wget http://turbocontrol.com/HelloWorld-fpc-2.2.2.i386-linux.tar.gz
tar xzvf HelloWorld-fpc-2.2.2.i386-linux.tar.gz
./ppc386 hello
sudo apt-get install binutils
./ppc386 hello
./hello

This downloads fpcup:
wget https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/blob/master/bin/i386-linux/fpcup_linux_x86?raw=true --no-check-certificate -O fpcup
chmod u+rx fpcup
./fpcup

To be continued ASAP!

Debian LXDE virtual machine

Built (on Ubuntu 14.04) a minimal i386 VM with QEMU with Debian (new version 8 release) Jessie.

Dowload from Debian debian-8.2.0-i386-netinst.iso (315 MB) and rename to debjes.iso

qemu-img create -f qcow2 debjes.img 6G
qemu-system-i386 -m 512 -hda debjes.img -cdrom debjes.iso -boot d
or
kvm -m 512 -hda debjes.img -cdrom debjes.iso -boot d -enable-kvm

Networking worked without having to add other command line parameters! Remove the 2 default software collections (near the end of the install) and make sure only the LXDE item is selected. The QEMU image file is about 3.9 GB.

In the VM in a (user) terminal:
su (and password for root)
adduser <user name> sudo
exit (exit su)
exit (exit user and terminal)
logout and login again

Reboot and choose recovery then enter root password:
apt-get clean
dd if=/dev/zero of=/mytempfile (note that this is very slow as it fills the entire 6G)
rm -f /mytempfile
halt

After this the new img file is 2.7 GB:
qemu-img convert -O qcow2 debjes.img debjesnew.img

Make a backup copy then start like this (for kvm):
kvm -m 512 -hda debjesnew.img -boot c -enable-kvm -net nic -net user

In the VM in a (user) terminal:
sudo apt-get install binutils
sudo apt-get install build-essential mingw32-binutils subversion unzip
sudo apt-get install libgtk2.0-dev
cd Downloads
wget https://github.com/LongDirtyAnimAlf/Reiniero-fpcup/blob/master/bin/i386-linux/fpcup_linux_x86?raw=true --no-check-certificate -O fpcup
chmod u+rx fpcup
./fpcup --verbose

To be continued ASAP!

Notes

On Ubuntu kvm can be substituted for quem-system-i386 and things work much faster.

On qemu-img create the 2G could be larger but then on linux it will be much slower to minimize the size. Any suggestions?

Add instructions on how to do this on Windows (not just Ubuntu)?

Original forum message where this got started: [[2]]
Add instructions for OS X per discussion there?

Further Reading

Levinux is a small (~20 MB) QEMU download for x86 PCs (Windows, OS X, Linux) that provides a small Tiny Core Linux VM. I'd like to see something similar but with all the files and tools needed to pull the latest source code and cross-compile FPC (also with Debian instead of Tiny Core?).

 http://mikelev.in/ux/
 http://levinux.com (just a slideshow about it)

What is the most simple way to compile an ARM Embedded compiler for Teensy? See this forum message for more details on Teensy: [[3]]
Use fpcup? [[4]]

See also