diff options
| author | Mingli Yu <mingli.yu@windriver.com> | 2022-04-18 15:26:09 +0800 |
|---|---|---|
| committer | Khem Raj <raj.khem@gmail.com> | 2022-04-18 10:13:16 -0700 |
| commit | c1b69601fd5898a8330c12388f57cfa527cb2341 (patch) | |
| tree | 638b8de7a405575a0cf781682f70d9681fe5b1eb /meta-networking | |
| parent | 159fd281968815b88bf683cd7c319e34202c1815 (diff) | |
| download | meta-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')
7 files changed, 359 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 @@ | |||
| 1 | From 93fea40915d01be6d02587a0b8be85a642e6a8d5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Zhenhua Luo <zhenhua.luo@freescale.com> | ||
| 3 | Date: Thu, 10 Apr 2014 11:26:39 +0800 | ||
| 4 | Subject: [PATCH] Correct the path of header files check in Yocto build env | ||
| 5 | |||
| 6 | Upstream-Status: Inappropriate [the fix is specific to Yocto build env] | ||
| 7 | |||
| 8 | Current Makefile will check headers on host instead of Yocto sysroot, following | ||
| 9 | error 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 | |||
| 15 | Signed-off-by: Zhenhua Luo <zhenhua.luo@freescale.com> | ||
| 16 | |||
| 17 | --- | ||
| 18 | usr/Makefile | 6 +++--- | ||
| 19 | 1 file changed, 3 insertions(+), 3 deletions(-) | ||
| 20 | |||
| 21 | diff --git a/usr/Makefile b/usr/Makefile | ||
| 22 | index 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 @@ | |||
| 1 | From 6f4e3b11c7dccf83e2d18635c84837b212dfcc1c Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Li xin <lixin.fnst@cn.fujitsu.com> | ||
| 3 | Date: Sun, 26 Jul 2015 04:23:51 +0900 | ||
| 4 | Subject: [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 | |||
| 9 | Upstream-Status: pending | ||
| 10 | |||
| 11 | Signed-off-by: Li Xin <lixin.fnst@cn.fujitsu.com> | ||
| 12 | |||
| 13 | --- | ||
| 14 | usr/Makefile | 2 +- | ||
| 15 | 1 file changed, 1 insertion(+), 1 deletion(-) | ||
| 16 | |||
| 17 | diff --git a/usr/Makefile b/usr/Makefile | ||
| 18 | index 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 | ||
| 2 | TGTD_OPTS="" | ||
| 3 | |||
| 4 | # configuration file | ||
| 5 | TGTD_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 | |||
| 13 | DESC="tgtd" | ||
| 14 | DAEMON="/usr/sbin/tgtd" | ||
| 15 | TGTD_CONFIG=/etc/tgt/targets.conf | ||
| 16 | |||
| 17 | start () | ||
| 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 | |||
| 49 | stop () | ||
| 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 | |||
| 69 | reload() | ||
| 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 | |||
| 82 | status() | ||
| 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 | |||
| 93 | case "$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 | ;; | ||
| 114 | esac | ||
| 115 | |||
| 116 | exit 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] | ||
| 2 | Description=tgtd iSCSI target daemon | ||
| 3 | After=network.target | ||
| 4 | |||
| 5 | [Service] | ||
| 6 | EnvironmentFile=@SYSCONFDIR@/sysconfig/tgtd | ||
| 7 | |||
| 8 | ExecStart=@SBINDIR@/tgtd -f $TGTD_OPTS | ||
| 9 | # see bz 848942. workaround for a race for now. | ||
| 10 | ExecStartPost=@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. | ||
| 14 | ExecStartPost=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline | ||
| 15 | # Configure the targets. | ||
| 16 | ExecStartPost=@SBINDIR@/tgt-admin -e -c $TGTD_CONFIG | ||
| 17 | # Put tgtd into "ready" state. | ||
| 18 | ExecStartPost=@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. | ||
| 22 | ExecReload=@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. | ||
| 26 | ExecStop=@SBINDIR@/tgtadm --op update --mode sys --name State -v offline | ||
| 27 | # Remove all targets. It only removes targets which are not in use. | ||
| 28 | ExecStop=@SBINDIR@/tgt-admin --update ALL -c /dev/null | ||
| 29 | # tgtd will exit if all targets were removed | ||
| 30 | ExecStop=@SBINDIR@/tgtadm --op delete --mode system | ||
| 31 | |||
| 32 | [Install] | ||
| 33 | WantedBy=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 @@ | |||
| 1 | From a815ac8ee16b344d9e24b445957f32bf2aafa532 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: Mark Asselstine <mark.asselstine@windriver.com> | ||
| 3 | Date: Thu, 5 Jan 2017 11:07:51 -0500 | ||
| 4 | Subject: [PATCH] usr/Makefile: apply LDFLAGS to all executables | ||
| 5 | |||
| 6 | Signed-off-by: Mark Asselstine <mark.asselstine@windriver.com> | ||
| 7 | --- | ||
| 8 | usr/Makefile | 4 ++-- | ||
| 9 | 1 file changed, 2 insertions(+), 2 deletions(-) | ||
| 10 | |||
| 11 | diff --git a/usr/Makefile b/usr/Makefile | ||
| 12 | index 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 | -- | ||
| 34 | 2.7.4 | ||
| 35 | |||
diff --git a/meta-networking/recipes-extended/tgt/tgt_git.bb b/meta-networking/recipes-extended/tgt/tgt_git.bb new file mode 100644 index 0000000000..42141cb72d --- /dev/null +++ b/meta-networking/recipes-extended/tgt/tgt_git.bb | |||
| @@ -0,0 +1,94 @@ | |||
| 1 | DESCRIPTION = "Linux SCSI target framework (tgt)" | ||
| 2 | HOMEPAGE = "http://stgt.sourceforge.net" | ||
| 3 | LICENSE = "GPL-2.0-only" | ||
| 4 | LIC_FILES_CHKSUM = "file://scripts/tgtd.spec;beginline=7;endline=7;md5=21c19ea7dad04648b9c2f791b6e29b4c" | ||
| 5 | DEPENDS = "sg3-utils libaio" | ||
| 6 | |||
| 7 | SRCREV = "b43dbc6711e43c0a32cc4d9df22884841d911d51" | ||
| 8 | PV = "1.0.79+git${SRCPV}" | ||
| 9 | |||
| 10 | SRC_URI = "git://github.com/fujita/tgt.git;branch=master;protocol=https \ | ||
| 11 | file://0001-Correct-the-path-of-header-files-check-in-Yocto-buil.patch \ | ||
| 12 | file://0001-usr-Makefile-WARNING-fix.patch \ | ||
| 13 | file://usr-Makefile-apply-LDFLAGS-to-all-executables.patch \ | ||
| 14 | " | ||
| 15 | SRC_URI += "file://tgtd.init \ | ||
| 16 | file://tgtd.service \ | ||
| 17 | file://tgtd \ | ||
| 18 | " | ||
| 19 | |||
| 20 | S = "${WORKDIR}/git" | ||
| 21 | |||
| 22 | COMPATIBLE_HOST:libc-musl = "null" | ||
| 23 | |||
| 24 | CONFFILES:${PN} += "${sysconfdir}/tgt/targets.conf" | ||
| 25 | |||
| 26 | inherit update-rc.d systemd | ||
| 27 | |||
| 28 | SYSTEMD_SERVICE:${PN} = "tgtd.service" | ||
| 29 | SYSTEMD_AUTO_ENABLE:${PN} = "disable" | ||
| 30 | |||
| 31 | CFLAGS += ' -I. -DUSE_SIGNALFD -DUSE_TIMERFD -D_GNU_SOURCE -DTGT_VERSION=\\"1.0.63\\" -DBSDIR=\\"${libdir}/backing-store\\"' | ||
| 32 | |||
| 33 | #do_compile() { | ||
| 34 | # oe_runmake SYSROOT="${STAGING_DIR_TARGET}" -e programs conf scripts | ||
| 35 | #} | ||
| 36 | EXTRA_OEMAKE = "-e programs conf scripts" | ||
| 37 | |||
| 38 | do_install() { | ||
| 39 | oe_runmake -e DESTDIR="${D}" install-programs install-conf install-scripts | ||
| 40 | |||
| 41 | if ${@bb.utils.contains('DISTRO_FEATURES', 'sysvinit', 'true', 'false', d)}; then | ||
| 42 | install -d ${D}${sysconfdir}/init.d | ||
| 43 | install -m 0755 ${WORKDIR}/tgtd.init ${D}${sysconfdir}/init.d/tgtd | ||
| 44 | elif ${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'true', 'false', d)}; then | ||
| 45 | install -d ${D}${systemd_unitdir}/system | ||
| 46 | install -m 0644 ${WORKDIR}/tgtd.service ${D}${systemd_unitdir}/system/tgtd.service | ||
| 47 | install -d ${D}${sysconfdir}/sysconfig | ||
| 48 | install -m 0644 ${WORKDIR}/tgtd ${D}${sysconfdir}/sysconfig/tgtd | ||
| 49 | sed -i -e 's,@SBINDIR@,${sbindir},g' ${D}${systemd_unitdir}/system/tgtd.service | ||
| 50 | sed -i -e 's,@BASE_BINDIR@,${base_bindir},g' ${D}${systemd_unitdir}/system/tgtd.service | ||
| 51 | sed -i -e 's,@SYSCONFDIR@,${sysconfdir},g' ${D}${systemd_unitdir}/system/tgtd.service | ||
| 52 | fi | ||
| 53 | } | ||
| 54 | |||
| 55 | FILES:${PN} += "${systemd_unitdir}/system/tgtd.service \ | ||
| 56 | ${sysconfdir}/sysconfig/tgtd \ | ||
| 57 | " | ||
| 58 | |||
| 59 | RDEPENDS:${PN} = " \ | ||
| 60 | bash \ | ||
| 61 | libaio \ | ||
| 62 | libconfig-general-perl \ | ||
| 63 | perl \ | ||
| 64 | perl-module-english \ | ||
| 65 | perl-module-tie-hash-namedcapture \ | ||
| 66 | perl-module-xsloader \ | ||
| 67 | perl-module-carp \ | ||
| 68 | perl-module-exporter \ | ||
| 69 | perl-module-errno \ | ||
| 70 | perl-module-exporter-heavy \ | ||
| 71 | perl-module-symbol \ | ||
| 72 | perl-module-selectsaver \ | ||
| 73 | perl-module-dynaloader \ | ||
| 74 | perl-module-carp-heavy \ | ||
| 75 | perl-module-filehandle \ | ||
| 76 | perl-module-feature \ | ||
| 77 | perl-module-overload \ | ||
| 78 | perl-module-fcntl \ | ||
| 79 | perl-module-io \ | ||
| 80 | perl-module-io-file \ | ||
| 81 | perl-module-io-handle \ | ||
| 82 | perl-module-io-seekable \ | ||
| 83 | perl-module-file-glob \ | ||
| 84 | perl-module-base \ | ||
| 85 | perl-module-encoding-warnings \ | ||
| 86 | perl-module-file-spec-unix \ | ||
| 87 | perl-module-file-spec \ | ||
| 88 | perl-module-file-spec-functions \ | ||
| 89 | perl-module-getopt-long \ | ||
| 90 | perl-module-constant \ | ||
| 91 | " | ||
| 92 | INITSCRIPT_PACKAGES = "${PN}" | ||
| 93 | INITSCRIPT_NAME:${PN} = "tgtd" | ||
| 94 | |||
