commit abe04420cfae24bc26df25681ddff7e9c54c49d3 Author: overweight <5324761+overweight@user.noreply.gitee.com> Date: Mon Sep 30 10:37:00 2019 -0400 Package init diff --git a/bugfix-compat_uuid.patch b/bugfix-compat_uuid.patch new file mode 100644 index 0000000..5a1a42f --- /dev/null +++ b/bugfix-compat_uuid.patch @@ -0,0 +1,70 @@ +From be8977d7768279a4c9b66bcc5937fab04f12cb39 Mon Sep 17 00:00:00 2001 +From: guoxiaoqi +Date: Fri, 25 Jan 2019 17:59:09 +0000 +Subject: [PATCH] bugfix-compat_uuid + +Signed-off-by: guoxiaoqi +--- + dmidecode.c | 2 +- + dmiopt.c | 5 +++++ + dmiopt.h | 1 + + 3 files changed, 7 insertions(+), 1 deletion(-) + +diff --git a/dmidecode.c b/dmidecode.c +index a3e9d6c..35c19c2 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -447,7 +447,7 @@ static void dmi_system_uuid(const u8 *p, u16 ver) + * network byte order, so I am reluctant to apply the byte-swapping + * for older versions. + */ +- if (ver >= 0x0206) ++ if (ver >= 0x0206 && !(opt.flags & FLAG_COMPAT_UUID)) + printf("%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x", + p[3], p[2], p[1], p[0], p[5], p[4], p[7], p[6], + p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15]); +diff --git a/dmiopt.c b/dmiopt.c +index 2f285f3..dede0f9 100644 +--- a/dmiopt.c ++++ b/dmiopt.c +@@ -276,6 +276,7 @@ int parse_command_line(int argc, char * const argv[]) + { "oem-string", required_argument, NULL, 'O' }, + { "no-sysfs", no_argument, NULL, 'S' }, + { "version", no_argument, NULL, 'V' }, ++ { "compat-uuid", no_argument, NULL, 'C' }, + { NULL, 0, NULL, 0 } + }; + +@@ -328,6 +329,9 @@ int parse_command_line(int argc, char * const argv[]) + case 'V': + opt.flags |= FLAG_VERSION; + break; ++ case 'C': ++ opt.flags |= FLAG_COMPAT_UUID; ++ break; + case '?': + switch (optopt) + { +@@ -375,6 +379,7 @@ void print_help(void) + " --dump-bin FILE Dump the DMI data to a binary file\n" + " --from-dump FILE Read the DMI data from a binary file\n" + " --no-sysfs Do not attempt to read DMI data from sysfs files\n" ++ " --compat-uuid use compat uuid format with 2.6 SMBIOS specification\n" + " --oem-string N Only display the value of the given OEM string\n" + " -V, --version Display the version and exit\n"; + +diff --git a/dmiopt.h b/dmiopt.h +index 2374637..4ada9ac 100644 +--- a/dmiopt.h ++++ b/dmiopt.h +@@ -46,6 +46,7 @@ extern struct opt opt; + #define FLAG_DUMP_BIN (1 << 4) + #define FLAG_FROM_DUMP (1 << 5) + #define FLAG_NO_SYSFS (1 << 6) ++#define FLAG_COMPAT_UUID (1 << 10) + + int parse_command_line(int argc, char * const argv[]); + void print_help(void); +-- +1.8.3.1 + diff --git a/dmidecode-3.2.tar.xz b/dmidecode-3.2.tar.xz new file mode 100644 index 0000000..0164e27 Binary files /dev/null and b/dmidecode-3.2.tar.xz differ diff --git a/dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch b/dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch new file mode 100644 index 0000000..9a995f5 --- /dev/null +++ b/dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch @@ -0,0 +1,38 @@ +From 74dfb854b8199ddb0a27e89296fa565f4706cb9d Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Wed, 16 Jan 2019 09:04:55 +0100 +Subject: [PATCH 5/8] dmidecode: Add "Logical non-volatile device" to the + memory device types + +When adding support for non-volative memory, we forgot to add +"Logical non-volatile device" to the list of memory types. This +causes NVDIMM modules to show up as . Fix the problem +by adding the missing enumerated value. + +Signed-off-by: Jean Delvare +Reviewed-by: Jerry Hoemann +--- + dmidecode.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 903ef35..91c6f62 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -2471,10 +2471,11 @@ static const char *dmi_memory_device_type(u8 code) + "LPDDR", + "LPDDR2", + "LPDDR3", +- "LPDDR4" /* 0x1E */ ++ "LPDDR4", ++ "Logical non-volatile device" /* 0x1F */ + }; + +- if (code >= 0x01 && code <= 0x1E) ++ if (code >= 0x01 && code <= 0x1F) + return type[code - 0x01]; + return out_of_spec; + } +-- +1.8.3.1 + diff --git a/dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch b/dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch new file mode 100644 index 0000000..685eba2 --- /dev/null +++ b/dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch @@ -0,0 +1,72 @@ +From 82497fa02d60757c2cfa645cf89a79abb1435273 Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Fri, 16 Nov 2018 11:18:25 +0100 +Subject: [PATCH 2/8] dmidecode: Don't use memcpy on /dev/mem on arm64 + +On arm64, calling memcpy on /dev/mem will cause a bus error if the +start and the end of the buffer are not aligned on a 64-bit boundary. +Using option --no-sysfs triggers this. + +Use a slow manual byte-by-byte copy in that case, to prevent the bus +error. This is only a fallback path (at least on Linux) and not +performance-critical anyway, as it is a one-time operation and DMI +tables are usually not too large. + +This fixes bug #55026: +https://savannah.nongnu.org/bugs/index.php?55026 + +Signed-off-by: Jean Delvare +--- + config.h | 5 +++++ + util.c | 14 +++++++++++++- + 2 files changed, 18 insertions(+), 1 deletion(-) + +diff --git a/config.h b/config.h +index e39091f..4237355 100644 +--- a/config.h ++++ b/config.h +@@ -26,4 +26,9 @@ + #define ALIGNMENT_WORKAROUND + #endif + ++/* Avoid unaligned memcpy on /dev/mem */ ++#ifdef __aarch64__ ++#define USE_SLOW_MEMCPY ++#endif ++ + #endif +diff --git a/util.c b/util.c +index eeffdae..04aaadd 100644 +--- a/util.c ++++ b/util.c +@@ -155,6 +155,18 @@ void *read_file(off_t base, size_t *max_len, const char *filename) + return p; + } + ++static void safe_memcpy(void *dest, const void *src, size_t n) ++{ ++#ifdef USE_SLOW_MEMCPY ++ size_t i; ++ ++ for (i = 0; i < n; i++) ++ *((u8 *)dest + i) = *((const u8 *)src + i); ++#else ++ memcpy(dest, src, n); ++#endif ++} ++ + /* + * Copy a physical memory chunk into a memory buffer. + * This function allocates memory. +@@ -214,7 +226,7 @@ void *mem_chunk(off_t base, size_t len, const char *devmem) + if (mmp == MAP_FAILED) + goto try_read; + +- memcpy(p, (u8 *)mmp + mmoffset, len); ++ safe_memcpy(p, (u8 *)mmp + mmoffset, len); + + if (munmap(mmp, mmoffset + len) == -1) + { +-- +1.8.3.1 + diff --git a/dmidecode-Fix-Redfish-Hostname-print-length.patch b/dmidecode-Fix-Redfish-Hostname-print-length.patch new file mode 100644 index 0000000..b7915fd --- /dev/null +++ b/dmidecode-Fix-Redfish-Hostname-print-length.patch @@ -0,0 +1,31 @@ +From fde47bb227b8fa817c88d7e10a8eb771c46de1df Mon Sep 17 00:00:00 2001 +From: Charles Rose +Date: Mon, 22 Oct 2018 09:48:02 +0200 +Subject: [PATCH 1/8] dmidecode: Fix Redfish Hostname print length + +Redfish Hostname prints beyond hlen characters. Fix it. + +Signed-off-by: Charles Rose +Fixes: 78539b06117c ("dmidecode: Parse Modern Management Controller blocks") +Acked-by: Neil Horman +Signed-off-by: Jean Delvare +--- + dmidecode.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/dmidecode.c b/dmidecode.c +index a3e9d6c..7ac6438 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -3609,7 +3609,7 @@ static void dmi_parse_protocol_record(const char *prefix, u8 *rec) + hname = out_of_spec; + hlen = strlen(out_of_spec); + } +- printf("%s\t\tRedfish Service Hostname: %*s\n", prefix, hlen, hname); ++ printf("%s\t\tRedfish Service Hostname: %.*s\n", prefix, hlen, hname); + } + + /* +-- +1.8.3.1 + diff --git a/dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch b/dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch new file mode 100644 index 0000000..0ec97a2 --- /dev/null +++ b/dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch @@ -0,0 +1,53 @@ +From c43afb47fcbadabe2655fe7863a1e2ea9af1446c Mon Sep 17 00:00:00 2001 +From: Jean Delvare +Date: Tue, 15 Jan 2019 12:59:00 +0100 +Subject: [PATCH 3/8] dmidecode: Use the most appropriate unit for cache size + +As newer CPUs have larger and larger cache, using kB to represent the +cache size is getting less convenient. Reuse the same function we have +for system memory size so that large units will be used as +appropriate. For example, a cache size reported as "20 MB" looks nicer +than as "20480 kB". + +Signed-off-by: Jean Delvare +Acked-by: Neil Horman +--- + dmidecode.c | 17 +++++++++++------ + 1 file changed, 11 insertions(+), 6 deletions(-) + +diff --git a/dmidecode.c b/dmidecode.c +index 7ac6438..162e0c5 100644 +--- a/dmidecode.c ++++ b/dmidecode.c +@@ -1560,17 +1560,22 @@ static void dmi_cache_size(u16 code) + + static void dmi_cache_size_2(u32 code) + { ++ u64 size; ++ + if (code & 0x80000000) + { + code &= 0x7FFFFFFFLU; +- /* Use a more convenient unit for large cache size */ +- if (code >= 0x8000) +- printf(" %u MB", code >> 4); +- else +- printf(" %u kB", code << 6); ++ size.l = code << 6; ++ size.h = code >> 26; + } + else +- printf(" %u kB", code); ++ { ++ size.l = code; ++ size.h = 0; ++ } ++ ++ /* Use a more convenient unit for large cache size */ ++ dmi_print_memory_size(size, 1); + } + + static void dmi_cache_types(u16 code, const char *sep) +-- +1.8.3.1 + diff --git a/dmidecode.spec b/dmidecode.spec new file mode 100644 index 0000000..c3b85e6 --- /dev/null +++ b/dmidecode.spec @@ -0,0 +1,58 @@ +Name: dmidecode +Version: 3.2 +Release: 2 +Epoch: 1 +Summary: DMI data report tool + +License: GPLv2+ +URL: https://www.nongnu.org/dmidecode/ +Source0: http://download.savannah.gnu.org/releases/dmidecode/%{name}-%{version}.tar.xz + +Patch6000: bugfix-compat_uuid.patch +Patch6001: dmidecode-Fix-Redfish-Hostname-print-length.patch +Patch6002: dmidecode-Don-t-use-memcpy-on-dev-mem-on-arm64.patch +Patch6003: dmidecode-Use-the-most-appropriate-unit-for-cache-si.patch +Patch6004: dmidecode-Add-Logical-non-volatile-device-to-the-mem.patch + +BuildRequires: make gcc xz + +ExclusiveArch: %{ix86} x86_64 ia64 aarch64 amd64 + +%description +Dmidecode reports information about your system's hardware as described +in your system BIOS according to the SMBIOS/DMI standard (see a sample +output). This information typically includes system manufacturer, model +name, serial number, BIOS version, asset tag as well as a lot of other +details of varying level of interest and reliability depending on the +manufacturer. This will often include usage status for the CPU sockets, +expansion slots (e.g. AGP, PCI, ISA) and memory module slots, and the +list of I/O ports (e.g. serial, parallel, USB). + +DMI data can be used to enable or disable specific portions of kernel code +depending on the specific hardware. Thus, one use of dmidecode is for kernel +developers to detect system "signatures" and add them to the kernel source code +when needed. + +%prep +%autosetup -n %{name}-%{version} -p1 + + +%build +# biosdecode ownership vpddecode programs are only useful on x86, +# so Makefile atuo compiled target programs depend on arch. +make %{?_smp_mflags} CFLAGS="%{__global_cflags}" LDFLAGS="%{__global_ldflags}" + + +%install +%make_install prefix=%{_prefix} + + +%files +%license LICENSE +%{_sbindir}/* +%{_docdir}/%{name}/* +%{_mandir}/man8/*.8.gz + +%changelog +* Wed Aug 21 2019 openEuler Buildteam - 1:3.2-2 +- Package init