• Games: Doom 3

    It has taken me around two years but, a week ago, I finally completed Doom 3. The game is good, although not excellent. Let's see why:On the first hand, the game is frightening. Yes, it is. I didn't believe it before playing, but once you get immersed in the game, it really becomes so. For the best experience, turn off your lights, rise the volume and, of course, play alone. If you like horror games or movies, you'll certainly enjoy this one.The ambient at the beginning of the game is neat. You have few ammo, you discover new monsters, you hear screams through radio transmissions... Easy to get "involved". As you progress, you'll learn about the game's plot basically through other people's PDAs, which hold mails and voice messages. These are also recorded in a way to increase tension, as in some way they outline what will happen soon you go on.On the graphics area, it is very good, even though it requires a good amount of resources. I have finished it at high quality and there certainly are a lot of details in the images, plus a lot of neat effects. As regards sounds, they are very well placed to create a horror ambient. I think some background voices were much better in the English version (the one I started playing) than in the Spanish one, but it has been so long that I cannot tell for sure.Let's now see the negative side: the game is too repetitive and too long. That's why it has taken me so long to finish it: I've played it in four runs, because after each one I was too bored to continue playing. Well, being too long wouldn't be bad if there was more variety in the levels... in fact, I'm not sure it's that long, but it seemed so. For example, the Delta Labs seem infinite.Also, once you get to the Hell level and onwards, you find so many monsters that it becomes not so frightening. It is more a "shoot everything that moves and run" than "go slowly to see what may happen" as is at the first half of the game.Summarizing, it has more pros than cons, so it's worth it. If not, I wouldn't have just got the expansion pack, Doom 3: Resurrection of Evil! [Continue reading]

  • NTFS read/write support for Mac OS X

    It is a fact that hard disk drives are very, very large nowadays. Formatting them as FAT (in any of its versions) is suboptimal due to the deficiencies of this file system: big clusters, lack of journaling support, etc. But, like it or not, FAT is the most compatible file system out there: virtually any OS and device supports it in read/write mode.Today, I had to reinstall Windows XP on my Mac (won't bother you with the reasons). In the past, I had used FAT32 for its 30Gb partition so I could access it from Mac OS X. But recently, some guys at Google ported Linux's FUSE to Mac OS X, effectively allowing anyone to use FUSE modules under this operating system. And you guessed right: there is a module that provides stable, full read/write support for NTFS file systems; it's name: ntfs-3g.So I installed Windows XP on a NTFS partition and gave these a try.MacFUSE, as said above, is a port of Linux's FUSE kernel-level interface to Mac OS X. For those that don't know it, FUSE is a kernel facility that allows file system drivers to be run as user-space applications; this speeds up development of these components and also prevents some common programming mistakes to take the whole system down. Having such a compatible interface means that you can run almost any FUSE module under Mac OS X without changes to its code.Installing MacFUSE is trivial, but I was afraid that using ntfs-3g could require messing with the command line — which would be soooo Mac-unlike — and feared it could not integrate well with the system (i.e. no automation nor replacement of the standard read-only driver).It turns out I was wrong. There is a very nice NTFS-3G for Mac OS X project that provides you the typical disk image with a couple of installers to properly merge ntfs-3g support into your system. Once done, just reboot and your NTFS partition will automatically come up in the Finder as a read/write volume! Sweet. Kudos to the developers that made this work.Oh, and by the way. We have got FUSE support in NetBSD too! [Continue reading]

  • Building an updated kernel for the PS3

    The mainstream Linux sources have some support for the PlayStation 3, but it is marked as incomplete. Trying to boot such a kernel results in a stalled machine, as the kernel configuration option says:CONFIG_PPC_PS3: This option enables support for the Sony PS3 game console and other platforms using the PS3 hypervisor. Support for this platform is not yet complete, so enabling this will not result in a bootable kernel on a PS3 system.To make things easier, I'd simply have used the Linux sources provided by YellowDog Linux 5 (YDL5), which correspond to a modified 2.6.16 kernel. However, as I have to do some kernel development on this platform, I objected to using such old sources: when developing for an open source project, it is much better to use the development branch of the code — if available — because custom changes will remain synchronized with mainstream changes. This means that, if those changes are accepted by the maintainers, it will be a lot easier to later merge them with the upstream code.So, after a bit of fiddling, I found the public kernel branch used to develop for the PS3. It is named ps3-linux, is maintained by Geoff Levand and can be found in the kernel's git repository under the project linux/kernel/git/geoff/ps3-linux.git.Fetching the code was "interesting". I was (and still am) a novice to git, but fortunately my prior experiences with CVS, Subversion and specially Monotone helped to understand what was going on.Let's now see how to fetch the code, cross-build a custom kernel and install it on the PS3 using YDL5.To checkout the latest code, which at this moment corresponds to a patched Linux 2.6.21-rc3 sources, do this:$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/geoff/ps3-linux.git ps3-linuxThis will clone the ps3-linux project from the main repository and leave it in a directory with the same name. You can keep it up to date by running git pull within the directory, but I'm not going to talk about git any more today.As I cross-compile the PS3 kernel from a FC6 Intel-based machine with the Cell SDK 2.0, I need to tell it which is the target platform and which is the cross-compiler before being able to build or even configure a kernel. I manually add these lines to the top-level Makefile, but setting them in the environment should work too:ARCH=powerpcCROSS_COMPILE=ppu-Now you can create a sample configuration file by executing the following command inside the tree:$ make ps3_defconfigThen proceed to modify the default configuration to your likings. To ease development, I want my kernels to be as small and easy to install as possible; this reduces the test-build-install-reboot cycle to the minimum (well, not exactly; see below). Therefore I disable all stuff I do not need, which includes modules support. Why? Keeping all the code in a single image will make later installation a lot easier.Once the kernel is configured, it is time to build it. But before doing so you need to install a helper utility used by the PS3 build code: the Device Tree Compiler (or dtc). Fetch its sources from the git repository that appears in that page, run make to build it and manually install the dtc binary into /usr/local/bin.With the above done, just run make and wait until your kernel is built. Then copy the resulting vmlinux file to your PS3; I put mine in /boot/vmlinux-jmerino to keep its name version-agnostic and specific to my user account. Note that I do not have to mess with modules as I disabled them; otherwise I'd have to copy them all to the machine — or alternatively set up a NFS root for simplicity as described in Geoff Levand's HOWTO.To boot the kernel, you should know that the PS3 uses the kboot boot loader, a minimal Linux system that chainloads another Linux system by means of the kexec functionality. It is very powerful, but the documentation is scarce. Your best bet is to mimic the entries already present in the file. With this in mind, I added the following line to /etc/kboot.conf:jmerino='/dev/sda1:/vmlinux-jmerino root=/dev/sda2 init=/sbin/init 4'I'd much rather fetch the kernel from a TFTP server, but I have not got this to work yet. Anyway, note that the above line does not specify an initrd image, although all the other entries in the file do. I did this on purpose: the less magic in the boot, the better. However, bypassing the initrd results in a failed boot with:Warning: Unable to open an initial console.This is because the /dev directory on the root partition is unpopulated, as YDL5 uses udev. Hence the need for an initrd image. Getting a workaround for this is trivial though: just create the minimum necessary devices on the disk — "below udev" —, as shown below.# mount --bind / /mnt# MAKEDEV -d /mnt/dev console zero null# umount /mntAnd that's it! Your new, fresh and custom kernel is ready to be executed. Reboot the PS3, wait for the kboot prompt and type your configuration name (jmerino in my case). If all goes fine, the kernel should boot and then start userland initialization.Thanks go to the guys at the cbe-oss-dev mailing list for helping me in building the kernel and solving the missing console problem.Update (23:01): Added a link to a NFS-root tutorial. [Continue reading]

  • X11 mode-line generator

    I recently installed NetBSD-current (4.99.12 at the time I did this) inside Parallels Desktop for Mac. Everything went fine except for the configuration of the XFree86 shipped with the base system: I was unable to get high resolutions to work (over 1024x768 if I recall correctly), and I wanted to configure a full-screen desktop. In my specific case, this is 1440x900, the MacBook Pro's native resolution.It turns out I had to manually add a mode line to the XF86Config file to get that resolution detected. I bet recent X.Org versions do not need this as, e.g. Fedora Core 6 works fine without manual fiddling.Writing mode lines is not fun, but fortunately I came across an automated generator. In fact, this seems to be just a web-based frontend to the gtf tool provided by NVIDIA. So I entered the appropriate details (x = 1440, y = 900, refresh = 60), hit the Generate modeline button and got:# 1440x900 @ 60.00 Hz (GTF) hsync: 55.92 kHz; pclk: 106.47 MHzModeline "1440x900_60.00" 106.47 1440 1520 1672 1904 900 901 904 932 -HSync +VsyncAfter that I had to make the HorizSync and VertRefresh values in my configuration file a bit wider to fulfill this mode's request and everything worked fine. Be extremely careful if you mess with synchronization values though; incorrect ones can physically damage a monitor, although I think this is not a problem for LCDs. [Continue reading]

  • Building the libspe2 on the PS3

    The Linux kernel, when built for a Cell-based platform, provides the spufs pseudo-file system that allows userland applications to interact with the Synergistic Processing Engines (SPEs). However, this interface is too low-level to be useful for application-level programs and hence another level of abstraction is provided over it through the libspe library.There are two versions of the libspe:1.x: Distributed as part of the Cell SDK 2.0, is the most widely used nowadays by applications designed to run on the Cell architecture.2.x: A rewrite of the library that provides a better and cleaner interface — e.g. less black boxes —, but which is currently distributed for evaluation and testing purposes. Further development will happen on this version, so I needed to have it available.The YellowDog Linux 5.0 (YDL5) distribution for the PlayStation 3 only provides an SRPM package for the 1.x version, but there is no support for 2.x. Fortunately, installing the libspe2 is trivial if you use the appropriate binary packages provided by BSC, but things get interesting if you try to build it from sources. As I need to inspect its code and do some changes in it, I have to be able to rebuild its code, so I had to go with the latter option.Let's see how to build and install libspe2 from sources on a PS3 running YDL5.The first step is to download the most up-to-date SRPM package for the libspe2, which at the time of this writing was libspe2-2.0.1-1.src.rpm. Once downloaded, install it on the system:# rpm -i libspe2-2.0.1-1.src.rpmThe above command leaves the original source tarball, any necessary patches and the spec file all properly laid out inside the /usr/src/yellowdog hierarchy.Now, before we can build the libspe2 package, we need to fulfill two requisites. The first is the installation of quilt (for which no binary package exists in the YDL5 repositories), a required tool in libspe2's build process. The second is the updating of bash to a newer version, as the one distributed in YDL5 has a quoting bug that prevents quilt from being built properly.The easiest way to solve these problems is to look for the corresponding SRPM packages for quilt and an updated bash. As YDL5 is based on Fedora Core, a safe bet is to fetch the necessary files from the Fedora Core 6 (FC6) repositories; these were: quilt-0.46-1.fc6.src.rpm and bash-3.1-16.1.src.rpm. After that, proceed with their installation as shown above for libspe2 (using rpm -i).With all the sources in place, it is time to build and install them in the right order. Luckily the FC6 SRPMs we need work fine in YDL5, but this might not be true for other packages. Here is what to do:# cd /usr/src/yellowdog/SRPMS# rpmbuild -ba --target=ppc bash.spec# rpm -U ../RPMS/ppc/bash-3.1-16.1.ppc.rpm# rpmbuild -ba --target=ppc quilt.spec# rpm -i ../RPMS/ppc/quilt-0.46-1.ppc.rpm# rpmbuild -ba libspe2.spec# rpm -i ../RPMS/ppc64/libspe2-2.0.1-1.ppc64.rpm# rpm -i ../RPMS/ppc64/libspe2-devel-2.0.1-1.ppc64.rpmAnd that's it! libspe2 is now installed and ready to be used. Of course, with the build requisites in place, you compile libspe2 in your home directory for testing purposes by using the tar.gz package instead of the SRPM.At last, complete the installation by adding the elfspe2-2.0.1-1.ppc.rpm package to the mix. [Continue reading]

  • NetBSD and SoC 2007

    Yes, ladies and gentlemen: Google Summer of Code 2007 is here and NetBSD is going to become a mentoring organization again (unless Google rejected the application, that is)!We are preparing a list of projects suitable for SoC; spend some time looking for one that interests you (I'm sure there is something) and get ready to send your proposal between the 14th and 24th of this same month. I've already made my choice :-)See the official announcement for more details. [Continue reading]

  • Article on Multiboot and NetBSD

    A bit more than a year ago I started working on Multiboot support for NetBSD. This work was completed by the end of past year and was integrated into the main source tree, allowing any user to boot his NetBSD installation by using GRUB alone, without having to chainload different boot loaders.I've written an introductory article on Multiboot and how NetBSD was converted to support it. It has just been published at ONLamp. Enjoy reading! [Continue reading]