Packaging changes. 03/136403/4
authorr.tyminski <r.tyminski@partner.samsung.com>
Thu, 29 Jun 2017 09:34:29 +0000 (11:34 +0200)
committerr.tyminski <r.tyminski@partner.samsung.com>
Tue, 19 Sep 2017 14:46:23 +0000 (16:46 +0200)
Adding manifest.
Setting root of tee fs to /opt.
Little spec cleanup.
Adding udev and service configuration.

Change-Id: Ife48795a84a2033404a0b76f74c151ce82303820

packaging/optee-client.spec
packaging/tef-optee.manifest [new file with mode: 0644]
systemd/90-teedaemon.rules [new file with mode: 0644]
systemd/CMakeLists.txt [new file with mode: 0644]
systemd/tef-optee.service.in [new file with mode: 0644]
tee-supplicant/Makefile

index 3b31ee9b9456fa49f41bc5e79813088a4982a2e7..ebc62d70ec716b0d0465a5ebba53cc9b63051361 100644 (file)
@@ -1,51 +1,85 @@
 %define major_version 2
 %define minor_version 4
 
-Name:       optee-client
-Summary:    Library for applications which use OPTEE functions.
-Version:    %{major_version}.%{minor_version}
+Name:       tef-optee
+Summary:    TEF TrustZone OpTEE backend
+Version:    %{major_version}.%{minor_version}.0
 Release:    1%{?dist}
 Group:      Security/Testing
 License:    BSD-2-Clause
 URL:        N/A
 Source0:    %{name}-%{version}.tar.gz
-Provides: libteec
+Source1:       %{name}.manifest
+ExclusiveArch: armv6l armv7hl armv7l aarch64
+Provides:   %{name}
 
 BuildRequires: make
+BuildRequires: cmake
+
+%{?systemd_requires}
+
+%define bin_dir %{?TZ_SYS_BIN:%TZ_SYS_BIN}%{!?TZ_SYS_BIN:%_bindir}
+%define udev_dir %_libdir/udev/rules.d/
+%define build_udev_dir %{buildroot}/%{udev_dir}
+%define build_unit_dir %{buildroot}%{_unitdir}
+
+%define smack_domain_name System
+
+%define compile_param  CROSS_COMPILE="" MAJOR_VERSION="%{major_version}" MINOR_VERSION="%{minor_version}"
 
 %description
-Library for applications which use OPTEE functions.
+TEF Trustzone OpTEE provides daemon to support OpTEE OS solution.
+
+%package -n %{name}-client
+Summary:    TEF TrustZone OpTEE Client contains a libteec library.
+Group:      Security/Libraries
+License:    BSD-2-Clause
+Provides:   %{name}-client
+
+BuildRequires: make
+
+%description -n %{name}-client
+TEF TrustZone OpTEE Client contains a libteec library, which is tef-libteec backend.
 
 %prep
 %setup -q
+cp -a %{SOURCE1} .
 
 %build
-make build CROSS_COMPILE="" MAJOR_VERSION=%{major_version} MINOR_VERSION=%{minor_version}
+export TEE_FS_SUBPATH="/opt/data" TEE_FS_PATH="/opt/data/tee"
+make %{compile_param} build
+
+cd systemd
+cmake . \
+               -DUDEV_RULES_DIR=%{build_udev_dir} \
+               -DSYSTEMD_UNIT_DIR=%{build_unit_dir} \
+               -DSYSTEMD_CFG_BIN_DIR=%{bin_dir} \
+               -DSMACK_DOMAIN_NAME=%{smack_domain_name}
+cd -
 
 %install
-make CROSS_COMPILE="" MAJOR_VERSION=%{major_version} MINOR_VERSION=%{minor_version} DESTDIR=%{buildroot}/%{_prefix} install
+make %{compile_param} DESTDIR=%{buildroot}/%{_prefix}/ LIBDIR=%{_lib}/tef/optee install
 
-if [ "%{_libdir}" == "%{_exec_prefix}/lib64" ]
-then
-  mkdir -p %{buildroot}/%{_libdir}
-  cp -f %{buildroot}/usr/lib/libteec.so* %{buildroot}/%{_libdir}/
-  rm -rf %{buildroot}/usr/lib
-fi
+rm -rf %{buildroot}/%{_includedir}
+cd systemd
+make install
+cd -
+
+%post
+./usr/sbin/tef-update.sh optee
 
-rm -rf %{buildroot}%{_libdir}/debug
+%postun
+./usr/sbin/tef-update.sh
 
 %files
-%defattr(-, root, root, -)
+%license LICENSE
 %{_bindir}/tee-supplicant
-%{_libdir}/libteec.so*
-%{_includedir}/tee_client_api.h
-%{_includedir}/tee_client_api_extensions.h
-%{_includedir}/teec_trace.h
-
-%post
-ln -sf %{_libdir}/libteec.so.%{version} %{_libdir}/libteec.so.%{major_version}
-ln -sf %{_libdir}/libteec.so.%{major_version} %{_libdir}/libteec.so
+%{_unitdir}/tef-optee.service
+%{udev_dir}/90-teedaemon.rules
 
-/sbin/ldconfig
+%files -n %{name}-client
+%license LICENSE
+%defattr(-, root, root, -)
+%{_libdir}/tef/optee/libteec.so*
 
 %changelog
diff --git a/packaging/tef-optee.manifest b/packaging/tef-optee.manifest
new file mode 100644 (file)
index 0000000..86dbb26
--- /dev/null
@@ -0,0 +1,5 @@
+<manifest>
+    <request>
+        <domain name="_" />
+    </request>
+</manifest>
diff --git a/systemd/90-teedaemon.rules b/systemd/90-teedaemon.rules
new file mode 100644 (file)
index 0000000..6cf5550
--- /dev/null
@@ -0,0 +1 @@
+SUBSYSTEM=="tee", KERNEL=="teepriv*", TAG+="systemd", ENV{SYSTEMD_WANTS}+="tef-optee.service"
diff --git a/systemd/CMakeLists.txt b/systemd/CMakeLists.txt
new file mode 100644 (file)
index 0000000..f65e2c1
--- /dev/null
@@ -0,0 +1,38 @@
+# Copyright (c) 2017 Samsung Electronics Co., Ltd All Rights Reserved
+#
+#    Licensed under the Apache License, Version 2.0 (the "License");
+#    you may not use this file except in compliance with the License.
+#    You may obtain a copy of the License at
+#
+#        http://www.apache.org/licenses/LICENSE-2.0
+#
+#    Unless required by applicable law or agreed to in writing, software
+#    distributed under the License is distributed on an "AS IS" BASIS,
+#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+#    See the License for the specific language governing permissions and
+#    limitations under the License.
+#
+# @file
+# @author  Lukasz Kostyra (l.kostyra@samsung.com)
+# @author  Rafal Tyminski (r.tyminski@partner.samsung.com)
+# @brief   CMakeLists for systemd configuration files
+#
+
+CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+PROJECT("tef-optee")
+
+CONFIGURE_FILE(${CMAKE_SOURCE_DIR}/tef-optee.service.in
+               ${CMAKE_SOURCE_DIR}/tef-optee.service @ONLY)
+
+INSTALL(FILES
+    ${CMAKE_SOURCE_DIR}/tef-optee.service
+    DESTINATION
+    ${SYSTEMD_UNIT_DIR}
+)
+
+INSTALL(FILES
+    ${CMAKE_SOURCE_DIR}/90-teedaemon.rules
+    DESTINATION
+       ${UDEV_RULES_DIR}
+)
+
diff --git a/systemd/tef-optee.service.in b/systemd/tef-optee.service.in
new file mode 100644 (file)
index 0000000..5b7498a
--- /dev/null
@@ -0,0 +1,12 @@
+[Unit]
+Description=TEF OpTEE Daemon
+DefaultDependencies=no
+After=opt.mount
+
+
+[Service]
+User=root
+Group=root
+SmackProcessLabel=@SMACK_DOMAIN_NAME@
+ExecStart=@SYSTEMD_CFG_BIN_DIR@/tee-supplicant
+RuntimeDirectory=@SERVICE_NAME@
index 808d90c9e4d5216b5e3e60f10af2a97f1817c1d4..2ff37d704c661f31aa9e52f01a4da4c4cec47432 100644 (file)
@@ -18,7 +18,8 @@ TEES_SRCS     := tee_supplicant.c \
                   teec_ta_load.c \
                   tee_supp_fs.c \
                   rpmb.c \
-                  handle.c
+                  handle.c \
+                  ../../libteec/src/teec_trace.c
 
 
 ifeq ($(CFG_GP_SOCKETS),y)
@@ -58,7 +59,9 @@ ifeq ($(CFG_TA_TEST_PATH),y)
 TEES_CFLAGS    += -DCFG_TA_TEST_PATH=1
 endif
 TEES_FILE      := $(OUT_DIR)/$(PACKAGE_NAME)
-TEES_LDFLAGS    := -L$(OUT_DIR)/../libteec -lteec
+# tee-supplicant needed OpTEE libteec to use libteec debugs
+# Now we compile debugs source with tee-supplicant
+#TEES_LDFLAGS    := -L$(OUT_DIR)/../libteec -lteec
 
 ifeq ($(CFG_SQL_FS),y)
 TEES_CFLAGS    += -DCFG_SQL_FS