summaryrefslogtreecommitdiffstats
path: root/meta-networking/recipes-extended/tgt/files
diff options
context:
space:
mode:
authorMingli Yu <mingli.yu@windriver.com>2022-04-18 15:26:09 +0800
committerKhem Raj <raj.khem@gmail.com>2022-04-18 10:13:16 -0700
commitc1b69601fd5898a8330c12388f57cfa527cb2341 (patch)
tree638b8de7a405575a0cf781682f70d9681fe5b1eb /meta-networking/recipes-extended/tgt/files
parent159fd281968815b88bf683cd7c319e34202c1815 (diff)
downloadmeta-openembedded-c1b69601fd5898a8330c12388f57cfa527cb2341.tar.gz
tgt: move from meta-openstack
tgt is a substitute to iscsitarget [1]. [1] https://git.openembedded.org/meta-openembedded/commit/?id=1e7e4e91817b272b7685406f8d9ef58fe8c65e29 Signed-off-by: Mingli Yu <mingli.yu@windriver.com> Signed-off-by: Khem Raj <raj.khem@gmail.com>
Diffstat (limited to 'meta-networking/recipes-extended/tgt/files')
-rw-r--r--meta-networking/recipes-extended/tgt/files/0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch47
-rw-r--r--meta-networking/recipes-extended/tgt/files/0001-usr-Makefile-WARNING-fix.patch29
-rw-r--r--meta-networking/recipes-extended/tgt/files/tgtd5
-rw-r--r--meta-networking/recipes-extended/tgt/files/tgtd.init116
-rwxr-xr-xmeta-networking/recipes-extended/tgt/files/tgtd.service33
-rw-r--r--meta-networking/recipes-extended/tgt/files/usr-Makefile-apply-LDFLAGS-to-all-executables.patch35
6 files changed, 265 insertions, 0 deletions
diff --git a/meta-networking/recipes-extended/tgt/files/0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch b/meta-networking/recipes-extended/tgt/files/0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch
new file mode 100644
index 0000000000..173ecb620d
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch
@@ -0,0 +1,47 @@
1From 93fea40915d01be6d02587a0b8be85a642e6a8d5 Mon Sep 17 00:00:00 2001
2From: Zhenhua Luo <zhenhua.luo@freescale.com>
3Date: Thu, 10 Apr 2014 11:26:39 +0800
4Subject: [PATCH] Correct the path of header files check in Yocto build env
5
6Upstream-Status: Inappropriate [the fix is specific to Yocto build env]
7
8Current Makefile will check headers on host instead of Yocto sysroot, following
9error appears. Change the path of header check.
10| bs_aio.c:34:20: fatal error: libaio.h: No such file or directory
11| #include <libaio.h>
12| ^
13| compilation terminated.
14
15Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com>
16
17---
18 usr/Makefile | 6 +++---
19 1 file changed, 3 insertions(+), 3 deletions(-)
20
21diff --git a/usr/Makefile b/usr/Makefile
22index decf13c..9ff8f15 100644
23--- a/usr/Makefile
24+++ b/usr/Makefile
25@@ -1,11 +1,11 @@
26 sbindir ?= $(PREFIX)/sbin
27 libdir ?= $(PREFIX)/lib/tgt
28
29-ifneq ($(shell test -e /usr/include/linux/signalfd.h && echo 1),)
30+ifneq ($(shell test -e $(SYSROOT)/usr/include/linux/signalfd.h && echo 1),)
31 CFLAGS += -DUSE_SIGNALFD
32 endif
33
34-ifneq ($(shell test -n $(shell find /usr/include -name "timerfd.h" | head -n1) && echo 1),)
35+ifneq ($(shell test -n $(shell find $(SYSROOT)/usr/include -name "timerfd.h" | head -n1) && echo 1),)
36 CFLAGS += -DUSE_TIMERFD
37 endif
38
39@@ -25,7 +25,7 @@ ifneq ($(SD_NOTIFY),)
40 CFLAGS += -DUSE_SYSTEMD
41 endif
42
43-ifneq ($(shell test -e /usr/include/sys/eventfd.h && test -e /usr/include/libaio.h && echo 1),)
44+ifneq ($(shell test -e $(SYSROOT)/usr/include/sys/eventfd.h && test -e $(SYSROOT)/usr/include/libaio.h && echo 1),)
45 CFLAGS += -DUSE_EVENTFD
46 TGTD_OBJS += bs_aio.o
47 LIBS += -laio
diff --git a/meta-networking/recipes-extended/tgt/files/0001-usr-Makefile-WARNING-fix.patch b/meta-networking/recipes-extended/tgt/files/0001-usr-Makefile-WARNING-fix.patch
new file mode 100644
index 0000000000..078ba9ef50
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/0001-usr-Makefile-WARNING-fix.patch
@@ -0,0 +1,29 @@
1From 6f4e3b11c7dccf83e2d18635c84837b212dfcc1c Mon Sep 17 00:00:00 2001
2From: Li xin <lixin.fnst@cn.fujitsu.com>
3Date: Sun, 26 Jul 2015 04:23:51 +0900
4Subject: [PATCH] usr/Makefile: WARNING fix WARNING: QA Issue: tgt:
5 /work/i586-oe-linux/tgt/1.0.60+gitAUTOINC+ab51727a36-r0/
6 packages-split/tgt/usr/sbin/tgtd contains probably-redundant RPATH /usr/lib
7 [useless-rpaths]
8
9Upstream-Status: pending
10
11Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com>
12
13---
14 usr/Makefile | 2 +-
15 1 file changed, 1 insertion(+), 1 deletion(-)
16
17diff --git a/usr/Makefile b/usr/Makefile
18index 9ff8f15..cc8df11 100644
19--- a/usr/Makefile
20+++ b/usr/Makefile
21@@ -63,7 +63,7 @@ TGTD_OBJS += tgtd.o mgmt.o target.o scsi.o log.o driver.o util.o work.o \
22
23 TGTD_DEP = $(TGTD_OBJS:.o=.d)
24
25-LDFLAGS = -Wl,-E,-rpath=$(libdir)
26+LDFLAGS += -Wl,-E
27
28 .PHONY:all
29 all: $(PROGRAMS) $(MODULES)
diff --git a/meta-networking/recipes-extended/tgt/files/tgtd b/meta-networking/recipes-extended/tgt/files/tgtd
new file mode 100644
index 0000000000..64df6a3eb4
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/tgtd
@@ -0,0 +1,5 @@
1# options for tgtd
2TGTD_OPTS=""
3
4# configuration file
5TGTD_CONFIG=/etc/tgt/targets.conf
diff --git a/meta-networking/recipes-extended/tgt/files/tgtd.init b/meta-networking/recipes-extended/tgt/files/tgtd.init
new file mode 100644
index 0000000000..4b0ce9443f
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/tgtd.init
@@ -0,0 +1,116 @@
1#!/bin/sh
2
3### BEGIN INIT INFO
4# Provides: tgtd
5# Required-Start: $remote_fs $network $syslog
6# Required-Stop: $remote_fs $syslog
7# Default-Start: 3 5
8# Default-Stop: 0 1 2 6
9# Short-Description: SCSI target daemon
10# Description: Linux SCSI target framework (tgt)
11### END INIT INFO
12
13DESC="tgtd"
14DAEMON="/usr/sbin/tgtd"
15TGTD_CONFIG=/etc/tgt/targets.conf
16
17start ()
18{
19 echo -n "Starting $DESC..."
20
21 # Ensure service isn't running
22 tgt-admin -s >/dev/null 2>&1
23 RETVAL=$?
24 if [ "$RETVAL" -ne 107 ] ; then
25 echo "$DESC is already running."
26 exit 1
27 fi
28
29 # Start tgtd first
30 $DAEMON &>/dev/null
31 RETVAL=$?
32 if [ "$RETVAL" -ne 0 ]; then
33 echo "failed."
34 exit 1
35 fi
36
37 # Put tgtd into "offline" state until all the targets are configured.
38 # We don't want initiators to (re)connect and fail the connection
39 # if it's not ready.
40 tgtadm --op update --mode sys --name State -v offline
41 # Configure the targets.
42 tgt-admin -f -e -c $TGTD_CONFIG
43 # Put tgtd into "ready" state.
44 tgtadm --op update --mode sys --name State -v ready
45
46 echo "done."
47}
48
49stop ()
50{
51 echo -n "Stopping $DESC..."
52
53 # Remove all targets. It only removes targets which are not in use.
54 tgt-admin --update ALL -c /dev/null &>/dev/null
55 # tgtd will exit if all targets were removed
56 tgtadm --op delete --mode system &>/dev/null
57 RETVAL=$?
58 if [ "$RETVAL" -eq 107 ] ; then
59 if [ "$TASK" != "restart" ] ; then
60 return 1
61 fi
62 elif [ "$RETVAL" -ne 0 ] ; then
63 echo "Some initiators are still connected - could not stop tgtd"
64 return 2
65 fi
66 echo -n
67}
68
69reload()
70{
71 echo "Reloading configuration of $DESC" "$NAME"
72 # Update configuration for targets. Only targets which
73 # are not in use will be updated.
74 tgt-admin --update ALL -c $TGTD_CONFIG &>/dev/null
75 RETVAL=$?
76 if [ "$RETVAL" -eq 107 ] ; then
77 echo "tgtd is not running"
78 exit 1
79 fi
80}
81
82status()
83{
84 tgt-admin -s >/dev/null 2>&1
85 RETVAL=$?
86 if [ "$RETVAL" -eq 107 ] ; then
87 echo "tgtd is not running"
88 else
89 echo "tgtd is running"
90 fi
91}
92
93case "$1" in
94 start)
95 start
96 ;;
97 stop)
98 stop
99 ;;
100 restart|force-reload)
101 stop
102 start
103 ;;
104 reload)
105 reload
106 ;;
107 status)
108 status
109 ;;
110 *)
111 echo "Usage: $0 {start|stop|force-reload|restart|status|reload}"
112 exit 1
113 ;;
114esac
115
116exit 0
diff --git a/meta-networking/recipes-extended/tgt/files/tgtd.service b/meta-networking/recipes-extended/tgt/files/tgtd.service
new file mode 100755
index 0000000000..afbd4b4eaa
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/tgtd.service
@@ -0,0 +1,33 @@
1[Unit]
2Description=tgtd iSCSI target daemon
3After=network.target
4
5[Service]
6EnvironmentFile=@SYSCONFDIR@/sysconfig/tgtd
7
8ExecStart=@SBINDIR@/tgtd -f $TGTD_OPTS
9# see bz 848942. workaround for a race for now.
10ExecStartPost=@BASE_BINDIR@/sleep 5
11# Put tgtd into "offline" state until all the targets are configured.
12# We don't want initiators to (re)connect and fail the connection
13# if it's not ready.
14ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
15# Configure the targets.
16ExecStartPost=@SBINDIR@/tgt-admin -e -c $TGTD_CONFIG
17# Put tgtd into "ready" state.
18ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v ready
19
20# Update configuration for targets. Only targets which
21# are not in use will be updated.
22ExecReload=@SBINDIR@/tgt-admin --update ALL -c $TGTD_CONFIG
23
24# NOTE: Shutdown of the iscsi target may cause data corruption
25# for initiators that are connected.
26ExecStop=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline
27# Remove all targets. It only removes targets which are not in use.
28ExecStop=@SBINDIR@/tgt-admin --update ALL -c /dev/null
29# tgtd will exit if all targets were removed
30ExecStop=@SBINDIR@/tgtadm --op delete --mode system
31
32[Install]
33WantedBy=multi-user.target
diff --git a/meta-networking/recipes-extended/tgt/files/usr-Makefile-apply-LDFLAGS-to-all-executables.patch b/meta-networking/recipes-extended/tgt/files/usr-Makefile-apply-LDFLAGS-to-all-executables.patch
new file mode 100644
index 0000000000..d480ef786e
--- /dev/null
+++ b/meta-networking/recipes-extended/tgt/files/usr-Makefile-apply-LDFLAGS-to-all-executables.patch
@@ -0,0 +1,35 @@
1From a815ac8ee16b344d9e24b445957f32bf2aafa532 Mon Sep 17 00:00:00 2001
2From: Mark Asselstine <mark.asselstine@windriver.com>
3Date: Thu, 5 Jan 2017 11:07:51 -0500
4Subject: [PATCH] usr/Makefile: apply LDFLAGS to all executables
5
6Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com>
7---
8 usr/Makefile | 4 ++--
9 1 file changed, 2 insertions(+), 2 deletions(-)
10
11diff --git a/usr/Makefile b/usr/Makefile
12index cc8df11..c55fd68 100644
13--- a/usr/Makefile
14+++ b/usr/Makefile
15@@ -78,7 +78,7 @@ TGTADM_OBJS = tgtadm.o concat_buf.o
16 TGTADM_DEP = $(TGTADM_OBJS:.o=.d)
17
18 tgtadm: $(TGTADM_OBJS)
19- $(CC) $^ -o $@
20+ $(CC) $^ -o $@ $(LDFLAGS)
21
22 -include $(TGTADM_DEP)
23
24@@ -86,7 +86,7 @@ TGTIMG_OBJS = tgtimg.o libssc.o libcrc32c.o
25 TGTIMG_DEP = $(TGTIMG_OBJS:.o=.d)
26
27 tgtimg: $(TGTIMG_OBJS)
28- $(CC) $^ -o $@
29+ $(CC) $^ -o $@ $(LDFLAGS)
30
31 -include $(TGTIMG_DEP)
32
33--
342.7.4
35