One of the new features of Grub2 is scriptability. At my work we're using it to great affect. However, I recent stumbled on a terrible short coming. There isn't any string manipulation or arithmetic support.
My exact problem: I need to mess with a PCI device before booting. Between
write_dword I can easily write the values I need to. I get the Base address register from
setpci, and 0x18 to it, and write the desired value to that address.
I did the math in my head while experimenting, but now I can't figure out how to get Grub2 to do the same math at boot time.
To add insult to injury, the PCI address always end in 000. So in theory I could just replace the last two 0's with "18" and that would work as well. Once again Grub2 fails me, with no string manipulation support.
Is there a way to get a substring in Grub2 script?
Is there a way to perform arithmetic in Grub2 script?