Skip to content

Conversation

Copy link

Copilot AI commented Nov 2, 2025

ConfigEditor fails on Linux due to Windows-specific SMBIOS code using ctypes.windll.kernel32, which doesn't exist on non-Windows platforms.

Changes

BoardMiscInfo.py

  • Add platform detection to route SMBIOS access appropriately
  • Windows: Use existing GetSystemFirmwareTable via kernel32.dll
  • Linux: Read from /sys/firmware/dmi/tables/DMI
  • Handle platform-specific data format differences (Windows prepends 8-byte header)
  • Wrap all SMBIOS calls in try-except to fail gracefully without permissions

ConfigEditor.py

  • Add null checks before dereferencing SMBIOS data
  • Default Manufacturing_enabled to "Unknown" when SMBIOS unavailable
  • Replace magic number 0x13 with SMBIOS_BIOS_CHAR_EXT2_OFFSET constant

BoardMiscInfo_test.py (new)

  • Unit tests verifying graceful degradation without SMBIOS access

Example

Before:

def locate_smbios_data():
    kernel32 = ctypes.windll.kernel32  # AttributeError on Linux

After:

def locate_smbios_data():
    if platform.system() == "Windows":
        kernel32 = ctypes.windll.kernel32
        # ... existing Windows code
    elif platform.system() == "Linux":
        with open("/sys/firmware/dmi/tables/DMI", "rb") as f:
            return f.read()
Original prompt

This section details on the original issue you should resolve

<issue_title>[Bug]: ConfigEditor only runs on windows</issue_title>
<issue_description>### Is there an existing issue for this?

  • I have searched existing issues

Current Behavior

https://github.com/microsoft/mu_feature_config/blob/main/SetupDataPkg/Tools/BoardMiscInfo.py#L60

Code has leaked into the ConfigEditor that is windows specific, and ConfigEditor is no longer running on linux due to an error in the available packages.

Expected Behavior

ConfigEditor should be able to run under linux.

Steps To Reproduce

Clone repo under a linux os
install pip requirements
attempt to run configeditor and see import error.

Build Environment

- OS(s): linux
- Tool Chain(s): python3
- Targets Impacted:

Version Information

top of tree

Urgency

Low

Are you going to fix this?

I will fix it

Do you need maintainer feedback?

No maintainer feedback needed

Anything else?

No response</issue_description>

<agent_instructions>SetupDataPkg/Tools/ConfigEditor.py needs to be able to run under both a windows envioronment and a linux based environment.

The Smbios code is causing problems. The smbios code needs reworked to support linux environments, and to be able to fail gracefully in both windows and linux environments</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 2 commits November 2, 2025 16:43
- Implement platform detection to handle Windows and Linux differently
- Add Linux SMBIOS data reading from /sys/firmware/dmi/tables/DMI
- Add graceful error handling for both platforms when SMBIOS unavailable
- Update ConfigEditor to handle None return values safely
- Add comprehensive unit tests for BoardMiscInfo module
- Fix all flake8 linting issues

Co-authored-by: apop5 <[email protected]>
- Fix docstring for locate_smbios_data() to accurately reflect return type
- Add named constant SMBIOS_BIOS_CHAR_EXT2_OFFSET to replace magic number 0x13

Co-authored-by: apop5 <[email protected]>
Copilot AI changed the title [WIP] Fix ConfigEditor to run on Linux environment Fix ConfigEditor Linux compatibility: add platform-aware SMBIOS access Nov 2, 2025
Copilot AI requested a review from apop5 November 2, 2025 16:47
@mu-automation mu-automation bot added the language:python Pull requests that update Python code label Nov 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

language:python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ConfigEditor only runs on windows

2 participants