Export to GitHub

grub4dos-chenall - issue #198

all grub4dos variables lost using some AMI BIOSes


Posted on Aug 23, 2014 by Happy Kangaroo

What steps will reproduce the problem?

Using Easy2Boot v1.54 on QEMU, VBox and most computers works OK.

On a few computers with an AMI BIOS, it gives an error during _ISO\e2b\grub\menu.lst.

All these systems show the same problem and all have AMI BIOS (e.g. 2012) HP Compaq dx2400 microtower Asus M4A89GTDPRO-USB3 motherboard Asus x550ca

\menu.lst is:

this is only to prevent the grub4dos default menu from appearing for a brief second!

clear if "%grub%"=="" if exist (bd)/_ISO/e2b/grub/E2B_GRUB.txt set grub=_ISO/e2b/grub if "%grub%"=="" if exist (bd)/grub/E2B_GRUB.txt set grub=grub if "%grub%"=="" if exist (bd)/e2b/grub/E2B_GRUB.txt set grub=e2b/grub if "%grub%"=="" if exist (bd)/_ISO/grub/E2B_GRUB.txt set grub=_ISO/grub if not exist (bd)/%grub%/E2B_GRUB.txt echo SORRY - CAN'T FIND grub\E2B_GRUB.txt file (please edit \menu.lst file)! && pause && commandline configfile /%grub%/menu.lst

This executes OK. grub variable is set OK.

_ISO\e2b\grub\menu.lst contains:

turn off cursor and clear screen

call Fn.70 0 ;; clear read 0x8278 > nul set v=%@retval% checkrange 20140819:-1 read 0x8278 > nul || echo -e $[0104]WARNING: \grldr IS OLD [%v%] - grub4dos version must be 2014-08-19 or later! && pause set v= set * && set grub=%grub% && set DONEMENU=%DONEMENU% && set DL=%DL% && set LANG=%LANG% && set GRUB_DUN=%GRUB_DUN%

echo Booting Easy2Boot - please wait...

uninstall hotkey and lose all preset definitions

/%grub%/hotkey -u > nul

Use grldr 4.6 if we booted as floppy instead of hd

if "%?_BOOT:~0,2%"=="(f" pause --wait=3 WARNING: Booted as a floppy disk - trying grub4dos 0.4.6 instead... && chainloader /%grub%/grldr_046 > nul && boot

map --unhook > nul map --unmap=0:0xff > nul root ()/ > nul

Are we booting from a CD?

set CD= && if "%?_BOOT%"=="(cd)" set CD=1

find grub folder...

if not exist /%grub%/E2B_GRUB.txt set grub= if "%grub%"=="" if exist /grub/E2B_GRUB.txt set grub=grub if "%grub%"=="" if exist /e2b/grub/E2B_GRUB.txt set grub=e2b/grub if "%grub%"=="" if exist /_ISO/grub/E2B_GRUB.txt set grub=_ISO/grub if "%grub%"=="" if exist /_ISO/e2b/grub/E2B_GRUB.txt set grub=_ISO/e2b/grub if not exist /%grub%/E2B_GRUB.txt echo -n -e $[0104] WARNING: CAN'T FIND grub FOLDER ON %?_BOOT% && pause --wait=2 Looking on all partitions...

try to find grub folder anywhere

if not exist /%grub%/E2B_GRUB.txt find --set-root /_ISO/e2b/grub/E2B_GRUB.txt > nul if not exist /%grub%/E2B_GRUB.txt echo EASY2BOOT - SORRY, CAN'T FIND E2B_GRUB.txt file (please edit \menu.lst file)! && pause && commandline

get E2B DEVICE DISK - e.g. hd0 or hd3 - for use with partnew command

set E2BDEV=%?_BOOT:~1,4% if "%E2BDEV:~3,1%"=="," set E2BDEV=%E2BDEV:~0,3% if "%E2BDEV%"=="cd)" set E2BDEV=cd set ask= if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" echo -e $[0104] WARNING: The Easy2Boot drive has been detected as %E2BDEV%\n (partition %E2BDEV%,3 will be changed if you continue) if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" set /p ask=Press C and then ENTER to continue : if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" if /i not "%ask%"=="C" commandline set ask=

check hd0 is OK to modify partitions on, otherwise partnew could wipe the internal hard disk partition!

set PN= echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8a

PROBLEM HERE

if not exist PN if not exist CD if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8b if not exist PN if not exist CD if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8c

see picture https://lh6.googleusercontent.com/SM7XyLSGh8WN539EO2xRRmBaOA6YSFBZYqQWDsZ7nDD7yD-0yq0rgBvS3pQYuvuONxQWfg=w1896-h873

all variables - e.g. grub and ?_BOOT are lost when the PROBLEM HERE line is executed.

USB drive is SDD - (hd0,1) contains a small, unformatted partition:

Partition 1 SIZE=228933.063MiB Type: 07 NTFS ACTIVE START POS = CYL:0 HD:32 SEC:33 END POS = CYL:1023 HD:254 SEC:63 START (LBA) = 2,048 (00000800) SIZE (LBA) = 468,854,914 (1BF22882) [End=468,856,961]

Partition 2 SIZE=0.031MiB Type: 21 Hidden(rsvd)
START POS = CYL:1023 HD:254 SEC:63 END POS = CYL:1023 HD:254 SEC:63 START (LBA) = 468,856,962 (1BF23082) SIZE (LBA) = 63 (0000003F) [End=468,857,024]

Partition 3 SIZE=0MiB Type: 00
START POS = CYL:0 HD:0 SEC:0 END POS = CYL:0 HD:0 SEC:0 START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 4 SIZE=0MiB Type: 00
START POS = CYL:0 HD:0 SEC:0 END POS = CYL:0 HD:0 SEC:0 START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

What is the expected output? What do you see instead?

This is a bug in the AMI BIOS.

Perhaps a CPU Register is corrupted? Code after the last line seems to execute correctly but all variables are lost/destroyed.

Problem can be 'fixed' using set PN= if not exist CD if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if not exist PN if not exist CD if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 if not exist PN if not exist CD if exist (hd0,4)/%grub%/E2B_GRUB.txt set PN=1 etc.

so that if exist hd0,1)/%grub%/E2B_GRUB.txt set PN=1 is never executed or other (hd0,4), hd0,5)

What version of the product are you using? On what operating system? 0.4.5c 2014

Please provide any additional information below.

adding debug lines showed variables lost after if exist (hd0,1) line...

Simple test in console (no menu.lst file) did not show the problem - see attached jpg

Comment #1

Posted on Aug 23, 2014 by Happy Kangaroo

What steps will reproduce the problem?

Using Easy2Boot v1.54 on QEMU, VBox and most computers works OK.

On a few computers with an AMI BIOS, it gives an error during _ISO\e2b\grub\menu.lst.

All these systems show the same problem and all have AMI BIOS (e.g. 2012) HP Compaq dx2400 microtower Asus M4A89GTDPRO-USB3 motherboard Asus x550ca

\menu.lst is:

this is only to prevent the grub4dos default menu from appearing for a brief second!

clear if "%grub%"=="" if exist (bd)/_ISO/e2b/grub/E2B_GRUB.txt set grub=_ISO/e2b/grub if "%grub%"=="" if exist (bd)/grub/E2B_GRUB.txt set grub=grub if "%grub%"=="" if exist (bd)/e2b/grub/E2B_GRUB.txt set grub=e2b/grub if "%grub%"=="" if exist (bd)/_ISO/grub/E2B_GRUB.txt set grub=_ISO/grub if not exist (bd)/%grub%/E2B_GRUB.txt echo SORRY - CAN'T FIND grub\E2B_GRUB.txt file (please edit \menu.lst file)! && pause && commandline configfile /%grub%/menu.lst

This executes OK. grub variable is set OK.

_ISO\e2b\grub\menu.lst contains:

turn off cursor and clear screen

call Fn.70 0 ;; clear read 0x8278 > nul set v=%@retval% checkrange 20140819:-1 read 0x8278 > nul || echo -e $[0104]WARNING: \grldr IS OLD [%v%] - grub4dos version must be 2014-08-19 or later! && pause set v= set * && set grub=%grub% && set DONEMENU=%DONEMENU% && set DL=%DL% && set LANG=%LANG% && set GRUB_DUN=%GRUB_DUN%

echo Booting Easy2Boot - please wait...

uninstall hotkey and lose all preset definitions

/%grub%/hotkey -u > nul

Use grldr 4.6 if we booted as floppy instead of hd

if "%?_BOOT:~0,2%"=="(f" pause --wait=3 WARNING: Booted as a floppy disk - trying grub4dos 0.4.6 instead... && chainloader /%grub%/grldr_046 > nul && boot

map --unhook > nul map --unmap=0:0xff > nul root ()/ > nul

Are we booting from a CD?

set CD= && if "%?_BOOT%"=="(cd)" set CD=1

find grub folder...

if not exist /%grub%/E2B_GRUB.txt set grub= if "%grub%"=="" if exist /grub/E2B_GRUB.txt set grub=grub if "%grub%"=="" if exist /e2b/grub/E2B_GRUB.txt set grub=e2b/grub if "%grub%"=="" if exist /_ISO/grub/E2B_GRUB.txt set grub=_ISO/grub if "%grub%"=="" if exist /_ISO/e2b/grub/E2B_GRUB.txt set grub=_ISO/e2b/grub if not exist /%grub%/E2B_GRUB.txt echo -n -e $[0104] WARNING: CAN'T FIND grub FOLDER ON %?_BOOT% && pause --wait=2 Looking on all partitions...

try to find grub folder anywhere

if not exist /%grub%/E2B_GRUB.txt find --set-root /_ISO/e2b/grub/E2B_GRUB.txt > nul if not exist /%grub%/E2B_GRUB.txt echo EASY2BOOT - SORRY, CAN'T FIND E2B_GRUB.txt file (please edit \menu.lst file)! && pause && commandline

get E2B DEVICE DISK - e.g. hd0 or hd3 - for use with partnew command

set E2BDEV=%?_BOOT:~1,4% if "%E2BDEV:~3,1%"=="," set E2BDEV=%E2BDEV:~0,3% if "%E2BDEV%"=="cd)" set E2BDEV=cd set ask= if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" echo -e $[0104] WARNING: The Easy2Boot drive has been detected as %E2BDEV%\n (partition %E2BDEV%,3 will be changed if you continue) if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" set /p ask=Press C and then ENTER to continue : if not "%E2BDEV%"=="hd0" if "%E2BDEV:~0,2%"=="hd" if /i not "%ask%"=="C" commandline set ask=

check hd0 is OK to modify partitions on, otherwise partnew could wipe the internal hard disk partition!

set PN= echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8a if not exist CD if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8b

PROBLEM HERE

if not exist CD if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 echo ;; root ;; echo ;; ls / ;; echo ;; echo grub=%grub% ;; pause 8c

see picture https://lh6.googleusercontent.com/SM7XyLSGh8WN539EO2xRRmBaOA6YSFBZYqQWDsZ7nDD7yD-0yq0rgBvS3pQYuvuONxQWfg=w1896-h873

all variables - e.g. grub and ?_BOOT are lost when the PROBLEM HERE line is executed.

USB drive is SDD - (hd0,1) contains a small, unformatted partition:

Partition 1 SIZE=228933.063MiB Type: 07 NTFS ACTIVE START POS = CYL:0 HD:32 SEC:33 END POS = CYL:1023 HD:254 SEC:63 START (LBA) = 2,048 (00000800) SIZE (LBA) = 468,854,914 (1BF22882) [End=468,856,961]

Partition 2 SIZE=0.031MiB Type: 21 Hidden(rsvd)
START POS = CYL:1023 HD:254 SEC:63 END POS = CYL:1023 HD:254 SEC:63 START (LBA) = 468,856,962 (1BF23082) SIZE (LBA) = 63 (0000003F) [End=468,857,024]

Partition 3 SIZE=0MiB Type: 00
START POS = CYL:0 HD:0 SEC:0 END POS = CYL:0 HD:0 SEC:0 START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

Partition 4 SIZE=0MiB Type: 00
START POS = CYL:0 HD:0 SEC:0 END POS = CYL:0 HD:0 SEC:0 START (LBA) = 0 (00000000) SIZE (LBA) = 0 (00000000)

What is the expected output? What do you see instead?

This is a bug in the AMI BIOS.

Perhaps a CPU Register is corrupted? Code after the last line seems to execute correctly but all variables are lost/destroyed.

Problem can be 'fixed' using set PN= if not exist CD if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if not exist PN if not exist CD if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 if not exist PN if not exist CD if exist (hd0,4)/%grub%/E2B_GRUB.txt set PN=1 etc.

so that if exist hd0,1)/%grub%/E2B_GRUB.txt set PN=1 is never executed or other (hd0,4), hd0,5)

What version of the product are you using? On what operating system? 0.4.5c 2014

Please provide any additional information below.

adding debug lines showed variables lost after if exist (hd0,1) line...

Simple test in console (no menu.lst file) did not show the problem - see attached jpg

Attachments

Comment #2

Posted on Aug 24, 2014 by Happy Kangaroo

Here is refined test which also shows the problem.

\menu.lst contains following code:

set grub=_ISO/e2b/grub echo TEST 1 if "%grub%"=="" pause 1a if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1b if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1c if exist (hd0,4)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1d if exist (hd0,5)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1e

result is>>>

TEST 1 1c

Comment #3

Posted on Aug 24, 2014 by Happy Kangaroo

User reports he is using a MyDigitalSSD device 256GB http://www.amazon.com/MyDigitalSSD-SuperSpeed-Portable-External-Storage/dp/B00EZ2FRP2

This fails on the 3 systems mentioned above, but works on other PC systems (that don't have an AMI BIOS).

The problem does not happen if using an ordinary USB Flash drive - e.g. Patriot Rage Corsair Survivor Stealth

OTG X550CA USB 3 - Problem OTG X550CA USB 2 - Problem Patriot X550CA USB 2 - OK Corsair X550CA USB 2 - OK

OTG HP Compaq dx2400 microtower USB 2 - Problem Patriot HP Compaq dx2400 microtower USB 2 - OK Corsair HP Compaq dx2400 microtower USB 2 - OK

OTG Asus M4A89GTDPRO-USB3 motherboard USB 2 - Problem Patriot Asus M4A89GTDPRO-USB3 motherboard USB 2 - OK Corsair Asus M4A89GTDPRO-USB3 motherboard USB 2 - OK

Comment #4

Posted on Aug 25, 2014 by Happy Hippo

all variable is here cat --hex (md)0x228+1

Please upload debug info,,before and after problem.

make two 2KB file on (hd0,0) debug1 debug2

dd if=(md)0x228+2 of=(hd0,0)/debug1 ...... .... dd if=(md)0x228+2 of=(hd0,0)/debug2

Comment #5

Posted on Aug 25, 2014 by Happy Kangaroo

set grub=_ISO/e2b/grub echo TEST 1 - OUTPUT TO DEBUG1 and DEBUG2 echo This should fail on 1c echo if "%grub%"=="" pause 1a if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1b dd if=(md)0x228+2 of=(hd0,0)/debug1 if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 dd if=(md)0x228+2 of=(hd0,0)/debug2 if "%grub%"=="" pause FAIL AT 1c

files attached - it shows all 0's in debug2!!!

Info: If the partitions sizes are changed so hd0,0 is 30GB and hd0,1 is just after that, then there is no problem and no corruption.

grub4dos 20140822 and 20140228 both show the issue.

Attachments

Comment #6

Posted on Aug 25, 2014 by Happy Kangaroo

Attached is first 2 sectors of OTG drive showing position of hd0,0 and hd0,1 partitions.

Attachments

Comment #7

Posted on Aug 26, 2014 by Happy Hippo

I can not find any problem in code. But i build a new version that can change the variable_base_addr.

you can try change it by using below command. write 0x307ff4 0x45000

0x45000 is default,you can change to another safe memory address.

Comment #8

Posted on Aug 28, 2014 by Happy Kangaroo

The test version 2014-08-26 seems to be causing a problem. It boots OK under QEMU and VBox and on the Asus X550CA system!

But on the HP dx2400 - if \grldr was changed to the test version, the user just got a Begin pxe scan... message but it went no further. He tried several times - going back to older grldr gave the 1c error - changing to test grldr gave Begin pxe scan... and stopped.

He is going to test the other system later.

Comment #9

Posted on Aug 28, 2014 by Happy Kangaroo

M4A89GTDPRO has same problem with test version of grldr - begin pxe scan... message and stops.

Comment #10

Posted on Sep 2, 2014 by Happy Hippo

I think this is the same problem with issue 201 please try it.

Comment #11

Posted on Sep 2, 2014 by Happy Kangaroo

debug 2

echo TEST MINIMAL - should fail at 1cm set grub=_ISO/e2b/grub if exist (hd0,1)/%grub%/E2B_GRUB.txt echo S if "%grub%"=="" pause FAIL AT 1cm

write 0x307ff4 0x45000 set * set grub=_ISO/e2b/grub

echo TEST 1 0x45000 - THIS SHOULD PRINT 'FAIL at 1c' echo if "%grub%"=="" pause 1a if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1b if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause FAIL AT 1c

write 0x307ff4 0x4000000 set * set grub=_ISO/e2b/grub

echo TEST 2 - NEW TEST - VARIABLES AT 0x4000000 (64MB) echo if "%grub%"=="" pause 1a if exist (hd0,0)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause 1b if exist (hd0,1)/%grub%/E2B_GRUB.txt set PN=1 if "%grub%"=="" pause FAIL AT N1c

pause TEST FINISHED

RESULTS

grlr 2014-02-28 FAIL at 1cm FAIL at 1c FAIL AT N1c

grlr 2014-09-02 FAIL at 1cm FAIL at 1c

so moving variable location seems to work. Why does it work? Why does the BIOS choose that memory to wipe?

Comment #12

Posted on Sep 3, 2014 by Happy Hippo

I don't know why,seems is bios bug or hidden bug in grub4dos.

Comment #13

Posted on Sep 3, 2014 by Happy Kangaroo

I notice the code in asm.S has a safe_int13 routine - is this working? Could it be used to see if it fixes the problem? Could you compile a version for me please?

Comment #14

Posted on Sep 4, 2014 by Happy Hippo

use safe_int13 test.

Attachments

Status: Accepted

Labels:
Type-Defect Priority-Medium