How to Flash Bios from USB Pen (Without Windows)

Hi all,

I just wanted to let you all know about a brilliant method (and in my opinion a much cleaner method) to flashing bios from a USB stick rather than running the GPD Windows Executable files.

SOURCE CREDIT & THANKS: https://www.reddit.com/r/GPDPocket/comments/cwc9zv/p2_max_initial_impressions/
Thanks to @PeterCxy and Stone-D for the solution and for permission to re-publish here and add screenshots.

I tried this myself last night and can confirm it worked brilliantly.

PRE-REQUISITES THAT YOU WILL NEED BEFORE WE START:

  1. You will need the smallest USB drive you can find (More than 10MB and formatted to FAT)
  2. @PeterCxy file from here: https://drive.google.com/open?id=1BsD8YTEbSwtU6ZVHg2uAXauRRB4Q4P5H
  3. Make a backup copy of that file somewhere and keep it safe as the GPD rar files do not contain the same files. You will need this file if you ever need to create a USB pen again for any new BIOS released by GPD. Perhaps a simpler option is to just keep a small USB pen drive for GPD Bios Updating (My preference)
  4. please make sure the SHA1 checksum of the downloaded rar file is 279c7bcaa010884d864d2f3e7e20da78742fd31e

If unsure how to do this follow the below steps:

In Linux or Mac - Open Terminal
sha1sum filename
Working Example
sha1sum /Users/Pete/Downloads/P2MAX.0.20.rar

In Windows - Open Command Prompt
CertUtil -hashfile filename
Working Example
CertUtil -hashfile c:\Users\pete\Downloads\P2MAX.0.20.rar
4. Download 7-Zip from here: Download and Install it.

Method:

  1. Extract @PeterCxy binary file you obtained in step 2 using 7-Zip

  2. Open location you extracted it to and copy the file afuefix64.efi

  3. Insert USB Pen from Step 1 and navigate to the USB pen drive and paste afuefix64.efi to the USB pen drive.

  4. Open a basic text editor (notepad for windows) (textedit for mac) (nano for Linux)
    and copy all of the text in the box below and paste it into your basic text editor of choice.

echo -off
for %i in fs0 fs1 fs2 fs3 fs4 fs5 fs6
	if exist %i:\%0 then 
		%i:
		#=============================================== 
		# ITE Tech. Inc. 
		# UEFI Shell IT8987E eFlash Update 
		# FILENAME: "P2MAX.0.20.bin" 
		#    BUILD: 2018/11/21-10:58:42 
		#=============================================== 
		afuefix64.efi P2MAX.0.20.bin /p /b /n /r /k
		cls


		reset
		goto: EOF
	else
	echo not find %i
	endif
endfor
:EOF
  1. Save this file to the USB Pen Drive as startup.nsh

  2. Locate and download the latest version of bios from GPD from their website GPD P2 Max Firmware & Driver & BIOS - Shenzhen GPD Technology Co., Ltd. (HINT: Look for one that ends (BIOS) and then choose the highest version at the time of writing this was P2MAX.0.21-afu.rar

  3. Extract the latest BIOS rar file you downloaded from GPD Website (in our case that is P2MAX.0.21-afu.rar)

  4. Once extracted, you want to locate the file P2MAX.0.21-afu.exe and then you want to extract the executable file using 7-Zip

  5. Out of all the files that were just extracted you are only concerned with the binary file with the .bin extension. In our case it’s P2MAX.0.21.bin copy this file and paste it to the USB pen

  6. Open startup.nsh from the USB pen and find “P2MAX.0.20.bin” and replace with the name of the latest .bin your going to flash in our case this is “P2MAX.0.21.bin”
    (Technically you don’t need to do the first in the picture below as that is just a comment)
    16%20(2)

  7. Once you have renamed do file and save.

  8. You should now have a USB pen drive that looks like this.

  9. WARNING: Ensure you have mains power connected to the laptop to prevent any battery failure during the flash process. Now reboot the computer with the USB Pen still in the machine and keep tapping Fn and 7 until you see this

  10. Choose UEFI: Built-in EFI Shell WARNING: Do not put the system into standby or hibernation and do not press Power, open/close LID, insert or remove USB from this point onwards whilst you are upgrading the BIOS

  11. You will see something like this

  12. Do not press escape key or if your impatient enough to wait 5 seconds then press another key otherwise just let it count down.

  13. You will then see AMI Firmware Update Utility run something like this

  14. Do not touch anything at all just leave it alone to finish, the system will shutdown and restart itself twice once to a static GPD logo then it will turn off for approx 5 seconds. It will then turn on show again the GPD logo and turn off. You should wait a further 20-30 seconds and then power up the laptop

  15. You can check to see the bios version number either with GPD Bios Version Check Tool located here http://www.gpd.hk/filedownload/28211 (Windows)


You can see here that BIOS shows 0.21, 2019/8/23

or you can restart the device and repeatedly tap Fn + Backspace key, this will show you the Project Version is P2 MAX 0.21 x64

I hope this is helpful.
Thanks.

2 Likes

That’s awesome. You need to be careful in the future though doing this… while it’s pretty unlikely, GPD could release a bios update in the future that uses different parameters in the flash tool command (the "/p /b /n /r /k " part of the command, which basically tells it what blocks of the bios to erase and write to), and if you just copy the bin file to the flash drive with this custom script and run it while not noticing the command changed, you could brick it. I’d advise always checking the install script that comes with each GPD bios file when downloaded to make sure the parameters of the flash command are still the same.

2 Likes

Thank you and well spotted!! Really good observation thanks @Bluegizmo83

In that case please carry out an additional step and when you extract the latest GPD Bios Executable P2MAX.0.21.exe (in this case) you will see a file called AfuWin64.bat edit this file (do not run the file) in a text editor to read it and check the parameter flags specified (the /p /b /n /r /k part) match the parameter flags in the startup.nsh file above.


AfuWin64.bat (the line your looking for within that file)

afuwin64.exe P2MAX.0.21.bin /p /b /n /r /k

startup.nsh (the line your looking for within that file)

afuefix64.efi P2MAX.0.21.bin /p /b /n /r /k

Accordingly our parameter flags in this example match and we’re good to go. If they were different in the afuwin64.bat file then you would as @Bluegizmo83 points out need to change them accordingly in the startup.nsh file.

2 Likes

I don’t think the case is very likely though. Flashing different “parts” of the ROM will make the new BIOS intrinsically depend on the previous content in the ROM, which I don’t think is something reliable. The only reliable way is to flash the entire region allocated for BIOS each time.

It can’t hurt to always check either tho.

3 Likes

Thanks guys! I did it. Jumped from 0.19 to 0.21.
Only difference to the tutorial is step 22.
Device restarted itself two times after executing all commands from EFI Shell - first to static GPD logo, then turned off for ~5s and started again flashing one time the GPD logo and again turned off.
To not fuck up I waited 3 minutes if it won’t turn on again but it didn’t.
Then I turned it on and it booted normally to Windows. Can agree it’s quieter now.

1 Like

Well spotted, yes, tbh I wrote it up a day after and had took screenshots day before then cropped them the following day.

Your right on the two times restart then power off. (I remember now you said)
I’ll edit my post at 22. thanks.

1 Like

29 posts were merged into an existing topic: UEFI EFI Shell: Cannot read from file - 800000000000001F