{"id":1198,"date":"2016-01-11T14:43:59","date_gmt":"2016-01-11T13:43:59","guid":{"rendered":"https:\/\/elkano.org\/blog\/?p=1198"},"modified":"2016-01-12T08:56:58","modified_gmt":"2016-01-12T07:56:58","slug":"updating-server-bios-freedos-grub","status":"publish","type":"post","link":"https:\/\/elkano.org\/blog\/updating-server-bios-freedos-grub\/","title":{"rendered":"Updating your server BIOS using FreeDOS and GRUB"},"content":{"rendered":"<p>In this post I am explaining the steps you can follow to boot from a DOS image using your grub to update the server&#8217;s BIOS version without the need of using a USB drive attached to your server.<\/p>\n<p>To check your BIOS version in your server run this command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ sudo dmidecode --type bios\r\n# dmidecode 2.12\r\nSMBIOS 2.6 present.\r\n\r\nHandle 0x0000, DMI type 0, 24 bytes\r\nBIOS Information\r\n\tVendor: Dell Inc.\r\n\tVersion: 1.12.0\r\n\tRelease Date: 07\/30\/2013\r\n\tAddress: 0xF0000\r\n\tRuntime Size: 64 kB\r\n\tROM Size: 4096 kB\r\n\tCharacteristics:\r\n\t\tISA is supported\r\n\t\tPCI is supported\r\n\t\tPNP is supported\r\n\t\tBIOS is upgradeable\r\n\t\tBIOS shadowing is allowed\r\n\t\tBoot from CD is supported\r\n\t\tSelectable boot is supported\r\n\t\tEDD is supported\r\n\t\tJapanese floppy for Toshiba 1.2 MB is supported (int 13h)\r\n\t\t5.25&quot;\/360 kB floppy services are supported (int 13h)\r\n\t\t5.25&quot;\/1.2 MB floppy services are supported (int 13h)\r\n\t\t3.5&quot;\/720 kB floppy services are supported (int 13h)\r\n\t\t8042 keyboard services are supported (int 9h)\r\n\t\tSerial services are supported (int 14h)\r\n\t\tCGA\/mono video services are supported (int 10h)\r\n\t\tACPI is supported\r\n\t\tUSB legacy is supported\r\n\t\tBIOS boot specification is supported\r\n\t\tFunction key-initiated network boot is supported\r\n\t\tTargeted content distribution is supported\r\n\tBIOS Revision: 1.12\r\n\r\nHandle 0x0D00, DMI type 13, 22 bytes\r\nBIOS Language Information\r\n\tLanguage Description Format: Long\r\n\tInstallable Languages: 1\r\n\t\ten|US|iso8859-1\r\n\tCurrently Installed Language: en|US|iso8859-1\r\n<\/pre>\n<p>Now we are going to make a small bootable DOS system that we will use to boot in the server. I did the following steps in my own PC, but you can do them anywhere.<\/p>\n<p>Install qemu if not installed yet to be able to install FreeDOS:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n# apt-get update\r\n# apt-get install syslinux qemu-system-x86\r\n<\/pre>\n<p>You can download FreeDOS here <a href=\"http:\/\/www.freedos.org\/download\/\">http:\/\/www.freedos.org\/download\/<\/a><\/p>\n<p>or just:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ wget http:\/\/www.ibiblio.org\/pub\/micro\/pc-stuff\/freedos\/files\/distributions\/1.0\/fdbasecd.iso\r\n<\/pre>\n<p>Creaty an empty image of 250MB size:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\ndd if=\/dev\/zero of=fdos-250m-hdd.img bs=1M count=250\r\n<\/pre>\n<p>Launch qemu and install FreeDOS into the empty image:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\nqemu-system-x86_64 -hda fdos-250m-hdd.img -cdrom fdbasecd.iso -boot d\r\n<\/pre>\n<p>After installing FreeDOS you have to copy the BIOS updater tool to the image. To do that follow this steps:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n~# fdisk -ul fdos-250m-hdd.img\r\nGNU Fdisk 1.2.5\r\nCopyright (C) 1998 - 2006 Free Software Foundation, Inc.\r\nThis program is free software, covered by the GNU General Public License.\r\n\r\nThis program is distributed in the hope that it will be useful,\r\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\r\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r\nGNU General Public License for more details.\r\n\r\n\r\nDisk \/home\/user\/fdos-250m-hdd.img: 261 MB, 261660672 bytes\r\n16 heads, 63 sectors\/track, 507 cylinders, total 511056 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\n\r\n                          Device Boot      Start         End      Blocks   Id  System \r\n\/home\/user\/fdos-250m-hdd.img1   *          63      511055      255496    e  FAT16 LBA\r\n<\/pre>\n<p>The partition starts at 63, so to get the offset, we have to multiply 63 by 512, 32256. To mount the partition you have to run this command:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n~# mount -o loop,offset=32256 fdos-250m-hdd.img \/mnt\/\r\n<\/pre>\n<p>And copy the required tool:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n~# mkdir \/mnt\/DELL\r\n~# cp PER410-011200.exe \/mnt\/DELL\/\r\n~# umount \/mnt\r\n<\/pre>\n<p>Once you have your FreeDOS image ready, copy the image to your server to \/boot\/images. Create the directory \/boot\/images if it does not exist.<\/p>\n<p>Prepare grub2 to use memdisk<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ sudo cp -a \/usr\/lib\/syslinux\/memdisk to \/boot\r\n<\/pre>\n<p>Create the following file with your preferred editor:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n~# cat \/etc\/grub.d\/50_memdisk \r\n#!\/bin\/sh\r\n\r\nset -e\r\n\r\nIMAGES=\/boot\/images\r\n. \/usr\/lib\/grub\/grub-mkconfig_lib\r\nif test -e \/boot\/memdisk ; then\r\n  MEMDISKPATH=$( make_system_path_relative_to_its_root &quot;\/boot\/memdisk&quot; )\r\n  echo &quot;Found memdisk: $MEMDISKPATH&quot; &gt;&amp;2\r\n  find $IMAGES -name &quot;*.img&quot; | sort | \r\n  while read image ; do\r\n      IMAGEPATH=$( make_system_path_relative_to_its_root &quot;$image&quot; )\r\n      echo &quot;Found floppy image: $IMAGEPATH&quot; &gt;&amp;2\r\n      cat &lt;&lt; EOF\r\nmenuentry &quot;Bootable floppy: $(basename $IMAGEPATH | sed s\/.img\/\/)&quot; {\r\nEOF\r\n      prepare_grub_to_access_device ${GRUB_DEVICE_BOOT} | sed -e &quot;s\/^\/\\t\/&quot;\r\n      cat &lt;&lt; EOF\r\n        linux16 $MEMDISKPATH bigraw\r\n        initrd16 $IMAGEPATH\r\n}\r\nEOF\r\n  done\r\nfi\r\n<\/pre>\n<p>And finally update grub with your new image:<\/p>\n<pre class=\"EnlighterJSRAW\" data-enlighter-linenumbers=\"false\" data-enlighter-theme=\"enlighter\" data-enlighter-language=\"xml\">\r\n$ sudo update-grub\r\nGenerating grub configuration file ...\r\nFound linux image: \/boot\/vmlinuz-3.13.0-68-generic\r\nFound initrd image: \/boot\/initrd.img-3.13.0-68-generic\r\nFound memtest86+ image: \/memtest86+.elf\r\nFound memtest86+ image: \/memtest86+.bin\r\nFound memdisk: \/memdisk\r\nFound floppy image: \/images\/fdos-250m-hdd.img\r\ndone\r\n<\/pre>\n<p>Reboot and boot from your new image.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In this post I am explaining the steps you can follow to boot from a DOS image using your grub to update the server&#8217;s BIOS version without the need of using a USB drive attached to your server. To check your BIOS version in your server run this command: $ sudo dmidecode &#8211;type bios # [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[3],"tags":[163,165,164],"_links":{"self":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1198"}],"collection":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/comments?post=1198"}],"version-history":[{"count":10,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1198\/revisions"}],"predecessor-version":[{"id":1210,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/posts\/1198\/revisions\/1210"}],"wp:attachment":[{"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/media?parent=1198"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/categories?post=1198"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/elkano.org\/blog\/wp-json\/wp\/v2\/tags?post=1198"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}