Obtaining the UUID of the system for a PXE boot
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): CAA91j0XETaDEh16K0WJ3p5hNxxVXWk-PDBh2Gp-TYq6UjvRetw@mail.gmail.com
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi,
ok posting on grub-devel list now. Further answer(s) at the bottom.
Quoted 78 lines · Andrey Borzenkov
I guess further discussion should be really moved to grub-devel
В Thu, 18 Jul 2013 12:39:44 +0200
Holger Goetz <[email protected]> пишет:Quoted 33 lines · Andrey Borzenkov
Quoted 23 lines · Holger Goetz
Quoted 15 lines
Hello all,
i've started to use grub.efi as boot loader for UEFI based systems and am getting slowly familiar w/ grub2.Now i've come across a problem w/ assigning individual boot configurations to target system identification. The BIOS line of systems gets booted through pxelinux and get their PXE configuration through files w/ names based on the individual UUID of the system.
The same should be possible for UEFI booted systems, but i couldn't find a way to get hold of the system-UUID yet. The MAC addresse(s) is/are not available and possibly have changed since the definition of the configuration, so even the lately introducednet_default_macvariable doesn't work here. Having the UUID as unique system identifyer across NICs which can be changed would be of big help.Quoted 2 lines
Any pointer/help would be greatly appreciated.
So, you need to fetch system GUID used by PXE, right? To be honest, I do not even know how (if it is possible at all) to obtain it. The only words about PXE GUID in EFI allow to switch between using GUID and MAC for client identification, but that's all:
Quoted 9 lines
===
SendGUIDThis field is used to change the Client Hardware Address (chaddr) field in the DHCP and Discovery packets. Set to TRUE to send the SystemGuid (if one is available).
===Do you know how to get this information?
Quoted 9 lines
Hi Andrey,
the system UUID is part of the SMBIOS structure which can be searched between
0xf000and0x100000in memory. It has a signature string "_SM_". With in the SMBIOS table (memory block) the table type 1 identifys the UUID table and it contains a 16byte binary number which typically is returned in a form like 00112233-4455-6677-8899-AABBCCDDEEFF. See the SMBIOS specs here: http://www.dmtf.org/standards/smbios.David Michael posted patch to grub-devel which provides access to SM BIOS information. You may be interested in checking to which extent it could be used in your case. Thread title is
[PATCH/RFC]
cpuid.c: Provide CPU model informationQuoted 11 lines
Also in the spec is some discussions around byte swappig parts of the uuid, for consistency probably a byte by byte representation as a string would be best.
One implementation can be found in eg. syslinux's
core/dmi.c- including a rudimentary validation check.
Other implementations under Linux (eg. dmidecode) often take/proc/efi/systabor/sys/firmware/efi/systabas starting points to the SMBIOS structure, but that's obviously not available at the time grub starts ;-)I'm still not sure what exactly you need. There are three steps in booting grub2 over network
1. Firmware loads core.img using PXE. At this point it may provide MAC or GUID as client identification
2. core.img loads normal.mod which loads grub.cfg. This is done using location hardcoded in core.img.
3. Finally grub.cfg loads other files, loads OS kernel and executes it. It is using whatever features and commands grub2 provides and may decide location dynamically.
Quoted 7 lines
Now, at which step exactly you need to know and use system GUID from SM BIOS?
_______________________________________________
Help-grub mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/help-grub
Hi Andrey,
i've checked David Michel's patch.
Yes it's towards the right direction. But it is 32bit only if i understand correctly, and it basically is a memory access to fixed/hardcoded MEMORY address (0x80000001). to pick the veondor id and machine info.
I have only 64bit - UEFI here - therefore the approach w/ first searching the SMBIOS infoblock in memory is probably required. And then properly walk through the info-tables/blocks to get to the UUID entry. It doesn'T need to be a fixed info to be retrieved from the SMBIOS memory - maybe a generic function to query/search a specific entry and return that to be assigned to a variable would be more flexible.
You asked where exactly the uuid is needed - let me explain:
At stage 3 of your list aabove - where the default grub.cfg is interpreted. There a target machine specific grub.cfg file needs to be found on the tftpserver which carries different OS (Linux / Windows) and different (kernel) parameters on a per machine basis. This target specific grub.cfg file is named after the System UUID of the target. UUID is used as it's not known which NIC (so it's MAC) will be used to connect to the network, but it's UUID is. Having the UUID the matching cfg would be loaded from the tftpserver.
Thanks,
Holger
Hi,
Quoted 3 lines · Holger Goetz
Yes it's towards the right direction. But it is 32bit only if i understand correctly, and it basically is a memory access to fixed/hardcoded MEMORY address (
0x80000001). to pick the veondor id and machine info.
It's true that I've mostly been using the module on 32-bit virtual machines, so it hasn't really been tested elsewhere. However, I'm not sure I understand what you mean by the hard-coded memory address. The first function grub_smbios_locate_eps searches for the SMBIOS entry point structure as described in the spec. The table entries are then read at the table address found in the EPS, not a hard-coded location.
Quoted 6 lines
I have only 64bit - UEFI here - therefore the approach w/ first searching the SMBIOS infoblock in memory is probably required. And then properly walk through the info-tables/blocks to get to the UUID entry. It doesn'T need to be a fixed info to be retrieved from the SMBIOS memory - maybe a generic function to query/search a specific entry and return that to be assigned to a variable would be more flexible.
The module's command-line interface does use a (dumb) query/search method. You can specify the desired entry's type and/or handle and the data to retrieve from it. For example the following command prints the machine name (i.e. the string at offset 5 in an entry with type 1).
smbios -t 1 -s 5
I think you may have found the first patch I sent in that old thread, which was for different functionality. The SMBIOS module can be downloaded from the list archive[1].
Unfortunately it doesn't have any convenient functions to output a usable UUID. It shouldn't take much to add one: the variable "entry" in the "main" function is a pointer to the matched entry, so entry[8] through entry[23] is the UUID in a call "smbios -t 1 ...". I've verified these bytes correspond to dmidecode output on my physical hardware with the following.
for i in 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 do smbios -t 1 -b $i
done
If the module isn't salvageable on UEFI, maybe I can send out an updated version whenever I upgrade to such a system.
Thanks.
David
[1] https://lists.gnu.org/archive/html/grub-devel/2013-04/binx8am8MvVSh.bin
Quoted 42 lines · David Michael
Hi,
Quoted 3 lines · Holger Goetz
Yes it's towards the right direction. But it is 32bit only if i understand correctly, and it basically is a memory access to fixed/hardcoded MEMORY address (
0x80000001). to pick the veondor id and machine info.It's true that I've mostly been using the module on 32-bit virtual machines, so it hasn't really been tested elsewhere. However, I'm not sure I understand what you mean by the hard-coded memory address. The first function
grub_smbios_locate_epssearches for the SMBIOS entry point structure as described in the spec. The table entries are then read at the table address found in the EPS, not a hard-coded location.Quoted 6 lines
I have only 64bit - UEFI here - therefore the approach w/ first searching the SMBIOS infoblock in memory is probably required. And then properly walk through the info-tables/blocks to get to the UUID entry. It doesn'T need to be a fixed info to be retrieved from the SMBIOS memory - maybe a generic function to query/search a specific entry and return that to be assigned to a variable would be more flexible.
The module's command-line interface does use a (dumb) query/search method. You can specify the desired entry's type and/or handle and the data to retrieve from it. For example the following command prints the machine name (i.e. the string at offset 5 in an entry with type 1).
smbios -t 1 -s 5
I think you may have found the first patch I sent in that old thread, which was for different functionality. The SMBIOS module can be downloaded from the list archive[1].
Unfortunately it doesn't have any convenient functions to output a usable UUID. It shouldn't take much to add one: the variable "entry" in the "main" function is a pointer to the matched entry, so entry[8] through entry[23] is the UUID in a call "smbios -t 1 ...". I've verified these bytes correspond to dmidecode output on my physical hardware with the following.
for i in 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 do smbios -t 1 -b $i
done
Quoted 9 lines
If the module isn't salvageable on UEFI, maybe I can send out an updated version whenever I upgrade to such a system.
Thanks.
David
[1] https://lists.gnu.org/archive/html/grub-devel/2013-04/binx8am8MvVSh.bin
Hi David,
you're right i had only found a small patch using cpuid to retrieve vendor&model .
Looking at the smbios module briefly it looks very much like what i was hoping for.
I'll look into it in detail and will see what needs to be added for the UUID on a x86_64-efi system and let you know.
Thanks,
Holger
Quoted 3 lines
If the module isn't salvageable on UEFI, maybe I can send out an updated version whenever I upgrade to such a system.
Change to retrieve SMBIOS on EFI is minor. See ACPI for comparison.
Hi,
looks i could need some help here.
I've moved the smbios module from commands/i386 to commands and added some casts to make the compiler happy. As I need a x86_64-efi grub.
What i see now is that the "_SM_" signature is not found: "Failed to locate entry point structure" some added grub_dprintf's show all zeros in the memory area. Actually when i use the "dump" command to display the memory in the area that gets swiped (0xf0000..0x10000) it (also) only displays "00"s.
Is there some memory mapping required in x86_64 mode to access the memory area properly? I did cross check w/ the Linux kernel efi code and syslinux all basically do the same searching.
Thanks,
Holger
Quoted 57 lines · David Michael
Hi,
Quoted 3 lines · Holger Goetz
Yes it's towards the right direction. But it is 32bit only if i understand correctly, and it basically is a memory access to fixed/hardcoded MEMORY address (
0x80000001). to pick the veondor id and machine info.It's true that I've mostly been using the module on 32-bit virtual machines, so it hasn't really been tested elsewhere. However, I'm not sure I understand what you mean by the hard-coded memory address. The first function
grub_smbios_locate_epssearches for the SMBIOS entry point structure as described in the spec. The table entries are then read at the table address found in the EPS, not a hard-coded location.Quoted 6 lines
I have only 64bit - UEFI here - therefore the approach w/ first searching the SMBIOS infoblock in memory is probably required. And then properly walk through the info-tables/blocks to get to the UUID entry. It doesn'T need to be a fixed info to be retrieved from the SMBIOS memory - maybe a generic function to query/search a specific entry and return that to be assigned to a variable would be more flexible.
The module's command-line interface does use a (dumb) query/search method. You can specify the desired entry's type and/or handle and the data to retrieve from it. For example the following command prints the machine name (i.e. the string at offset 5 in an entry with type 1).
smbios -t 1 -s 5
I think you may have found the first patch I sent in that old thread, which was for different functionality. The SMBIOS module can be downloaded from the list archive[1].
Unfortunately it doesn't have any convenient functions to output a usable UUID. It shouldn't take much to add one: the variable "entry" in the "main" function is a pointer to the matched entry, so entry[8] through entry[23] is the UUID in a call "smbios -t 1 ...". I've verified these bytes correspond to dmidecode output on my physical hardware with the following.
for i in 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 do smbios -t 1 -b $i
doneIf the module isn't salvageable on UEFI, maybe I can send out an updated version whenever I upgrade to such a system.
Thanks.
David
[1] https://lists.gnu.org/archive/html/grub-devel/2013-04/binx8am8MvVSh.bin
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel
В Tue, 23 Jul 2013 18:24:55 +0200
Holger Goetz <[email protected]> пишет:
Quoted 4 lines
Hi,
looks i could need some help here.
Quoted 11 lines
I've moved the smbios module from commands/i386 to commands and added some casts to make the compiler happy. As I need a x86_64-efi grub. What i see now is that the "_SM_" signature is not found: "Failed to locate entry point structure" some added grub_dprintf's show all zeros in the memory area.
Actually when i use the "dump" command to display the memory in the area that gets swiped (0xf0000..0x10000) it (also) only displays "00"s. Is there some memory mapping required inx86_64mode to access the memory area properly? I did cross check w/ the Linux kernel efi code and syslinux all basically do the same searching.
You need to fetch SMBIOS table address from EFI system table. See as example
https://git.ipxe.org/ipxe.git/blob/HEAD:/src/interface/efi/efi_smbios.c
You can use grub_machine_acpi_get_rsdpv2() as example implementation. Just add SMBIOS GUID and any sanity checks as required.
Quoted 64 lines
Thanks,
HolgerQuoted 57 lines · David Michael
Hi,
Quoted 3 lines · Holger Goetz
Yes it's towards the right direction. But it is 32bit only if i understand correctly, and it basically is a memory access to fixed/hardcoded MEMORY address (
0x80000001). to pick the veondor id and machine info.It's true that I've mostly been using the module on 32-bit virtual machines, so it hasn't really been tested elsewhere. However, I'm not sure I understand what you mean by the hard-coded memory address. The first function
grub_smbios_locate_epssearches for the SMBIOS entry point structure as described in the spec. The table entries are then read at the table address found in the EPS, not a hard-coded location.Quoted 6 lines
I have only 64bit - UEFI here - therefore the approach w/ first searching the SMBIOS infoblock in memory is probably required. And then properly walk through the info-tables/blocks to get to the UUID entry. It doesn'T need to be a fixed info to be retrieved from the SMBIOS memory - maybe a generic function to query/search a specific entry and return that to be assigned to a variable would be more flexible.
The module's command-line interface does use a (dumb) query/search method. You can specify the desired entry's type and/or handle and the data to retrieve from it. For example the following command prints the machine name (i.e. the string at offset 5 in an entry with type 1).
smbios -t 1 -s 5
I think you may have found the first patch I sent in that old thread, which was for different functionality. The SMBIOS module can be downloaded from the list archive[1].
Unfortunately it doesn't have any convenient functions to output a usable UUID. It shouldn't take much to add one: the variable "entry" in the "main" function is a pointer to the matched entry, so entry[8] through entry[23] is the UUID in a call "smbios -t 1 ...". I've verified these bytes correspond to dmidecode output on my physical hardware with the following.
for i in 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 do smbios -t 1 -b $i
doneIf the module isn't salvageable on UEFI, maybe I can send out an updated version whenever I upgrade to such a system.
Thanks.
David
[1] https://lists.gnu.org/archive/html/grub-devel/2013-04/binx8am8MvVSh.bin
_______________________________________________
Grub-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/grub-devel