Compiling and Bundling SqueakNOS

A month ago, we met with richie and guille to work in SqueakNOS and we advanced a lot in compiling the VM. Here I'll try to document the process and results.

 

The problem

After spending some time fooling around with SqueakNOS image, I decided to make some real work and develop hard drive support. There was a lot of work already done by richie in this area so he sent me the .st driver files. After filing them in I quickly found these changes wouldn't work so easily: this driver used some new in/out primitives, that failed when I tried to use. That happened because altough they where included in SqueakNOSPlugin which is what get's all SqueakNOS primitives translated to C and then compiled when you make the VM, they weren't present in the VMs that I could download from SqueakNOS (the site's versions were too old). So to make it work, I had to recompile the VM or ask richie a newer version of it. It goes without saying that I took the hard way.

As a side effect of compiling this new VM, we got a nice extra: with this updated VM we can now load a pharo image, so SqueakNOS can also be PharoNOS!

This will not only allow us to generate a VM but also let us generate an entire bootable ISO image, with a custom image if we want.

How to solve it

Remember that this article tackles the problem of building the VM completely. If you just want to modify the .image file and bundle it into a bootable ISO, without recompiling the VM, you should read getting started with SqueakNOS article.

Compiling a custom VM wasn't as easy as I first thought, but mainly because the latest one found in the site was almost two-years old, and much things have changed since then. So this instructions may reference some things that won't be needed anymore when we upload an updated VM. The good news is that after this update gets uploaded to the sourceforge site, compiling it becomes really easy.

As always, to compile a VM, you have to gather all the C code files. To do this, the first step is to check out the squeakvm svn repository. This will download the generic (OS-agnostic) part of the handwritten C files.

Then you have to open squeak/pharo image and load VMMaker and SqueakNOS, as explained in code snippets to generate the rest of the C code.  Now, using VMMakerTool, set the platforms dir to your-squeak-svn/platforms. Create a SqueakNOS dir under platforms and then a plugins one under SqueakNOS. So the layout would be:

your-squeak-svn
 \->platforms
     \->SqueakNOS
         \->plugins

Then in VMMakerTool as platform choose SqueakNOS and as the output dir use platforms/SqueakNOS/src32, (you can't give it another name nor path for now I think because of the makefiles).

And for the supported plugins, you can only use internal plugins, and you must add SqueakNOSPlugin. Also, if you want, you can include others, but they are not a must. Known to compile are ADPCMCodecPlugin, B2DPlugin, BitBltPlugin, DSAPrims, FFTPlugin, FloatArrayPlugin, LargeIntegersPlugin, Matrix2x3Plugin, SqueakFFIPrimsPlugin, StarSqueakPlugin and ZipPlugin.

To finish gathering the C files, you have to open the ISO image with some file manager and from /trunk/platforms/SqueakNOS/ copy all files, boot and nos folders into your platforms/SqueakNOS.

The last step is to save the image you used to generate the source and, if you want/need, edit the makefile file specifying the name you used in the variable SQIMAGE.  After that you're ready to compile. Open a shell and cd into SqueakNOS folder. Then type

$ make  (to generate the VM )

and

$ make iso (to create the bootable ISO)

You should be done by now, try to load the generated ISO which was placed in release directory with VMWare to know if it worked.