From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1V0BcN-0004aR-VJ for mharc-grub-devel@gnu.org; Fri, 19 Jul 2013 10:25:11 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0BcK-0004X5-4s for Grub-devel@gnu.org; Fri, 19 Jul 2013 10:25:11 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1V0BcD-0005m6-2A for Grub-devel@gnu.org; Fri, 19 Jul 2013 10:25:08 -0400 Received: from moutng.kundenserver.de ([212.227.126.187]:56040) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1V0BcC-0005lu-P5 for Grub-devel@gnu.org; Fri, 19 Jul 2013 10:25:00 -0400 Received: from [10.0.0.100] (p508CDCC5.dip0.t-ipconnect.de [80.140.220.197]) by mrelayeu.kundenserver.de (node=mrbap0) with ESMTP (Nemesis) id 0LgvCQ-1UOQTX1iCc-00oDb0; Fri, 19 Jul 2013 16:24:57 +0200 Message-ID: <51E94C37.4030300@hgsys.de> Date: Fri, 19 Jul 2013 16:24:55 +0200 From: Holger Goetz User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:23.0) Gecko/20100101 Thunderbird/23.0 MIME-Version: 1.0 To: Andrey Borzenkov Subject: Re: Obtaining the UUID of the system for a PXE boot References: <51E67DC2.1090609@hgsys.de> <51E7C5F0.5000308@hgsys.de> <20130718193501.629d9c69@opensuse.site> In-Reply-To: <20130718193501.629d9c69@opensuse.site> Content-Type: text/plain; charset=KOI8-R; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:30NLrHap3lLPNoYm9F+37uU0jskjV8U6s9Z+umVxHdu E7XxeffuXDm2YY6nSwbH1e1tMNA8YzBvkkLlCN9tqLThgjMxY3 BRUEmviQHaB19msjPKxWrAJg9OfvJ77+f84L6kQ+KsoZfKpHxk HR1d9A3514W8xOET5YCc3viA3WhJHpxy4aVwfr+VjwIUiTZWqN 8SZ6id0xy5h8CJmwH88/wwskuB791cIwViUusKhFDDE8sRRU6a 1MwepGy/YOzLpMlEDOTzUa3mQbtCgFSOfQb7GXEze4V3aVmN9K i3zHqq9hObrQGVMTHNqnpatzlQ9vtBUodg7gFyXhNTUFXeQpA= = X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 212.227.126.187 Cc: Grub-devel@gnu.org, fedora.dm0@gmail.com X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jul 2013 14:25:11 -0000 Hi, ok posting on grub-devel list now. Further answer(s) at the bottom. On 18.07.2013 17:35, Andrey Borzenkov wrote: > I guess further discussion should be really moved to grub-devel > > В Thu, 18 Jul 2013 12:39:44 +0200 > Holger Goetz пишет: > >> On 17.07.2013 16:31, Andrey Borzenkov wrote: >>> On Wed, Jul 17, 2013 at 3:19 PM, Holger Goetz wrote: >>>> 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 introduced net_default_mac variable >>>> doesn't work here. Having the UUID as unique system identifyer across NICs >>>> which can be changed would be of big help. >>>> >>>> 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: >>> >>> === >>> 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? >>> >>> >> Hi Andrey, >> >> the system UUID is part of the SMBIOS structure which can be searched >> between 0xf000 and 0x100000 in 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 information > >> 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/systab or /sys/firmware/efi/systab as 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. > > Now, at which step exactly you need to know and use system GUID from SM > BIOS? > > _______________________________________________ > Help-grub mailing list > Help-grub@gnu.org > 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