I'm playing around with rewriting efibootmgr, and I want it to use libblkid to figure out how to label disks. Unfortunately, there's a bit of byte order confusion. libblkid treats gpt guids like they're big-endian, which seems to contradict the spec and all other software. gpt.c does: blkid_partition_set_uuid(par, (const unsigned char *) &e->unique_partition_guid); blkid_partition_set_type_uuid(par, (const unsigned char *) &e->partition_type_guid); which assumes that the guids are stored in big-endian (i.e. sane) byte order. Unfortunately, the rest of the world seems to disagree. - The UEFI 2.3 spec says (section 1.8.1) "the low-order byte of a multibyte data item in memory is at the lowest address" and section 6.3 says: typedef struct { UINT32 Data1; UINT16 Data2; UINT16 Data3; UINT8 Data4[8]; } EFI_GUID; This means that the the first three fields should be byte-swapped. Wikipedia's page on GPT agrees. Finally, blkid seems to be alone among the standard tools in its interpretation: # sgdisk -i 1 /dev/sda Partition GUID code: C12A7328-F81F-11D2-BA4B-00A0C93EC93B (EFI System) Partition unique GUID: 61FAE219-E1B7-492F-A147-5FAA268BECBF [...] # efibootmgr -v [...] Boot0000* Linux HD(1,800,80000,61fae219-e1b7-492f-a147-5faa268becbf)File(\EFI\redhat\grub.efi) [...] # blkid -p /dev/sda1 -i [...] PART_ENTRY_SCHEME=gpt PART_ENTRY_UUID=19e2fa61-b7e1-2f49-a147-5faa268becbf PART_ENTRY_TYPE=28732ac1-1ff8-d211-ba4b-00a0c93ec93b UEFI spec 2.3 section 5.3 gives the EFI system partition guid as "C12A7328-F81F-11D2-BA4B-00A0C93EC93B", which agrees with the little endian order. Should I submit a patch to fix up the byte order? I don't think that fixing this will break anyone's boot since findfs and friends seem to use UUID not PART_ENTRY_UUID. (I think we should at least fix PART_ENTRY_TYPE -- anyone who looks up the types in a table will get confused.) --Andy -- To unsubscribe from this list: send the line "unsubscribe util-linux" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html