martes, 16 de mayo de 2006

SqueakNOS is back!

This is part of an article written almost four years ago (2006), telling some history of the evolution of SqueakNOS, with some updates mixed up in red. SqueakNOS has evolved a lot since that time but we wanted to rescue the article.

During this 5 years SqueakNOS has seen some activity from people not originally related to it, and although we never forgot about this project, this activity was what finally helped us move forward. Thanks a lot to everybody who sent emails and kind words, and specially to those who got dirty into our ugly code and successfully tried to make it come back.

Lots of things happened in the world, and we thought we would take advantage of them. First, and most important, GRUB, and of course, vmware. Also the Squeak source tree is quite nicely arranged, and the community is much more organized with SqueakPeople, SqueakMap, Monticello, etc. Some of this things we already took advantage from, and some we still have to learn how they work.

GRUB

The original bootloader was a mutant born from LILO, linux boot loader and our fingers. It was really a mess, we changed it to overcome an image size limit it impossed, and modified it to initialize the video mode before jumping to the interpreter. Now, we are using GRUB (Legacy) instead of this mutant. We also had to modify GRUB Legacy, but it's a lot cleaner than our original code, and if GRUB Legacy was not dead, our code would make into the standard GRUB release. We'll work on using GRUB2, but there are some things that we need which are still missing (we'll probably implement them).

    Why GRUB?

  • we need the bootloader to jump into protected mode and map 4G of RAM
  • we need the bootloader to load the .image from disk for us and put it in memory.
  • we need the bootloader to set the right video mode for us.
  • we need the bootloader to be able to handle a big bootable disk.
GRUB already did all this, except for a small detail.

VMWare

We were using VMWare originally in 2001, but now it's more easy to use (VMPlayer is even free to use and quite small for what it does). We are testing everything with VMWare player on Linux, but we successfuly tried it on VMWare on windows and Virtual PC on Mac OSX. We also booted it natively on some boxes, with different results.

Squeak native sourcecode

We are so incredibly happy that we started it all again from scratch (no kidding). Already changing to a new bootloader was big enough a change to push us start from scratch. But also the rearrangement of the sourcecode in subversion was so nice that we wanted to join it. We tried not to touch anything in the Common sources, nor in the generated code. And we managed to do it! We created a new platform (SqueakNOS) next to unix, Max OS, RiscOS, Common and win32 in our local copy of the main trunk. To create a new image we open Squeak and with VMMaker generate everything (only internal plugins are supported of course), and compile. This results in a SqueakNOS.obj which we move to a boot directory where we just "make SqueakNOS.iso". If you want to change the .image, you just move the new one to boot/iso.template, and that's it. As you can see, recompiling SqueakNOS and rebuilding an .iso must be really easy.

We'd love to get help here, specially in rearranging our source code so it looks more like other Squeak ports, and to check if the platform support is Ok as we implemented it (we know some things are not Ok).

Squeak community

Here we got lost. We asked around a few friends, and all recomended to start with a release and an article in SqueakPeople. Latter we'll update the swiki (this time in Squeak's main swiki, so it doesn't get lost), and upload the sources and other things somewhere, but we first need to understand what goes where.

UPDATE: here we are, now we have this site which is the official SqueakNOS site!

What's already here?

Not much yet, but already enough :-)

SqueakNOS is booting, GRUB gives us a nice 1024x768x32 color screen (this is hardcoded somewhere in the .c source code, so even if you change it with GRUB, SqueakNOS will think it's still that resolution). It already has all the primitives it had in its previous life, and some more. IRQs are handled correctly, and can be handled from Squeak (in fact, that's the only way to do it). When you boot the image you should see a quite standard Squeak (Squeak3.8-6665full UPDATE: Squeak4.1), with some add ons. You can open this very same image from a real squeak, and wonder around. There you'll find the source for the SqueakNOSPlugin implementing the primitives, and the class Computer. Although the IRQs and hardware port access are working correctly, keyboard and mouse are not yet implemented (sorry). It'll take a bit more (unless you do it!). It shouldn't bee too complicated, and in fact, it could be ported from the older version quite easily (although we prefer to reimplement it, at least in part). UPDATE: Keyboard and mouse drivers have been implemented and work very well now.

When you open SqueakNOS, you'll see lots of things, and you'll see also that if you press a key its scancode will show up in the Transcript. This is what we used to verify that IRQs and ioports are working.

This is pretty much it. We believe that everything needed to start playing inside Squeak is already done, and now everything missing should be done inside Squeak!

Near future

  • Of course, make it available in a more Squeakish form (SqueakMap? Monticello? Subversion? ???. UPDATE: Smalltalk side is maintained in SqueakSource and C side in Git.
  • Write a serie of small articles, or diary entries describing most of what we did to reimplement it. We did it all in small steps, so we think it'll be a nice serie of articles. UPDATE: We have this site now and lots of articles!
  • Implement PCKeyboard and mouse first! UPDATE: Done!
  • Implement serial port support UPDATE: Done!
  • Implement some kind of file system support over serial ports (vmware lets you set up virtual serial ports, which can be used to connect the inner world to the outer world) UPDATE: It's done, we should write an article about it. Tell us if you really really want it.
  • Our final short term goal is to be able to develop SqueakNOS from within SqueakNOS. With sources, changes and everything. UPDATE: We are almost there, have filesystem support and are almost ready to save the image from inside.

Although we think this could be contributed, we saddly think it'll be a lot easier for us to do it given that it involves going out and in of Squeak for every small test.

Mid term future

  • Add support for other hardware devices.
  • Start trying with other hardware platforms (PowerPCs on Powerbooks/eBooks)
  • Add networking capabilities (independently of the hardware support) UPDATE: Some (or all?) of this is done.

Here's where we think the community can help a lot.