• The Multiboot specification and NetBSD

    In the OS world, each OS comes with its custom boot loader that knows how to load the kernel and how to pass the execution flow to it. These boot loaders often know very little about other OSes, so if you need a multi-OS environment, you have to install several different boot loaders. It is often tricky to get them to coexist and, even if you accomplish it, it's still annoying to chainload between them.The GRUB developers wrote the Multiboot specification which aims to solve this problem. This specification defines an interface between a boot loader and the OS's kernel, so that any Multiboot-compliant boot loader can execute any Multiboot-compliant OS without knowing any of its internal details. There are several free OSes that already follow this specification, including GNU/Hurd, ForthOS, AtheOS or Syllable. (I'm sure there are many more.)Although this is i386-specific, I think the idea is quite interesting. Therefore, I've started adapting the NetBSD kernel to this specification. I'm progressing (very) slowly, mostly because the lack of documentation on boot code, the complexity behind it and some bugs in GRUB! No matter what, I can boot a kernel directly from GRUB already, although it still lacks configuration (i.e., information about the boot device, memory mappings, etc.). Leave me some more days and I think it'll be ready :-)What are those bugs in GRUB I said? The specification reserves some space in the Multiboot header to specify where in memory the image has to be loaded. This is required for a.out binaries but it is optional for ELF binaries... and optional means that GRUB forgets about it in the ELF case. Which is a pity because I must pass special information through there. To the curious ones, the kernel's text is mapped into the 0xc0100000 virtual address, but the boot loader must load it into the physical address 0x00100000 (because paging is not enabled and such high addresses are not available). Similarly for all the other segments.I also hope to write a little boot(9) manual page as a result of this mini-project, explaining the overall NetBSD boot process (at least under i386). I'm sure many people could benefit from it.Edit (23:49): Some typos and grammar incorrections pointed out by Amitai Schlair have been fixed. [Continue reading]

  • Merry Christmas!

    Merry Christmas, my fellow readers, and thanks for reading this blog! Seizing the opportunity to post some numbers: since this blog was moved from Livejournal to Blogger it has got around 2.300 unique visits. This makes the 209th post and the blog has been up for 19 months; I think it's in good health.Oh, and I just got a Linksys WRT54GS broadband router as a Christmas present... time to set it up :-) [Continue reading]

  • Monotone: Got T-Shirt

    The last weekend of past November, Monotone's main author, Graydon Hoare, proposed a "bugathon": a time frame in which all efforts could be focused on fixing existing bugs in the code. The price for solving a bug was a T-Shirt (or any other object from its CafePress shop), so I decided to help a bit by fixing some portability bugs to NetBSD. And today, I received the long sleeved T-Shirt I ordered in exchange for the fixes :-) (Will post a photo of this one too when I learn how to do it.) [Continue reading]

  • NetBSD 3.0 released

    The NetBSD Project has just released a new major version of its operating system, thus making NetBSD 3.0. This release comes a year after of 2.0 publication and includes lots of new features and bug fixes. For more information, see the announcement (also available in Spanish).From here, a big thank you to all the people who made this release possible and, specially, to the release engineering team. [Continue reading]

  • SoC: Got T-Shirt

    When I got home yesterday, I found that I had already received the so-promised Google's Summer of Code T-Shirt as well as a certificate stating that I passed the program. I'm happy :-) I now should learn how to post photos here in Blogger. [Continue reading]

  • Comments after a month with the iBook

    It has already passed a full month since I bought the iBook 12". And man, this is one of the best buys I've ever made. Just after I got it, the preinstalled Mac OS X greeted me and let me set up the machine. After that, I spent some time installing the applications I needed such as XCode, Vim.app (yes, I really like Vim's graphical version), the Subversion and Monotone clients, Adium X, Firefox (because Safari fails to open my faculty's website), NeoOffice/J, The Gimp, Colloquy and a bunch of other less-important things. (I haven't had time yet to play with some of the integrated applications.)Since then, I have been doing real work exclusively. The machine has been rock solid and I haven't had any single problem with the hardware nor the software. Not to mention that the system and the applications have taken care to update themselves whenever needed, so I haven't had to administer the box. I now understand when people say they want to use computers rather than fight with them...Anyway, the first idea of this post was to summarize the things I like most about the system itself, so let's continue with that. First of all, I'm in love with Exposé. Before I had the Mac, Mac-users often told me how great this feature was, but I was really skeptical and didn't believe them. My mind has changed completely: this feature is truly amazing. Visually selecting the window you want rather than having to look for a name in a task bar or window list is a lot easier. Not to mention that the way it behaves is a lot better than some free clones (which I had tried and didn't really convince me).Secondly, there is the Dashboard. I find this feature useful because I have tools like a dictionary, the weather report, iTunes control and several other things quickly available after a mouse gesture. Indeed, GNOME provides much of these features in the task bar, but they end up bothering me because they remove a lot of useful space from it. Having these applications in a "secondary screen" is nice — of course, you can achieve something like this with an auxiliary virtual desktop.Then, there is the concept of active application vs. active window. I also was quite reluctant to have the menu bar at the top of the screen; in fact, I'd already tried this behavior in KDE but didn't convince me (possibly because its applications are not designed to work in such way). I've now come to like it: the menu bar is quickly accessible, as it is placed along a screen boundary, and when the application is active, all its windows come to the front layer. Furthermore, the menu layout is well standarized across applications, so the most common options are available in a known place even if you've not used the program before.There is also Spotlight, which quickly searches your hard drive for files matching a given search criterion. It is nice, but there is already Google Desktop for Windows boxes or Beagle for Unix ones, so I don't see it as revealing as the other features described here.Not to mention its BSD core. While the system is designed for desktop usage, having a Unix system underneath is excellent for development tasks. Add pkgsrc to the mix and you can get any Unix software you want painlessly :-)At last, although I'm also a bit reluctant about visual effects, the ones in Mac OS X are well done and do not get in the way. They even help you in your daily work by, e.g., showing your active window at a "upper" level (using a drop shadow), letting you put some windows in transparent mode so that you can work on two documents at once and other similar things.Conclusion: I don't regret at all having bought the iBook and I really like its OS, Mac OS X (pity its UI is not free). Of course, I won't leave NetBSD nor pkgsrc development, as I already have a quite long to-do list for them (on which I'll work when I finish this university semester) and I believe in them! ;-) [Continue reading]

  • Vim: Macros

    Vim (The editor) is able to record and replay macros; unfortunately, this feature is often unknown. Since I learned about it, I'm not afraid any more to do large and monotonous editing tasks as Vim can do most of the work for me.OK, but, what is a macro? A macro is a list of prerecorded actions that can be executed (replayed) at any time in an automated fashion. Macros are identified by a single letter and can be recorded while Vim is running — that they are volatile in the sense that they are forgotten when the editor is closed. I'm sure there is a way to store them in the configuration file but I haven't looked for it (yet).In order to record a macro, press q followed by the name — a single letter — you want to assign to it. The most commonly used name is q (because it's quick to type after the recording command), so simply press this key twice, qq, to start recording a macro named q. You will see that the status line changes to recording so that you know what is going on.With the editor in recording mode, do changes to the document as you'd usually do. The macro will remember everything; even changing the current document to another one (e.g., :wn) will be stored (useful in multifile edits). When you are done, simply press q again to stop recording.So, now that you have your macro recorded, how do you replay it? Simply press @q and watch Vim redo your actions! Note that @ stands for the replay command and q indicates the macro's name.Be careful when recoding macros, though. It is useful to stick to generic movements around the text rather than simple ones; that is, instead of moving letter by letter, move word by word, go to the beginning/end of the line, move X lines forward/backward, etc. This way, the macro will be applicable even if the text you are currently editing does not match the one you used to record the macro. [Continue reading]

  • Java: Visibility

    I'd always (incorrectly) believed that, if you didn't specify the visibility of an attribute or method in a Java class, it'd be private in the former case and public in the latter. This is not what really happens. In fact, Java has four different visibility modifiers: public, protected, private and "package". The first three are the "standard" OOP types, while the last one is Java specific.There is no reserved keyword in the Java language to denote an attribute or method as "package"-visible; this status is automatically assigned when no modifier is applied. But... what does it mean? Consider a Foo class with an attribute bar and a methodbaz, both with the default visibility set. Any other class in the same package as Foo will be able to freely access bar and baz. In the other hand, classes from other pacakges will see bar and baz private.Aren't you thinking about C++'s friend keyword by now? Exactly! This default visibility status can be used to achieve a similar thing in Java. Just put the classes with a friendship relation in the same package and they will be able to interact with each other, sharing implementation details without exposing them to the public. [Continue reading]

  • Case-sensitive vs. case-preserving

    A file system is case-sensitive when it differentiaties uppercase letters from lowercase ones. This means that foo.c is not the same thing as Foo.c and therefore you are allowed to have these two files living in the same directory. While I've lived with case-sensitive file systems for a long time (since I discovered Unix), I haven't yet found any advantages to them except for an easier and faster implementation. In these file systems, detecting a file match is a matter of a raw comparison of the characters you are given agains the ones stored on disc. Examples of case-sensitive file systems include UFS, Ext3, Reiser, etc., while examples of the other set include VFAT, NTFS and HFS+.On the other hand, case-insensitive file systems can be case-preserving or not. A file system is case preserving if it keeps the case of the file names as they are entered. For example, if you name a file Foo.c, it will appear as such in all listings, not foo.c nor FOO.C. Such file systems include VFAT, NTFS and HFS+. However, if the file system is not case-preserving, it will convert all file names to either uppercase or lowercase. An example is the old FAT, which shows all 8.3 file names in uppercase letters.I'm sorry for not having posted in more than 20 days, but this university project (PROP, if you must know) is really exhausting me. Not to mention that I've taken the FCE exam today, too... [Continue reading]