Category Archives: Computing

Adventures in BIOS hacking

I’m a complete gadget nut, and love playing with shiny new toys, but I’m also a hacker,  and take great joy in fixing up something that was broken, repurposing old kit, or modding something to do something it wasn’t designed for. Like, for example, modding the BIOS of an ageing gaming PC to support TRIM on a RAID 0 array of SSDs.

Because why not?

My gaming rig is getting quite long in the tooth – I’ve had it for almost six years, which is the longest I’ve ever had a PC, and it’s still going strong, able to play any game with the settings pretty much maxed out (albeit with a graphics card transplant since I first built it).

I put its longevity (that is, my lack of desire to replace it) down to the excellent Nehalem i7 920, which has some of the best overclocking characteristics of any processor I’ve come across, and the Asus P6T Deluxe V2 mobo in which it sits. Using air cooling, the CPU will happily run north of 3.8GHz – 50% faster than its rated clock speed – and remain cool, idling at 35°C and only hitting 70°C under extreme torture tests on a hot day (yes, whilst everyone else was enjoying the sunshine six years ago, I was inside, hunched under a desk, overclocking my CPU).

With the CPU happily overclocked, the perf bottleneck moved to the disk. The P6T-D V2 only has two SATA 2.0 controllers, one of which supports RAID. I decided to RAID 0 two SSDs to get the 6GBps throughput of the newer SATA 3.0 controllers, which worked better than expected. Taking into account IO overheads, the RAID array actually runs slightly faster than a single SATA 3.0 SSD. The problem is maintenance. Intel never back-applied their TRIM command support to their older SATA controllers, so over time the disks would slow down. I decided to take the hit and just do a low-level format every six months or so, but of course that habit didn’t last for more than a few years.

After a particularly slow boot, I decided to fix the problem once and for all. After a bit of Googling, I stumbled upon this post on the win-raid forums. Some enterprising users had managed to enable TRIM on older chipsets by modifying the BIOS’s RST RAID ROM module (with a bit of hex editing) and re-injecting the modified ROM into the BIOS.

Excitedly, I set to work, and an hour later I was the proud owner of a freshly flashed BIOS. Sadly the PC wouldn’t boot after that, and to add insult to injury alarmed loudly every time i powered it on, as if announcing to the world what a numpty I’d been.

Fearing a long evening of reinstalling and restoring from backups (yes, I do have them. I’m a bit paranoid about backups after a hard drive died on me whilst I was at uni), I used my laptop to check the instructions again, and realized that the RST ROM i’d flashed was too new for my ancient BIOS. Sigh.

Rinse and repeat (with the correct ROM version this time) and not only did the system boot, but Windows immediately detected the TRIM support and set about doing its thing on the SSDs. CrystalDiskMark seemed to confirm that the perf was back to that of my factory fresh SSDs. Success!

Then the noises started.

The magnetic drives seemed to be periodically spinning down hard, emitting a horrible “weeee-chk” noise every 5 minutes or so. The SSDs were running faster than ever, but my magnetic drives were definitely not happy.

Coincidence? This is a 6 year old PC, remember, and drives die. That said, both magnetic drives seemed making the same noise, at the same intervals, and they weren’t doing that before I started hex-editing the firmware of the chip they’re attached to.

More Googling, a different forum (this post on Intel’s forums this time), and it turns out that the BIOS mod was now interfering with the drives’ acoustic and power management algortihms. Fortunately that can be fixed in software, by modifying the SMART properties of the disks.

Unfortunately, the SMART hack doesn’t persist over power state changes, such as hibernation. Even more fun, the only reliable way to detect a wake from hibernation in software is to monitor the system logs in the Windows Management Console’s Event Viewer.

So now I have a scheduled task which triggers when the power service drops a log, and modifies the SMART settings of the disks plugged into the hacked RAID controller of a PC which should by rights be long since retired. It’s hacks all the way down.

But i’m not going to pretend that I don’t get a kick out of that.

Advertisements

ROMChecker, a python script to check for new Android ROMs and notify your phone.

I’ve recently been running the rather excellent PAC-ROM nightlies on my Galaxy Note II, and wrote a simple python script to alert me via Android push notification when a new build is available using the Pushover API.

This gets run as a cron job on one of my servers. It might be a bit niche, but I thought I’d post the code on my GitHub anyway in case anyone else finds it useful:

ROMChecker
A python script to check for new Android ROMs and notify your phone.