anchor.diff:  
       cp -a --no-preserve=ownership ${S}/${PV}/${ARCH_PLATFORM_DIR}/common/*.so* ${D}${libdir}
   
  -    if [ "${USE_WL}" = "yes" ]; then
  -	install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/
  -	install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc
  -	install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/libMali.so.8.0 ${D}${libdir}/wayland/libMali.so.8.0
  -	ln -snf wayland/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0
  -    elif [ "${USE_X11}" = "yes" ]; then
  -	install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/libMali.so.8.0 ${D}${libdir}/x11/libMali.so.8.0
  -	ln -snf x11/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0
  -    elif [ "${USE_FB}" = "yes" ]; then
  -	install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/libMali.so.8.0 ${D}${libdir}/fbdev/libMali.so.8.0
  -	ln -snf fbdev/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0
  -    else
  -	install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/libMali.so.8.0 ${D}${libdir}/headless/libMali.so.8.0
  -	ln -snf headless/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0
  -    fi
   
  -    if ${@bb.utils.contains('DISTRO_FEATURES', 'x11', 'false', 'true', d)}; then
  -        sed -i -e 's/^#if defined(MESA_EGL_NO_X11_HEADERS)$/#if (1)/' ${D}${includedir}/EGL/eglplatform.h
  -    fi
  +    install -m 0644 ${S}/${PV}/glesHeaders/GBM/gbm.h ${D}${includedir}/
  +    install -m 0644 ${WORKDIR}/gbm.pc ${D}${libdir}/pkgconfig/gbm.pc
  +    install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/wayland/libMali.so.8.0 ${D}${libdir}/wayland/libMali.so.8.0
  +    install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/x11/libMali.so.8.0 ${D}${libdir}/x11/libMali.so.8.0
  +    install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/fbdev/libMali.so.8.0 ${D}${libdir}/fbdev/libMali.so.8.0
  +    install -Dm 0644 ${S}/${PV}/${ARCH_PLATFORM_DIR}/headless/libMali.so.8.0 ${D}${libdir}/headless/libMali.so.8.0
  +
  +    # We need to have one of the libraries available at build time for the linker
  +    ln -snf x11/libMali.so.8.0 ${D}${libdir}/libMali.so.8.0
  +}
  +
  +
  +# We need separate packages to provide multiple alternatives, at this point we install
  +# everything on the default one but that can be split if necessary
  +PACKAGES += "${PN}-x11 ${PN}-fbdev ${PN}-wayland ${PN}-headless"
  +
  +# This is default/common for all alternatives
  +ALTERNATIVE_LINK_NAME[libmali-xlnx] = "${libdir}/libMali.so.8.0"
  +
  +
  +# Declare alternatives and corresponding library location
  +ALTERNATIVE_${PN}-x11 = "libmali-xlnx"
  +ALTERNATIVE_TARGET_libmali-xlnx-x11[libmali-xlnx] = "${libdir}/x11/libMali.so.8.0"
  +
  +ALTERNATIVE_${PN}-fbdev = "libmali-xlnx"
  +ALTERNATIVE_TARGET_libmali-xlnx-fbdev[libmali-xlnx] = "${libdir}/fbdev/libMali.so.8.0"
  +
  +ALTERNATIVE_${PN}-wayland = "libmali-xlnx"
  +ALTERNATIVE_TARGET_libmali-xlnx-wayland[libmali-xlnx] = "${libdir}/wayland/libMali.so.8.0"
  +
  +ALTERNATIVE_${PN}-headless = "libmali-xlnx"
  +ALTERNATIVE_TARGET_libmali-xlnx-headless[libmali-xlnx] = "${libdir}/headless/libMali.so.8.0"
  +
  +# Set priorities according to what we prveiously defined
  +ALTERNATIVE_PRIORITY_libmali-xlnx-x11[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "x11", "20", "10", d)}"
  +ALTERNATIVE_PRIORITY_libmali-xlnx-fbdev[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "fbdev", "20", "10", d)}"
  +ALTERNATIVE_PRIORITY_libmali-xlnx-wayland[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "wayland", "20", "10", d)}"
  +ALTERNATIVE_PRIORITY_libmali-xlnx-headless[libmali-xlnx] = "${@bb.utils.contains("MALI_BACKEND_DEFAULT", "headless", "20", "10", d)}"
  +
  +
  +# Package gets renamed on the debian class, but we want to keep -xlnx
  +DEBIAN_NOAUTONAME_libmali-xlnx = "1"
  +
  +# Update alternatives will actually have separate postinst scripts (one for each package)
  +# This wont work for us, so we create a common postinst script and we pass that as the general
  +# libmali-xlnx postinst script, but we defer execution to run on first boot (pkg_postinst_ontarget).
  +# This will avoid ldconfig removing the symbolic links when creating the root filesystem.
  +python populate_packages_updatealternatives_append () {
  +    # We need to remove the 'fake' libmali-xlnx before creating any links
  +    libdir = d.getVar('libdir')
  +    common_postinst = "#!/bin/sh\nrm " + libdir + "/libMali.so.8.0\n"
  +    for pkg in (d.getVar('PACKAGES') or "").split():
  +        # Not all packages provide an alternative (e.g. ${PN}-lic)
  +        postinst = d.getVar('pkg_postinst_%s' % pkg)
  +        if postinst:
  +            old_postinst = postinst
  +            new_postinst = postinst.replace('#!/bin/sh','')
  +            common_postinst += new_postinst
  +    d.setVar('pkg_postinst_ontarget_%s' % 'libmali-xlnx', common_postinst)
   }
   
   
  
positive.code: 
  S = "${WORKDIR}/git"
  
  X11RDEPENDS = "libxdamage libxext libx11 libdrm libxfixes"
  X11DEPENDS = "libxdamage libxext virtual/libx11 libdrm libxfixes"
  
  RDEPENDS_${PN} = " \
  	kernel-module-mali \
  	${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11RDEPENDS}', '', d)} \
  	"
  
  DEPENDS = "\
  	${@bb.utils.contains('DISTRO_FEATURES', 'x11', '${X11DEPENDS}', '', d)} \
  	${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'wayland libdrm', '', d)} \
  	"
  
  USE_X11 = "${@bb.utils.contains("DISTRO_FEATURES", "x11", "yes", "no", d)}"
  USE_FB = "${@bb.utils.contains("DISTRO_FEATURES", "fbdev", "yes", "no", d)}"
  USE_WL = "${@bb.utils.contains("DISTRO_FEATURES", "wayland", "yes", "no", d)}"
  
  do_install() {
      #Identify the ARCH type
  
negative.code: LICENSE = "Proprietary"
  LIC_FILES_CHKSUM = "file://EULA;md5=82e466d0ed92c5a15f568dbe6b31089c"
  
  inherit distro_features_check update-alternatives
  
  REQUIRED_DISTRO_FEATURES = "x11 fbdev wayland"
  
  PROVIDES += "virtual/libgles1 virtual/libgles2 virtual/egl virtual/libgbm"
  
  