descriptionMuen hardware config generator
ownerReto Buerki
last changeFri, 21 Apr 2017 09:31:40 +0000 (11:31 +0200)
readme

Mugenhwcfg

Overview

mugenhwcfg is a Python tool developed to support the Muen Project. It retrieves hardware information from a running Linux system and produces a Muen hardware configuration file in XML format.

Requirements

mugenhwcfg is written mainly for Python version 2.7.6, and might not work correctly on Python 3.

mugenhwcfg requires iasl (part of the acpica-tools package) to be installed. You can get it by from its website or through Ubuntu's Advanced Packaging Tool:

$ sudo apt-get install acpica-tools

Optionally, mugenhwcfg also uses the Python Package lxml to format the generated XML file. You can get it (if not yet installed) with either:

$ sudo apt-get install python-lxml

or

$ sudo pip install lxml

Installing mugenhwcfg

mugenhwcfg can be obtained from the repository with the command:

$ git clone --recursive http://git.codelabs.ch/git/muen/mugenhwcfg.git

This clones all submodules required by the tool as well as the source files.

Running mugenhwcfg

After installation, mugenhwcfg can be run with the following commands:

$ sudo modprobe msr
$ cd mugenhwcfg
$ sudo ./mugenhwcfg.py

Root user permissions are necessary to allow mugenhwcfg to examine system data.

Output

After running the tool, the output XML file will be produced in the tool directory and will be named output.xml.

Any errors encountered by the tool will (by default) prevent the output file from being generated. The tool can attempt to generate an output file anyway (for manual editing) using the -f / --force argument.

Updating

As the tool relies on external files (such as the pci.ids repository), some of these files might need to be updated to retrieve accurate information. You can utilise the -u / --update argument to download and update these files automatically.

Optional Arguments

More about mugenhwcfg

How it works

mugenhwcfg scans Linux system files (/sys, /proc, /dev) for processor, memory and device information needed by the Muen kernel. It then fills up PyXB Python objects with the information and creates an XML file.

Use of PyXB Library

mugenhwcfg utilises the PyXB package to generate a Python binding file from a hardware configuration schema file which should be included with the tool distribution at /schema/hardware_config.xsd. This generation happens the first time the tool is run, at the location /generated/hardware_config.py. This binding file is then used to create and fill objects that are later converted to XML in the output.

The PyXB package is included as a submodule in the mugenhwcfg repository at: /contrib/pyxb

Use of pci.ids

To decode device names, mugenhwcfg parses the pci.ids file in /data/pci.ids. pci.ids is a repository of PCI identification numbers maintained by the good people here.

Running Tests

The mugenhwcfg tests require the Python packages pytest and mock. Install them with either:

$ sudo apt-get install python-pytest python-mock

or

$ sudo pip install pytest
$ sudo pip install mock

After installing the required dependencies, the tests can be run with:

$ py.test

To produce a coverage report, execute the following commands:

$ sudo apt-get install python-pytest-cov
$ py.test --cov=src

Append the --cov-report html option if a html report instead of terminal output is desired.

Additional information on generated hardware file

mugenhwcfg alters the following in the XML output hardware file to match the requirements of the Muen Kernel:

Memory
Devices (PCI)
Devices (Serial)

Contact

You can drop an email to the Muen development team's mailing list at

muen-dev@googlegroups.com

or contact the author (Chen Chin Jieh) directly at

chinjieh@gmail.com

Acknowledgements

Big thanks to Adrian and Reto for their unending guidance and advice!

shortlog
2017-04-21 Adrian-Ken... README: Use acpica-tools instead of iasl package master
2017-03-30 Reto BuerkiFilter out memory blocks with zero size
2017-03-30 Reto BuerkiFilter out memory blocks with zero size
2017-03-30 Reto BuerkiAdd new memory block to memorycreator test data
2017-03-30 Reto BuerkiAssert len of block list in memmapextraction test
2017-02-06 Adrian-Ken... Update pci.ids to version 2017.01.28
2017-02-06 Adrian-Ken... Update pci.ids to version 2017.01.28
2017-01-11 Reto BuerkiAdd system board device to generated config
2017-01-11 Reto BuerkiAdd pm1a_cnt_slp_typ capability to system board
2017-01-11 Reto BuerkiRename poweroff port to 'pma1_cnt'
2017-01-11 Reto BuerkiAppend ACPI poweroff port to system board device
2017-01-11 Reto BuerkiDeclare path to FADT in paths.py
2017-01-11 Reto BuerkiImplement ACPI FADT parser
2017-01-10 Reto BuerkiDrop unneeded DMAR_TEMP path from paths.py
2017-01-10 Reto BuerkiAdd system board device to generated config
2017-01-10 Reto BuerkiFactor out ACPI decompile_table function to acpi.py
...
tags
21 months ago v0.5 Mugenhwcfg version 0.5
heads
2 months ago devel
7 months ago master