Thursday 4 February 2016

Auto-detect your computer model in E2B (for automatic BIOS upgrade or repair/install)

If you want to boot a different ISO or .IMA floppy image depending on what system you are running E2B on, you can detect what system it is running on by searching the BIOS for the model string.

The menu below can be used as a template.


For instance, you could run the correct firmware update ISO or floppy image for a variety of different models of PC or Notebook (and check what firmware revision was currently installed), or perhaps run a Windows repair ISO or a Windows Install ISO for each specific model.

In the example below, if no BIOS string is recognised, it uses default.iso (if you don't set an ISO then it won't run anything if no string match is found).

You will also need to change the BIOS search strings (max 32 characters??).

So you can have some payloads which run ISOs and some which run .ima floppy disk image files, for instance.

You can use forceiso.isope01 to force a specific type of boot behaviour regardless of what ISO is picked (see commented line near end).

The payload (ISO/IMA,etc.) files should all be in the same folder as the .mnu file.

This menu is based on the BIOS Detect and Run.mnu file in the Sample mnu Files folder (but has been tweaked to work better as I found a bug in it!).

To find your BIOS strings, first boot on that particular system and go to the E2B command prompt and type, e.g.:

SearchBS 0x680+0x180 "Acer"

where Acer is the string you want to find. It will print all the strings it can find beginning with 'Acer' (not case sensitive) and you can then see any additional strings for the Model number or BIOS revision, etc.
Once you have found a suitable string, if you wish, you can shorten the search area to make the searches quicker. Then use the search area value and string in your .mnu file. You will need to do this on each model of PC\Notebook\Tablet.


Example of how to find a specific version string - start with a likely manufacturer name or model number. The first number is the start address (e.g. 0x680 = 0x680*0x200 = 0xD0000). The second number is the search length (e.g. 0x180 = 0x180*0x200 = 0x30000).

Here is the sample .mnu file:

# Looks for a BIOS string to find PC Model and then run the correct ISO file for that system
# force.isope01 forces it to run as .isope01 - you can force the iso to run as any type by changing 2nd-last line
# Search strings (e.g. "eeepc") are not case-sensitive
# All ISO files must be in same folder as this .mnu file
# 0x7ff+0x01 searches 512 bytes at end of BIOS ROM, 0x600+0x40 will search the BIOS VGA ROM area
# 0x680+0x180 searches all of BIOS from 0xD000:0 to 0xFFFF:F (and so will be slower)
# remove the " > nul" text if you want to see the strings that it has found

title Update Firmware \n Auto-detect based on BIOS strings
# if you edit the line below, it will use that ISO as the default ISO if no BIOS string match is found - e.g. set ISO=AsusEeePC.iso or set ISO=
set ISO=default.iso

set MATCH=

set GOTSTR=
if not exist MATCH call /%grub%/SearchBS.g4b 0x680+0x180 "VirtualBox BIOS" > nul
if "%GOTSTR%"=="1" set ISO=VBox.iso && set MATCH=1

set GOTSTR=
if not exist MATCH call /%grub%/SearchBS.g4b 0x780+0x80 "eeepc" > nul
if "%GOTSTR%"=="1" set ISO=AsusEeePC.ima && set MATCH=1

set GOTSTR=
if not exist MATCH call /%grub%/SearchBS.g4b 0x780+0x80 "inspiron 530" > nul
if "%GOTSTR%"=="1" set ISO=Dell530.imgPTN && set MATCH=1

set GOTSTR=
if not exist MATCH call /%grub%/SearchBS.g4b 0x680+0x40 "ATI technologies" > nul
if "%GOTSTR%"=="1" set ISO=ATIVGA.isoPE01 && set MATCH=1

set GOTSTR=
if not exist MATCH call /%grub%/SearchBS.g4b 0x680+0x180 "samsung"
if "%GOTSTR%"=="1" set ISO=Samsung.iso && set MATCH=1


# ADD MORE TESTS HERE FOR MORE SYSTEMS...

set GOTSTR=
if not exist MATCH echo WARNING: BIOS NOT RECOGNISED
if exist ISO echo USING DEFAULT ISO
if not exist MATCH if not exist ISO pause && set MFOLDER=/_ISO/MAINMENU && set MATCH= && configfile (md)0xa000+0x50
if exist ISO && pause --wait=3  BOOTING %ISO%...
set MATCH=
#/%grub%/QRUN.g4b force.isope01 $HOME$/%ISO%
/%grub%/QRUN.g4b $HOME$/%ISO%
boot

No comments:

Post a Comment