Jump to content











Photo
- - - - -

Grub4dos for UEFI for beginners [Questions and Help topic]

grub4dos for uefi beginners

  • Please log in to reply
115 replies to this topic

#101 Atari800XL

Atari800XL

    Frequent Member

  • Advanced user
  • 192 posts
  •  
    Netherlands

Posted 31 August 2021 - 03:05 PM

I found a nice thread on the "Terabyte" forum about "truly" hiding a GPT partition. Terabyte are the creators of "Image for Windows" and "BootIt Bare Metal" (BIBM), which is available for MBR disks, and more recently also for GPT. It's a very powerful product, but I like Grub4Dos better (open source, a bit less intrusive, etc.)

 

The topic is "Can you really hide a GPT partition?", the link is below, but I'm posting some quotes from there as well.

https://www.terabyte...opic.php?t=3386

 

========    QUOTES  ========

"I would like to hide one OS partition from the other. By "hide" I mean prevent its files from being seen or accessed."

 

"> For what it's worth, Hide does work with Windows OS. NTFS and FAT
> partitions can be hidden.
Not really. Hidden NTFS and FAT partitions are clearly visible in Windows. The only thing you can't see is their contents."

 

"In my particular case with a single-user machine, my concern is possible harm arising from an inadvertent (stupid) operation on my part or harm from spyware/malware as tas3086 suggested."

 

"Hello! Can anyone help with hiding a drive, so it is not visible in other windows installation 'Disk Management'? I am testing a demo BIBM in Oracle VirtualBox, and can not get the drive NOT to show up in 'Disk Management'."

========    END QUOTES  ========

 

So, to me this confirms that the "hidden" attribute is not of much use. For me, the current alternative of simply not attaching a drive letter to the "other" partitions is good enough, maybe other alternatives will pop up in the future.

It seemed useful to post this info here.

 

Quote of the day: "I can't get the drive NOT to show up".



#102 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 September 2021 - 07:20 AM

Yep, this is again post #42, there is simply not an official way in GPT to "hide" partitions.

 

In the meantime - JFYI - I made a few (not so quick) tests with grub4dos and contrary to my expectations, crc32 calculation is doable and not that much slow.

 

This opens (in the future) the possibility to truly hide partitions by simply deleting their entries in the GPT partition table (and recreating them when needed on-the-fly).

 

:duff:

Wonko 



#103 Atari800XL

Atari800XL

    Frequent Member

  • Advanced user
  • 192 posts
  •  
    Netherlands

Posted 01 September 2021 - 09:14 AM

 

This opens (in the future) the possibility to truly hide partitions by simply deleting their entries in the GPT partition table (and recreating them when needed on-the-fly).

Interesting...

I say: "Let the future begin tomorrow!"


Seriously, thank you Wonko for all your input...



#104 Wonko the Sane

Wonko the Sane

    The Finder

  • Advanced user
  • 16066 posts
  • Location:The Outside of the Asylum (gate is closed)
  •  
    Italy

Posted 01 September 2021 - 12:56 PM

Interesting...

I say: "Let the future begin tomorrow!"


Seriously, thank you Wonko for all your input...

 

You are welcome :).

Tomorrow is now a little closer ;):

http://reboot.pro/in...showtopic=22553

 

:duff:

Wonko



#105 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 08:18 PM

Hi all,

Today marks a very limited return to the forum for me. Work/life/family/study commitments continue to keep me busy, however my curiosity has been piqued by grub4dos for UEFI.

Thanks alacran, my old friend, for documenting your own experiments - it's helped me to find my way. It's been hard trying to catch up after over 2 years away and there is a lot of information to work through in the grub4dos for UEFI topic (http://reboot.pro/in...showtopic=22400)

My experiments have been carried out with grub4dos-for_UEFI-2022-03-28 - any references to grub4efi below are for this build of grub4dos for UEFI.

I have focused largely on booting a full Windows Operating System from FILEDISK and RAMDISK (SVBus version 1.2 driver intergrated/installed).

I also did a quick test loading ipxe.efi - loading only as I wasn't connected to a network and had no PXE server available.

My tests have not been straightforward due to some complicating factors - the grub4efi commandline was throwing 0xc000000f BSOD errors when chainloading the windows efi loader (/efi/microsoft/boot/bootmgfw.efi). Weirdly, the exact same commands in a configuration file worked fine. Wonko will not be pleased as it goes against his usual advice to always use the commandline - advice I generally agree with.

A further complicating factor has been issues with wimlib to capture and apply my Windows 10 Enterprise LTSC (verson 21H2 / build 19044.1288) operating system to a VHD file. When the FILEDISK/RAMDISK was booted, the start menu and other functions were not working and I made an incorrect assumption that this was either linked to SVBus or grub4efi. I am confident that the issue has been traced back to wimlib (latest version 1.13.5 tested). A new test using DISM to capture and then apply the OS to a vhd file was successful.

My test system is a Lenovo Thinkpad W530 with firmware set to UEFI only (CSM disabled). This system is a beast and has 32GB RAM - which made RAMDISK booting a full windows possible.

Hard disk configuration on the test system -

  • Partition 1 - System/EFI (1GB) - EFI boot loaders and a custom WinPE
  • Partition 2 - MSR (64MB)
  • Partition 3 - OS (60GB) - Windows 10 Enterprise LTSC (verson 21H2 / build 19044.1288)
  • Partition 4 - Data (404GB) - shared data drive for use by the OS, WinPE and any FILEDISK/RAMDISK systems

This is a test system that I am more than capable of rescuing if I mess anything up - if you choose to follow these instructions and you don't know what you are doing then exercise caution and don't blame me. I'd also recommend that you have a USB boot disk to hand if there are any issues - preferably WinPE as this makes life much easier if you need to rebuild Windows boot files and the BCD store.

There is only one hard disk - disk 0 in DiskPart. If you have a system with multiple then care needs to be taken when selecting disks and partitions to ensure that you don't format the wrong device.



#106 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 08:18 PM

Installing grub4efi

Firstly, the term installing is a bit misleading as all I did was rename the Windows EFI loader and replace it with the grub4efi EFI loader. This works on my system with secure boot disabled - my system always UEFI boots using the file \EFI\boot\bootx64.efi and it appears to ignore any NVRAM settings.

I carried out this step from WinPE because this is my preferred tool - my WinPE is configured to display hidden and system files, everything runs as admin and I do not need to worry about antivirus, locked files or file access restrictions.

The EFI system partition is not automatically mounted - this is by default/design in Windows and WinPE.

Mount the EFI system partition using diskpart - as drive R:


select disk 0
select partition 1
assign letter=R

Now rename R:\EFI\boot\bootx64.efi as R:\EFI\boot\bootx64win.efi

Copy the grub4dos EFI loader BOOTX64.EFI to R:\EFI\boot\bootx64.efi

Create a grub4efi configuration file menu.lst in the path R:\EFI\grub\menu.lst

Contents of menu.let for a basic menu

timeout 20
default 1

title windows /efi/microsoft/boot/bootmgfw.efi
chainloader /efi/microsoft/boot/bootmgfw.efi

title (hd0)
chainloader (hd0)

title commandline
commandline

title reboot
reboot

Optional - copy the ext folder and files from the grub4efi download package to R:\EFI\grub\ext\ - these files add support for additional commands.

Reboot the PC and check that grub4efi is running. You should see a basic menu with the following options -

windows /efi/microsoft/boot/bootmgfw.efi
(hd0)
commandline
reboot


#107 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 08:19 PM

Install Windows to FILEDISK and boot from RAMDISK

In my previous experiments with SVBus on systems with BIOS firmware (or CSM enabled) I was able to install Windows in a FILEDISK mapped using grub4dos. My attempts to replicate this using grub4efi were unsuccessful as Windows Setup failed - I cannot recall the issue unfortunately.

My notes/guide for SVBus (old and not updated to include any grub4efi experiments) - http://mistyprojects...ocuments/SVBus/

The most straightforward way I found was to use Windows native VHD boot to install Windows to a VHD file - once the installation is complete it can then be booted as a SVBus FILEDISK or RAMDISK.

Notes on files/paths -
  • Drive C: = Windows OS (Disk 0, partition 3)
  • Drive D: = Data (Disk 0, partition 4)
  • Drive R: = VHD file (Disk 1, partition 1) - refer to the steps below
  • Drive S: = VHD file (Disk 1, partition 2) - refer to the steps below
Lets create a VHD file with 2 partitions - one for the EFI and Windows boot loader files (drive R:) and one for the Operating System files (Drive S:). Diskpart commands -
create vdisk file=D:\svbus1.vhd maximum=20480 type=fixed
select vdisk file=D:\svbus1.vhd 
attach vdisk
create partition primary size=100
format fs=fat label=vhdboot quick
assign letter=r
create partition primary
format fs=ntfs label=vhd_os quick
assign letter=s
Now lets apply the Windows 10 operating system files to drive S: - I used wimlib-imagex, however DISM can also be used (E:\sources\install.wim is the contents of a mounted Windows 10 iso file)
wimlib-imagex.exe apply E:\sources\install.wim 1 s:
DISM.exe /Apply-Image /ImageFile:E:\sources\install.wim /ApplyDir:s: /Index:1
Now lets create the required boot files to drive R:
bcdboot S:\windows /s r:
Now lets modify the BCD store on drive R: (created in the preceeding step)
  • testsigning is required for the unsigned SVBus driver. I have not tested the signed version of SVBus
  • bootmenupolicy legacy - my own preference as I detest the graphic boot menu. You probably won't see any menu anyway as the BCD has only one OS entry and shouldn't be displayed.
  • advancedoptions yes - I have found this useful as I know when it's displayed that Windows has started booting and I can use safemode to troubleshoot if required.
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} bootmenupolicy legacy
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} testsigning on
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} advancedoptions yes
Now lets use DISM to install the SVBus driver in the offline Operating System image in drive S: (NOTE - Windows Defender does not like the SVBus driver and may take action. Consider disabling your AV)
dism.exe /image:S: /Add-driver /Driver:D:\SVBus\svbus.inf /ForceUnsigned
As we are using Windows native boot VHD to complete the installation, an entry for the operating system in the VHD file will need to be added to the default system BCD store in the EFI system partition. This partition does not need to be mounted.
bcdboot S:\windows
Unmount/detach the VHD disk
select vdisk file=D:\svbus1.vhd
detach vdisk
Reboot the PC.

Assuming grub4efi is running and configured as per the instructions in my previous post, select the menu option windows /efi/microsoft/boot/bootmgfw.efi

Complete the windows installation - there will be at least one reboot. At the reboot(s), select the menu option windows /efi/microsoft/boot/bootmgfw.efi to complete the installation.

As soon as the installation has completed, lets add menu entries for RAMDISK and FILEDISK booting. As the SVBus driver was installed to the offline windows, it should be integrated and working (NOTE/REMINDER - Windows Defender does not like the SVBus driver and may take action. Consider disabling your AV).

To add menu enties - open a command prompt (run as administrator) and enter the following commands (the first command will mount the EFI system partition as drive T: - use a different letter as required. The second command will open T:\efi\grub\menu.lst in notepad.exe) -
mountvol t: /S
notepad T:\efi\grub\menu.lst
Lets add grub4efi menu entries for \svbus1.vhd
title Boot /svbus1.vhd - SVBus RAMDISK
find --set-root /svbus1.vhd
map --mem --top /svbus1.vhd (hd)
chainloader (hd-1)

title Boot /svbus1.vhd - SVBus FILEDISK
find --set-root /svbus1.vhd
map /svbus1.vhd (hd)
chainloader (hd-1)
Reboot the PC and select your preferred menu entry.

#108 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 08:19 PM

Experiment 2 - Clone Windows to FILEDISK/RAMDISK

To avoid pagefile issues/conflicts I recommend moving the pagefile to make sure it's not on the same partition as the running operating system. This step may not be required, however moving my pagefile to my data drive avoided some potential issues and conflicts, and increases space available in my RAM booted OS.

Lets install the SVBus driver to the Windows system we will be cloning. Assuming the system is booted and running, enter the following commands (command prompt - Run as Administrator) -



bcdedit /set {current} testsigning on
bcdedit /set {current} advancedoptions yes
These settings are covered in more detail in my SVBus guide - see http://mistyprojects...r-signature.htm.

Reboot the PC and when the Advanced Boot Options menu is displayed, select Disable Driver Signature Enforcement - this is required to install the SVBus driver.

A watermark stating Test Mode should be displayed to the bottom right of the desktop - this is nothing to do with the disabling driver signature enforcement in the previous step but is required for running the unsigned SVBus after it is installed.

Lets use the Add Hardware Wizard to install SVBus (Run > hdwwiz). Follow the instructions in my SVBus guide - see http://mistyprojects...iles/hdwwiz.htm

Summary of steps -
  • Welcome to the Add Hardware Wizard - click on Next
  • Select Install the hardware that I manually select from a list (Advanced), then click on Next
  • Select Storage controllers from the list, then click on Next
  • When prompted to Select the device driver you want to install for this hardware, select Have Disk...
  • Install from Disk > Browse... (and browse to svbus.inf) > OK
  • The SVBus Virtual SCSI Host Adapter should be displayed in the Model area > Next >
  • Hardware to install: - SVBus Virtual SCSI Host Adapter should be displayed > Next >
  • A warning will be displayed as the SVBus driver is unsigned. Select Install this software anyway
Let prepare a new VHD file. The steps are similar to my previous post where Installing Windows to FILEDISK and boot from RAMDISK is covered.

Notes on files/paths -
  • Drive C: = Windows OS (Disk 0, partition 3)
  • Drive D: = Data (Disk 0, partition 3)
  • Drive R: = VHD file (Disk 1, partition 1) - refer to the steps below
  • Drive S: = VHD file (Disk 1, partition 2) - refer to the steps below
Lets create a VHD file with 2 partitions - one for the EFI and Windows boot loader files (drive R:) and one for the Operating System files (Drive S:). Diskpart commands -
create vdisk file=D:\svbus2.vhd maximum=20480 type=fixed
select vdisk file=D:\svbus2.vhd 
attach vdisk
create partition primary size=100
format fs=fat label=vhdboot2 quick
create partition primary
format fs=ntfs label=vhd_os2 quick
detach vdisk
Now lets make sure that SVBus is installed properly and is working. Add menu enties - open a command prompt (run as administrator) and enter the following commands (the first command will mount the EFI system partition as drive T: - use a different letter as required. The second command will open T:\efi\grub\menu.lst in notepad.exe) -
mountvol t: /S
notepad T:\efi\grub\menu.lst
Lets add grub4efi menu entries for \svbus2.vhd
title Load /svbus2.vhd (FILEDISK) then boot /efi/microsoft/boot/bootmgfw.efi
find --set-root /svbus2.vhd
map /svbus2.vhd (hd)
find --set-root /efi/grub/menu.lst
chainloader /efi/microsoft/boot/bootmgfw.efi
Let's reboot the PC and test that the SVBus driver is installed and working. Select the grub4efi menu option Load /svbus2.vhd (FILEDISK) then boot /efi/microsoft/boot/bootmgfw.efi

Once Windows has booted you should hopefully see the vhd partitions mounted in Windows. Optionally, check diskpart by running the following commands (editing the disk number as required) -
select disk 1
Output from running the above command on my system - note the SVBus Virtual Hard Disk SCSI Disk Device
Spoiler



Now lets boot to WinPE, capture Windows on Disk 0 Partition 3 to a wim file, mount D:\svbus2.vhd, apply the wim to partition 2 on the mounted VHD file, create boot files on partition 1 on the mounted VHD file, add a grub4efi menu entry and boot to RAMDISK or FILEDISK.


Notes on files/paths in WinPE (they remain the same as in the running Windows installed to Disk 0, partition 3) -
  • Drive C: = Windows OS (Disk 0, partition 3)
  • Drive D: = Data (Disk 0, partition 3)
  • Drive R: = VHD file (Disk 1, partition 1) - refer to the steps below
  • Drive S: = VHD file (Disk 1, partition 2) - refer to the steps below
WinPE - mount D:\svbus2.vhd (adjust path as required) using DiskPart (adjust disk number as required) -
select vdisk file=D:\svbus2.vhd 
attach vdisk
select partition 1
assign letter=r
select partition 2
assign letter=s
WinPE - capture Windows OS (Disk 0, partition 3) to D:\win10svbus.wim (I'd recommend using DISM for this due to errors when using wimblib) -
Dism /Capture-Image /ImageFile:D:\win10svbus.wim /CaptureDir:C: /Name:Windows10svbus /Compress:fast
WinPE - Now lets apply the Windows 10 operating system files captured in the preceeding step to drive S: -
DISM.exe /Apply-Image /ImageFile:D:\win10svbus.wim /ApplyDir:s: /Index:1
WinPE - Now lets create/apply the required boot files in/to drive R:
bcdboot S:\windows /s r:
WinPE - Now lets modify the BCD store on drive R: (created in the preceeding step).
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} bootmenupolicy legacy
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} testsigning on
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} advancedoptions yes
As mentioned in one of my previous posts -
  • testsigning is required for the unsigned SVBus driver. I have not tested the signed version of SVBus.
  • bootmenupolicy legacy - my own preference as I detest the graphic boot menu. You probably won't see any menu anyway as the BCD has only one OS entry and shouldn't be displayed.
  • advancedoptions yes - I have found this useful as I know when it's displayed that Windows has started booting and I can use safemode to troubleshoot if required.
WinPE - OPTIONAL - edit the MountedDevices registry key in the S:\Windows\System32\config\SYSTEM registry hive. Remove (or rename) the entry for the C: drive (\DosDevices\C:). Adjust other letters as required. The steps are covered in more detail at http://mistyprojects...files/clone.htm


WinPE - Unmount/detach the VHD disk
select vdisk file=D:\svbus2.vhd 
detach vdisk
To add menu grub4efi enties - open a command prompt (run as administrator) and enter the following commands -
mountvol t: /S
notepad T:\efi\grub\menu.lst
Lets add grub4efi menu entries for \svbus2.vhd
title Boot /svbus2.vhd - SVBus RAMDISK
find --set-root /svbus2.vhd
map --mem --top /svbus2.vhd (hd)
chainloader (hd-1)

title Boot /svbus2.vhd - SVBus FILEDISK
find --set-root /svbus2.vhd
map /svbus2.vhd (hd)
chainloader (hd-1)
Reboot the PC and select your preferred menu entry.

#109 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 08:19 PM

More reserved space - just in case



#110 alacran

alacran

    Platinum Member

  • .script developer
  • 2710 posts
  •  
    Mexico

Posted 09 May 2022 - 09:06 PM

@ misty

 

Hi my old good friend misty, it's a pleasure to see you around again.

 

Following some topics that may be useful in your experiments:

 

SVBus_V1.2 signed

Compact mode installs

Useful info for WinPEs, Wimboot and Compact installs

Summary of new tools for UEFI and MBR/CSM boot and Ramboot

Install Win10XPE_x64 Flat or Compact Mode on VHD

Testing UEFI booting on a only Bios PC

VHD_WIMBOOT - Apply and Capture of WIM Files for OS in VHD

Mini Windows made with WinNTSetup

 

NOTE: By means of VHD_WIMBOOT program by wimb, it is also possible to Ramboot having Secure Boot enabled, but Win 10 and 11 made after Win 10 v2004 have some troubles to run SVBus driver, even using signed version, but I suggested a workaround, and our fellow wimb icluded in his VHD_WIMBOOT program

 

alacran


  • misty likes this

#111 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 09 May 2022 - 09:23 PM

@alacran

It's good to be back. You appear to have been very busy on this and other forums. 

 

Thanks for the links - I'm look forward to catching up and experimenting, although that's a lot of reading/homework! 

 

Regarding the issues running SVBus in newer versions of Windows 10 and Windows 11 - I did locate the signed SVBus drivers and wimb's workaround, however I like to understand things by working through the steps. I've not had any issues with installing the unsigned SVBus so far - other then stupid AV false positives. 

 

Look after yourself and I'll catch up soon. 

 

Misty



#112 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 11 May 2022 - 07:51 PM

grub4efi WIMBOOT Windows 8.1 Update 1

Notes on files/paths -

  • Drive C: = Windows 10 Operating System (Disk 0, partition 3)
  • Drive D: = Data (Disk 0, partition 4)
  • Drive E: = Virtual CD\DVD (mounted Windows 8.1 Update 1 ISO)
  • Drive R: = VHD file (Disk 1, partition 1) - refer to the steps below
  • Drive S: = VHD file (Disk 1, partition 2) - refer to the steps below

Summary of the steps completed - in the Windows 10 Operating System.

Lets create a VHD file with 2 partitions - one for the EFI and Windows boot loader files (drive R:) and one for the Operating System files (Drive S:). Diskpart commands -

create vdisk file=D:\svbus3.vhd maximum=20480 type=fixed
select vdisk file=D:\svbus3.vhd 
attach vdisk
create partition primary size=100
format fs=fat label=vhdboot quick
assign letter=R
create partition primary
format fs=ntfs label=vhd_os quick
assign letter=S

Use wimlib-imagex to apply the contents of E:\sources\install.wim (mounted Windows 8.1 update 1 ISO file) to D:\wimboot_temp

wimlib-imagex.exe apply E:\sources\install.wim 1 D:\wimboot_temp

Capture the files extracted in the previous step using wimlib-imagex with the --wimboot parameter (saving as file D:\win81wimboot.wim)

wimlib-imagex.exe capture D:\wimboot_temp\ D:\win81wimboot.wim --wimboot

Apply the contents of D:\win81wimboot.wim created in the previous step to S:\ using wimlib-imagex with the --wimboot parameter

wimlib-imagex.exe apply D:\win81wimboot.wim 1 S:\ --wimboot

Now lets create the required boot files on drive R:

bcdboot S:\windows /s r:

Now lets modify the BCD store on drive R: (created in the preceeding step)

  • testsigning is required for the unsigned SVBus driver. I have not tested the signed version of SVBus.
  • bootmenupolicy legacy - my own preference as I detest the graphic boot menu. You probably won't see any menu anyway as the BCD has only one OS entry and shouldn't be displayed.
  • advancedoptions yes - I have found this useful as I know when it's displayed that Windows has started booting and I can use safemode to troubleshoot if required.
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} bootmenupolicy legacy
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} testsigning on
bcdedit /store R:\EFI\microsoft\boot\bcd /set {default} advancedoptions yes

Now lets use DISM to install the SVBus driver in the offline Operating System image in drive S: (NOTE - Windows Defender does not like the SVBus driver and may take action. Consider disabling your AV)

dism.exe /image:S: /Add-driver /Driver:D:\SVBus\svbus.inf /ForceUnsigned

Unmount/detach the VHD disk

select vdisk file=D:\svbus3.vhd 
detach vdisk

Lets add menu entries for RAMDISK and FILEDISK booting. As the SVBus driver was installed to the offline windows (NOTE/REMINDER - Windows Defender does not like the SVBus driver and may take action. Consider disabling your AV).

To add menu enties - open a command prompt (run as administrator) and enter the following commands (the first command will mount the EFI system partition as drive T: - use a different letter as required. The second command will open T:\efi\grub\menu.lst in notepad.exe) -

mountvol t: /S
notepad T:\efi\grub\menu.lst

Lets add grub4efi menu entries for \svbus3.vhd

title Boot /svbus3.vhd - SVBus RAMDISK
find --set-root /svbus3.vhd
map --mem --top /svbus3.vhd (hd)
chainloader (hd-1)

title Boot /svbus3.vhd - SVBus FILEDISK
find --set-root /svbus3.vhd
map /svbus3.vhd (hd)
chainloader (hd-1)

Reboot the PC.

Assuming grub4efi is running and configured as per the instructions in my previous post, select the menu option Boot /svbus3.vhd - SVBus FILEDISK

Complete the windows installation - there will be at least one reboot. At the reboot(s), select the menu option Boot /svbus3.vhd - SVBus FILEDISK to complete the installation.

_______________________________________________

A few notes on grub4efi WIMBOOT Windows 8.1 Update 1

A similar experiment using DISM to apply the WIMBOOT image failed - this needs to be retested as I tried to complete the Windows OS installation using Windows native VHD boot rather than SVBus FILEDISK.

The WIMBOOT .wim file was present on a physical disk - I haven't tried copying it to the mounted VHD file and running from there.

I was also able to clone an installed Windows 8.1 Update 1 Operating System using similar steps.

Screenshot of the Windows 8.1 Update 1 installation up and running -

2022.05.11_1.jpg



#113 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 22 May 2022 - 11:16 AM

Here follows some random notes on my Thinkpad T450 - setting it up for Grub4efi.

These notes are focused on using the bcdedit command to change settings in NVRAM.

Getting Grub4efi booting on this system has been a pain, however this is due as much to my own lack of knowlege around NVRAM boot settings. My older Thinkpad W530 (circa 2013) was much easier to get working.

Let's have a look at the current firmware settings in NVRAM.
 
bcdedit /enum firmware
This resulted in the following output -
Spoiler



Now look at the {fwbootmgr} display order -
identifier              {fwbootmgr}
displayorder            {bootmgr}
                        {e8cb7bbd-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bbc-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bbe-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bbf-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bc2-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bc0-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bc1-d7db-11ec-81e0-806e6f6e6963}
                        {e8cb7bbb-d7db-11ec-81e0-806e6f6e6963}
Tracing the GUID values back to their more understandable entries -
  • {bootmgr} = \EFI\Microsoft\Boot\bootmgfw.efi on \Device\HarddiskVolume1
  • {e8cb7bbd-d7db-11ec-81e0-806e6f6e6963} = USB FDD
  • {e8cb7bbc-d7db-11ec-81e0-806e6f6e6963} = USB CD
  • {e8cb7bbe-d7db-11ec-81e0-806e6f6e6963} = ATA HDD1
  • {e8cb7bbf-d7db-11ec-81e0-806e6f6e6963} = ATA HDD2
  • {e8cb7bc2-d7db-11ec-81e0-806e6f6e6963} = USB HDD
  • {e8cb7bc0-d7db-11ec-81e0-806e6f6e6963} = ATA HDD0
  • {e8cb7bc1-d7db-11ec-81e0-806e6f6e6963} = PCI LAN
  • {e8cb7bbb-d7db-11ec-81e0-806e6f6e6963} = PCI LAN
This appears to be the boot order on my system, with any devices not connected being skipped. Pressing the F12 key on Thinkpads during boot will display a quick boot menu - attached items are displayed in the order listed above.

This would explain my initial frustration as replacing the Windows bootx64.efi with Grub4efi bootx64.efi failed to boot Grub4efi - it was effectively ignoring it and booting the {bootmgr} entry (\EFI\Microsoft\Boot\bootmgfw.efi on \Device\HarddiskVolume1).

Let's use bcdedit to change the boot order, adding HDD0 (guid {e8cb7bc0-d7db-11ec-81e0-806e6f6e6963} on my system) as the first boot device -
bcdedit /set {fwbootmgr} displayorder {e8cb7bc0-d7db-11ec-81e0-806e6f6e6963} /addfirst
When the system was rebooted this loaded /EFI/boot/bootx64.efi from disk 0 - booting to Grub4efi.

With the boot device set as HD0 in firmware (NVRAM) - replacing the boot file bootx64.efi (e.g. from Windows bootx64.efi to Grub4efi bootx64.efi) resulted in a warm reboot the first time it was booted. Subsequent boots were ok. Replacing it again (e.g. back to the Windows bootx64.efi) resulted in the same behaviour. I did not observe similar behaviour on my older W530, but will retest at some point.

Now how about using bcdedit to add a menu entry for Grub4efi to the firmware?

Let's have a look at the {bootmgr} firmware entry -
Windows Boot Manager
--------------------
identifier              {bootmgr}
device                  partition=\Device\HarddiskVolume1
path                    \EFI\Microsoft\Boot\bootmgfw.efi
description             Windows Boot Manager
locale                  en-US
inherit                 {globalsettings}
default                 {default}
resumeobject            {3b2eef6b-d7d4-11ec-a7a9-abfd0d5793d0}
displayorder            {default}
                        {dd2b4cb2-d7d6-11ec-a20c-877b7d4e91a4}
                        {current}
toolsdisplayorder       {memdiag}
timeout                 30
Now how about copying this entry, replacing the path to a different .efi loader and getting rid of all of the unnecessary entries (locale, inherit, default, resumeobject, displayorder, toolsdisplayorder)

The following batch file should do the trick -
@echo off
setlocal
net.exe session 1>NUL 2>NUL || (Echo This script requires elevated rights - right-click and Run as administrator. & PING 127.0.0.1 > NUL 2>&1 & EXIT /B 1)

for /f "tokens=2 delims={}" %%a in ('bcdedit /copy {bootmgr} /d "Grub4efi"') do set guid={%%a}
bcdedit /set %guid% path \EFI\grub\g4e.efi
bcdedit /set {fwbootmgr} displayorder %guid% /addlast
bcdedit /deletevalue %guid% locale
bcdedit /deletevalue %guid% inherit 
bcdedit /deletevalue %guid% default
bcdedit /deletevalue %guid% resumeobject
bcdedit /deletevalue %guid% displayorder
bcdedit /deletevalue %guid% toolsdisplayorder 
bcdedit /deletevalue %guid% timeout 
When I rebooted the system, accessed the F12 boot menu and selected the entry "Grub4efi" I was able to boot Grub4efi.

Mileage will undoubtedly vary on different systems. It has however been useful to understand more about using bcdedit to manage EFI firmware settings.

Regards,

Misty

#114 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 22 May 2022 - 01:51 PM

And now for a really good GUI tool for editing the NVRAM UEFI boot menu - BootICE

It does not appear to have command-line options for UEFI, however it does have a very simple and intuitive user interface.

Just don't forget to run your efi file from a supported partition type - rookie error on my part as I was scratching my head and cursing until I realised that my grub4efi bootx64.efi was on an NTFS partition (not supported on my system).

:cheers:

misty



#115 Vortex

Vortex

    Frequent Member

  • Advanced user
  • 299 posts

Posted 22 May 2022 - 08:18 PM

Hi misty,

 

No need to change the settings in NVRAM. Here is an easier approach :

 

Rename \EFI\Microsoft\Boot\bootmgfw.efi to \EFI\Microsoft\Boot\bootmgfw10.efi
 
Copy BOOTX64.EFI \ the UEFI grub4dos loader to \EFI\Microsoft\Boot and rename it to \EFI\Microsoft\Boot\bootmgfw.efi
 
My computer's operating system is Windows 10. You can select another name instead of bootmgfw10.efi
 
Here is my \EFI\grub\menu.lst :
 
color blue/green yellow/red white/magenta white/magenta
timeout 30
default 0


title Win10XPE


find --set-root /Win10XPE_x64.iso
map --mem /Win10XPE_x64.iso (0xff)
chainloader (0xff)


title Windows 10


chainloader /EFI/Microsoft/Boot/bootmgfw10.efi


#116 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 07 July 2022 - 08:44 AM

I've been playing around with SVBus again after a short break. My initial Grub4EFI + SVBus tests were carried out on a Thinkpad W530. Subsequent tests on a Thinkpad T450 failed - with grub4EFI hanging after executing commands.

A recently acquired refurbised Thinkpad X260 led to more tests. Grub4EFI + SVBus works fine on this system.

Follow the steps below to install svbus in an offline system (tested using WIMBOOT Windows To Go on an external SSD - VHD installation).

My .vhd operating system partition is mounted as S:\

Mount the system registry hive

reg.exe load HKLM\_SYSTEM S:\Windows\system32\config\system

Use SetACL to change ownership/permissions (required in tests on Windows 8.1 Update and Windows 10 2016 LTSC)

SetACL.exe -on "HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Enum\ROOT" -ot reg -actn setowner -ownr n:Administrators
SetACL.exe -on "HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Enum\ROOT" -ot reg -actn ace -ace "n:Administrators;p:full"

Import the following registry settings -

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Enum\ROOT\SVBUSX64]

[HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Enum\ROOT\SVBUSX64\0000]
"HardwareID"=hex(7):52,00,4f,00,4f,00,54,00,5c,00,73,00,76,00,62,00,75,00,73,\
  00,78,00,36,00,34,00,00,00,00,00
"Capabilities"=dword:00000000
"ConfigFlags"=dword:00000000
"ContainerID"="{00000000-0000-0000-FFFF-FFFFFFFFFFFF}"
"ClassGUID"="{4d36e97b-e325-11ce-bfc1-08002be10318}"
"Service"="svbusx64"
"DeviceDesc"="@svbus.inf,%adaptername%;SVBus Virtual SCSI Host Adapter"
"Mfg"="@svbus.inf,%manufacturer%;Kai Schtrom"

[HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Services]

[HKEY_LOCAL_MACHINE\_SYSTEM\ControlSet001\Services\svbusx64]
"Type"=dword:00000001
"Start"=dword:00000000
"ErrorControl"=dword:00000001
"Tag"=dword:00000040
"ImagePath"=hex(2):53,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,64,00,\
  72,00,69,00,76,00,65,00,72,00,73,00,5c,00,73,00,76,00,62,00,75,00,73,00,78,\
  00,36,00,34,00,2e,00,73,00,79,00,73,00,00,00
"Group"="SCSI Miniport"
"Owners"=hex(7):73,00,76,00,62,00,75,00,73,00,2e,00,69,00,6e,00,66,00,00,00,00,\
  00

Copy svbusx64.sys to S:\Windows\System32\drivers\svbusx64.sys

Copy svbus.inf to S:\Windows\Inf\svbus.inf

Unmount the system registry hive -

reg.exe unload HKLM\_SYSTEM

:cheers:

misty



#117 misty

misty

    Gold Member

  • Developer
  • 1066 posts
  •  
    United Kingdom

Posted 13 January 2023 - 06:06 PM

Hi all,

it looks like there has been some development activity with Grub4EFI since I last checked chenall's releases - grub4dos-for_UEFI-2022-12-27.7z is now available.

I have not tested as yet. Is anyone able to confirm what has changed?

:cheers:

misty





Also tagged with one or more of these keywords: grub4dos for uefi, beginners

1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users