SHA256
1
0
forked from pool/biosdevname

Accepting request 287188 from Base:System

- biosdevname-pic.patch: make cpuid() not expose %ebx out of 
  assembler, so we can build it with -fPIE.

- Update to version 0.6.1
- Do not disable rule via perl script in .spec file, better use a patch
  (biosdevname_udevrule_rename_all_network_devices.patch)
- Modify configure.ac via sed to make use of %{_udevruledir} from .spec file
- Remove already integrated patches in latest source code:
  Delete biosdevname_v0.5.0_to_git_c140ce659a204d67e4cc.patch
  Delete biosdevname_udevrule_rename_all_network_devices.patch
  Delete fix_several_PCI_root_ports_in_one_bus.patch
  Modify udev-rule-path.patch
  Modify whitelist-dell

OBS-URL: https://build.opensuse.org/request/show/287188
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/biosdevname?expand=0&rev=32
This commit is contained in:
Dominique Leuenberger 2015-02-25 01:16:14 +00:00 committed by Git OBS Bridge
commit cee4d0ad09
11 changed files with 136 additions and 1267 deletions

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2619f42fbfa049930346af6c7f149d2475d93d7cedc4dfab27f18a7b34b0cc69
size 84045

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a295b8d876bb0d75be1b575c414197c629ef132c00b386e2226a7b6324f0bf51
size 160908

28
biosdevname-pic.patch Normal file
View File

@ -0,0 +1,28 @@
Index: biosdevname-0.6.1/src/bios_dev_name.c
===================================================================
--- biosdevname-0.6.1.orig/src/bios_dev_name.c
+++ biosdevname-0.6.1/src/bios_dev_name.c
@@ -114,10 +114,21 @@ static u_int32_t
cpuid (u_int32_t eax, u_int32_t ecx)
{
asm volatile (
- "xor %%ebx, %%ebx; cpuid"
+#ifdef __x86_64__
+ "push %%rbx\n"
+#else
+ "push %%ebx\n"
+#endif
+ "xor %%ebx, %%ebx\n" /* not useful? ebx is overwritten by call? */
+ "cpuid\n"
+#ifdef __x86_64__
+ "pop %%rbx\n"
+#else
+ "pop %%ebx\n"
+#endif
: "=a" (eax), "=c" (ecx)
: "a" (eax)
- : "%ebx", "%edx");
+ : "%edx");
return ecx;
}

View File

@ -1,3 +1,23 @@
-------------------------------------------------------------------
Sat Feb 21 22:49:47 UTC 2015 - meissner@suse.com
- biosdevname-pic.patch: make cpuid() not expose %ebx out of
assembler, so we can build it with -fPIE.
-------------------------------------------------------------------
Thu Jan 22 13:02:08 UTC 2015 - trenn@suse.de
- Update to version 0.6.1
- Do not disable rule via perl script in .spec file, better use a patch
(biosdevname_udevrule_rename_all_network_devices.patch)
- Modify configure.ac via sed to make use of %{_udevruledir} from .spec file
- Remove already integrated patches in latest source code:
Delete biosdevname_v0.5.0_to_git_c140ce659a204d67e4cc.patch
Delete biosdevname_udevrule_rename_all_network_devices.patch
Delete fix_several_PCI_root_ports_in_one_bus.patch
Modify udev-rule-path.patch
Modify whitelist-dell
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Aug 12 16:03:10 UTC 2014 - trenn@suse.de Tue Aug 12 16:03:10 UTC 2014 - trenn@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package biosdevname # spec file for package biosdevname
# #
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -16,9 +16,8 @@
# #
Name: biosdevname Name: biosdevname
Version: 0.5.0 Version: 0.6.1
Release: 0 Release: 0
Summary: Udev helper for naming devices per BIOS names Summary: Udev helper for naming devices per BIOS names
License: GPL-2.0 License: GPL-2.0
@ -30,16 +29,15 @@ Url: http://linux.dell.com/files/biosdevname/
# on LKML. # on LKML.
ExclusiveArch: %{ix86} x86_64 ExclusiveArch: %{ix86} x86_64
Source0: %{name}-%{version}.tar.bz2 Source0: %{name}-%{version}.tar.bz2
Patch1: biosdevname_v0.5.0_to_git_c140ce659a204d67e4cc.patch Patch1: ignore-broken-BIOSes
Patch2: ignore-broken-BIOSes Patch2: whitelist-dell
Patch3: whitelist-dell Patch3: udev-rule-path.patch
Patch4: udev-rule-path.patch Patch4: biosdevname-pic.patch
Patch5: biosdevname_udevrule_rename_all_network_devices.patch
Patch6: fix_several_PCI_root_ports_in_one_bus.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: automake BuildRequires: automake
BuildRequires: pciutils-devel BuildRequires: pciutils-devel
BuildRequires: pkgconfig BuildRequires: pkgconfig
BuildRequires: sed
BuildRequires: zlib-devel BuildRequires: zlib-devel
# to figure out how to name/location of the rules file # to figure out how to name/location of the rules file
BuildRequires: libudev-devel BuildRequires: libudev-devel
@ -66,27 +64,23 @@ You can enable/disable usage of biosdevname with boot option
%patch2 -p1 %patch2 -p1
%patch3 -p1 %patch3 -p1
%patch4 -p1 %patch4 -p1
%patch5 -p1
%patch6 -p1
%build %build
# this is a udev rule, so it needs to live in / rather than /usr sed -i -e 's#@@BIOSDEVNAME_RULEDEST@@#'%{_udevrulesdir}'/71-biosdevname.rules#' configure.ac
./autogen.sh --no-configure autoreconf
%configure --disable-rpath --prefix=/ --bindir=/bin --sbindir=/sbin %configure --disable-rpath --prefix=/ --bindir=/bin --sbindir=/sbin
make %{?_smp_mflags} make %{?_smp_mflags}
%install %install
make install DESTDIR=$RPM_BUILD_ROOT make install DESTDIR=$RPM_BUILD_ROOT
rm %{buildroot}/sbin/%{name}S || : rm %{buildroot}/sbin/%{name}S || :
# remain disabled by default
perl -pi -e 's,^# GOTO,GOTO,g;' \
$RPM_BUILD_ROOT/%{_udevrulesdir}/*-biosdevname.rules
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)
%doc COPYING README %doc COPYING README
/sbin/%{name} /sbin/%{name}
%{_udevrulesdir}/*%{name}.rules %{_udevrulesdir}/*%{name}.rules
%{_mandir}/man1/* %{_mandir}/man1/*
%post %post

View File

@ -1,47 +0,0 @@
From: Tom Gundersen <tgunders@redhat.com>
Subject: Fix double renaming of network interfaces on systems with systemd
References: bnc#869614
Patch-Mainline: yes
Git-commit: 6f7fbcc352aeae08b5cf2a8e608f92abf98529f8
Git-repo: linux.dell.com/biosdevname.git
Signed-off-by: Thomas Renninger <trenn@suse.de>
On systems with systemd, the network interfaces which are renamed by
biosdevname, could get renamed again by systemd. This happens because,
two ADD events get generated for every network interface and on the
second ADD event, the KERNEL!="eth*" check in 71-biosdevname.rules
matches as the interfaces will have em names. As a result, the NAME
gets unset and the interface will get renamed again by
80-net-name-slot.rules again to systemd naming scheme.
This patch addresses the issue by removing the KERNEL!="eth*" check.
Also, this patch enhances the 71-biosdevname.rules to
1. Check the interface type and run biosdevname if it matches ARPHRD_ETHER
2. Skip running biosdevname if the interface is a virtual device such
as vlan etc.
Index: biosdevname-0.5.0/biosdevname.rules.in
===================================================================
--- biosdevname-0.5.0.orig/biosdevname.rules.in
+++ biosdevname-0.5.0/biosdevname.rules.in
@@ -1,7 +1,8 @@
SUBSYSTEM!="net", GOTO="netdevicename_end"
-KERNEL!="eth*", GOTO="netdevicename_end"
ACTION!="add", GOTO="netdevicename_end"
NAME=="?*", GOTO="netdevicename_end"
+ATTR{type}!="1", GOTO="netdevicename_end"
+ENV{DEVTYPE}=="?*", GOTO="netdevicename_end"
# whitelist all Dell systems
ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1"
@@ -21,6 +22,6 @@ LABEL="netdevicename_start"
# using NAME= instead of setting INTERFACE_NAME, so that persistent
# names aren't generated for these devices, they are "named" on each boot.
-PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c", OPTIONS+="string_escape=replace"
+SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c", OPTIONS+="string_escape=replace"
LABEL="netdevicename_end"

File diff suppressed because it is too large Load Diff

View File

@ -1,143 +0,0 @@
From: Jordan Hargrave <Jordan_Hargrave@dell.com>
Subject: From Adrian Huang
References: bnc#890562
Patch-Mainline: yes
Git-commit: 51b8cdb0b60df3baa1be4ea3d8c303b0198465d3
Git-repo: linux.dell.com/biosdevname.git
Signed-off-by: Thomas Renninger <trenn@suse.de>
The command "biosdevname -d" shows the field "SMBIOS Lable" with "MEZZ2" for
all network interfaces when there are two or more PCI root ports in the same
Bus ID/Device ID.
With this patch, the info can be showed correctly if there are two or more PCI
root ports in the same Bus ID/Device ID. For example, the field of the
"p4p1" and "p4p2" would be showed as "MEZZ1".
This patch is based on v0.5.1.
Signed-off-by: Adrian Huang <ahuang12@lenovo.com>
diff --git a/src/dmidecode/dmidecode.c b/src/dmidecode/dmidecode.c
index f766b8c..4acac01 100644
--- a/src/dmidecode/dmidecode.c
+++ b/src/dmidecode/dmidecode.c
@@ -48,6 +48,27 @@ extern int smver_mjr, smver_mnr, is_valid_smbios;
#define dprintf(a...)
#endif
+struct dmi_type9
+{
+ u8 hdrtype;
+ u8 hdrlength;
+ u16 hdrhandle;
+
+ u8 ref;
+ u8 type;
+ u8 buswidth;
+ u8 usage;
+ u8 length;
+ u16 id;
+ u8 flags1;
+ /* 2.1+ */
+ u8 flags2;
+ /* 2.6+ */
+ u16 segment;
+ u8 bus;
+ u8 devfn;
+} __attribute__((packed));
+
static const char *bad_index = "<BAD INDEX>";
/*
@@ -116,8 +137,7 @@ int smbios_setslot(const struct libbiosdevname_state *state,
int domain, int bus, int device, int func,
int type, int slot, int index, const char *label)
{
- struct pci_device *pdev, *n;
- int i;
+ struct pci_device *pdev;
dprintf("setslot: %.4x:%.2x:%.2x.%x = type:%x slot(%2d %2d) %s\n",
domain, bus, device, func, type, slot, index, label);
@@ -128,7 +148,7 @@ int smbios_setslot(const struct libbiosdevname_state *state,
(bus == 0xFF && device == 0x1F && func == 0x7))
{
dprintf(" disabled\n");
- return;
+ return -1;
}
list_for_each_entry(pdev, &state->pci_devices, node) {
@@ -164,7 +184,8 @@ int smbios_setslot(const struct libbiosdevname_state *state,
static void dmi_decode(struct dmi_header *h, u16 ver, const struct libbiosdevname_state *state)
{
u8 *data=h->data;
- int domain, bus, device, function, i;
+
+ int domain, bus, device, function;
switch(h->type)
{
case 9: /* 3.3.10 System Slots */
@@ -173,7 +194,11 @@ static void dmi_decode(struct dmi_header *h, u16 ver, const struct libbiosdevnam
bus = data[0x0F];
device = (data[0x10]>>3)&0x1F;
function = data[0x10] & 7;
- smbios_setslot(state, domain, bus, device, -1,
+
+ /* Root ports can be on multiport device.. scan single */
+ if (!is_root_port(state, domain, bus, device, function))
+ function = -1;
+ smbios_setslot(state, domain, bus, device, function,
0x00, WORD(data+0x09), 0x00,
dmi_string(h, data[0x04]));
}
diff --git a/src/pci.c b/src/pci.c
index 7a7cb36..168cd59 100644
--- a/src/pci.c
+++ b/src/pci.c
@@ -876,3 +876,31 @@ struct pci_device * find_dev_by_pci_name(const struct libbiosdevname_state *stat
return find_pci_dev_by_pci_addr(state, domain, bus, device, func);
}
+
+int is_root_port(const struct libbiosdevname_state *state,
+ int domain, int bus, int device, int func)
+{
+ struct pci_device *pdev;
+ int pos;
+ u16 flag;
+
+ pdev = find_pci_dev_by_pci_addr(state, domain, bus, device, func);
+
+ if (!pdev || !pdev->pci_dev)
+ return 0;
+
+ pos = pci_find_capability(pdev->pci_dev, PCI_CAP_ID_EXP);
+ if (pos != 0) {
+ u8 type;
+
+ flag = pci_read_word(pdev->pci_dev, pos + PCI_EXP_FLAGS);
+
+ type = (flag & PCI_EXP_FLAGS_TYPE) >> 4;
+
+ if (type == PCI_EXP_TYPE_ROOT_PORT)
+ return 1;
+ }
+
+ return 0;
+}
+
diff --git a/src/pci.h b/src/pci.h
index eacb539..ab2eb64 100644
--- a/src/pci.h
+++ b/src/pci.h
@@ -102,5 +102,7 @@ static inline int pci_domain_nr(const struct pci_dev *dev)
}
#endif
+int is_root_port(const struct libbiosdevname_state *state,
+ int domain, int bus, int device, int func);
#endif /* PCI_H_INCLUDED */

View File

@ -1,10 +1,13 @@
--- biosdevname-0.3.8/biosdevname.rules.in.orig 2011-03-09 00:58:08.000000000 +0100 Index: biosdevname-0.6.1/biosdevname.rules.in
+++ biosdevname-0.3.8/biosdevname.rules.in 2011-08-01 15:13:10.000000000 +0200 ===================================================================
@@ -18,6 +18,6 @@ LABEL="netdevicename_start" --- biosdevname-0.6.1.orig/biosdevname.rules.in 2015-01-21 16:00:20.790396992 +0100
+++ biosdevname-0.6.1/biosdevname.rules.in 2015-01-21 16:01:54.926398489 +0100
@@ -19,6 +19,7 @@
# using NAME= instead of setting INTERFACE_NAME, so that persistent # using NAME= instead of setting INTERFACE_NAME, so that persistent
# names aren't generated for these devices, they are "named" on each boot. # names aren't generated for these devices, they are "named" on each boot.
-PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace" -SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical -i %k", NAME="%c", OPTIONS+="string_escape=replace"
+PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6 --nopirq -i %k", NAME="%c", OPTIONS+="string_escape=replace" +SUBSYSTEMS=="pci", PROGRAM="/sbin/biosdevname --policy physical --smbios 2.6
+ --nopirq -i %k", NAME="%c", OPTIONS+="string_escape=replace"
LABEL="netdevicename_end" LABEL="netdevicename_end"

View File

@ -1,16 +1,52 @@
Index: biosdevname-0.5.0/configure.ac Index: biosdevname-0.6.1/configure.ac
=================================================================== ===================================================================
--- biosdevname-0.5.0.orig/configure.ac --- biosdevname-0.6.1.orig/configure.ac 2014-12-01 16:05:47.000000000 +0100
+++ biosdevname-0.5.0/configure.ac +++ biosdevname-0.6.1/configure.ac 2015-01-22 13:24:22.231621837 +0100
@@ -70,7 +70,10 @@ AC_CHECK_FUNCS([dup2 gettimeofday memset @@ -66,20 +66,9 @@
# handles default udev rules as of udev 114 or thereabouts AC_FUNC_VPRINTF
RULEDEST=/lib/udev/rules.d/71-biosdevname.rules AC_CHECK_FUNCS([dup2 gettimeofday memset munmap select socket strcasecmp strchr strdup strerror strncasecmp strpbrk strrchr strstr strtol strtoul])
-# this is ugly, but accounts for SLES 10, Red Hat/Fedora, and Ubuntu
-# handles default udev rules as of udev 114 or thereabouts
-RULEDEST=/lib/udev/rules.d/71-biosdevname.rules
-
-if [[ -e /etc/udev/rules.d/60-net.rules ]]; then -if [[ -e /etc/udev/rules.d/60-net.rules ]]; then
+if [[ -e /usr/lib/udev/rules.d/95-udev-late.rules ]]; then - # RHEL 5 / Fedora
+ # openSUSE 12.3+ - RULEDEST=/etc/udev/rules.d/60-biosdevname.rules
+ RULEDEST=/usr/lib/udev/rules.d/71-biosdevname.rules -elif [[ -e /etc/udev/rules.d/31-network.rules ]]; then
+elif [[ -e /etc/udev/rules.d/60-net.rules ]]; then - # SLES 10
# RHEL 5 / Fedora - RULEDEST=/etc/udev/rules.d/31-biosdevname.rules
RULEDEST=/etc/udev/rules.d/60-biosdevname.rules -elif [[ -e /etc/udev/rules.d/25-iftab.rules ]]; then
elif [[ -e /etc/udev/rules.d/31-network.rules ]]; then - # older Ubuntu
- RULEDEST=/etc/udev/rules.d/25-biosdevname.rules
-fi
+# Only way to make this robust: Replace for each distro with the correct path
+# /lib/udev/rules.d/71-biosdevname.rules
+RULEDEST=@@BIOSDEVNAME_RULEDEST@@
RULEDIR=$(dirname $RULEDEST)
AC_SUBST(RULEDEST, $RULEDEST)
AC_SUBST(RULEDIR, $RULEDIR)
Index: biosdevname-0.6.1/configure
===================================================================
--- biosdevname-0.6.1.orig/configure 2014-12-01 16:06:21.000000000 +0100
+++ biosdevname-0.6.1/configure 2015-01-22 13:48:51.915645203 +0100
@@ -7305,18 +7305,7 @@
# this is ugly, but accounts for SLES 10, Red Hat/Fedora, and Ubuntu
# handles default udev rules as of udev 114 or thereabouts
-RULEDEST=/lib/udev/rules.d/71-biosdevname.rules
-
-if [ -e /etc/udev/rules.d/60-net.rules ]; then
- # RHEL 5 / Fedora
- RULEDEST=/etc/udev/rules.d/60-biosdevname.rules
-elif [ -e /etc/udev/rules.d/31-network.rules ]; then
- # SLES 10
- RULEDEST=/etc/udev/rules.d/31-biosdevname.rules
-elif [ -e /etc/udev/rules.d/25-iftab.rules ]; then
- # older Ubuntu
- RULEDEST=/etc/udev/rules.d/25-biosdevname.rules
-fi
+RULEDEST=@@BIOSDEVNAME_RULEDEST@@
RULEDIR=$(dirname $RULEDEST)
RULEDEST=$RULEDEST

View File

@ -1,8 +1,10 @@
--- biosdevname-0.3.8/biosdevname.rules.in.orig 2011-08-03 18:06:57.000000000 +0200 Index: biosdevname-0.6.1/biosdevname.rules.in
+++ biosdevname-0.3.8/biosdevname.rules.in 2011-08-03 18:07:59.000000000 +0200 ===================================================================
@@ -3,6 +3,9 @@ --- biosdevname-0.6.1.orig/biosdevname.rules.in 2015-01-22 13:18:19.275616067 +0100
ACTION!="add", GOTO="netdevicename_end" +++ biosdevname-0.6.1/biosdevname.rules.in 2015-01-22 13:59:10.967655045 +0100
NAME=="?*", GOTO="netdevicename_end" @@ -4,6 +4,9 @@
ATTR{type}!="1", GOTO="netdevicename_end"
ENV{DEVTYPE}=="?*", GOTO="netdevicename_end"
+# whitelist all Dell systems +# whitelist all Dell systems
+ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1" +ATTR{[dmi/id]sys_vendor}=="Dell*", ENV{UDEV_BIOSDEVNAME}="1"
@ -10,3 +12,14 @@
# kernel command line "biosdevname={0|1}" can turn off/on biosdevname # kernel command line "biosdevname={0|1}" can turn off/on biosdevname
IMPORT{cmdline}="biosdevname" IMPORT{cmdline}="biosdevname"
ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}" ENV{biosdevname}=="?*", ENV{UDEV_BIOSDEVNAME}="$env{biosdevname}"
@@ -12,8 +15,8 @@
ENV{UDEV_BIOSDEVNAME}=="0", GOTO="netdevicename_end"
ENV{UDEV_BIOSDEVNAME}=="1", GOTO="netdevicename_start"
-# uncomment the next line for biosdevname to be off by default
-# GOTO="netdevicename_end"
+# comment the next line for biosdevname to be on by default
+GOTO="netdevicename_end"
LABEL="netdevicename_start"