sponsors:

How to create dosboot image for grub for updating bios


I always having the issues during updating bios under linux/ubuntu.

All bios updaters developed by vendors for processing under DOS/Windows, but very small amount of them have thoughts about linux users.
I have written article about using flashrom application for updating bios in ubuntu/linux(in ukrainian), but it is not universal and has limited support of devices.

Here I want to share ability to have boot image item in grub with freedos installed for making possible boot into and update bios for Your mobo.

So here is what you can do after you setup your Ubuntu system.

apt-get update
apt-get install syslinux

Download latest freedos iso image from original website

Do prepare grub2 bootloader for using memory disk

sudo cp -rfp /usr/lib/syslinux/memdisk to /boot
sudo mkdir /boot/images

Create file /etc/grub.d/55_memdisk

#!/bin/sh
set -e
IMAGES=/boot/images
. /usr/lib/grub/grub-mkconfig_lib
if test -e /boot/memdisk ; then
  MEMDISKPATH=$( make_system_path_relative_to_its_root "/boot/memdisk" )
  echo "Memdisk found at: $MEMDISKPATH" >&2
  find $IMAGES -name "*.img" | sort |
  while read image ; do
      IMAGEPATH=$( make_system_path_relative_to_its_root "$image" )
      echo "Floppy image found at: $IMAGEPATH" >&2
      cat << EOF
menuentry "Bootable floppy image: $(basename $IMAGEPATH | sed s/.img//)" {
EOF
      prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e "s/^/\t/"
      cat << EOF
        linux16 $MEMDISKPATH bigraw
        initrd16 $IMAGEPATH
}
EOF
  done
fi

Install VirtualBox and create VM for dos with disk size ~300M. The same procedure, but using outdated qemu
Use downloaded freedos iso as bootable image for created VM. Do install it inside VM.
After installation, shut down VM and convert disk image to raw format

VBoxManage clonehd freedos.vhdk freedos.img –format raw
cp freedos.img /boot/images/

Copy the BIOS utilities for Your modo into the created FreeDOS Image

sudo -s
sfdisk -l -uS /boot/images/freedos.img

You should get result with a line

Device Boot Start End #sectors Id System
/boot/images/freedos.img * 63 650000 650000 e W95 FAT16 (LBA)

If You'll see 63 as Start, You have to be able to mount it with offset 63*512=32256
So do that

mkdir /mnt/freedos
mount -o loop,offset=32256 /boot/images/freedos.img /mnt/freedos
mkdir /mnt/freedos/bios
cp -rv ALL_FILES_WITH_BIOS_AND_FLASHER /mnt/freedos/bios
sync
cd ~
umount -f /mnt/freedos

Now You have to update Your grub2 boot list with a command

update-grub2

After all You may reboot to freedos and make standard procedure for BIOS update.

Trackback URL for this post:

http://itua.name/en/trackback/954
Share this

Syndicate content Syndicate content

Propeople Expert

Партнери

експерименти

Rambler's Top100