From 1c46fcd4f482be6c114a815d9501adf4b7588d2c Mon Sep 17 00:00:00 2001 From: Takashi Matsuzawa Date: Wed, 28 Jun 2017 15:55:13 +0900 Subject: Fix i.MX6 Bug-AGL: SPEC-704 This is part of the fixe to make i.MX6 buildable again. Following fixes are included in this change: - adding build target imx6qsabreauto - fixing qt5.8 build error - refine bblayers.conf layer order (for dynamic-layers) - meta-fsl-arm -> meta-freescale layer name change - weston.ini lines (use fbdev-backend.so) - /dev/galcore permission (by /etc/udev/rules.d/zz-dri.rules) - kernel configuraion to include smack, etc. Follwings are stil not addressed yet: - bblayer.conf layer order still have issue re. dynamic-layers - built and booted on imx6qsabreauto only yet. following existing community boards may need update (i have imx6qsabrelite, but no notrogen6x) Note, this fix is prepared independently of nxp or fsl-community, who should follow-up if there are mistakes to be fixed, or updates that they find needed. Update: Refined on review comment regarding tune settings and kernel configurations. The board successfully boots and shows AGL homescreen. But I found I still have problem with USB. lsusb says 'unable to initialize libusb: -99' error which I am still faling to find the cause. Update2: usb issue may be related to dtb configuration in linux-fslc-imx better to be tracked separately Change-Id: If5fa4e5f0450385bcb2648d57e63dc1fc14b0574 Signed-off-by: Takashi Matsuzawa Reviewed-on: https://gerrit.automotivelinux.org/gerrit/9871 Tested-by: Jenkins Job builder account ci-image-build: Jenkins Job builder account Reviewed-by: Jan-Simon Moeller --- meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc | 35 +++++++ .../wayland/weston-ini-conf.bbappend | 9 ++ ...n-smack_known_web-label-for-kernel-thread.patch | 49 ++++++++++ .../recipes-kernel/linux/files/ath9k_htc.cfg | 6 ++ .../recipes-kernel/linux/files/btusb.cfg | 6 ++ .../recipes-kernel/linux/files/cgroup.cfg | 17 ++++ .../recipes-kernel/linux/files/namespace.cfg | 6 ++ .../recipes-kernel/linux/files/ramblock_nbd.cfg | 2 + .../recipes-kernel/linux/files/rtl_sdr.cfg | 5 + .../recipes-kernel/linux/files/tmpfs.cfg | 2 + .../recipes-kernel/linux/files/touchscreen.cfg | 2 + .../recipes-kernel/linux/linux-fslc-imx_%.bbappend | 103 +++++++++++++++++++++ .../qt5/qtbase/0014-Add-IMX-GPU-support.patch | 17 ++++ .../recipes-qt/qt5/qtbase_%.bbappend | 5 + .../recipes-graphics/wayland/weston-init.bbappend | 9 ++ .../machine/imx6qsabreauto/40_bblayers.conf.inc | 7 ++ templates/machine/imx6qsabreauto/50_local.conf.inc | 4 + templates/machine/imx6qsabreauto/50_setup.sh | 2 + 18 files changed, 286 insertions(+) create mode 100644 meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf.bbappend create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ath9k_htc.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/btusb.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/cgroup.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/namespace.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ramblock_nbd.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/rtl_sdr.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/tmpfs.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/touchscreen.cfg create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase/0014-Add-IMX-GPU-support.patch create mode 100644 meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase_%.bbappend create mode 100644 templates/machine/imx6qsabreauto/40_bblayers.conf.inc create mode 100644 templates/machine/imx6qsabreauto/50_local.conf.inc create mode 100644 templates/machine/imx6qsabreauto/50_setup.sh diff --git a/meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc b/meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc new file mode 100644 index 000000000..74879dbbf --- /dev/null +++ b/meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc @@ -0,0 +1,35 @@ +# Caution: Hand-merge needed when original recipes are updated +# +# Here we only have selected lines from the following (and +# their included) files +# +# fslc-wayland.conf +# fsl-image-multimedia-full.bb +# + +# fslc-wayland.conf + +# +# Followings were intentionally removed from the original recipe +# to make our set simpler +# +# gtk+3-demo clutter-1.0-examples +# + +IMAGE_INSTALL_append = " \ + packagegroup-fsl-tools-gpu \ + packagegroup-fsl-gstreamer1.0 \ + packagegroup-imx-tools-audio \ + weston weston-init weston-examples \ +" + +# fsl-image-multimedia-full.bb + +IMAGE_INSTALL_append = " \ + packagegroup-fsl-gstreamer1.0-full \ +" + +# fix build error + +SECURITY_CFLAGS_pn-devil = "${SECURITY_NO_PIE_CFLAGS}" + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf.bbappend new file mode 100644 index 000000000..e736dddd2 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-graphics/wayland/weston-ini-conf.bbappend @@ -0,0 +1,9 @@ +# Currently only works with fbdev backend +# and only one default output + +WESTONCORE[backend] = "fbdev-backend.so" + +SCREEN_fbdev[name] = "fbdev" +SCREEN_fbdev[transform] = "270" +WESTONOUTPUT1[agl_screen] = "SCREEN_fbdev" + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch new file mode 100644 index 000000000..1b17bc73f --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch @@ -0,0 +1,49 @@ +From c8bbb0f916de54610513e376070aea531af19dd6 Mon Sep 17 00:00:00 2001 +From: jooseong lee +Date: Thu, 3 Nov 2016 10:55:43 +0100 +Subject: [PATCH 4/4] Smack: Assign smack_known_web label for kernel thread's +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Assign smack_known_web label for kernel thread's socket in the sk_alloc_security hook + +Creating struct sock by sk_alloc function in various kernel subsystems +like bluetooth dosen't call smack_socket_post_create(). In such case, +received sock label is the floor('_') label and makes access deny. + +Refers-to: https://review.tizen.org/gerrit/#/c/80717/4 + +Change-Id: I2e5c9359bfede84a988fd4d4d74cdb9dfdfc52d8 +Signed-off-by: jooseong lee +Signed-off-by: José Bollo +--- + security/smack/smack_lsm.c | 12 ++++++++++-- + 1 file changed, 10 insertions(+), 2 deletions(-) + +diff --git a/security/smack/smack_lsm.c b/security/smack/smack_lsm.c +index e45f0a3..a3f3ccc 100644 +--- a/security/smack/smack_lsm.c ++++ b/security/smack/smack_lsm.c +@@ -2107,8 +2107,16 @@ static int smack_sk_alloc_security(struct sock *sk, int family, gfp_t gfp_flags) + if (ssp == NULL) + return -ENOMEM; + +- ssp->smk_in = skp; +- ssp->smk_out = skp; ++ /* ++ * Sockets created by kernel threads receive web label. ++ */ ++ if (unlikely(current->flags & PF_KTHREAD)) { ++ ssp->smk_in = &smack_known_web; ++ ssp->smk_out = &smack_known_web; ++ } else { ++ ssp->smk_in = skp; ++ ssp->smk_out = skp; ++ } + ssp->smk_packet = NULL; + + sk->sk_security = ssp; +-- +2.7.4 + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ath9k_htc.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ath9k_htc.cfg new file mode 100644 index 000000000..001587bcd --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ath9k_htc.cfg @@ -0,0 +1,6 @@ +# build errors if built as module +#CONFIG_CFG80211=m +CONFIG_CFG80211=y +CONFIG_MAC80211=m +CONFIG_ATH_CARDS=m +CONFIG_ATH9K_HTC=m diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/btusb.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/btusb.cfg new file mode 100644 index 000000000..5f18d8223 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/btusb.cfg @@ -0,0 +1,6 @@ +CONFIG_BT_INTEL=m +CONFIG_BT_BCM=m +CONFIG_BT_RTL=m +CONFIG_BT_HCIBTUSB=m +CONFIG_BT_HCIBTUSB_BCM=y +CONFIG_BT_HCIBTUSB_RTL=y diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/cgroup.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/cgroup.cfg new file mode 100644 index 000000000..9f168b4f9 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/cgroup.cfg @@ -0,0 +1,17 @@ +CONFIG_CGROUPS=y +CONFIG_CGROUP_DEBUG=y +CONFIG_CGROUP_FREEZER=y +# CONFIG_CGROUP_PIDS is not set +CONFIG_CGROUP_DEVICE=y +CONFIG_CGROUP_CPUACCT=y +# CONFIG_CGROUP_HUGETLB is not set +# CONFIG_CGROUP_PERF is not set +CONFIG_CGROUP_SCHED=y +CONFIG_BLK_CGROUP=y +# CONFIG_DEBUG_BLK_CGROUP is not set +CONFIG_CGROUP_WRITEBACK=y +# CONFIG_NETFILTER_XT_MATCH_CGROUP is not set +CONFIG_NET_CLS_CGROUP=y +# CONFIG_CGROUP_NET_PRIO is not set +CONFIG_CGROUP_NET_CLASSID=y + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/namespace.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/namespace.cfg new file mode 100644 index 000000000..6254019c1 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/namespace.cfg @@ -0,0 +1,6 @@ +CONFIG_NAMESPACES=y +CONFIG_UTS_NS=y +CONFIG_IPC_NS=y +CONFIG_USER_NS=y +CONFIG_PID_NS=y +CONFIG_NET_NS=y diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ramblock_nbd.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ramblock_nbd.cfg new file mode 100644 index 000000000..ef498669d --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/ramblock_nbd.cfg @@ -0,0 +1,2 @@ +CONFIG_BLK_DEV_RAM=y +CONFIG_BLK_DEV_NBD=y diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/rtl_sdr.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/rtl_sdr.cfg new file mode 100644 index 000000000..df5a871ef --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/rtl_sdr.cfg @@ -0,0 +1,5 @@ +CONFIG_I2C_MUX=y +CONFIG_MEDIA_USB_SUPPORT=y +CONFIG_MEDIA_DIGITAL_TV_SUPPORT=y +CONFIG_DVB_USB_V2=m +CONFIG_DVB_USB_RTL28XXU=m diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/tmpfs.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/tmpfs.cfg new file mode 100644 index 000000000..8385bb180 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/tmpfs.cfg @@ -0,0 +1,2 @@ +CONFIG_TMPFS_POSIX_ACL=y +CONFIG_TMPFS_XATTR=y diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/touchscreen.cfg b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/touchscreen.cfg new file mode 100644 index 000000000..fbd0e3229 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/files/touchscreen.cfg @@ -0,0 +1,2 @@ +CONFIG_HID_MULTITOUCH=y + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend new file mode 100644 index 000000000..5fe15cb97 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-kernel/linux/linux-fslc-imx_%.bbappend @@ -0,0 +1,103 @@ +# Borrowed fragments logic from linaro kernel configuration + +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" +KERNEL_CONFIG_FRAGMENTS ?= "" + +kernel_conf_variable() { + CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" + if test "$2" = "n" + then + echo "# CONFIG_$1 is not set" >> ${B}/.config + else + echo "CONFIG_$1=$2" >> ${B}/.config + fi +} + +do_configure_append() { + + CONF_SED_SCRIPT="" + + # kernel_conf_variable NAME y/n lines here + + if [ -f '${WORKDIR}/defconfig' ]; then + sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config' + else + sed -e "${CONF_SED_SCRIPT}" < '${KERNEL_DEFCONFIG}' >> '${B}/.config' + fi + + # Check for kernel config fragments. The assumption is that the config + # fragment will be specified with the absolute path. For example: + # * ${WORKDIR}/config1.cfg + # * ${S}/config2.cfg + # Iterate through the list of configs and make sure that you can find + # each one. If not then error out. + # NOTE: If you want to override a configuration that is kept in the kernel + # with one from the OE meta data then you should make sure that the + # OE meta data version (i.e. ${WORKDIR}/config1.cfg) is listed + # after the in kernel configuration fragment. + # Check if any config fragments are specified. + if [ ! -z "${KERNEL_CONFIG_FRAGMENTS}" ] + then + for f in ${KERNEL_CONFIG_FRAGMENTS} + do + # Check if the config fragment was copied into the WORKDIR from + # the OE meta data + if [ ! -e "$f" ] + then + echo "Could not find kernel config fragment $f" + exit 1 + fi + done + +# # Now that all the fragments are located merge them. +# ( cd ${WORKDIR} && ${S}/scripts/kconfig/merge_config.sh -m -r -O ${B} ${B}/.config ${KERNEL_CONFIG_FRAGMENTS} 1>&2 ) +# + + cat ${KERNEL_CONFIG_FRAGMENTS} >> ${B}/.config + fi + + yes '' | oe_runmake -C ${S} O=${B} oldconfig + oe_runmake -C ${S} O=${B} savedefconfig && cp ${B}/defconfig ${WORKDIR}/defconfig.saved +} + +# Make sure these are enabled so that AGL configurations work + +SRC_URI_append = " file://tmpfs.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/tmpfs.cfg" +SRC_URI_append = " file://namespace.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/namespace.cfg" +SRC_URI_append = " file://cgroup.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/cgroup.cfg" + +# Fragments common to AGL demo platform (make sure they are added) + +# Enable support for USB HID touch display +SRC_URI_append = " file://touchscreen.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/touchscreen.cfg" + +# Enable support for TP-Link TL-W722N USB Wifi adapter +SRC_URI_append = " file://ath9k_htc.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/ath9k_htc.cfg" + +# Enable support for RTLSDR +SRC_URI_append = " file://rtl_sdr.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/rtl_sdr.cfg" + +# Enable support for Bluetooth HCI USB devices +SRC_URI_append = " file://btusb.cfg" +KERNEL_CONFIG_FRAGMENTS_append = " ${WORKDIR}/btusb.cfg" + +#------------------------------------------------------------------------- +# smack patches for handling bluetooth + +SRC_URI_append_smack = "\ + file://0004-Smack-Assign-smack_known_web-label-for-kernel-thread.patch \ +" + +# Enable support for smack +KERNEL_CONFIG_FRAGMENTS_append_smack = "\ + ${WORKDIR}/audit.cfg \ + ${WORKDIR}/smack.cfg \ + ${WORKDIR}/smack-default-lsm.cfg \ +" + diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase/0014-Add-IMX-GPU-support.patch b/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase/0014-Add-IMX-GPU-support.patch new file mode 100644 index 000000000..8489b6f39 --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase/0014-Add-IMX-GPU-support.patch @@ -0,0 +1,17 @@ +Index: git/mkspecs/linux-oe-g++/qmake.conf +=================================================================== +--- git.orig/mkspecs/linux-oe-g++/qmake.conf 2016-12-14 16:51:48.468955533 -0600 ++++ git/mkspecs/linux-oe-g++/qmake.conf 2016-12-14 17:03:17.000000000 -0600 +@@ -39,5 +39,12 @@ isEmpty(QMAKE_QT_CONFIG):QMAKE_QT_CONFIG + + include(../oe-device-extra.pri) + ++QMAKE_CFLAGS += -DLINUX=1 -DEGL_API_FB=1 ++QMAKE_CXXFLAGS += -DLINUX=1 -DEGL_API_FB=1 ++ ++QMAKE_LIBS_EGL += -lEGL ++QMAKE_LIBS_OPENGL_ES2 += -lEGL -lGLESv2 ++QMAKE_LIBS_OPENVG += -lEGL -lOpenVG ++ + load(device_config) + load(qt_config) diff --git a/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase_%.bbappend b/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase_%.bbappend new file mode 100644 index 000000000..c4afc30eb --- /dev/null +++ b/meta-agl-bsp/meta-freescale-layer/recipes-qt/qt5/qtbase_%.bbappend @@ -0,0 +1,5 @@ + +# Fixing Qt5.8 build breaks by overriding original patches with ours +# This will be fixed in the latest meta-freescale upstream +FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:" + diff --git a/meta-agl/recipes-graphics/wayland/weston-init.bbappend b/meta-agl/recipes-graphics/wayland/weston-init.bbappend index 2e87572b3..4975b8e68 100644 --- a/meta-agl/recipes-graphics/wayland/weston-init.bbappend +++ b/meta-agl/recipes-graphics/wayland/weston-init.bbappend @@ -57,6 +57,15 @@ EOF -i ${D}/${libdir}/tmpfiles.d/weston.conf } +do_install_append_imx() { + + install -d ${D}${sysconfdir}/udev/rules.d + cat >>${D}${sysconfdir}/udev/rules.d/zz-dri.rules <<'EOF' +SUBSYSTEM=="gpu_class", MODE="0660", GROUP="${WESTONGROUP}", SECLABEL{smack}="*" +EOF + +} + FILES_${PN} += "${libdir}/tmpfiles.d/*.conf" diff --git a/templates/machine/imx6qsabreauto/40_bblayers.conf.inc b/templates/machine/imx6qsabreauto/40_bblayers.conf.inc new file mode 100644 index 000000000..f09144959 --- /dev/null +++ b/templates/machine/imx6qsabreauto/40_bblayers.conf.inc @@ -0,0 +1,7 @@ +# This must be parsed after qt5, etc. layers so that they are correctly +# recognized by meta-freescale/dynamic-layers +BBLAYERS =+ "\ + ${METADIR}/meta-freescale \ + ${METADIR}/meta-freescale-3rdparty \ + ${METADIR}/meta-freescale-distro \ + " diff --git a/templates/machine/imx6qsabreauto/50_local.conf.inc b/templates/machine/imx6qsabreauto/50_local.conf.inc new file mode 100644 index 000000000..cbfda6a86 --- /dev/null +++ b/templates/machine/imx6qsabreauto/50_local.conf.inc @@ -0,0 +1,4 @@ +MACHINE = "imx6qsabreauto" +#see meta-agl/meta-agl-bsp/conf/include/agl_imx6qsabreauto.inc +require conf/include/agl_imx6qsabreauto.inc + diff --git a/templates/machine/imx6qsabreauto/50_setup.sh b/templates/machine/imx6qsabreauto/50_setup.sh new file mode 100644 index 000000000..bb22790dc --- /dev/null +++ b/templates/machine/imx6qsabreauto/50_setup.sh @@ -0,0 +1,2 @@ +find_and_ack_eula $METADIR/meta-freescale EULA +export EULA_FLAG_NAME="ACCEPT_FSL_EULA" -- cgit 1.2.3-korg