#language en ~-[[DebianWiki/EditorGuide#translation|Translation(s)]]: none-~ ---- <> = Flashing a BIOS with FreeDOS and Grml via USB = Most BIOS update utilities for PCs expect to run in a DOS like environment. This page describes how to flash a BIOS, using [[https://www.debian.org/| Debian]], [[https://www.freedos.org/|FreeDOS]], [[https://grml.org/| Grml Live Linux]], and a USB stick, no matter what Operating System is installed, without using a Windows Operating System. A USB stick allows the use of >1.2MB files in the FreeDOS image, where the traditional floppy based methods would not work. Many BIOS files and tools are bigger than can fit on a floppy image. {{{#!wiki caution ''If the hardware works, there is often no need to flash the BIOS. If something goes wrong, this might cause permanent damage to your BIOS and you might lose your warranty. Flashing motherboard BIOS is a dangerous activity that can render your motherboard inoperable! '' }}} == Preparation == === Identifying the motherboard === You should know your motherboard and have any necessary BIOS files available. If you have not identified your motherboard, you should do so now for reference and any potential troubleshooting later. Check any manuals that came with the computer. You can also use the [[DebianPkg:dmidecode]] package to retrieve some info: {{{ # dmidecode -t bios -t baseboard }}} If you have physical access to the motherboard, you may find the required information directly on the motherboard itself. === Working directory === Make a directory to work in and change into it: {{{ # mkdir -p ~/bios/ # cd ~/bios/ }}} Move or copy your BIOS update files into your working directory. === USB stick === You need USB flash drive that can be completely overwritten. grml2usb should take care of any necessary formatting. Insert the stick, and it will be recognized in the `/dev/` system, probably as `/dev/sdb` with primary partition `/dev/sdb1` but this can vary based on your system config. ''Note, we will assume that the USB stick is recognized as `/dev/sdX` with primary partition `/dev/sdX1`.'' === Packages === . `grml2usb` for copying the downloaded Grml .iso to USB . `qemu-kvm` (optional) for testing the Grml/FreeDOS image == Grml == === Install Grml to USB stick === Download a [[https://grml.org/download/|Grml iso.]] `grml-small` is fine. Use [[DebianPkg:grml2usb]] to install Grml to a usb stick: {{{ # grml2usb grml96-full_2013.02.iso /dev/sdX1 }}} See the [[https://grml.org/grml2usb/|grml2usb manual]] for more information. === Option 1: Insert BIOS update into the Grml FreeDOS image === After Grml is installed on a usb stick, mount it, e.g. {{{ # mkdir -p /media/grml_usb # mount /dev/sdX1 /media/grml_usb }}} Next we need to unzip and mount the embedded FreeDOS image: {{{ # gunzip -k -S imz --stdout /media/grml_usb/boot/addons/balder10.imz > balder10.img # mkdir balder10 # mount -o loop balder10.img balder10 }}} Now, just copy any necessary BIOS update files into the mounted image: {{{ # cp -a FLASH-PROGRAM BIOS-UPDATE balder10/ }}} Unmount FreeDOS, re-zip it, and put it back on the USB stick: {{{ # umount balder10 # cp /media/grml_usb/boot/addons/balder10.imz balder10.imz.bak # gzip < balder10.img > /media/grml_usb/boot/addons/balder10.imz }}} === Option 2: Insert BIOS update into the Grml image === Option 1 did not work for me (I could not find the files afterwards). However, I figured out that the grml media is visible in the FreeDOS environment, in particular the boot/addons directory. It is accessible in FreeDOS as C:\boot\addons. So it worked for me to copy the bios update files to /media/grml_usb/boot/addons… === Test the FreeDOS image === Unmount the USB stick and test it with Qemu / KVM: {{{ # umount /dev/sdX1 # kvm -hdb /dev/sdX }}} After booting Grml, select FreeDOS from the menu: {{{ Addons => Run FreeDOS }}} If you see a message about 'cannot find command.com' then try: {{{ # qemu-system-x86_64 -hda /dev/sdX }}} Boot into DOS / command.com and check that your BIOS files are present. === Perform the update === We can't flash the BIOS from within Qemu obviously. Now you can reboot from the Grml USB stick and flash your BIOS from FreeDOS running on the metal. You may need to press a key on boot to access the BIOS menu or a boot menu. When the motherboard powers on you ought to see a message about which buttons to press, or check your motherboard manual. Then you can boot into FreeDOS from the USB stick and run the BIOS update program. Some useful commands in DOS: || `cd ` || ''change to the directory'' || || `dir` || ''list the files in the current directory'' || || `type ` || ''display the contents of a file'' || || `:` || ''e.g. switch to the A drive'' || For Example, flashing a Foxconn H67S motherboard: {{{ C:\> dir C:\> A: A:\> dir A:\> cd mebios\bios\ A:\> dir A:\> fpt -f C33F1P02.BIN -y }}} = Flashing with BIOS FreeDOS from a USB Stick when the flash .exe is too big for a floppy image = It may be that the flash image your manufacturer provides is too large to fit on the floppy image of Grml. An alternative is to use a larger FreeDOS image, you can find FreeDOS images with more space on [[https://joelinoff.com/blog/?p=431|Joe's Blog]] = See Also = * [[Firmware/Updates]] * [[Derivatives/Census/Grml]] * [[DualBoot/FreeDOS]] * [[KVM]] * [[BIOS]] == External Links == * https://wiki.gentoo.org/wiki/BIOS_Update * https://wiki.grml.org/doku.php?id=biosupdate * https://wiki.archlinux.org/index.php/Flashing_BIOS_from_Linux * https://www.flashrom.org/Flashrom