Tuesday 11 February 2014

BIOS type and 64-bit CPU detection features for Easy2Boot

The next version (available soon! v1.28 now available!) will have a BIOS string-detection feature.

You will be able to detect which system E2B is running on and boot the correct ISO file for it.

Suppose you had some EeePC laptops and some Samsung laptops and you want to run a different  .isoPE file for each one (or different linux ISO or Windows Install ISO). Now you can do this using this type of menu:

# Example menu. Look for a BIOS string and then pick correct ISO file
# force.isope01 forces it to run as a .isope01 even if the file is an ISO file
# strings are not case-sensitive - ISO files must be in same folder as this .mnu file
# 0x7ff+0x01 searches 512 bytes at end of BIOS ROM
# 0x680+0x180 searches all of BIOS from 0xD000:0 to 0xFFFF:F (and so will be slower)
# remove > nul text if you want to see the strings that it has found


title Run Win PE ISO \n Auto-detect based on BIOS
set ISO=
call /%grub%/SearchBS.g4b 0x700+0x100 "eeepc" > nul
if "%GOTSTR%"=="1" set ISO=AsusEeePC.iso
if not exist GOTSTR call /%grub%/SearchBS.g4b 0x680+0x180 "samsung" > nul
if "%GOTSTR%"=="1" set ISO=Samsung.iso
if "%ISO%"=="" echo WARNING: BIOS NOT IDENTIFIED!" && pause && configfile /menu.lst
if not "%ISO%"=="" echo BIOS IDENTIFIED - WILL BOOT %ISO% && pause
/%grub%/qrun.g4b force.isope01 $HOME$/%ISO%
boot

All you need to do is specify the BIOS string and the ISO you want to run.
Depending on your ISO, this may work with Windows Install ISOs too (depending on if they require a Product Key in the AutoUnattend.xml file or not!).
0x600+0x40 is a good base address and range to test for Video BIOS ROM strings (C000:0-C800:0).

Note that the line:
/%grub%/qrun.g4b force.isope01 $HOME$/%ISO%
forces the file to run as an .isope01 file, even if the file has a different extension. You can change this as you wish (e.g. use force.iso to make it boot as a plain ISO file or just omit the force.isope01 text completely to run it with whatever file extension you have used in the ISO= variable line).

If you have different Windows 8 ISOs that you want to install depending on which system that you boot the E2B USB drive from, then use a menu like this:

title Install Windows 8 \n Auto-detects based on BIOS type
set ISO=
call /%grub%/SearchBS.g4b 0x700+0x100 "eeepc" > nul
if "%GOTSTR%"=="1" set ISO=AsusEeePCWin8.iso
if not exist GOTSTR call /%grub%/SearchBS.g4b 0x680+0x180 "samsung" > nul
if "%GOTSTR%"=="1" set ISO=SamsungWin8.iso
if "%ISO%"=="" echo WARNING: SYSTEM NOT IDENTIFIED! && pause && configfile /menu.lst
if not "%ISO%"=="" pause --wait=3 SYSTEM IDENTIFIED - WILL BOOT %ISO%
set MFOLDER=/_ISO/WINDOWS/Win8
/%grub%/%LANG%/RunWin8.g4b  Win8
boot

In this case the .ISO files need to be in the \_ISO\WINDOWS\Win8 folder.

Reducing the search area will improve the speed of the string search.

P.S. To experiment in finding strings and reducing the search area, run E2B and get to the grub4dos command console (press p then enter the password 'easy2boot' then press c). Now you can run the grub4dos batch file from the command console, e.g.:

/%grub%/SearchBS.g4b 0x680+0x180 "Inspiron"

This will display any matching strings it finds for 'Inspiron' and their location. If 'Inspiron 530' is displayed, you can try specifying that as the search string. As the exact location of the BIOS string may vary from BIOS version  to BIOS version, it is best to search an area of xxxx+0x80 - don't just use xxxx+0x1 or it may not work on a slightly different BIOS version even if it is the the same system type and mainboard.

Please let me know if you think this might be useful for you and how you might like to use it. For instance, if some of your systems require a different parameter when booting linux but other systems crash when the same parameter is used, you can use this feature to identify which system you have booted from.

CPU 64-bit detection

You can also do a similar thing to detect 64-bit CPUs. Thus you could have an 'Install Windows 8' menu item and it would install Win8 64-bit on 64-bit systems and 32-bit Win8 on 32-bit systems. See Tutorial 72a for more details.

To boot an ordinary payload (ISO, IMA, IMG) file, use the following .mnu file (see 64Bit_Auto_Detect_ISO.mnu)

# Change the 1st, 2nd and 3rd line as required - line 4 may be deleted if no pause required

title Run a 32-bit or 64-bit linux ISO \n Auto-Detect system type and run correct ISO
set ISO=Ubuntu32.iso
checkrange 2,3 is64bit && set ISO=Ubuntu64.iso
pause WILL BOOT %ISO% - Press ENTER key to continue...
/%grub%/qrun.g4b $HOME$/%ISO%
boot

P.S. It would also be possible to change the linux vga parameters for linux livecd ISO booting, based on what vga modes the system supported by the BIOS when E2B was booted. Let me know if you would be interested in this (and give me an example grub4dos menu).

No comments:

Post a Comment