BozoSort

yet another CS blog

Browsing Posts in Projects

I use an MSI Wind Nettop 100 as a server, which sits in a dark corner of my bedroom underneath a router. It’s powered by an Intel Atom 330N which is perfect for a low noise, yet capable server, running things like this wordpress blog and my personal bugtracker. However, quiet just isn’t quiet enough. I wanted something silent, so I set out to reduce the noise even more. The stock machine uses a passive cooler for the CPU, and a small fan at the back which pulls air in from the opposite side of the case. Under no load, the machine is near silent, but when the load goes up, the speed of the fan increases significantly, along with the noise it produces. So my solution was to reduce the fan noise by eliminating the throttling feature on the case fan in addition to using a small, quiet, dedicated CPU fan.

Tiny CPU Fan, pushes 5 cfm at 14 dBA I picked this up at fry’s for a ripoff.. but it is exactly what I wanted. A tiny, virtually silent fan that has just enough cfm to push air through the fins of a passive CPU heatsink. Sadly it’s not perfectly silent still when under full load, but a few additional resistors might be able to help that.

There’s an immediate problem upon inspection of the heatsink. The hard drive caddy places the end of the hard drive directly where we want the fan to go. I can’t help but wonder how bad of a design this is in regards to cooling. All the heat from the cpu is rising into the hard drive, quite possibly shortening its lifespan.

That’s an 80 gig Western Digital Caviar Blue, which I picked up for $30 on Newegg. On the left you can see the single stick of SO-DIMM (laptop) RAM. At 2Gb it is very much overkill for a headless server that spends 99% of its life doing nothing. Hardrive on top of CPU heatsink

One thing I really like about this computer is the ability to completely remove the hard drive caddy, which makes working on individual components much easier. Fortunately, I have no use for the 5.25″ drive bay, so I bought the appropriate mounting hardware to mount the hdd in that slot, which opens up the vertical space above the CPU heatsink. If I ever add another harddrive, I will purchase a 2.5″ laptop drive and use mounting brackets to mount it in the 3.5″ bay, which should allow the vertical space above the CPU to remain free. Of course, with only ~4% of 80 Gb used so far, that day might be a long, long way away.

Harddrive Caddy and Mounted CPU Fan CPU Heatsink, Fan, and Hotglue

In the above right picture you can see the SanDisk 2Gb Compact Flash card which is plugged directly into the motherboard. I use this as my backup drive. The important files and databases are tar’ed, zipped and moved to the CF card every day at midnight. I once considered installing the OS itself to the card, but that would actually be a bad idea, since these cards have a (comparatively) very limited read/write life. The CPU Fan is simply glued to the heatsink using hotglue. Sound like a bad idea? Possibly, but it hasn’t melted off so far, so I’ve been happy with it. While the case was open, I decided to eliminate the hardrive activity and power indicator LEDs. They aren’t particularly informative, and they light up my bedroom at night.

Cutting wires The two wires NOT to cut are the WHITE and BLACK wires leading to where my thumb is gripping the plastic. Those wires go to the power switch. The colored wires only power LED lights. They can be cut without fear of damaging something important.. or making things explode.

Now that the case fan is no longer throttled by the motherboard, it would run full speed all the time, which is extremely counter productive to the point of this mod. To remedy this, I added a resistor in series with the fan so as to limit the voltage going across the motor. I chose a 110k ohm resistor, calculated by closing my eyes, walking up to the wall of resistors at Fry’s, and picking the first one I grabbed. In retrospect my choice isn’t too far from optimal, though I think I’ll add another pair of resistors in parallel in series with the resistor that’s currently there. That’ll reduce the noise just a bit more while still providing adequate airflow.

Case fan with resistor It isn’t until looking at this picture that I realize how dangerous it is to leave that resistor bare. The case itself is grounded, so if that positive lead touches any part of the case, it will cause a short in the motherboard, which would likely (according to Murphy’s law) kill all of the electronics that are connected to it. I should probably go fix that.

Finishing up: The hard drive caddy goes back in place, the power adapter is plugged in, and a sanity check is performed before putting the case back together. Luckily everything still worked. All there is to worry about now is the hot-glue which is holding the fan in place melting, and also that bare resistor touching the case. But that’s a fix for a rainy day, and it isn’t raining today.

Power Testing Server under WRT54G

My server and the Linksys WRT54G router that sits on top of it are in a perpetual uptime contest. It’s like a staring contest, but for nerds. And machines. The router runs the Tomato firmware while the server runs Turnkey Linux, which is a convenience- oriented derivative of Ubuntu Server 8.04LTS.






This is a Sudoku Solver which uses recursive backtracking to brute force its way to the first possible solution. This means it can solve all puzzles with at least one solution – including a blank puzzle. Can you do that?

Building RTEMS

1 comment

Overview

The classic way of building RTEMS is to start by building your own tool chain for the specific target architecture for which you wish to build your RTEMS kernel for. This can be a tedious process as there are an abundance of little “gotcha’s” that lead to many failed compiles and hurt feelings.

The simplest way to build RTEMS is with the pre-built tool chains available on the rtems website. They are only available in .rpm format, and require the yum package manager for the easy – easy way of getting RTEMS compiled.

The website does have existing instructions on getting these pre-built tool chains setup, but I found them to be incomplete and confusing. So here is a guide to augment those instructions.

General vs. Example

For the sake of clarity, I’ll be showing general commands in normal code font and example commands in red code font . Since there are many different environments and build targets, the general case will be sort of “fill in the blank”, while following the examples in red will get to a working i386 RTEMS kernel.

Downloading Things

For the example build, I’ll be using i386 RTEMS 4.9.2 and the Fedora 12 32-bit O.S. If you aren’t using either Fedora, CentOS, RedHat, or Suse, these instructions are probably useless to you. You’ll need to either build the toolchain by hand or start using one of the supported operating systems.

*One important thing to note about the RTEMS naming convention is that the toolchain drops the last digit of the version number of the RTEMS version you want to build. For example, if you’re building RTEMS 4.9.2, you use the 4.9 toolchain.

Download

Go to www.rtems.org/ftp/pub/rtems/linux/ and click through the links until you’ve found the page listing rpm packages relevant to your OS and desired RTEMS version. There will be an .rpm (probably at the bottom) in the form:
rtems-BRANCH-yum-conf-VERSION-DISTRO.noarch.rpm
For example,
wget http://www.rtems.org/ftp/pub/rtems/linux/4.9/fedora/12/i386/rtems-4.9-yum-conf-0.20-1.fc12.noarch.rpm
will download the correct file into your current directory.

Load

Load the .rpm into yum with command: sudo rpm -ivh [package] . For example, I did
sudo rpm -ivh rtems4.9-yum-conf-0.20-1.fc12.noarch.rpm
Now reload yum and search for rtems to display all the different toolchain components you can download for all the different available target architectures:
sudo yum update
yum search rtems

Install

Install the toolchain of build target of your choice. There are some things that all targets need, and then there are architecture specific things. First, the general stuff:
sudo yum install rtems-4.9-auto*
Now for the architecture specific stuff:
sudo yum install rtems-4.9-[ARCH]*
Playing along with the i386 example, the command would be:
sudo yum install rtems-4.9-i386-*

Sadly yum fails to completely install our tools. It puts everything in /opt/rtems-[VER]/bin/ which is not a part of your $PATH, so trying to compile will still result in "no compatible cc found" at this point. To correct this, tell the $PATH where the tools are with either a quick:
PATH=/opt/rtems-[VER]/bin:$PATH
(or the following for the i386 example):
PATH=/opt/rtems-4.9/bin:$PATH
or for a better solution, edit your ~/.bashrc and add the above line. If you go this route, the changes will take place after you reboot, and will continue to work after every reboot.

Now verify that the toolchain is available for use with the which command.
which [ARCH]-rtems[VER]-gcc
Or for the i386 example:
which i386-rtems4.9-gcc

If you don't get something along the lines of "/opt/rtems-VER/bin/ARCH-rtemsVER-gcc" as your output, you did something wrong.

Compile RTEMS

Compiling RTEMS is no different than compiling other programs. First call the configure script with the options you want, and then hit the make button. However the make files do seem to ignore the "--prefix=" flag if you try to use it (relevant only during make install), and dumps all the output into /opt/... anyway. In the general case, to compile RTEMS, you want to use a command (from the build directory, where [...] is the location of the source files for RTEMS) is:
[...]/rtemsVER/configure --target=ARCH --[ other options ]
In the i386 example:
[...]/rtems4.9/configure --target=i386-rtems4.9 --enable-tests --enable-networking --enable-posix --enable-rtemsbsp="pc386"

To quickly find the output files (assuming you built the tests) do a simple:
sudo find / -name hello.exe
This will reveal the directory holding all of the sample output files, and you can copy or move those somewhere into your home directory so they're more convenient to use.

Congratulations, you built RTEMS!

To get RTEMS booted in QEMU using GRUB, see my article about that