Sunday, 18 November 2012

Allow Gigabyte GA-EP45-DS4 to boot up with AHCI enabled

If your computer is failing to boot and hangs during AHCI enumeration with a possible code 23 in the top right corner, and it only happens when (1 or more) SATA HDD are connected that have a MBR (Master Boot Record), this may fix it for you, as it did for me:
  • Turn off computer.
  • Disconnect (not-really-)faulty HDD.
  • Turn on computer.
  • In BIOS, disable AHCI:
    • BIOS > Integrated Peripherals > SATA AHCI Mode = Disabled
  • Save changes and turn off computer.
  • Reconnect (not-really-)faulty HDD.
  • Turn on computer.
  • Boot in to operating system of your choice. e.g. Linux
  • Open (not-really-)faulty HDD in a hex editor. e.g. hexcurse /dev/sda
  • Set the 3 bytes starting at offset 0x1C3 to FE FF FF, save and quit.
    • You may wish to make a note of the original values you're replacing in case you need to undo.
  • If using Arch Linux, add ahci to mkinitcpio.conf modules list and rebuild kernel image
  • Reboot, in bios enable AHCI again, save and reboot
There is an error in the BIOS/AHCI controller ROM that has been reported to Gigabyte, but whether they've released BIOS updates for all affected motherboards is a mystery. For example, there's a "beta" bios update for my motherboard, but without a changelog I'm hesitant to install it.


Thursday, 8 November 2012

Startup script for DD-WRT to get date from NTP server.

May or may not work:

while [ "`date +%Y`" == "1970" ]; do
 ntpclient && \
 sleep 3 && \
 stopservice process_monitor && \
 sleep 3 && \
 startservice process_monitor;
 echo "done" >> "/tmp/ntp.example.txt" && \
 sleep 120;
echo "end" >> "/tmp/ntp.example.txt"