I have a boot chain that I've asked about previously in this forum which you can read about here if you'd like.
The basic gist is that I was tasked with creating a secure boot chain for my work, the general flow of which happens as such:
Power on -> GRUB2 checks grubenv variable. If the variable is true, display Windows boot option. If false, display Linux boot option. -> (Variable = False): Linux performs integrity checks on the filesystem and sets the grubenv variable to true, then reboots -> GRUB2 checks grubenv variable (which is now True), displays Windows boot option -> boot to Windows.
However, the grubenv variable is a plaintext file. I'd like to change from this plaintext file to a byte located somewhere in the blank space of the drive. I am able to have Linux read/write this byte and in the thread linked, Wimb and Wonko the Sane were able to get Grub4Dos to perform this byte flipping, but I am having trouble getting GRUB2 to perform this same functionality.
GRUB2 CLI has the commands
read_byte and write_byte
which I believe are exactly what I need. However, the commands require an address of some sort. Via a HexEditor, I have the decimal and hexadecimal offsets of where the byte to flip is, but neither offset works as the address.
It should be noted that neither of the commands are listed in the GRUB2 manual and other than finding the source code for the commands, I've not found anything useful regarding either of them by simple Google searches.
Any help is greatly appreciated,
EDIT/PS: I was very conflicted on making a new thread vs. continuing my old one, but I figured since I am NOT using Grub4Dos in any capacity, it would be better served to make a new thread in this new subforum.
Edited by DapperDeer, 15 September 2020 - 05:48 PM.