Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all grub4dos variables lost using some AMI BIOSes #198

Open
GoogleCodeExporter opened this issue Dec 17, 2015 · 14 comments
Open

all grub4dos variables lost using some AMI BIOSes #198

GoogleCodeExporter opened this issue Dec 17, 2015 · 14 comments

Comments

@GoogleCodeExporter
Copy link

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




Original issue reported on code.google.com by Steve6375 on 23 Aug 2014 at 1:00

@GoogleCodeExporter
Copy link
Author

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

Original comment by Steve6375 on 23 Aug 2014 at 1:08

Attachments:

@GoogleCodeExporter
Copy link
Author

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



Original comment by Steve6375 on 24 Aug 2014 at 8:04

@GoogleCodeExporter
Copy link
Author

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

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



Original comment by Steve6375 on 24 Aug 2014 at 9:34

@GoogleCodeExporter
Copy link
Author

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

Original comment by chenall.cn on 25 Aug 2014 at 12:13

@GoogleCodeExporter
Copy link
Author


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.








Original comment by Steve6375 on 25 Aug 2014 at 5:49

Attachments:

@GoogleCodeExporter
Copy link
Author

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

Original comment by Steve6375 on 25 Aug 2014 at 6:04

Attachments:

@GoogleCodeExporter
Copy link
Author

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.


Original comment by chenall.cn on 26 Aug 2014 at 7:06

@GoogleCodeExporter
Copy link
Author

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.





Original comment by Steve6375 on 28 Aug 2014 at 12:04

@GoogleCodeExporter
Copy link
Author

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

Original comment by Steve6375 on 28 Aug 2014 at 3:40

@GoogleCodeExporter
Copy link
Author

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

Original comment by chenall.cn on 2 Sep 2014 at 1:31

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author


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?







Original comment by Steve6375 on 2 Sep 2014 at 5:04

@GoogleCodeExporter
Copy link
Author

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

Original comment by chenall.cn on 3 Sep 2014 at 2:39

@GoogleCodeExporter
Copy link
Author

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?

Original comment by Steve6375 on 3 Sep 2014 at 8:11

@GoogleCodeExporter
Copy link
Author

use safe_int13 test.


Original comment by chenall.cn on 4 Sep 2014 at 1:26

Attachments:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant