bluez5: split init scripts and systemd service in a different recipe
This commit moves all the work related with the initialization process to a new recipe to allow disgregate the init scripts from the bluez5 recipe. Signed-off-by: Arturo Buzarra <arturo.buzarra@digi.com>
This commit is contained in:
parent
ea0d8d7b8b
commit
fb6612dabe
|
|
@ -0,0 +1,59 @@
|
|||
# Copyright (C) 2022 Digi International.
|
||||
|
||||
SUMMARY = "Bluetooth init scripts"
|
||||
LICENSE = "GPL-2.0"
|
||||
LIC_FILES_CHKSUM = "file://${COMMON_LICENSE_DIR}/GPL-2.0-only;md5=801f80980d171dd6425610833a22dbe6"
|
||||
|
||||
SRC_URI = " \
|
||||
file://bluetooth-init \
|
||||
file://bluetooth-init.service \
|
||||
"
|
||||
|
||||
SRC_URI_append_ccimx6sbc = " \
|
||||
file://bluetooth-init_atheros \
|
||||
"
|
||||
|
||||
inherit update-rc.d
|
||||
|
||||
do_install() {
|
||||
# INITSCRIPT
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/bluetooth-init
|
||||
ln -sf /etc/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init
|
||||
# SYSTEMD
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/bluetooth-init.service ${D}${systemd_unitdir}/system/bluetooth-init.service
|
||||
}
|
||||
|
||||
do_install_append_ccimx6sbc() {
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init_atheros ${D}${sysconfdir}/bluetooth-init_atheros
|
||||
}
|
||||
|
||||
pkg_postinst_ontarget_${PN}_ccimx6sbc() {
|
||||
# Only execute the script on wireless ccimx6 platforms
|
||||
if [ -e "/proc/device-tree/bluetooth/mac-address" ]; then
|
||||
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
|
||||
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
|
||||
mv /etc/bluetooth-init_atheros /etc/bluetooth-init
|
||||
break
|
||||
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
|
||||
rm /etc/bluetooth-init_atheros
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
FILES_${PN} = " ${sysconfdir}/bluetooth-init* \
|
||||
${sysconfdir}/init.d/bluetooth-init \
|
||||
${systemd_unitdir}/system/bluetooth-init.service \
|
||||
"
|
||||
|
||||
INITSCRIPT_PACKAGES += "${PN}"
|
||||
INITSCRIPT_NAME_${PN} = "bluetooth-init"
|
||||
INITSCRIPT_PARAMS_${PN} = "start 19 2 3 4 5 . stop 21 0 1 6 ."
|
||||
|
||||
SYSTEMD_SERVICE_${PN} = "bluetooth-init.service"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
COMPATIBLE_MACHINE = "(ccimx6$|ccimx6ul|ccimx8x|ccimx8mn|ccimx8mm)"
|
||||
|
|
@ -9,4 +9,4 @@ ExecStart=/etc/bluetooth-init start
|
|||
ExecStop=/etc/bluetooth-init stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
WantedBy=bluetooth.service
|
||||
|
|
@ -4,27 +4,20 @@ Subject: [PATCH] bluetooth.service: add Digi customizations
|
|||
|
||||
These changes include:
|
||||
|
||||
* Adding the bluetooth-init service as a soft dependency.
|
||||
* Having the bluetooth stack start automatically on boot.
|
||||
|
||||
Signed-off-by: Gabriel Valcazar <gabriel.valcazar@digi.com>
|
||||
---
|
||||
src/bluetooth.service.in | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
src/bluetooth.service.in | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/bluetooth.service.in b/src/bluetooth.service.in
|
||||
index f799f65..d8b150c 100644
|
||||
index f9faaa4..95d9ba2 100644
|
||||
--- a/src/bluetooth.service.in
|
||||
+++ b/src/bluetooth.service.in
|
||||
@@ -2,6 +2,7 @@
|
||||
Description=Bluetooth service
|
||||
Documentation=man:bluetoothd(8)
|
||||
ConditionPathIsDirectory=/sys/class/bluetooth
|
||||
+Wants=bluetooth-init.service
|
||||
|
||||
[Service]
|
||||
Type=dbus
|
||||
@@ -16,5 +17,5 @@ ProtectHome=true
|
||||
@@ -14,7 +14,7 @@ CapabilityBoundingSet=CAP_NET_ADMIN CAP_NET_BIND_SERVICE
|
||||
LimitNPROC=1
|
||||
ProtectHome=true
|
||||
ProtectSystem=full
|
||||
|
||||
[Install]
|
||||
|
|
|
|||
|
|
@ -1,69 +0,0 @@
|
|||
#!/bin/sh
|
||||
#===============================================================================
|
||||
#
|
||||
# Copyright (C) 2018,2022 by Digi International Inc.
|
||||
# All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of the GNU General Public License version 2 as published by
|
||||
# the Free Software Foundation.
|
||||
#
|
||||
#
|
||||
# !Description: Initialize bluetooth hardware
|
||||
#
|
||||
#===============================================================================
|
||||
|
||||
bluetooth_init() {
|
||||
# Get MAC address from the device tree. Use a default value if it has not been set.
|
||||
BT_MACADDR="$(hexdump -ve '1/1 "%02X" ":"' /proc/device-tree/bluetooth/mac-address 2>/dev/null | sed 's/:$//g')"
|
||||
if [ -z "${BT_MACADDR}" ] || [ "${BT_MACADDR}" = "00:00:00:00:00:00" ]; then
|
||||
BT_MACADDR="00:04:F3:FF:FF:BB"
|
||||
fi
|
||||
|
||||
# Start the Bluetooth driver and bring up the interface
|
||||
HCIATTACH_LOG="/var/log/hciattach.log"
|
||||
|
||||
for RETRY in $(seq 1 5)
|
||||
do
|
||||
killproc hciattach
|
||||
modprobe btdigi
|
||||
if hciattach ttyBt qca ${BT_RATE:-3000000} -t30 ${BT_FLOW:-flow} unused ${BT_MACADDR} >${HCIATTACH_LOG} 2>&1; then
|
||||
return
|
||||
fi
|
||||
rmmod btdigi
|
||||
sleep 1
|
||||
done
|
||||
BT_ERROR="FAIL (hciattach)"
|
||||
}
|
||||
|
||||
# Source function library
|
||||
. /etc/init.d/functions
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
if [ -d "/proc/device-tree/bluetooth" ]; then
|
||||
if [ "$(tr -d '\0' 2>/dev/null </proc/device-tree/bluetooth/status)" != "disabled" ]; then
|
||||
echo -n "Starting bluetooth hardware: "
|
||||
bluetooth_init
|
||||
echo "${BT_ERROR:-done.}"
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
stop)
|
||||
if [ -d "/sys/class/bluetooth/hci0" ]; then
|
||||
echo -n "Stopping bluetooth hardware: "
|
||||
killproc hciattach
|
||||
rmmod btdigi
|
||||
echo "done."
|
||||
fi
|
||||
;;
|
||||
restart)
|
||||
$0 stop
|
||||
sleep 1
|
||||
$0 start
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
|
@ -1,8 +1,6 @@
|
|||
# Copyright (C) 2015-2021 Digi International.
|
||||
# Copyright (C) 2015-2022 Digi International.
|
||||
|
||||
SRC_URI += " \
|
||||
file://bluetooth-init \
|
||||
file://bluetooth-init.service \
|
||||
file://bluetooth.service-add-customizations.patch \
|
||||
file://main.conf \
|
||||
file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \
|
||||
|
|
@ -30,20 +28,12 @@ SRC_URI_append_ccimx6ul = " ${QCA65XX_COMMON_PATCHES}"
|
|||
SRC_URI_append_ccimx6 = " ${QCA65XX_COMMON_PATCHES}"
|
||||
|
||||
SRC_URI_append_ccimx6sbc = " \
|
||||
file://bluetooth-init_atheros \
|
||||
file://main.conf_atheros \
|
||||
"
|
||||
|
||||
inherit update-rc.d
|
||||
|
||||
PACKAGECONFIG_append = " experimental"
|
||||
|
||||
do_install_append() {
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/bluetooth-init
|
||||
ln -sf /etc/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/bluetooth-init.service ${D}${systemd_unitdir}/system/bluetooth-init.service
|
||||
install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/
|
||||
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
|
||||
${D}${sysconfdir}/bluetooth/main.conf
|
||||
|
|
@ -53,7 +43,6 @@ do_install_append() {
|
|||
}
|
||||
|
||||
do_install_append_ccimx6sbc() {
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init_atheros ${D}${sysconfdir}/bluetooth-init_atheros
|
||||
install -m 0644 ${WORKDIR}/main.conf_atheros ${D}${sysconfdir}/bluetooth/
|
||||
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
|
||||
${D}${sysconfdir}/bluetooth/main.conf_atheros
|
||||
|
|
@ -64,11 +53,9 @@ pkg_postinst_ontarget_${PN}_ccimx6sbc() {
|
|||
if [ -e "/proc/device-tree/bluetooth/mac-address" ]; then
|
||||
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
|
||||
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
|
||||
mv /etc/bluetooth-init_atheros /etc/bluetooth-init
|
||||
mv /etc/bluetooth/main.conf_atheros /etc/bluetooth/main.conf
|
||||
break
|
||||
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
|
||||
rm /etc/bluetooth-init_atheros
|
||||
rm /etc/bluetooth/main.conf_atheros
|
||||
break
|
||||
fi
|
||||
|
|
@ -76,18 +63,6 @@ pkg_postinst_ontarget_${PN}_ccimx6sbc() {
|
|||
fi
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-init"
|
||||
|
||||
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf*"
|
||||
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init* \
|
||||
${sysconfdir}/init.d/bluetooth-init \
|
||||
${systemd_unitdir}/system/bluetooth-init.service \
|
||||
"
|
||||
|
||||
INITSCRIPT_PACKAGES += "${PN}-init"
|
||||
INITSCRIPT_NAME_${PN}-init = "bluetooth-init"
|
||||
INITSCRIPT_PARAMS_${PN}-init = "start 19 2 3 4 5 . stop 21 0 1 6 ."
|
||||
|
||||
SYSTEMD_SERVICE_${PN}-init = "bluetooth-init.service"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
|
|
|||
|
|
@ -1,10 +1,8 @@
|
|||
# Copyright (C) 2015-2021 Digi International.
|
||||
# Copyright (C) 2015-2022 Digi International.
|
||||
|
||||
FILESEXTRAPATHS_prepend := "${THISDIR}/${BPN}:${THISDIR}/${BP}:"
|
||||
|
||||
SRC_URI += " \
|
||||
file://bluetooth-init \
|
||||
file://bluetooth-init.service \
|
||||
file://bluetooth.service-add-customizations.patch \
|
||||
file://main.conf \
|
||||
file://0001-hcitool-do-not-show-unsupported-refresh-option.patch \
|
||||
|
|
@ -25,18 +23,10 @@ SRC_URI_append_ccimx8x = " ${QCA65XX_COMMON_PATCHES}"
|
|||
SRC_URI_append_ccimx8m = " ${QCA65XX_COMMON_PATCHES}"
|
||||
|
||||
SRC_URI_append_ccimx6sbc = " \
|
||||
file://bluetooth-init_atheros \
|
||||
file://main.conf_atheros \
|
||||
"
|
||||
|
||||
inherit update-rc.d
|
||||
|
||||
do_install_append() {
|
||||
install -d ${D}${sysconfdir}/init.d/
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init ${D}${sysconfdir}/bluetooth-init
|
||||
ln -sf /etc/bluetooth-init ${D}${sysconfdir}/init.d/bluetooth-init
|
||||
install -d ${D}${systemd_unitdir}/system/
|
||||
install -m 0644 ${WORKDIR}/bluetooth-init.service ${D}${systemd_unitdir}/system/bluetooth-init.service
|
||||
install -m 0644 ${WORKDIR}/main.conf ${D}${sysconfdir}/bluetooth/
|
||||
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
|
||||
${D}${sysconfdir}/bluetooth/main.conf
|
||||
|
|
@ -53,7 +43,6 @@ do_install_append() {
|
|||
}
|
||||
|
||||
do_install_append_ccimx6sbc() {
|
||||
install -m 0755 ${WORKDIR}/bluetooth-init_atheros ${D}${sysconfdir}/bluetooth-init_atheros
|
||||
install -m 0644 ${WORKDIR}/main.conf_atheros ${D}${sysconfdir}/bluetooth/
|
||||
sed -i -e "s,##BT_DEVICE_NAME##,${BT_DEVICE_NAME},g" \
|
||||
${D}${sysconfdir}/bluetooth/main.conf_atheros
|
||||
|
|
@ -64,11 +53,9 @@ pkg_postinst_ontarget_${PN}_ccimx6sbc() {
|
|||
if [ -e "/proc/device-tree/bluetooth/mac-address" ]; then
|
||||
for id in $(find /sys/devices -name modalias -print0 | xargs -0 sort -u -z | grep sdio); do
|
||||
if [[ "$id" == "sdio:c00v0271d0301" ]] ; then
|
||||
mv /etc/bluetooth-init_atheros /etc/bluetooth-init
|
||||
mv /etc/bluetooth/main.conf_atheros /etc/bluetooth/main.conf
|
||||
break
|
||||
elif [[ "$id" == "sdio:c00v0271d050A" ]] ; then
|
||||
rm /etc/bluetooth-init_atheros
|
||||
rm /etc/bluetooth/main.conf_atheros
|
||||
break
|
||||
fi
|
||||
|
|
@ -76,22 +63,11 @@ pkg_postinst_ontarget_${PN}_ccimx6sbc() {
|
|||
fi
|
||||
}
|
||||
|
||||
PACKAGES =+ "${PN}-init"
|
||||
PACKAGECONFIG_append = " health-profiles \
|
||||
mesh \
|
||||
btpclient \
|
||||
"
|
||||
|
||||
FILES_${PN} += " ${sysconfdir}/bluetooth/main.conf*"
|
||||
FILES_${PN}-init = " ${sysconfdir}/bluetooth-init* \
|
||||
${sysconfdir}/init.d/bluetooth-init \
|
||||
${systemd_unitdir}/system/bluetooth-init.service \
|
||||
"
|
||||
|
||||
INITSCRIPT_PACKAGES += "${PN}-init"
|
||||
INITSCRIPT_NAME_${PN}-init = "bluetooth-init"
|
||||
INITSCRIPT_PARAMS_${PN}-init = "start 19 2 3 4 5 . stop 21 0 1 6 ."
|
||||
|
||||
SYSTEMD_SERVICE_${PN}-init = "bluetooth-init.service"
|
||||
|
||||
PACKAGE_ARCH = "${MACHINE_ARCH}"
|
||||
|
|
|
|||
Loading…
Reference in New Issue