From d1387e9ac42101a22a43572dcc016a4b03837465 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 11 Jun 2017 10:19:21 +0200 Subject: [PATCH] osmo-bts: support sysmobts-v2 and sysmobts2100 machine targets --- .../osmo-bts/files/osmo-bts-lc15.service | 20 ++++++ recipes-sysmobts/osmo-bts/osmo-bts_git.bb | 68 +++++++++++++------ 2 files changed, 69 insertions(+), 19 deletions(-) create mode 100644 recipes-sysmobts/osmo-bts/files/osmo-bts-lc15.service diff --git a/recipes-sysmobts/osmo-bts/files/osmo-bts-lc15.service b/recipes-sysmobts/osmo-bts/files/osmo-bts-lc15.service new file mode 100644 index 0000000..677006a --- /dev/null +++ b/recipes-sysmobts/osmo-bts/files/osmo-bts-lc15.service @@ -0,0 +1,20 @@ +[Unit] +Description=osmo-bts for LC15 / sysmoBTS 2100 + +[Service] +Type=simple +ExecStartPre=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness' +ExecStart=/usr/bin/osmo-bts-lc15 -s -c /etc/osmocom/osmo-bts.cfg -M +ExecStopPost=/bin/sh -c 'echo 0 > /sys/class/leds/activity_led/brightness' +#FIXME: dra7-dsp1-fw.xe66 dra7-dsp2-fw.xe66 litecell15.bit-100t litecell15.bit-75t +#ExecStopPost=/bin/sh -c 'cat /lib/firmware/sysmobts-v?.bit > /dev/fpgadl_par0 ; sleep 3s; cat /lib/firmware/sysmobts-v?.out > /dev/dspdl_dm644x_0; sleep 1s' +Restart=always +RestartSec=2 +RestartPreventExitStatus=1 + +# The msg queues must be read fast enough +CPUSchedulingPolicy=rr +CPUSchedulingPriority=1 + +[Install] +WantedBy=multi-user.target diff --git a/recipes-sysmobts/osmo-bts/osmo-bts_git.bb b/recipes-sysmobts/osmo-bts/osmo-bts_git.bb index 94eda1d..9368d69 100644 --- a/recipes-sysmobts/osmo-bts/osmo-bts_git.bb +++ b/recipes-sysmobts/osmo-bts/osmo-bts_git.bb @@ -5,25 +5,35 @@ LIC_FILES_CHKSUM="file://COPYING;md5=73f1eb20517c55bf9493b7dd6e480788" SRC_URI = "git://git.osmocom.org/osmo-bts.git;protocol=git;branch=sysmocom/0.3.5-stable;name=osmobts;destsuffix=git \ git://git.osmocom.org/openbsc;protocol=git;branch=master;name=openbsc;destsuffix=openbsc \ file://gcc6-linking-fix.patch" +SRC_URI_append_sysmobts2100 = " file://osmo-bts-lc15.service" SRCREV_osmobts = "a4bd813081e788012c72f34d31150cdf02db307f" SRCREV_openbsc = "57ee78078905c7499bd4e6857f8981d22badfcac" PV = "0.4.3+git${SRCPV}" -PR = "r18.${META_TELEPHONY_OSMO_INC}" +PR = "r19.${META_TELEPHONY_OSMO_INC}" S = "${WORKDIR}/git" SRCREV_FORMAT = "openbsc-rosmobts" -DEPENDS = "libosmocore libosmo-abis femtobts-api gpsd" -RDEPENDS_${PN} += "coreutils sysmobts-firmware (>= 5.1)" -RCONFLICTS_${PN} = "sysmobts-firmware (< 5.1)" -EXTRA_OECONF += "--enable-sysmocom-bts" +DEPENDS = "libosmocore libosmo-abis femtobts-api gpsd" +DEPENDS_append_sysmobts-v2 = " femtobts-api" +DEPENDS_append_sysmobts2100 = " lc15-firmware" + +RDEPENDS_${PN} += "coreutils" + +RDEPENDS_${PN}_append_sysmobts-v2 = " sysmobts-firmware (>= 5.1)" +RCONFLICTS_${PN}_append_sysmobts-v2 = " sysmobts-firmware (< 5.1)" + +RDEPENDS_${PN}_append_sysmobts2100 = " lc15-firmware" + +EXTRA_OECONF_sysmobts-v2 += "--enable-sysmocom-bts" +EXTRA_OECONF_sysmobts2100 += "--enable-litecell15" inherit autotools update-rc.d pkgconfig # Select the API version inherit femtobts_api -CPPFLAGS += " ${BTS_HW_VERSION} " +CPPFLAGS_append_sysmobts-v2 = " ${BTS_HW_VERSION} " do_configure_prepend() { ln -sf ../openbsc openbsc || true @@ -36,7 +46,20 @@ do_compile_append_sysmobts-v2() { do_install_append() { install -d ${D}${sysconfdir}/osmocom - install -m 0660 ${S}/doc/examples/osmo-bts.cfg ${D}${sysconfdir}/osmocom + + # Future sysmobts-mgr handling + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/ + install -m 0660 ${S}/doc/examples/sysmobts-mgr.cfg ${D}${sysconfdir}/osmocom + install -m 0644 ${S}/contrib/sysmobts-mgr.service ${D}${systemd_unitdir}/system/ + ln -sf ../sysmobts-mgr.service ${D}${systemd_unitdir}/system/multi-user.target.wants/ +} + +do_install_append_sysmobts-v2() { + install -m 0755 ${S}/contrib/sysmobts-calib/sysmobts-calib ${D}${bindir}/ + + install -m 0660 ${S}/doc/examples/sysmo/osmo-bts.cfg ${D}${sysconfdir}/osmocom + + # old sysv init install -m 0755 ${S}/contrib/respawn.sh ${D}${sysconfdir}/osmocom/ install -m 0755 ${S}/contrib/respawn-only.sh ${D}${sysconfdir}/osmocom/ install -m 0644 ${S}/contrib/screenrc-sysmobts ${D}${sysconfdir}/osmocom/ @@ -47,26 +70,33 @@ do_install_append() { install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/ install -m 0644 ${S}/contrib/sysmobts.service ${D}${systemd_unitdir}/system/ ln -sf ../sysmobts.service ${D}${systemd_unitdir}/system/multi-user.target.wants/ - - # Future sysmobts-mgr handling - install -m 0660 ${S}/doc/examples/sysmobts-mgr.cfg ${D}${sysconfdir}/osmocom - install -m 0644 ${S}/contrib/sysmobts-mgr.service ${D}${systemd_unitdir}/system/ - ln -sf ../sysmobts-mgr.service ${D}${systemd_unitdir}/system/multi-user.target.wants/ } -do_install_append_sysmobts-v2() { - install -m 0755 ${S}/contrib/sysmobts-calib/sysmobts-calib ${D}${bindir}/ +do_install_append_sysmobts2100() { + install -m 0660 ${S}/doc/examples/litecell15/osmo-bts.cfg ${D}${sysconfdir}/osmocom + + # ensure consistent naming + mv ${D}/${bindir}/lc15bts-util ${D}/${bindir}/sysmobts-util + mv ${D}/${bindir}/lc15bts-mgr ${D}/${bindir}/sysmobts-mgr + + # Install systemd and enable on sysinit + install -d ${D}${systemd_unitdir}/system/multi-user.target.wants/ + install -m 0644 ${WORKDIR}/osmo-bts-lc15.service ${D}${systemd_unitdir}/system/ + ln -sf ../osmo-bts-lc15.service ${D}${systemd_unitdir}/system/multi-user.target.wants/ } + CONFFILES_${PN} = "${sysconfdir}/osmocom/osmo-bts.cfg" -CONFFILES_${PN} += "${sysconfdir}/osmocom/sysmobts-mgr.cfg" +CONFFILES_${PN}_append_sysmobts-v2 = " ${sysconfdir}/osmocom/sysmobts-mgr.cfg" INITSCRIPT_PACKAGES = "${PN}" -INITSCRIPT_NAME_${PN} = "sysmobts" -INITSCRIPT_PARAMS_${PN} = "defaults 30 30" +INITSCRIPT_NAME_${PN}_sysmobts-2 = "sysmobts" +INITSCRIPT_PARAMS_${PN}_sysmobts-v2 = "defaults 30 30" +# somehow it seems not posible to use _append constructs on PACKAGES +#PACKAGES_append_sysmobts-v2 = " osmo-bts-remote sysmobts-calib sysmobts-util" PACKAGES =+ "osmo-bts-remote sysmobts-calib sysmobts-util" FILES_${PN} += "${systemd_unitdir}" -FILES_osmo-bts-remote = " ${bindir}/sysmobts-remote " -FILES_sysmobts-calib = " ${bindir}/sysmobts-calib " +FILES_osmo-bts-remote_sysmobts-v2 = " ${bindir}/osmo-bts-sysmo-remote " +FILES_sysmobts-calib_sysmobts-v2 = " ${bindir}/sysmobts-calib " FILES_sysmobts-util = " ${bindir}/sysmobts-util "