How to extract SMbios data from saved SPI IC image and insert into factory ROM file?

Discussion in 'BIOS Mods' started by optarix12, Jan 5, 2017.

  1. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    A failed BIOS update left me with a Sapphire PURE Mini E350 that wouldn't even post. I removed the SPI chip from the board, hooked it to a Raspberry Pi, and used first used the linux command "flashrom -r backup.rom" to make an image of the IC. Then I got the factory fresh image from Sapphire's website and used flashrom to write the fresh image to the IC. Now the machine boots again(yay!), but because of the low level write I have lost SMbios data and the machine has lost it's UUID, serial #, and MAC address.

    I would like to restore the UUID, MAC, and Serial # from the saved .ROM file, but am not sure how to do so.

    1.) Can I correctly write parts of the factory fresh ROM image OVER parts of the saved (but corrupt) .ROM file to correct the failed flash and retain all the SMbios info? If so what addresses/offsets do i need to write to/form to correct the flash failure?
    2.) Can I pull the SMBios data out of the corrupted ROM (I would guess it is intact) and correctly place it in the factory fresh ROM? If so, what tool can I use to pull the data out of the corrupt ROM and transplant to the factory fresh ROM? Or where do I read from with a tool like the linux "dd" command?

    I have already tried rewriting entire volumes of the UEFI structure using the linux "dd" command to try and create a working image WITH SMbios data but either the machine booted but still had no SMbios data, or it failed to boot completely with DXE error "DB". It feels like there should be a tool that allow me to extract the UUID from the failed flash ROM image, but most tools for reading SMbios data seem to do it on the live system, and not from a saved file.

    Any help would be much appreciated. I just started learning about BIOSes 2 weeks ago when this failed, but I have learned a lot more now than I thought I would, and still don't feel any closer to getting the SMbios data restored.
     
  2. Lutschpuppe

    Lutschpuppe MDL Junior Member

    Dec 23, 2014
    82
    17
    0
    Which BIOS-Type has is?

    You could read the actual ROM and compare it with hexeditor, perhaps you can find the lost data. Do you know some of the data or could you read them from a sticker on the board?
     
  3. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    #3 optarix12, Jan 5, 2017
    Last edited: Jan 6, 2017
    (OP)
    The BIOS is AMI APTIO IV. I have looked at the file intensely with a hex editor and looked at the 4 partition volumes using UEFItool. However, I am still unable to find where the SMbios data resides exactly because there are many other transient values stored throughout the ROM. Every BIOS setting seems to be saved in the ROM, such as boot devices ordering, options I have selected, and more. Because of this, when I compare the fresh BIOS image with my failed update image, there are many differences instead of just a few.

    As for stickers, I am able to recover the MAC addr from a sticker, but the serial # is incomplete on the sticker (only 13 digits??) and the UUID is only present inside the ROM.

    Do we know if the SMbios data is stored in the PEI volume or the DXE volume? Its a very big file to manually search, so just having somewhere smaller to focus on could help me find it. What is the significance of the four volumes that UEFItool finds? The third is DXE and the fourth is PEI, but what are the first and second volumes for?
     
  4. Lutschpuppe

    Lutschpuppe MDL Junior Member

    Dec 23, 2014
    82
    17
    0
    You can try FD44-editor, but i think it works only for Asus-files.

    Can you upload your backupped romfile?
     
  5. quid

    quid MDL Senior Member

    Oct 22, 2010
    347
    409
    10
    #5 quid, Jan 6, 2017
    Last edited: Jan 6, 2017
    You should also be able to read the SMBIOS data in AMIBCP 4.xx. Usually you can also read the Serial Number/UUID in a hex editor. SMBIOS data for APTIO 4 can then be written back with AMIDEDOS/AMIDEWIN/AMIDEEFI/AMIDELNX/DMIEDIT 2.xx.

    There should be links in the BIOS Tools thread.
     
  6. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    I did try FD44, but it did complain that it was not an ASUS file and therefore could not open it. I will try a couple more things and then I will upload it.
     
  7. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Yes! Thanks! I didn't know what version of BCP to use, and the one I happened to have was not playing nice with the file at all. I found a version of BCP (4.53.0.50) that CAN open it, and I was browsing around the file in no time. Now I just need to know where to read the UUID and serial# values that I need.

    I've also stared at the file in a hex editor for a while, and searched the strings in it for "UUID" and "SERIAL #" using CTRL-F many times but it didn't turn anything up. Since the term UUID and serial are not present in the file, how do I know where they are stored? The file is 130,000 lines, so manual searching has been unsuccessful.

    I feel like this is possible again, but how should I proceed? Should I get the data I need out of AMIBCP, or try and find it in the .ROM file using a hex editor. I'm using Notepad++ and the HEX-editor plugin to do the viewing. Is there another tool that would do a better job than N++?
     
  8. quid

    quid MDL Senior Member

    Oct 22, 2010
    347
    409
    10
    If the backup ROM included the SMBIOS data you should be able to see it in AMIBCP on the DMI Tables tab.
     
  9. Flipp3r

    Flipp3r MDL Expert

    Feb 11, 2009
    1,524
    652
    60
    The MAC address is usually printed somewhere on the motherboard/box/etc.
    Can't you use any of the tools Quid listed to add the MAC. Surly the Serial is printed somewhere too.
    Does the UUID need to be the same? I think anything none zero is ok isn't it??
     
  10. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Well I've rifled through every item under that tab and sadly I don't see anything that resembles UUID or Serial. I see fields like "BIOS information", "System Information", and "Base Board" that I've carefully gone through the contents of with nothing jump out at me. I've attached two images showing what I see. Is the data right in front of me and I just cant see it?
     

    Attached Files:

  11. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Yes I have recovered and re-implanted the MAC addr from a sticker on the board. There is also a serial # on the back of the board 52t1111000028, which is 13 characters. I was led to believe that the serial # was 15 characters, so I was concerned it was incomplete. I also just have some software that licenses to the UUID of the system. When that got cleared in the flash failure, the software now fails to launch throwing errors about the hardware ID changing.

    I can call the company up and get the software license reset, but I figured it would be a fun project to dive into learning more about BIOSes the hardest way possible. So far I've had a good time just learning about whats under the hood by going in the deep end, and reading intel powerpoints about UEFI, PEI, DXE, etc has been interesting.

    I've also seen some guides about re-generating a valid UUID, but all methods seem to be different, and Sapphire as a motherboard vendor is very rare so there is no adjacent information on the subject.
     
  12. Lutschpuppe

    Lutschpuppe MDL Junior Member

    Dec 23, 2014
    82
    17
    0
    Did you also search textg mirrored? In some Asus-backups you will find the position of mac and uuid with "diuu".
     
  13. quid

    quid MDL Senior Member

    Oct 22, 2010
    347
    409
    10
    #13 quid, Jan 7, 2017
    Last edited by a moderator: Apr 20, 2017
    It looks like your backup ROM is missing all the System (Type 1) DMI information. That's where the serial number and UUID is stored:

    Code:
    Type 00 = BIOS Information (Handle 0000h/0x0000/0)
    Offset 04 = BIOS Vendor
    Offset 05 = BIOS Version
    Offset 08 = BIOS Release Date
    Offset 14 = BIOS Major Release
    Offset 15 = BIOS Minor Release
    Type 01 = System Information (Handle 0001h/0x0001/1)
    Offset 04 = System Manufacturer
    Offset 05 = System Product Name/Model
    Offset 06 = System Version
    Offset 07 = System Serial Number
    Offset 08 = System UUID
    Offset 25 = SKU Number
    Offset 26 = Family
    Type 02 = Base Board Information (Handle 0002h/0x0002/2)
    Offset 04 = Base Board Manufcaturer
    Offset 05 = Base Board Product Name/Model
    Offset 06 = Base Board Version
    Offset 07 = Base Board Serial Number
    Offset 08 = Base Board Asset Tag
    Type 03 = System Enclosure Information (Handle 0003h/0x0003/3)
    Offset 04 = System Enclosure Manufacturer
    Offset 06 = System Enclosure Version
    Offset 07 = System Enclosure Serial Number
    Offset 08 = System Enclosure Asset Tag
    If you have a license tied to the UUID you might be able to pull it from the license file. You can add a specific UUID with the AMIDEXXX tools.
     
  14. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Wow I really appreciate the help, how do you know all this stuff?

    This discovery, however, is disappointing. The one thing I needed was lost in the failed flash update! I guess now I have to find the UUID by alternate means as you suggested. The SW dev is pretty easy going, maybe they can tell me how to get the UUID from the license file which appears to be encrypted. Would the windows registry have the UUID that it originally installed to stored somewhere?

    Also, regarding the 13-digit serial #, is it worth plugging that in? Or are serial #s always 15 digits making the sticker incomplete?
     
  15. quid

    quid MDL Senior Member

    Oct 22, 2010
    347
    409
    10
    They're as long as the manufacturer chooses to make them. I'd go ahead and put it in.
     
  16. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Ok, and since this is a homebuilt PC, I want to put the serial # into the "Type 2" Base Board information, right? Not the "Type 1" System Information? I only ask because it would appear that both sections have a serial # entry.
     
  17. quid

    quid MDL Senior Member

    Oct 22, 2010
    347
    409
    10
    Baseboard = Motherboard which should have it's own serial number (and may already be populated).

    I'd put the serial number in Type 1 (System) and Type 3 (System Enclosure = Chassis)
     
  18. klas2264

    klas2264 MDL Novice

    Jan 16, 2011
    5
    0
    0
    #18 klas2264, Jan 17, 2017
    Last edited by a moderator: Apr 20, 2017
    Detailed explanation? Please
     
  19. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    Quid,

    Do you think its possible that I'm potentially using the wrong version of AMIBCP? I only ask because I can see, using a hex editor, values such as "OfflineUniqueIDRandomSeed". I also find it suspect that the values were blank as opposed to just garbled. I may be incorrect in my assessment that it is an APTIO IV bios. If there is a more surefire way to determine the APTIO version, I'm all ears. There is such a dizzying number of tools its hard to know which one is for which purpose, and then again difficult to know which version to use.
     
  20. optarix12

    optarix12 MDL Novice

    Jan 5, 2017
    12
    0
    0
    klas2264,

    The suggestion is saying that since the machine is licensed to the UUID, then the UUID itself might be inside the software license files in plaintext for us to read. In my case, it is clearly encrypted, but I have reached out to the software developer to see if they can extract the UUID for me. I know many license files, such as many of the engineering design tools I use at work, are in plaintext and contain a bounty of information about the system they are licensed to.

    Perhaps something I've installed to the system recorded the UUID to a log or txt file that I can read back. Heck, I'm going to check my various windows logs, such as the windows update and error log files. Maybe I'll get a hit in there for my UUID before I lost it in December.