Add Xorg driver ABI dependencies
cover Add Xorg driver ABI dependencies
Hi,
The xserver driver ABIs frequently change and as such are versioned. It's entirely possible to build an image with an Xserver with ABI 13 but drivers using ABI 11, and in this situation the server won't load the modules. These ABI versions have no relationship to the package version so the existing dependencies can't be made stricter.
The solution Debian (and probably others) take is to add versioned Provides to the server, and dependencies on those provides in the drivers. Then ABI version mismatches become package dependencies errors and are caught at image construction time, not boot time.
Ross
The following changes since commit caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:
kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26 +0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contrib ross/xorg
for you to fetch changes up to 4bb20610fa08a2daf71f59b42929181500345e75:
insane: add a check for Xorg driver ABI dependencies (2012-10-22 09:26:20 +0100)
----------------------------------------------------------------
Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI version
xorg-driver: add xserver driver ABI dependencies
insane: add a check for Xorg driver ABI dependencies
meta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)
Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI version
xorg-driver: add xserver driver ABI dependencies
insane: add a check for Xorg driver ABI dependencies
meta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)
Signature · 1 line
1.7.10
PATCH 1/3 xserver-xorg: add runtime provides for the driver ABI version
The xserver driver ABIs can and do change in a way that is unrelated to the version of xserver, so it's entirely possible to build an image that has a mismatch between the server ABI version and the version that the drivers were built against. xserver detects this and refuses to load the modules.
By adding RPROVIDEs to the xserver package that describe the ABI versions it has (such as xorg-abi-video-13, xorg-abi-input-11), drivers can RDEPEND on the version that they were built against. This means that when the ABIs change, there will be package dependency errors at image time instead of images that build fine but don't work.
--- .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-xserver/xserver-xorg.inc +26 -1
@@ -13,7 +13,7 @@ PROVIDES = "virtual/xserver-xf86" PROVIDES += "virtual/xserver" PE = "2" -INC_PR = "r2" +INC_PR = "r3" XORG_PN = "xorg-server" SRC_URI = "${XORG_MIRROR}/individual/xserver/${XORG_PN}-${PV}.tar.bz2"
@@ -132,3 +132,28 @@ do_install_append () { # Its assumed base-files creates this for us rmdir ${D}${localstatedir}/log/ } + +# Add runtime provides for the ABI versions of the video and input subsystems, +# so that drivers can depend on the relevant version. +python populate_packages_prepend() { + import subprocess + + # Set PKG_CONFIG_PATH so pkg-config looks at the .pc files that are going + # into the new package, not the staged ones. + newenv = dict(os.environ) + newenv["PKG_CONFIG_PATH"] = d.expand("${PKGD}${libdir}/pkgconfig/") + + def get_abi(name): + abis = { + "video": "abi_videodrv", + "input": "abi_xinput" + } + p = subprocess.Popen(args="pkg-config --variable=%s xorg-server" % abis[name], + shell=True, env=newenv, stdout=subprocess.PIPE) + output = p.communicate()[0] + return "xorg-abi-%s-%s" % (name, output.split(".")[0]) + + pn = d.getVar("PN", True) + d.appendVar("RPROVIDES_" + pn, " " + get_abi("input")) + d.appendVar("RPROVIDES_" + pn, " " + get_abi("video")) +}
Signature · 1 line
1.7.10
PATCH 2/3 xorg-driver: add xserver driver ABI dependencies
At build time extract the xserver driver ABI versions that we're building against and add RDEPENDs on them, so the driver isn't used against an xserver with a different ABI (which won't work).
--- .../xorg-driver/xorg-driver-common.inc | 17 ++++++++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 ++++ .../xorg-driver/xorg-driver-video.inc | 3 +++ 3 files changed, 23 insertions(+), 1 deletion(-)
meta/recipes-graphics/xorg-driver/xorg-driver-common.inc +16 -1
@@ -5,7 +5,7 @@ SECTION = "x11/drivers" LICENSE = "MIT-X" PE = "2" -INC_PR = "r17" +INC_PR = "r18" DEPENDS = "virtual/xserver xproto randrproto util-macros"
@@ -31,3 +31,18 @@ do_configure_prepend () { do_install_append() { find ${D}${libdir}/xorg/modules -regex ".*\.la$" | xargs rm -f -- } + +# Function to add the relevant ABI dependency to drivers, which should be called +# from a populate_packages append/prepend. +def add_abi_depends(d, name): + # Map of ABI names exposed in the dependencies to pkg-config variables + abis = { + "video": "abi_videodrv", + "input": "abi_xinput" + } + + output = os.popen("pkg-config xorg-server --variable=%s" % abis[name]).read() + abi = "xorg-abi-%s-%s" % (name, output.split(".")[0]) + + pn = d.getVar("PN", True) + d.appendVar('RDEPENDS_' + pn, ' ' + abi)
meta/recipes-graphics/xorg-driver/xorg-driver-input.inc +4 -0
@@ -2,5 +2,9 @@ include xorg-driver-common.inc DEPENDS += "inputproto kbproto " +python populate_packages_prepend() { + add_abi_depends(d, "input") +} + FILES_${PN} += " ${libdir}/xorg/modules/input/*.so" FILES_${PN}-dbg += " ${libdir}/xorg/modules/input/.debug"
meta/recipes-graphics/xorg-driver/xorg-driver-video.inc +3 -0
@@ -2,3 +2,6 @@ include xorg-driver-common.inc DEPENDS =+ "renderproto videoproto xextproto fontsproto" +python populate_packages_prepend() { + add_abi_depends(d, "video") +}
Signature · 1 line
1.7.10
PATCH 3/3 insane: add a check for Xorg driver ABI dependencies
In reply to Ross BurtonNow that xserver provides driver ABI names, all drivers should depend on the ABI version that they have been built against.
All drivers that include xorg-driver-input.inc or xorg-driver-video.inc will get these automatically, so this should only impact binary drivers.
--- meta/classes/insane.bbclass | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-)
meta/classes/insane.bbclass +19 -1
@@ -109,7 +109,7 @@ def package_qa_get_machine_dict(): # Currently not being used by default "desktop" -WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir" +WARN_QA ?= "ldflags useless-rpaths rpaths unsafe-references-in-binaries unsafe-references-in-scripts staticdev libdir xorg-driver-abi" ERROR_QA ?= "dev-so debug-deps dev-deps debug-files arch la2 pkgconfig la perms dep-cmp" ALL_QA = "${WARN_QA} ${ERROR_QA}"
@@ -496,6 +496,24 @@ def package_qa_check_buildpaths(path, name, d, elf, messages): if tmpdir in file_content: messages.append("File %s in package contained reference to tmpdir" % package_qa_clean_path(path,d)) + +QAPATHTEST[xorg-driver-abi] = "package_qa_check_xorg_driver_abi" +def package_qa_check_xorg_driver_abi(path, name, d, elf, messages): + """ + Check that all packages containing Xorg drivers have ABI dependencies + """ + + # Skip dev, dbg or nativesdk packages + if name.endswith("-dev") or name.endswith("-dbg") or name.startswith("nativesdk-"): + return + + driverdir = d.expand("${libdir}/xorg/modules/drivers/") + if driverdir in path and path.endswith(".so"): + for rdep in bb.utils.explode_deps(d.getVar('RDEPENDS_' + name, True) or ""): + if rdep.startswith("xorg-abi-"): + return + messages.append("Package %s contains Xorg driver (%s) but no xorg-abi- dependencies" % (name, os.path.basename(path))) + def package_qa_check_license(workdir, d): """ Check for changes in the license files
Signature · 1 line
1.7.10
Saul Wold
AppliedQuoted 23 lines · Ross Burton
Hi,
The xserver driver ABIs frequently change and as such are versioned. It's entirely possible to build an image with an Xserver with ABI 13 but drivers using ABI 11, and in this situation the server won't load the modules. These ABI versions have no relationship to the package version so the existing dependencies can't be made stricter.
The solution Debian (and probably others) take is to add versioned Provides to the server, and dependencies on those provides in the drivers. Then ABI version mismatches become package dependencies errors and are caught at image construction time, not boot time.
Ross
The following changes since commit
caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26 +0100)are available in the git repository at:
git://git.yoctoproject.org/poky-contribross/xorg
Quoted 7 lines
for you to fetch changes up to
4bb20610fa08a2daf71f59b42929181500345e75:insane: add a check for Xorg driver ABI dependencies (2012-10-22 09:26:20 +0100)
----------------------------------------------------------------
Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI version
Merged into OE-Core
Quoted 1 line
xorg-driver: add xserver driver ABI dependencies
Not merged yet.
Quoted 2 lines
insane: add a check for Xorg driver ABI dependencies
Merged into OE-Core
Thanks
Sau!
Quoted 19 lines
meta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI version
xorg-driver: add xserver driver ABI dependencies
insane: add a check for Xorg driver ABI dependenciesmeta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)
Saul Wold
AppliedQuoted 36 lines · Saul Wold
Quoted 35 lines · Ross Burton
Hi,
The xserver driver ABIs frequently change and as such are versioned. It's
entirely possible to build an image with an Xserver with ABI 13 but drivers
using ABI 11, and in this situation the server won't load the modules. These
ABI versions have no relationship to the package version so the existing dependencies can't be made stricter.The solution Debian (and probably others) take is to add versioned Provides to
the server, and dependencies on those provides in the drivers. Then ABI version
mismatches become package dependencies errors and are caught at image construction time, not boot time.Ross
The following changes since commit
caba9cbfce09f19eb27f4c6615c0c5c48e1a2952:kernel.bbclass: add kernel-modules to PACKAGES (2012-10-19 23:06:26+0100)
are available in the git repository at:
git://git.yoctoproject.org/poky-contribross/xorgfor you to fetch changes up to
4bb20610fa08a2daf71f59b42929181500345e75:insane: add a check for Xorg driver ABI dependencies (2012-10-22
09:26:20 +0100)
Quoted 7 lines
Quoted 3 lines
----------------------------------------------------------------
Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI versionMerged into OE-Core
Quoted 1 line
xorg-driver: add xserver driver ABI dependencies
Not merged yet.
Merged into OE-Core
Thanks
Sau!
Quoted 36 lines
Quoted 2 lines
insane: add a check for Xorg driver ABI dependencies
Merged into OE-Core
Thanks
Sau!Quoted 14 lines
meta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)Ross Burton (3):
xserver-xorg: add runtime provides for the driver ABI version
xorg-driver: add xserver driver ABI dependencies
insane: add a check for Xorg driver ABI dependenciesQuoted 9 lines
meta/classes/insane.bbclass | 20 ++++++++++++++- .../xorg-driver/xorg-driver-common.inc | 17 +++++++++++- .../xorg-driver/xorg-driver-input.inc | 4 +++ .../xorg-driver/xorg-driver-video.inc | 3 +++ .../recipes-graphics/xorg-xserver/xserver-xorg.inc | 27 +++++++++++++++++++- 5 files changed, 68 insertions(+), 3 deletions(-)_______________________________________________
Openembedded-core mailing list
[email protected]
http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core