jason schaefer . com

"arguing that you don’t care about the right to privacy because you have nothing to hide is no different than saying you don’t care about free speech because you have nothing to say."

Tag: bios

  • Flashing a BIOS update using only free tools (FreeDOS, etc)

    The wonderful world of motherboard BIOS updates, is still old fashioned. Updates are often still built for Microsoft Windows environments. Those of us who don’t have MS Windows, DOS, a floppy drive, an install of Windows 98 to create a bootable floppy, or cheesy Pâté for that matter ….. Here is a way one can flash that BIOS of your mobo using, our favorite free software licensed, operating systems and tools.

    DISCLAIMER: Don’t attempt this unless you know what you are doing. I have never had problems doing this, BUT many things can go wrong and you CAN easily “brick” your hardware. Proceed at your own risk!!

    We will be using FreeDOS, a wonderfully free and royalty exempt Microsoft DOS compatible operating system. Licensed under the General Public License (GPL).
    Note: As usual, my posts require some knowledge of the command line.

    ======================
    UPDATE: Because the 1.4mb and 2.8mb FreeDos disk images are not large enough for most modern BIOS flashing utilities and payloads you will need to build a custom disk image of freeDos.

    The easiest way to do this is to write freeDos onto a usb flash drive. Here is an example of how to do this.

    1. download the Lite USB version and unzip
    2. write the FD12LITE.img to a USB stick. I used gnome-disks (right click and open with “Disk Image Writer” or you can use dd.
    3. mount the usb stick and copy the bios update onto it. If your bios update is too large to fit you will need to resize.
    4. run “sudo gparted” resize the fat16 partition. I chose 100mb. Apply
    5. now copy the bios update and boot from the usb. Don’t run the DOS installer, instead run DOS. Now you can execute the bios update. Done!

    Another option would be to install FreeDOS using qemu. This is more complicated but I’ll leave the instructions here for reference.

    Download FreeDOS Standard CDROM Installer at http://www.freedos.org/download/

    sudo qemu-system-x86_64 -cdrom FD12CD.iso /dev/sdb -boot d

    Go through the DOS installer. You can use it to partition the usb stick. I made a 700MB fat 16 partition and marked it “active”. I said no to the fat32 LBA because I had issues, the first time I tried this, reading files that I had put on the fs while booted into DOS. Fat32 should be ok, try it and let me know your experience. After this it will ask to restart the install. Install to hard disk again and now you partition the c: drive. Then install the full version. Done.
    If you need more space you can always run cfdisk, gparted or fdisk to add a large fat32 partition on the usb stick. This would show up as d:\ while booted up in FreeDOS. You can copy your BIOS files to the usb DOS partition and boot into FreeDos to run them. Yay! No more floppy space issues!
    ======================

    And feel free to try the old floppy way. I’ll leave it up here for reference.

    wget http://www.fdos.org/bootdisks/autogen/FDOEM.144.gz
    gunzip FDOEM.144.gz
    mkdir floppy
    sudo mount -o loop FDOEM.144 floppy/
    ls floppy
    

    you should see these files:
    AUTOEXEC.BAT COMMAND.COM CONFIG.SYS KERNEL.SYS README sys.com

    Download your BIOS update file from the manufacturer or vendor.
    Note: Sometimes, the update will be distributed as a .exe (Windows Executable) file. Most likely it will actually be a compressed zip archive. You can use unzip to extract the .exe file.

    Download the update using wget, then unzip the resulting image file “FDOEM.144” into the mounted folder: “floppy/”

    wget http://path-to-your-bios-update/BIOS_UPDATE.zip
    sudo unzip BIOS_UPDATE.zip -d floppy/
    

    In this case, the following files are extracted from the BIOS_UPDATE.zip file:
    inflating: BIOS.WPH
    inflating: OEMPHL.EXE
    inflating: OPTIONS.BAT
    inflating: PHLASH16.EXE
    inflating: releasenotes.txt
    inflating: 1.BAT

    now, move to the previous directory (cd ..), and un-mount the FDOEM.144 image:

    cd ..
    sudo umount floppy/
    

    generate an el torito bootable iso image:

    genisoimage -o flashboot.iso -b FDOEM.144 FDOEM.144
    

    Now burn flashboot.iso to CD using wodim:

    wodim flashboot.iso
    

    Now you can boot from that cd and run your flash utility!! Read the BIOS update instructions on how to do this..

  • Transition away from MBR to GPT booting

    Recently, I was installing debian on a new server and grub2 would not install gave me this error:

    “This GPT partition label has no BIOS Boot Partition; embedding won’t be possible! grub-setup: error: Embedding is not possible, but this is required when the root device is on a RAID array or LVM volume.”

    Of course, it being grub2, I jumped to the conclusion that grub2 was the problem. I installed legacy grub and got nowhere.
    Doing the usual
    grub> root (hd0,0)
    grub> setup (hd0)
    produces this error:
    “file /boot/grub/stage1 not read correctly”

    No matter what I did, it would not install. So, I went back to the original message and gave grub2 its due process. Turns out this Dell T410 uses GPT (GUID Partition Table) which is an extension of EFI. The “BIOS Boot Partition” is an actual partition on the hard drive. Grub2 embeds the core.img (multiboot boot kernel) into this BIOS boot partition instead of the MBR.
    Here are two great resources on this subject:
    http://www.rodsbooks.com/gdisk/index.html and
    http://grub.enbug.org/BIOS_Boot_Partition

    So, the solution:
    I had to re-install Debian with a small partition. Apparently it can be under a few hundred KiB. Space is cheap and I didn’t want to have more problems, so I made mine 5MB and put it at the beginning of the disk. In the Debian partitioner, set the partition under “use as:” to “Reserved BIOS boot area“. Then continue with the rest of your partitions and install. Grub2 installed with no problems this time!

    If using an older version of Debian, lenny (v5) or older. The “use as:” does not have an option for Reserved BIOS boot area. So, I booted into expert install mode, when you get to “Load installed components from CD” select parted. This will install parted in the install environment. Before you get to detect disks, do ctrl+alt+f2. On the command line you can manually create a bios boot area.

    The following parted commands.

    parted -a optimal /dev/sda mkpart 1 1 6

    The above command creates the first (1) partition from 1MB of the drive to 6MB. -a optimal sets the block alignment for best performance. If you start the partition at 0 the alignment is wrong and parted will Warn: “The resulting partition is not properly aligned for best performance. Ignore/Cancel?”

    parted /dev/sda set 1 bios_grub on

    This sets /dev/sda1 as GPT grub bios partition. This partition will be found and used by grub on install.

    Now, ctrl+alt+f1, and continue the install. Select manual partitioning and be sure not to delete the primary partition (gpt, grub bios) when creating your new partitions.

    Do this to all drives in a raid!

    After you boot into the fresh install, you can manually install to the other disks.

    grub-install /dev/sdb

    Now its installed on sda and sdb. In case sda fails, it should be able to boot from sdb.