[LEDE-DEV] [RFC v3 2/2] x86: use sysfs DMI information to populate sysinfo
Dirk Neukirchen
dirkneukirchen at web.de
Wed Jun 1 09:13:11 PDT 2016
On 01.06.2016 17:14, Jo-Philipp Wich wrote:
> Use the DMI data available in sysfs to extract manufacturer and model info
> and write it to /tmp/sysinfo/.
>
> The data will be picked up by board_detect and can be used by e.g. LuCI to
> display a more appropriate model description.
>
> On an APU board the files will contain the following values:
>
> # cat /tmp/sysinfo/model
> PC Engines APU
>
> # cat /tmp/sysinfo/board_name
> pc-engines-apu
>
> Signed-off-by: Jo-Philipp Wich <jo at mein.io>
> ---
> target/linux/x86/base-files/lib/preinit/20_sysinfo | 16 ++++++++++++++++
> 1 file changed, 16 insertions(+)
> create mode 100644 target/linux/x86/base-files/lib/preinit/20_sysinfo
>
> diff --git a/target/linux/x86/base-files/lib/preinit/20_sysinfo b/target/linux/x86/base-files/lib/preinit/20_sysinfo
> new file mode 100644
> index 0000000..0b836ce
> --- /dev/null
> +++ b/target/linux/x86/base-files/lib/preinit/20_sysinfo
> @@ -0,0 +1,16 @@
> +do_sysinfo_x86() {
> + local vendor product boardname
> +
> + vendor="$(cat /sys/devices/virtual/dmi/id/sys_vendor 2>/dev/null)"
> + product="$(cat /sys/devices/virtual/dmi/id/product_name 2>/dev/null)"
> +
> + [ -n "$vendor" -a -n "$product" ] || return
> +
> + boardname="$(printf "%s %s" "$vendor" "$product" | tr 'A-Z' 'a-z' | tr -cs 'a-z0-9_-' '-')"
> +
> + mkdir -p /tmp/sysinfo
> + echo "$boardname" > /tmp/sysinfo/board_name
> + echo "$vendor $product" > /tmp/sysinfo/model
Issue 1:
Maybe change up variable naming to keep more in line with sysfs/DMI standards ?
as future reference: [1]
on my normal(?) Intel ATX motherboard both sysfs entries are empty
but board_name & board_vendor exist: I might expect to get /tmp/sysinfo/board_name
from board_* and not from the sys_* or product* domain
cat /sys/devices/virtual/dmi/id/board_vendor
Intel Corporation
cat /sys/devices/virtual/dmi/id/board_name
DZ77RE-75K
Issue 2:
boardname can end with a dash in QEMU:
cat /sys/devices/virtual/dmi/id/product_name
Standard PC (i440FX + PIIX, 1996)
[1] http://www.dmtf.org/sites/default/files/standards/documents/DSP0134_3.0.0.pdf
More information about the Lede-dev
mailing list