From 50579753a0e3d450a4128c6671de96a4efc31b22 Mon Sep 17 00:00:00 2001 From: Daniel Willmann Date: Tue, 21 May 2019 18:14:59 +0200 Subject: [PATCH] oc2g-sysdev-remap: Use systemd automount to mount /mnt/rom/* The filesystems are now mounted in the same way the sysmobts2100 build does it. This fixes the failing checkflash systemd service on the oc2g. Related: SYS#4493 --- .../base-files/base-files_sysmocom.inc | 4 +- recipes-bsp/base-files/files/oc2g/fstab | 9 ---- .../files/mnt-rom-factory.automount | 8 +++ .../files/mnt-rom-factory.mount | 11 ++++ .../files/mnt-rom-user.automount | 8 +++ .../files/mnt-rom-user.mount | 10 ++++ .../files/mnt-storage.automount | 8 +++ .../oc2g-sysdev-remap/files/mnt-storage.mount | 10 ++++ .../files/oc2g-sysdev-remap.init | 52 ------------------- .../files/oc2g-sysdev-remap.service | 21 ++++---- .../oc2g-sysdev-remap_1.0.bb | 44 +++++++--------- 11 files changed, 85 insertions(+), 100 deletions(-) delete mode 100644 recipes-bsp/base-files/files/oc2g/fstab create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.automount create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.mount create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.automount create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.mount create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-storage.automount create mode 100644 recipes-support/oc2g-sysdev-remap/files/mnt-storage.mount delete mode 100644 recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.init diff --git a/recipes-bsp/base-files/base-files_sysmocom.inc b/recipes-bsp/base-files/base-files_sysmocom.inc index defb299..110a511 100644 --- a/recipes-bsp/base-files/base-files_sysmocom.inc +++ b/recipes-bsp/base-files/base-files_sysmocom.inc @@ -1,6 +1,4 @@ THISDIR := "${@os.path.dirname(d.getVar('FILE', True))}" FILESPATH =. "${@base_set_filespath(["${THISDIR}/files"], d)}:" -PRINC="4" - -dirs755_append_oc2g = "/mnt/rom /mnt/rom/factory" +PRINC="5" diff --git a/recipes-bsp/base-files/files/oc2g/fstab b/recipes-bsp/base-files/files/oc2g/fstab deleted file mode 100644 index e99281d..0000000 --- a/recipes-bsp/base-files/files/oc2g/fstab +++ /dev/null @@ -1,9 +0,0 @@ -/dev/root / auto defaults 1 1 -proc /proc proc defaults 0 0 -devpts /dev/pts devpts mode=0620,gid=5 0 0 -tmpfs /run tmpfs mode=0755,nodev,nosuid,strictatime 0 0 -tmpfs /var/volatile tmpfs defaults 0 0 - -/dev/mtdblock8 /mnt/rom/factory jffs2 ro,sync,noatime,nofail 0 0 -#/dev/mmcblk0p4 /mnt/storage ext4 defaults,noatime,nofail 0 0 - diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.automount b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.automount new file mode 100644 index 0000000..2341173 --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.automount @@ -0,0 +1,8 @@ +[Unit] +Description=Automount ROM partition with factory defaults + +[Automount] +Where=/mnt/rom/factory + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.mount b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.mount new file mode 100644 index 0000000..b31384c --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-factory.mount @@ -0,0 +1,11 @@ +[Unit] +Description=Mount ROM partition with factory defaults + +[Mount] +What=/dev/mtdblock8 +Where=/mnt/rom/factory +Type=jffs2 +Options=ro + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.automount b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.automount new file mode 100644 index 0000000..e23d097 --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.automount @@ -0,0 +1,8 @@ +[Unit] +Description=Automount user partition with default settings + +[Automount] +Where=/mnt/rom/user + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.mount b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.mount new file mode 100644 index 0000000..946b4ce --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-rom-user.mount @@ -0,0 +1,10 @@ +[Unit] +Description=Mount user partition with default settings + +[Mount] +What=/dev/mtdblock9 +Where=/mnt/rom/user +Type=jffs2 + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-storage.automount b/recipes-support/oc2g-sysdev-remap/files/mnt-storage.automount new file mode 100644 index 0000000..0ab9e07 --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-storage.automount @@ -0,0 +1,8 @@ +[Unit] +Description=Automount storage partition + +[Automount] +Where=/mnt/storage + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/mnt-storage.mount b/recipes-support/oc2g-sysdev-remap/files/mnt-storage.mount new file mode 100644 index 0000000..33203ae --- /dev/null +++ b/recipes-support/oc2g-sysdev-remap/files/mnt-storage.mount @@ -0,0 +1,10 @@ +[Unit] +Description=Mount storage partition + +[Mount] +What=/dev/mmcblk0p4 +Where=/mnt/storage +Type=ext4 + +[Install] +WantedBy=multi-user.target diff --git a/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.init b/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.init deleted file mode 100644 index 76cf38b..0000000 --- a/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.init +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/sh -# Start/stop the system devices remapping for OC-2G daemon. -# -### BEGIN INIT INFO -# Provides: oc2g-sysdev-remap -# Required-Start: $syslog $time -# Required-Stop: $syslog $time -# Default-Start: 2 3 4 5 -# Default-Stop: 0 1 6 -# Short-Description: Remapping all availble system devices of OC-2G platform in system to a easy to reach location -# Description: Accessible to all system devices related to OC-2G platform will be available at /var/oc2g -# -### END INIT INFO - -REMAP_DIR='/var/volatile/oc2g' - -test -f /usr/bin/oc2g-sysdev-remap|| exit 0 - -. /etc/init.d/functions - -log_daemon_msg () { - echo $@ -} - -log_end_msg () { - if test "$1" != "0"; then - echo "Error with $DESCRIPTION: $NAME" - fi - return $1 -} - - -case "$1" in -start) log_daemon_msg "Starting system devices remapping script:" "oc2g-sysdev-remap" - mkdir -p ${REMAP_DIR} - /usr/bin/oc2g-sysdev-remap - log_end_msg $? - ;; -stop) log_daemon_msg "Stopping system devices remapping script:" "oc2g-sysdev-remap" - test -d ${REMAP_DIR} && rm -rf ${REMAP_DIR} - ;; -restart) log_daemon_msg "Restarting system devices remapping script:" "oc2oc2gg-sysdev-remap" - test -d ${REMAP_DIR} && rm -rf ${REMAP_DIR} - mkdir -p ${REMAP_DIR} - /usr/bin/oc2g-sysdev-remap - log_end_msg $? - ;; -*) log_action_msg "Usage: /etc/init.d/oc2g-sysdev-remap {start|stop|restart}" - exit 2 - ;; -esac -exit 0 diff --git a/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.service b/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.service index c0b0105..80eb76e 100644 --- a/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.service +++ b/recipes-support/oc2g-sysdev-remap/files/oc2g-sysdev-remap.service @@ -1,21 +1,18 @@ [Unit] -SourcePath=/etc/init.d/oc2g-sysdev-remap Description=Remapping all available system devices of platform to a easy to reach location -Before=multi-user.target -Before=shutdown.target -Before=watchdog.service +After=local-fs.target +Before=osmo-bts-oc2g.service After=checkflash.service Wants=checkflash.service After=time-sync.target Conflicts=shutdown.target [Service] -Type=forking -Restart=no -TimeoutSec=5min -IgnoreSIGPIPE=no -KillMode=process -GuessMainPID=no +Type=oneshot +RuntimeDirectory=oc2g +ExecStart=/bin/ln -f -s /run/oc2g /var/oc2g +ExecStart=/usr/bin/oc2g-sysdev-remap RemainAfterExit=yes -ExecStart=/etc/init.d/oc2g-sysdev-remap start -ExecStop=/etc/init.d/oc2g-sysdev-remap stop + +[Install] +WantedBy=multi-user.target oc2gbts-mgr.service diff --git a/recipes-support/oc2g-sysdev-remap/oc2g-sysdev-remap_1.0.bb b/recipes-support/oc2g-sysdev-remap/oc2g-sysdev-remap_1.0.bb index de23164..47aa8e3 100644 --- a/recipes-support/oc2g-sysdev-remap/oc2g-sysdev-remap_1.0.bb +++ b/recipes-support/oc2g-sysdev-remap/oc2g-sysdev-remap_1.0.bb @@ -2,15 +2,18 @@ DESCRITOPN = "Remap all available system devices of OC-2G platform as symbolic l LICENSE = "BSD" LIC_FILES_CHKSUM = "file://${COREBASE}/meta/files/common-licenses/BSD;md5=3775480a712fc46a69647678acb234cb" -inherit update-rc.d - SRC_URI = "file://oc2g-sysdev-remap \ - file://oc2g-sysdev-remap.init \ + file://mnt-rom-factory.automount \ + file://mnt-rom-factory.mount \ + file://mnt-rom-user.automount \ + file://mnt-rom-user.mount \ + file://mnt-storage.automount \ + file://mnt-storage.mount \ file://oc2g-sysdev-remap.service" S = "${WORKDIR}" -inherit gitver-repo +inherit gitver-repo systemd REPODIR = "${THISDIR}" REPOFILE = "oc2g-sysdev-remap_1.0.bb" @@ -22,31 +25,24 @@ PR := "${PR}.${REPOGITFN}" RDEPENDS_${PN} += "backup-scripts" +SYSTEMD_PACKAGES = "${PN}" +SYSTEMD_AUTO_ENABLE_${PN}="enable" +SYSTEMD_SERVICE_${PN} = "oc2g-sysdev-remap.service mnt-rom-factory.automount mnt-rom-factory.mount mnt-rom-user.automount mnt-rom-user.mount mnt-storage.automount mnt-storage.mount" + do_install() { - install -d ${D}${sysconfdir} - install -d ${D}${sysconfdir}/systemd - install -d ${D}${sysconfdir}/systemd/system - install -d ${D}${sysconfdir}/systemd/system/multi-user.target.wants - install -d ${D}${sysconfdir}/init.d - install -m 0755 -d ${D}${base_libdir} - install -m 0755 -d ${D}${systemd_unitdir} - install -m 0755 -d ${D}${systemd_unitdir}/system install -d ${D}${bindir} - install -d ${D}/var/volatile/oc2g - ln -sf volatile/oc2g ${D}/var/oc2g + install -d ${D}/${systemd_system_unitdir} install -m 0755 ${S}/oc2g-sysdev-remap ${D}${bindir}/oc2g-sysdev-remap - install -m 0755 ${S}/oc2g-sysdev-remap.init ${D}${sysconfdir}/init.d/oc2g-sysdev-remap - install -m 0644 ${S}/oc2g-sysdev-remap.service ${D}${systemd_unitdir}/system/oc2g-sysdev-remap.service - ln -sf ${systemd_unitdir}/system/oc2g-sysdev-remap.service ${D}${sysconfdir}/systemd/system/multi-user.target.wants/oc2g-sysdev-remap.service + install -m 0644 ${S}/oc2g-sysdev-remap.service ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-rom-factory.automount ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-rom-factory.mount ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-rom-user.automount ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-rom-user.mount ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-storage.automount ${D}${systemd_system_unitdir}/ + install -m 0644 ${S}/mnt-storage.mount ${D}${systemd_system_unitdir}/ } FILES_${PN} += "${bindir} \ - ${sysconfdir} \ - ${systemd_unitdir} \ - ${sysconfdir}/init.d \ - /var/oc2g" + ${sysconfdir}" INSANE_SKIP_${PN} = "arch" -INITSCRIPT_PACKAGES = "${PN}" -INITSCRIPT_NAME_${PN} = "oc2g-sysdev-remap" -INITSCRIPT_PARAMS_${PN} = "defaults 21 21"