[Feature]add MT2731_MP2_MR2_SVN388 baseline version
Change-Id: Ief04314834b31e27effab435d3ca8ba33b499059
diff --git a/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.service b/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.service
new file mode 100644
index 0000000..53d693e
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.service
@@ -0,0 +1,11 @@
+[Unit]
+Description=SofthsmInitScript
+RequiresMountsFor=#SOFTHSM_DATA_MOUNT_POINT#
+
+[Service]
+ExecStart=/etc/softhsm-init.sh
+Type=simple
+
+[Install]
+Alias=SofthsmInitScript
+WantedBy=multi-user.target
\ No newline at end of file
diff --git a/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.sh b/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.sh
new file mode 100644
index 0000000..4fdf411
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/softhsm-init/files/softhsm-init.sh
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# @author
+# @brief generate the top index for each module doc
+
+if [ -d "#SOFTHSM_DATA_TOKEN_DIR#" ]; then
+ exit 0
+fi
+
+mkdir -p #SOFTHSM_DATA_TOKEN_DIR#
+
+softhsm2-util --init-token --free --label \"#SOFTHSM_DEFAULT_TOKEN_LABEL#\" --pin #SOFTHSM_DEFAULT_TOKEN_PIN# --so-pin #SOFTHSM_DEFAULT_TOKEN_SO_PIN#
\ No newline at end of file
diff --git a/meta/meta-mediatek/recipes-support/softhsm-init/softhsm-init.bb b/meta/meta-mediatek/recipes-support/softhsm-init/softhsm-init.bb
new file mode 100644
index 0000000..d83a056
--- /dev/null
+++ b/meta/meta-mediatek/recipes-support/softhsm-init/softhsm-init.bb
@@ -0,0 +1,45 @@
+inherit workonsrc
+inherit pkgconfig
+inherit systemd
+
+DESCRIPTION = "SoftHSM Init"
+LICENSE = "MediaTekProprietary"
+LIC_FILES_CHKSUM = "file://COPYING;md5=d7810fab7487fb0aad327b76f1be7cd7"
+APPS_SRC = "${TOPDIR}/../meta/meta-mediatek/recipes-support/softhsm-init"
+WORKONSRC = "${APPS_SRC}"
+
+#####Customization Start#####
+SOFTHSM_DATA_MOUNT_POINT = "/data"
+SOFTHSM_DATA_TOKEN_DIR = "/data/softhsm"
+SOFTHSM_DEFAULT_TOKEN_LABEL = "8516softhsm"
+SOFTHSM_DEFAULT_TOKEN_PIN = "85168516"
+SOFTHSM_DEFAULT_TOKEN_SO_PIN = "85168516"
+#####Customization End#####
+
+SYSTEMD_PACKAGES = "${PN}"
+SYSTEMD_SERVICE_${PN} = "softhsm-init.service"
+FILES_${PN} += "${systemd_unitdir}/system/softhsm-init.service"
+FILES_${PN} += "etc/softhsm-init.sh"
+FILES_${PN} += "etc/softhsm2.conf"
+
+do_install() {
+ install -d ${D}/etc
+ install -m 755 ${S}files/softhsm-init.sh ${D}/etc/softhsm-init.sh
+
+ install -d ${D}${systemd_system_unitdir}
+ install -m 0755 ${S}files/softhsm-init.service ${D}${systemd_system_unitdir}
+
+ sed -e 's%#SOFTHSM_DATA_MOUNT_POINT#%${SOFTHSM_DATA_MOUNT_POINT}%g' \
+ -i ${D}${systemd_system_unitdir}/softhsm-init.service
+
+ sed -e 's%#SOFTHSM_DATA_TOKEN_DIR#%${SOFTHSM_DATA_TOKEN_DIR}%g' \
+ -e 's%#SOFTHSM_DEFAULT_TOKEN_LABEL#%${SOFTHSM_DEFAULT_TOKEN_LABEL}%g' \
+ -e 's%#SOFTHSM_DEFAULT_TOKEN_PIN#%${SOFTHSM_DEFAULT_TOKEN_PIN}%g' \
+ -e 's%#SOFTHSM_DEFAULT_TOKEN_SO_PIN#%${SOFTHSM_DEFAULT_TOKEN_SO_PIN}%g' \
+ -i ${D}/etc/softhsm-init.sh
+
+ echo "objectstore.backend = file" > ${D}/etc/softhsm2.conf
+ echo "directories.tokendir = ${SOFTHSM_DATA_TOKEN_DIR}" >> ${D}/etc/softhsm2.conf
+}
+
+