added my Recipes

This commit is contained in:
2024-07-11 14:16:35 +02:00
parent 38bc4f53ac
commit 09b621d929
7118 changed files with 525762 additions and 3 deletions

View File

@@ -0,0 +1,61 @@
# Please read the corosync.conf.5 manual page
totem {
version: 2
# Set name of the cluster
cluster_name: testCluster
# crypto_cipher and crypto_hash: Used for mutual node authentication.
# If you choose to enable this, then do remember to create a shared
# secret with "corosync-keygen".
# enabling crypto_cipher, requires also enabling of crypto_hash.
# crypto works only with knet transport
crypto_cipher: none
crypto_hash: none
}
logging {
# Log the source file and line where messages are being
# generated. When in doubt, leave off. Potentially useful for
# debugging.
fileline: off
# Log to standard error. When in doubt, set to yes. Useful when
# running in the foreground (when invoking "corosync -f")
to_stderr: yes
# Log to a log file. When set to "no", the "logfile" option
# must not be set.
to_logfile: yes
logfile: /var/log/cluster/corosync.log
# Log to the system log daemon. When in doubt, set to yes.
to_syslog: yes
# Log debug messages (very verbose). When in doubt, leave off.
debug: off
# Log messages with time stamps. When in doubt, set to hires (or on)
#timestamp: hires
logger_subsys {
subsys: QUORUM
debug: off
}
}
quorum {
# Enable and configure quorum subsystem (default: off)
# see also corosync.conf.5 and votequorum.5
provider: corosync_votequorum
}
nodelist {
# Change/uncomment/add node sections to match cluster configuration
node {
# Hostname of the node
name: node1
# Cluster membership node identifier
nodeid: 1
# Address of first link
ring0_addr: 127.0.0.1
# When knet transport is used it's possible to define up to 8 links
#ring1_addr: 192.168.1.1
}
# ...
}

View File

@@ -0,0 +1,63 @@
SUMMARY = "The Corosync Cluster Engine and Application Programming Interfaces"
DESCRIPTION = "This package contains the Corosync Cluster Engine Executive, several default \
APIs and libraries, default configuration files, and an init script."
HOMEPAGE = "http://corosync.github.io/corosync/"
SECTION = "base"
inherit autotools pkgconfig systemd
SRC_URI = "https://github.com/${BPN}/${BPN}/releases/download/v${PV}/${BP}.tar.gz \
file://corosync.conf \
"
SRC_URI[sha256sum] = "ca6ed32b4d7f33ed614afce8760fe58d0de92c68b575d4969ebacd892f3d1e27"
UPSTREAM_CHECK_REGEX = "(?P<pver>\d+\.(?!99)\d+(\.\d+)+)"
LICENSE = "BSD-3-Clause"
LIC_FILES_CHKSUM = "file://LICENSE;md5=a85eb4ce24033adb6088dd1d6ffc5e5d"
DEPENDS = "groff-native nss libqb kronosnet"
SYSTEMD_SERVICE:${PN} = "corosync.service corosync-notifyd.service"
SYSTEMD_AUTO_ENABLE = "disable"
INITSCRIPT_NAME = "corosync-daemon"
PACKAGECONFIG ??= "${@bb.utils.filter('DISTRO_FEATURES', 'systemd', d)} \
dbus snmp \
"
PACKAGECONFIG[dbus] = "--enable-dbus,--disable-dbus,dbus"
PACKAGECONFIG[snmp] = "--enable-snmp,--disable-snmp,net-snmp"
PACKAGECONFIG[systemd] = "--enable-systemd --with-systemddir=${systemd_system_unitdir},--disable-systemd --without-systemddir,systemd"
EXTRA_OECONF = "ac_cv_path_BASHPATH=${base_bindir}/bash ap_cv_cc_pie=no"
EXTRA_OEMAKE = "tmpfilesdir_DATA="
#do_configure:prepend() {
# ( cd ${S}
# ${S}/autogen.sh )
#}
do_install:append() {
install -D -m 0644 ${WORKDIR}/corosync.conf ${D}${sysconfdir}/corosync/corosync.conf.example
install -d ${D}${sysconfdir}/sysconfig/
install -m 0644 ${S}/init/corosync.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync
install -m 0644 ${S}/tools/corosync-notifyd.sysconfig.example ${D}${sysconfdir}/sysconfig/corosync-notifyd
rmdir ${D}${localstatedir}/log/cluster ${D}${localstatedir}/log
rmdir --ignore-fail-on-non-empty ${D}${localstatedir}
install -d ${D}${sysconfdir}/default/volatiles
echo "d root root 0755 ${localstatedir}/log/cluster none" > ${D}${sysconfdir}/default/volatiles/05_corosync
if [ ${@bb.utils.filter('DISTRO_FEATURES','systemd',d)} ]; then
install -d ${D}${sysconfdir}/tmpfiles.d
echo "d ${localstatedir}/log/cluster - - - -" > ${D}${sysconfdir}/tmpfiles.d/corosync.conf
fi
}
RDEPENDS:${PN} += "bash ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'sysvinit-pidof', 'procps', d)}"
FILES:${PN}-dbg += "${libexecdir}/lcrso/.debug"
FILES:${PN}-doc += "${datadir}/snmp/mibs/COROSYNC-MIB.txt"

View File

@@ -0,0 +1,41 @@
From a55ab8a07770296bf6a622df14f2f0445be16327 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Sun, 19 Aug 2018 15:58:49 -0700
Subject: [PATCH] Include sys/sysmacros.h for major/minor macros in glibc 2.25+
sys/sysmacros.h was included though sys/types.h until 2.28
glibc release removed it therefore it must be included
explicitly now.
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
dlm_controld/action.c | 2 ++
libdlm/libdlm.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/dlm_controld/action.c b/dlm_controld/action.c
index 84637f1..2b8ad6c 100644
--- a/dlm_controld/action.c
+++ b/dlm_controld/action.c
@@ -8,6 +8,8 @@
#include "dlm_daemon.h"
+#include <sys/sysmacros.h>
+
#include <corosync/corotypes.h>
#include <corosync/cmap.h>
diff --git a/libdlm/libdlm.c b/libdlm/libdlm.c
index a9e6195..499eb6a 100644
--- a/libdlm/libdlm.c
+++ b/libdlm/libdlm.c
@@ -14,6 +14,7 @@
#include <sys/ioctl.h>
#include <sys/param.h>
#include <sys/stat.h>
+#include <sys/sysmacros.h>
#include <stdint.h>
#include <stdlib.h>
#include <inttypes.h>

View File

@@ -0,0 +1,35 @@
From da08f5ec5e553bd43f92a0b0f7476179b0b74502 Mon Sep 17 00:00:00 2001
From: Changqing Li <changqing.li@windriver.com>
Date: Wed, 26 Jun 2019 11:49:33 +0800
Subject: [PATCH] dlm: fix compile error since xml2-config should not be used
xml2-config is disabled, so change Makefile to use pkgconfig
to find libxml2.
Upstream-Status: Inappropriate [oe-specific]
Signed-off-by: Changqing Li <changqing.li@windriver.com>
---
fence/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/fence/Makefile b/fence/Makefile
index 2b080468..ff2eda3f 100644
--- a/fence/Makefile
+++ b/fence/Makefile
@@ -18,12 +18,12 @@ CFLAGS += -D_GNU_SOURCE -O2 -ggdb \
-fstack-clash-protection -Wl,-z,now
CFLAGS += -fPIE -DPIE
-CFLAGS += `xml2-config --cflags`
+CFLAGS += `pkg-config libxml-2.0 --cflags`
CFLAGS += -I../include
CFLAGS += $(shell pkg-config --cflags pacemaker-fencing)
LDFLAGS += -Wl,-z,relro -Wl,-z,defs -pie
-LDFLAGS += `xml2-config --libs`
+LDFLAGS += `pkg-config libxml-2.0 --libs`
LDFLAGS += -ldl
all: $(BIN_TARGET)

View File

@@ -0,0 +1,51 @@
From 2f72f9271b8dd61ca5092e025b0f8243c6fd68f2 Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Tue, 3 Mar 2020 12:38:19 -0800
Subject: [PATCH] make: Replace cp -a with mode preserving options
Helps fix permissions in staging area
Upstream-Status: Pending
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
dlm_controld/Makefile | 4 ++--
libdlm/Makefile | 8 ++++----
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/dlm_controld/Makefile b/dlm_controld/Makefile
index 6081cf8..fe71be2 100644
--- a/dlm_controld/Makefile
+++ b/dlm_controld/Makefile
@@ -88,8 +88,8 @@ install: all
$(INSTALL) -d $(DESTDIR)/$(PKGDIR)
$(INSTALL) -m 755 $(BIN_TARGET) $(DESTDIR)/$(BINDIR)
$(INSTALL) -m 755 $(LIB_TARGET) $(DESTDIR)/$(LIBDIR)
- cp -a $(LIB_SO) $(DESTDIR)/$(LIBDIR)
- cp -a $(LIB_SMAJOR) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LIB_SO) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LIB_SMAJOR) $(DESTDIR)/$(LIBDIR)
$(INSTALL) -m 644 $(LIB_PC) $(DESTDIR)/$(PKGDIR)
$(INSTALL) -m 644 libdlmcontrol.h $(DESTDIR)/$(HDRDIR)
$(INSTALL) -m 644 dlm_controld.8 $(DESTDIR)/$(MANDIR)/man8/
diff --git a/libdlm/Makefile b/libdlm/Makefile
index ab32761..8820bf8 100644
--- a/libdlm/Makefile
+++ b/libdlm/Makefile
@@ -125,10 +125,10 @@ install: all
$(INSTALL) -d $(DESTDIR)/$(UDEVDIR)
$(INSTALL) -c -m 755 $(LIB_TARGET) $(DESTDIR)/$(LIBDIR)
$(INSTALL) -c -m 755 $(LLT_TARGET) $(DESTDIR)/$(LIBDIR)
- cp -a $(LIB_SO) $(DESTDIR)/$(LIBDIR)
- cp -a $(LIB_SMAJOR) $(DESTDIR)/$(LIBDIR)
- cp -a $(LLT_SO) $(DESTDIR)/$(LIBDIR)
- cp -a $(LLT_SMAJOR) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LIB_SO) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LIB_SMAJOR) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LLT_SO) $(DESTDIR)/$(LIBDIR)
+ cp -R --no-dereference --preserve=mode,links $(LLT_SMAJOR) $(DESTDIR)/$(LIBDIR)
$(INSTALL) -m 644 $(LIB_PC) $(DESTDIR)/$(PKGDIR)
$(INSTALL) -m 644 $(LLT_PC) $(DESTDIR)/$(PKGDIR)
$(INSTALL) -c -m 644 $(HDR_TARGET) $(DESTDIR)/$(HDRDIR)
--
2.25.1

View File

@@ -0,0 +1,23 @@
From 9652e6b3c43b4c051f2ff0e000d7ebf5fbab418e Mon Sep 17 00:00:00 2001
From: Khem Raj <raj.khem@gmail.com>
Date: Mon, 29 Aug 2022 10:54:51 -0700
Subject: [PATCH] include string.h for memset prototype
Upstream-Status: Submitted [https://pagure.io/dlm/pull-request/3]
Signed-off-by: Khem Raj <raj.khem@gmail.com>
---
dlm_controld/lib.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/dlm_controld/lib.c b/dlm_controld/lib.c
index 8cbdd27f..a7502fcd 100644
--- a/dlm_controld/lib.c
+++ b/dlm_controld/lib.c
@@ -10,6 +10,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <stdint.h>
+#include <string.h>
#include <errno.h>
#include <time.h>
#include <sys/types.h>

View File

@@ -0,0 +1,60 @@
DESCRIPTION = "dlm control daemon and tool"
SECTION = "utils"
HOMEPAGE = "https://fedorahosted.org/cluster/wiki/HomePage"
REQUIRED_DISTRO_FEATURES = "systemd"
SRC_URI = "https://pagure.io/dlm/archive/dlm-${PV}/dlm-dlm-${PV}.tar.gz \
file://0001-dlm-fix-compile-error-since-xml2-config-should-not-b.patch \
file://0001-Include-sys-sysmacros.h-for-major-minor-macros-in-gl.patch \
file://0001-make-Replace-cp-a-with-mode-preserving-options.patch \
file://0004-include-string.h-for-memset-prototype.patch \
"
SRC_URI[sha256sum] = "f12c0056b9196dfcecbec2fa8930feb87c605a86ef0f3d7bd6fb0b77cd7f45ca"
UPSTREAM_CHECK_URI = "https://pagure.io/dlm/releases"
UPSTREAM_CHECK_REGEX = "dlm-(?P<pver>\d+(\.\d+)+)"
LICENSE = "LGPL-2.0-or-later & GPL-2.0-only & GPL-2.0-or-later"
LIC_FILES_CHKSUM = "file://README.license;md5=8f0bbcdd678df1bce9863492b6c8832d"
S = "${WORKDIR}/dlm-dlm-${PV}"
DEPENDS += "corosync"
inherit pkgconfig systemd features_check
PACKAGECONFIG ??= ""
PACKAGECONFIG[pacemaker] = ",,pacemaker"
SYSTEMD_SERVICE:${PN} = "dlm.service"
SYSTEMD_AUTO_ENABLE = "enable"
export EXTRA_OEMAKE = ""
DONTBUILD = "${@bb.utils.contains('PACKAGECONFIG', 'pacemaker', '', 'fence', d)}"
do_compile:prepend:toolchain-clang() {
sed -i -e "s/-fstack-clash-protection//g" ${S}/*/Makefile
}
do_compile() {
sed -i "s/libsystemd-daemon/libsystemd/g" ${S}/dlm_controld/Makefile
sed -i -e "s/ ${DONTBUILD}//g" ${S}/Makefile
oe_runmake 'CC=${CC}'
}
do_install() {
oe_runmake install DESTDIR=${D} LIBDIR=${libdir}
install -Dm 0644 ${S}/init/dlm.sysconfig ${D}${sysconfdir}/sysconfig/dlm
install -Dm 0644 ${S}/init/dlm.init ${D}${sysconfdir}/init.d/dlm
# install systemd unit files
if ${@bb.utils.contains('DISTRO_FEATURES','systemd','true','false',d)}; then
install -Dm 0644 ${S}/init/dlm.service ${D}${systemd_unitdir}/system/dlm.service
fi
}

View File

@@ -0,0 +1,40 @@
From a8aac8f3fd8b07fde8f5dc0aa9ece54a46d24425 Mon Sep 17 00:00:00 2001
From: Mingli Yu <mingli.yu@windriver.com>
Date: Thu, 9 Jun 2022 16:03:06 +0800
Subject: [PATCH] links.c: Fix build with gcc-12
Fixes:
| /build/tmp-glibc/work/corei7-64-wrs-linux/kronosnet/1.22-r0/recipe-sysroot/usr/include/bits/string_fortified.h:59:10: error: 'link' may be used uninitialized [-Werror=maybe-uninitialized]
| 59 | return __builtin___memset_chk (__dest, __ch, __len,
| | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| 60 | __glibc_objsize0 (__dest));
| | ~~~~~~~~~~~~~~~~~~~~~~~~~~
| ../../git/libknet/links.c: In function 'knet_link_set_config':
| ../../git/libknet/links.c:108:27: note: 'link' was declared here
| 108 | struct knet_link *link;
| | ^~~~
| cc1: all warnings being treated as errors
Upstream-Status: Submitted [https://github.com/kronosnet/kronosnet/pull/382]
Signed-off-by: Mingli Yu <mingli.yu@windriver.com>
---
libknet/links.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/libknet/links.c b/libknet/links.c
index 8cb1621b..0ef42b79 100644
--- a/libknet/links.c
+++ b/libknet/links.c
@@ -105,7 +105,7 @@ int knet_link_set_config(knet_handle_t knet_h, knet_node_id_t host_id, uint8_t l
{
int savederrno = 0, err = 0, i, wipelink = 0, link_idx;
struct knet_host *host, *tmp_host;
- struct knet_link *link;
+ struct knet_link *link = NULL;
if (!_is_valid_handle(knet_h)) {
return -1;
--
2.25.1

View File

@@ -0,0 +1,32 @@
# Copyright (C) 2020 Khem Raj <raj.khem@gmail.com>
# Released under the MIT license (see COPYING.MIT for the terms)
SUMMARY = "Kronosnet, often referred to as knet, is a network abstraction layer \
designed for High Availability use cases, where redundancy, security, \
fault tolerance and fast fail-over are the core requirements of your application."
HOMEPAGE = "https://kronosnet.org/"
LICENSE = "GPL-2.0-or-later & LGPL-2.1-only"
LIC_FILES_CHKSUM = "file://COPYING.applications;md5=751419260aa954499f7abaabaa882bbe \
file://COPYING.libraries;md5=2d5025d4aa3495befef8f17206a5b0a1"
SECTION = "libs"
DEPENDS = "doxygen-native libqb-native libxml2-native bzip2 libqb libxml2 libnl lksctp-tools lz4 lzo openssl nss xz zlib zstd"
SRCREV = "f8f80fd7f9b85f2626d2c6452612962ad8efca9e"
SRC_URI = "git://github.com/kronosnet/kronosnet;protocol=https;branch=stable1 \
file://0001-links.c-Fix-build-with-gcc-12.patch \
"
UPSTREAM_CHECK_URI = "https://github.com/kronosnet/kronosnet/releases"
inherit autotools pkgconfig
S = "${WORKDIR}/git"
# libknet/transport_udp.c:326:48: error: comparison of integers of different signs: 'unsigned long' and 'int' [-Werror,-Wsign-compare]
# for (cmsg = CMSG_FIRSTHDR(&msg);cmsg; cmsg = CMSG_NXTHDR(&msg, cmsg)) {
# ^~~~~~~~~~~~~~~~~~~~~~~
CFLAGS:append:toolchain-clang = " -Wno-sign-compare"
PACKAGECONFIG[man] = "enable_man="yes", --disable-man, "
PACKAGECONFIG:remove = "man"

View File

@@ -0,0 +1,47 @@
From 93fea40915d01be6d02587a0b8be85a642e6a8d5 Mon Sep 17 00:00:00 2001
From: Zhenhua Luo <zhenhua.luo@freescale.com>
Date: Thu, 10 Apr 2014 11:26:39 +0800
Subject: [PATCH] Correct the path of header files check in Yocto build env
Upstream-Status: Inappropriate [the fix is specific to Yocto build env]
Current Makefile will check headers on host instead of Yocto sysroot, following
error appears. Change the path of header check.
| bs_aio.c:34:20: fatal error: libaio.h: No such file or directory
| #include <libaio.h>
| ^
| compilation terminated.
Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
---
usr/Makefile | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index decf13c..9ff8f15 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -1,11 +1,11 @@
sbindir ?= $(PREFIX)/sbin
libdir ?= $(PREFIX)/lib/tgt
-ifneq ($(shell test -e /usr/include/linux/signalfd.h && echo 1),)
+ifneq ($(shell test -e $(SYSROOT)/usr/include/linux/signalfd.h && echo 1),)
CFLAGS += -DUSE_SIGNALFD
endif
-ifneq ($(shell test -n $(shell find /usr/include -name "timerfd.h" | head -n1) && echo 1),)
+ifneq ($(shell test -n $(shell find $(SYSROOT)/usr/include -name "timerfd.h" | head -n1) && echo 1),)
CFLAGS += -DUSE_TIMERFD
endif
@@ -25,7 +25,7 @@ ifneq ($(SD_NOTIFY),)
CFLAGS += -DUSE_SYSTEMD
endif
-ifneq ($(shell test -e /usr/include/sys/eventfd.h && test -e /usr/include/libaio.h && echo 1),)
+ifneq ($(shell test -e $(SYSROOT)/usr/include/sys/eventfd.h && test -e $(SYSROOT)/usr/include/libaio.h && echo 1),)
CFLAGS += -DUSE_EVENTFD
TGTD_OBJS += bs_aio.o
LIBS += -laio

View File

@@ -0,0 +1,29 @@
From 6f4e3b11c7dccf83e2d18635c84837b212dfcc1c Mon Sep 17 00:00:00 2001
From: Li xin <lixin.fnst@cn.fujitsu.com>
Date: Sun, 26 Jul 2015 04:23:51 +0900
Subject: [PATCH] usr/Makefile: WARNING fix WARNING: QA Issue: tgt:
/work/i586-oe-linux/tgt/1.0.60+gitAUTOINC+ab51727a36-r0/
packages-split/tgt/usr/sbin/tgtd contains probably-redundant RPATH /usr/lib
[useless-rpaths]
Upstream-Status: Pending
Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
---
usr/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/usr/Makefile b/usr/Makefile
index 9ff8f15..cc8df11 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -63,7 +63,7 @@ TGTD_OBJS += tgtd.o mgmt.o target.o scsi.o log.o driver.o util.o work.o \
TGTD_DEP = $(TGTD_OBJS:.o=.d)
-LDFLAGS = -Wl,-E,-rpath=$(libdir)
+LDFLAGS += -Wl,-E
.PHONY:all
all: $(PROGRAMS) $(MODULES)

View File

@@ -0,0 +1,5 @@
# options for tgtd
TGTD_OPTS=""
# configuration file
TGTD_CONFIG=/etc/tgt/targets.conf

View File

@@ -0,0 +1,116 @@
#!/bin/sh
### BEGIN INIT INFO
# Provides: tgtd
# Required-Start: $remote_fs $network $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: SCSI target daemon
# Description: Linux SCSI target framework (tgt)
### END INIT INFO
DESC="tgtd"
DAEMON="/usr/sbin/tgtd"
TGTD_CONFIG=/etc/tgt/targets.conf
start ()
{
echo -n "Starting $DESC..."
# Ensure service isn't running
tgt-admin -s >/dev/null 2>&1
RETVAL=$?
if [ "$RETVAL" -ne 107 ] ; then
echo "$DESC is already running."
exit 1
fi
# Start tgtd first
$DAEMON &>/dev/null
RETVAL=$?
if [ "$RETVAL" -ne 0 ]; then
echo "failed."
exit 1
fi
# Put tgtd into "offline" state until all the targets are configured.
# We don't want initiators to (re)connect and fail the connection
# if it's not ready.
tgtadm --op update --mode sys --name State -v offline
# Configure the targets.
tgt-admin -f -e -c $TGTD_CONFIG
# Put tgtd into "ready" state.
tgtadm --op update --mode sys --name State -v ready
echo "done."
}
stop ()
{
echo -n "Stopping $DESC..."
# Remove all targets. It only removes targets which are not in use.
tgt-admin --update ALL -c /dev/null &>/dev/null
# tgtd will exit if all targets were removed
tgtadm --op delete --mode system &>/dev/null
RETVAL=$?
if [ "$RETVAL" -eq 107 ] ; then
if [ "$TASK" != "restart" ] ; then
return 1
fi
elif [ "$RETVAL" -ne 0 ] ; then
echo "Some initiators are still connected - could not stop tgtd"
return 2
fi
echo -n
}
reload()
{
echo "Reloading configuration of $DESC" "$NAME"
# Update configuration for targets. Only targets which
# are not in use will be updated.
tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null
RETVAL=$?
if [ "$RETVAL" -eq 107 ] ; then
echo "tgtd is not running"
exit 1
fi
}
status()
{
tgt-admin -s >/dev/null 2>&1
RETVAL=$?
if [ "$RETVAL" -eq 107 ] ; then
echo "tgtd is not running"
else
echo "tgtd is running"
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart|force-reload)
stop
start
;;
reload)
reload
;;
status)
status
;;
*)
echo "Usage: $0 {start|stop|force-reload|restart|status|reload}"
exit 1
;;
esac
exit 0

View File

@@ -0,0 +1,33 @@
[Unit]
Description=tgtd iSCSI target daemon
After=network.target
[Service]
EnvironmentFile=@SYSCONFDIR@/sysconfig/tgtd
ExecStart=@SBINDIR@/tgtd -f $TGTD_OPTS
# see bz 848942. workaround for a race for now.
ExecStartPost=@BASE_BINDIR@/sleep 5
# Put tgtd into "offline" state until all the targets are configured.
# We don't want initiators to (re)connect and fail the connection
# if it's not ready.
ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
# Configure the targets.
ExecStartPost=@SBINDIR@/tgt-admin -e -c $TGTD_CONFIG
# Put tgtd into "ready" state.
ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v ready
# Update configuration for targets. Only targets which
# are not in use will be updated.
ExecReload=@SBINDIR@/tgt-admin --update ALL -c $TGTD_CONFIG
# NOTE: Shutdown of the iscsi target may cause data corruption
# for initiators that are connected.
ExecStop=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
# Remove all targets. It only removes targets which are not in use.
ExecStop=@SBINDIR@/tgt-admin --update ALL -c /dev/null
# tgtd will exit if all targets were removed
ExecStop=@SBINDIR@/tgtadm --op delete --mode system
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,35 @@
From a815ac8ee16b344d9e24b445957f32bf2aafa532 Mon Sep 17 00:00:00 2001
From: Mark Asselstine <mark.asselstine@windriver.com>
Date: Thu, 5 Jan 2017 11:07:51 -0500
Subject: [PATCH] usr/Makefile: apply LDFLAGS to all executables
Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
---
usr/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/usr/Makefile b/usr/Makefile
index cc8df11..c55fd68 100644
--- a/usr/Makefile
+++ b/usr/Makefile
@@ -78,7 +78,7 @@ TGTADM_OBJS = tgtadm.o concat_buf.o
TGTADM_DEP = $(TGTADM_OBJS:.o=.d)
tgtadm: $(TGTADM_OBJS)
- $(CC) $^ -o $@
+ $(CC) $^ -o $@ $(LDFLAGS)
-include $(TGTADM_DEP)
@@ -86,7 +86,7 @@ TGTIMG_OBJS = tgtimg.o libssc.o libcrc32c.o
TGTIMG_DEP = $(TGTIMG_OBJS:.o=.d)
tgtimg: $(TGTIMG_OBJS)
- $(CC) $^ -o $@
+ $(CC) $^ -o $@ $(LDFLAGS)
-include $(TGTIMG_DEP)
--
2.7.4

View File

@@ -0,0 +1,94 @@
DESCRIPTION = "Linux SCSI target framework (tgt)"
HOMEPAGE = "http://stgt.sourceforge.net"
LICENSE = "GPL-2.0-only"
LIC_FILES_CHKSUM = "file://scripts/tgtd.spec;beginline=7;endline=7;md5=21c19ea7dad04648b9c2f791b6e29b4c"
DEPENDS = "sg3-utils libaio"
SRCREV = "a6bd1f0578bf85788a1563cbfb42a75e500d5318"
PV = "1.0.83"
SRC_URI = "git://github.com/fujita/tgt.git;branch=master;protocol=https \
file://0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch \
file://0001-usr-Makefile-WARNING-fix.patch \
file://usr-Makefile-apply-LDFLAGS-to-all-executables.patch \
"
SRC_URI += "file://tgtd.init \
file://tgtd.service \
file://tgtd \
"
S = "${WORKDIR}/git"
COMPATIBLE_HOST:libc-musl = "null"
CONFFILES:${PN} += "${sysconfdir}/tgt/targets.conf"
inherit update-rc.d systemd
SYSTEMD_SERVICE:${PN} = "tgtd.service"
SYSTEMD_AUTO_ENABLE:${PN} = "disable"
CFLAGS += ' -I. -DUSE_SIGNALFD -DUSE_TIMERFD -D_GNU_SOURCE -DTGT_VERSION=\\"1.0.63\\" -DBSDIR=\\"${libdir}/backing-store\\"'
#do_compile() {
# oe_runmake SYSROOT="${STAGING_DIR_TARGET}" -e programs conf scripts
#}
EXTRA_OEMAKE = "-e programs conf scripts"
do_install() {
oe_runmake -e DESTDIR="${D}" install-programs install-conf install-scripts
if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then
install -d ${D}${sysconfdir}/init.d
install -m 0755 ${WORKDIR}/tgtd.init ${D}${sysconfdir}/init.d/tgtd
elif ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then
install -d ${D}${systemd_unitdir}/system
install -m 0644 ${WORKDIR}/tgtd.service ${D}${systemd_unitdir}/system/tgtd.service
install -d ${D}${sysconfdir}/sysconfig
install -m 0644 ${WORKDIR}/tgtd ${D}${sysconfdir}/sysconfig/tgtd
sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/tgtd.service
sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/tgtd.service
sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/tgtd.service
fi
}
FILES:${PN} += "${systemd_unitdir}/system/tgtd.service \
${sysconfdir}/sysconfig/tgtd \
"
RDEPENDS:${PN} = " \
bash \
libaio \
libconfig-general-perl \
perl \
perl-module-english \
perl-module-tie-hash-namedcapture \
perl-module-xsloader \
perl-module-carp \
perl-module-exporter \
perl-module-errno \
perl-module-exporter-heavy \
perl-module-symbol \
perl-module-selectsaver \
perl-module-dynaloader \
perl-module-carp-heavy \
perl-module-filehandle \
perl-module-feature \
perl-module-overload \
perl-module-fcntl \
perl-module-io \
perl-module-io-file \
perl-module-io-handle \
perl-module-io-seekable \
perl-module-file-glob \
perl-module-base \
perl-module-encoding-warnings \
perl-module-file-spec-unix \
perl-module-file-spec \
perl-module-file-spec-functions \
perl-module-getopt-long \
perl-module-constant \
"
INITSCRIPT_PACKAGES = "${PN}"
INITSCRIPT_NAME:${PN} = "tgtd"