summaryrefslogtreecommitdiffstats
path: root/meta-agl-core/recipes-kernel
AgeCommit message (Collapse)AuthorFilesLines
2022-07-27Add SELinux featureScott Murray2-0/+19
Add agl-selinux feature to enable SELinux support. Notes: - SELinux is in permissive mode by default for now, and using the targeted policy by default. - The linux-yocto specific bbappend in meta-selinux is masked out in favor of adding a more universal kernel configuration fragment with AGL's own scheme. - SELinux specific recipes and bbappends are added via a meta-selinux dynamic-layers addition in meta-agl-core to keep using meta-selinux optional. This will avoid issues with the Yocto autobuilder testing of meta-agl-core. - To avoid the effectively hard-coded autorelabel on first boot, a bbappend is added to the selinux-autorelabel recipe to remove the flag creation. In the off chance that a build happens on a filesystem without xattr support, the logic in the selinux-image bbclass will still touch the /.autorelabel flag and trigger relabeling. - A systemd unit and script are added with a new systemd-selinux-relabel recipe to handle relabeling of some systemd generated files that do not get handled during root filesystem construction. Some of these can be addressed by some upstream tweaks, but /etc/machine-id will always need special handling unless there is a shift to using read-only or stateless root by default. With this workaround we still avoid doing a full relabel and reboot on first boot, which helps simplify CI. Bug-AGL: SPEC-4332 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: Ibf469e11eb3a67709074cc6794b3d12cd5071a90 Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27790 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
2022-07-05x86-extra-graphic-devices: Build vmwgfx driver as built-inMarius Vlad1-1/+1
Rather than building the vmwgfx driver as a module, build it as a built-in in module to avoid a possible probe failure when the driver loads up. This is a temporary work-around which seems to work just fine on VBox but also on qemu. Bug-AGL: SPEC-4449 Signed-off-by: Marius Vlad <marius.vlad@collabora.com> Change-Id: I4f342854df1a0ed2d14ed0ca2bbe754618c61689 Reviewed-on: https://gerrit.automotivelinux.org/gerrit/c/AGL/meta-agl/+/27695 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account ci-image-boot-test: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
2022-03-30meta-agl-core: Update x86 kernel configurationScott Murray1-2/+0
Update x86 kernel configuration fragment that enables extra graphics drivers for removal of GMA600 and GMA3600 options in 5.13. Support for them is now enabled by default when GMA500 is enabled. Bug-AGL: SPEC-3819 Signed-off-by: Scott Murray <scott.murray@konsulko.com> Change-Id: If5bc8d36c4473a0adea71d9456e2938f20143a3d
2022-03-05Disable CONFIG_RELAY on BBE boardJan-Simon Moeller2-0/+2
The config option does provoke an Internal error at runtime. Disable it for the BBE. Bug-AGL: SPEC-4156 Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org> Change-Id: I9c6c8a1279a3c4f40c383e036251f51bb4e9fc8e Reviewed-on: https:
#
# aglwgt bbclass
#
# Jan-Simon Moeller, jsmoeller@linuxfoundation.org
#
# This class expects a "make package" target in the makefile
# which creates the wgt files in the package/ subfolder.
# The makefile needs to use wgtpkg-pack.
#

# 'wgtpkg-pack' in af-main-native is required.
DEPENDS_append = " af-main-native"

# for bindings af-binder is required.
DEPENDS_append = " af-binder"

# for bindings that use the cmake-apps-module
DEPENDS_append = " cmake-apps-module-native"

# for hal bindings genskel is required.
DEPENDS_append = " af-binder-devtools-native"

# Re-enable strip for qmake based projects (default value is "echo")
OE_QMAKE_STRIP = "${STRIP}"

# Extra build arguments passed to the autobuild script invocations
AGLWGT_EXTRA_BUILD_ARGS ?= 'VERBOSE=TRUE BUILD_ARGS="${PARALLEL_MAKE}"'

# CMake based widgets that inherit cmake.bbclass will have the
# following automatically appended to AGLWGT_EXTRA_BUILD_ARGS as
# the value of CONFIGURE_FLAGS.  This definition may need to be
# extended to include more of what is passed in cmake.bbclass's
# do_configure if it is found insufficient.  Using the generated
# toolchain.cmake file does fix issues with respect to finding the
# Qt5 CMake modules that seem difficult to fix otherwise, so at the
# very minimum it should be present.
AGLWGT_CMAKE_CONFIGURE_ARGS ?= "-DCMAKE_TOOLCHAIN_FILE=${WORKDIR}/toolchain.cmake ${EXTRA_OECMAKE}"

# Only widgets with recipe names starting with agl-service- are
# assumed to have tests by default, set this to "1" to force
# building/packaging of the test widget for other widgets.
AGLWGT_HAVE_TESTS ?= "0"

# Whether the widget should be auto-installed on first boot
AGLWGT_AUTOINSTALL ?= "1"

# Signature keys
# These are default keys for development purposes !
# Change it for production.
WGTPKG_AUTOSIGN_0_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/developer.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/developer.cert.pem"
WGTPKG_AUTOSIGN_1_agl-sign-wgts ??= "${WORKDIR}/recipe-sysroot-native/usr/share/afm/keys/platform.key.pem:${WORKDIR}/recipe-sysroot-native/usr/share/afm/certs/platform.cert.pem"

export WGTPKG_AUTOSIGN_0
export WGTPKG_AUTOSIGN_1

python __anonymous () {
    # NOTE: AGLWGT_CMAKE_CONFIGURE_ARGS is not updated directly here,
    #       but via the prefunc below to avoid issues around anonymous
    #       python ordering conflicts with e.g. externalsrc.bbclass.
    if bb.data.inherits_class("cmake", d):
        d.appendVarFlag('do_compile', 'prefuncs', ' aglwgt_cmake_configure')
}

python aglwgt_cmake_configure () {
    # Define CONFIGURE_FLAGS appropriately if cmake.bbclass has been
    # inherited, see description of AGLWGT_CMAKE_CONFIGURE_ARGS above
    # for more details.
    cmake_config_args = d.getVar("AGLWGT_CMAKE_CONFIGURE_ARGS")
    if bb.data.inherits_class("cmake", d) and cmake_config_args:
        d.appendVar("AGLWGT_EXTRA_BUILD_ARGS", ' CONFIGURE_ARGS="' + cmake_config_args + '"')
        d.appendVarFlag("AGLWGT_EXTRA_BUILD_ARGS", "vardeps", " AGLWGT_CMAKE_CONFIGURE_ARGS")
}

# Placeholder to keep things like externalsrc that prefunc or append
# do_configure working as expected.
aglwgt_do_configure() {
    true
}

aglwgt_do_compile() {
    bldcmd=${S}/autobuild/agl/autobuild
    if [ ! -x "$bldcmd" ]; then
        bbfatal "Missing autobuild/agl/autobuild script"
    fi

    if [ "${S}" != "${B}" ]; then
        rm -rf ${B}
        mkdir -p ${B}
        cd ${B}
    fi

    $bldcmd package BUILD_DIR=${B}/build-release ${AGLWGT_EXTRA_BUILD_ARGS}
    $bldcmd package-debug BUILD_DIR_DEBUG=${B}/build-debug ${AGLWGT_EXTRA_BUILD_ARGS}

    if echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
        # Only try building the test widget if there's source for it, to avoid spurious errors
        if [ -f ${S}/test/CMakeLists.txt ]; then
            $bldcmd package-test BUILD_DIR_TEST=${B}/build-test ${AGLWGT_EXTRA_BUILD_ARGS}
        fi

        # The coverage widget should always build
        $bldcmd package-coverage BUILD_DIR_COVERAGE=${B}/build-coverage ${AGLWGT_EXTRA_BUILD_ARGS}
    fi
}

POST_INSTALL_LEVEL ?= "10"
POST_INSTALL_SCRIPT ?= "${POST_INSTALL_LEVEL}-${PN}.sh"

EXTRA_WGT_POSTINSTALL ?= ""

aglwgt_do_install() {
    DEST=release
    if [ "${AGLWGT_AUTOINSTALL_${PN}}" = "0" ]; then
        DEST=manualinstall
    fi

    wgt="$(find ${B}/build-release -maxdepth 1 -name '*.wgt'| head -n 1)"
    if [ -n "$wgt" ]; then
        install -d ${D}/usr/AGL/apps/$DEST
        install -m 0644 $wgt ${D}/usr/AGL/apps/$DEST/
    else
        bbfatal "no package found in widget directory"
    fi

    for t in debug coverage test; do
        if [ "$(find ${B}/build-${t} -maxdepth 1 -name *-${t}.wgt)" ]; then
            install -d ${D}/usr/AGL/apps/${t}
            install -m 0644 ${B}/build-${t}/*-${t}.wgt ${D}/usr/AGL/apps/${t}/
        elif [ "$t" = "debug" ]; then
            # HTML5 widgets complicate things here, need to detect them and
            # not error out in that case.  ATM this requires looking in the
            # config.xml of the release widget.
            rm -rf ${B}/tmp
            unzip $wgt config.xml -d ${B}/tmp
            if [ -f ${B}/tmp/config.xml -a \
                 ! cat ${B}/tmp/config.xml | \
                     grep -q '^[[:space:]]*<content[[:space:]]\+src="[^\"]*"[[:space:]]\+type="text/html"' ]; then
                bbfatal "no package found in ${t} widget directory"
            fi
            rm -rf ${B}/tmp
        elif echo ${BPN} | grep -q '^agl-service-' || [ "${AGLWGT_HAVE_TESTS}" = "1" ]; then
            if [ "$t" = "coverage" -o -f ${S}/test/CMakeLists.txt ]; then
                bbfatal "no package found in ${t} widget directory"
            fi
        fi
    done

    if [ "${AGLWGT_AUTOINSTALL}" != "0" ]; then
        # For now assume autoinstall of the release versions
        rm -rf ${D}/usr/AGL/apps/autoinstall
        ln -sf release ${D}/usr/AGL/apps/autoinstall

        APP_FILES=""
        for file in ${D}/usr/AGL/apps/autoinstall/*.wgt; do
            APP_FILES="${APP_FILES} $(basename $file)";
        done
        install -d ${D}/${sysconfdir}/agl-postinsts
        cat > ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} <<EOF
#!/bin/sh -e
for file in ${APP_FILES}; do
    /usr/bin/afm-install install /usr/AGL/apps/autoinstall/\$file
done
sync
${EXTRA_WGT_POSTINSTALL}
EOF
        chmod a+x ${D}/${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT}
    fi
}

PACKAGES += "${PN}-test ${PN}-debug ${PN}-coverage"

FILES_${PN} += " \
    /usr/AGL/apps/release/*.wgt \
    /usr/AGL/apps/autoinstall \
    /usr/AGL/apps/manualinstall \
    ${sysconfdir}/agl-postinsts/${POST_INSTALL_SCRIPT} \
"
FILES_${PN}-test = "/usr/AGL/apps/test/*.wgt"
FILES_${PN}-debug = "/usr/AGL/apps/debug/*.wgt"
FILES_${PN}-coverage = "/usr/AGL/apps/coverage/*.wgt"

# Test widgets need the parent widget and the test framework
RDEPENDS_${PN}-test = "${PN} afb-test"

EXPORT_FUNCTIONS do_configure do_compile do_install