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
This commit is contained in:
Daniel Willmann 2019-05-21 18:14:59 +02:00
parent 584c1ccf10
commit 50579753a0
11 changed files with 85 additions and 100 deletions

View File

@ -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"

View File

@ -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

View File

@ -0,0 +1,8 @@
[Unit]
Description=Automount ROM partition with factory defaults
[Automount]
Where=/mnt/rom/factory
[Install]
WantedBy=multi-user.target

View File

@ -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

View File

@ -0,0 +1,8 @@
[Unit]
Description=Automount user partition with default settings
[Automount]
Where=/mnt/rom/user
[Install]
WantedBy=multi-user.target

View File

@ -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

View File

@ -0,0 +1,8 @@
[Unit]
Description=Automount storage partition
[Automount]
Where=/mnt/storage
[Install]
WantedBy=multi-user.target

View File

@ -0,0 +1,10 @@
[Unit]
Description=Mount storage partition
[Mount]
What=/dev/mmcblk0p4
Where=/mnt/storage
Type=ext4
[Install]
WantedBy=multi-user.target

View File

@ -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

View File

@ -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

View File

@ -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"