commit: b2b148e90850f0e172995c2012cfd2e9e96c9232
Author: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
AuthorDate: Sun Mar 24 22:00:54 2019 +0000
Commit: Thomas Deutschmann <whissi <AT> gentoo <DOT> org>
CommitDate: Sun Mar 24 23:05:24 2019 +0000
URL: https://gitweb.gentoo.org/proj/genkernel.git/commit/?id=b2b148e9
Fix iSCSI support
Bump to open-scsi-2.0.875 & open-isns-0.99.
Signed-off-by: Thomas Deutschmann <whissi <AT> gentoo.org>
defaults/software.sh | 5 ++
gen_compile.sh | 79 ++++++++++++++++++----
gen_determineargs.sh | 1 +
gen_funcs.sh | 1 +
maintenance/docmatcher.py | 2 +-
.../open-iscsi-2.0.872-omg-calling-configure.patch | 11 ---
.../open-iscsi-2.0.874-musl-ethtool-compat.patch | 69 +++++++++++++++++++
.../2.0.875/open-iscsi-2.0.874-musl-fixes.patch | 51 ++++++++++++++
...eclare-inline-best_match_bufcmp-as-static.patch | 24 +++++++
.../open-iscsi-2.0.875-include-sysmacros.patch | 21 ++++++
.../open-iscsi-2.0.875-static-iscsistart.patch | 13 ++++
11 files changed, 250 insertions(+), 27 deletions(-)
diff --git a/defaults/software.sh b/defaults/software.sh
index 1263c9f..f332431 100644
--- a/defaults/software.sh
+++ b/defaults/software.sh
@@ -39,6 +39,11 @@ ISCSI_DIR="${ISCSI_DIR:-open-iscsi-${ISCSI_VER}}"
ISCSI_SRCTAR="${ISCSI_SRCTAR:-${DISTDIR}/open-iscsi-${ISCSI_VER}.tar.gz}"
ISCSI_BINCACHE="${ISCSI_BINCACHE:-%%CACHE%%/iscsi-${ISCSI_VER}-%%ARCH%%.bz2}"
+ISCSI_ISNS_VER="${ISCSI_ISNS_VER:-VERSION_ISCSI_ISNS}"
+ISCSI_ISNS_DIR="${ISCSI_ISNS_DIR:-open-isns-${ISCSI_ISNS_VER}}"
+ISCSI_ISNS_SRCTAR="${ISCSI_ISNS_SRCTAR:-${DISTDIR}/open-isns-${ISCSI_ISNS_VER}.tar.gz}"
+ISCSI_ISNS_BINCACHE="${ISCSI_ISNS_BINCACHE:-%%CACHE%%/open-isns-${ISCSI_ISNS_VER}-%%ARCH%%.tar.bz2}"
+
FUSE_VER="${FUSE_VER:-VERSION_FUSE}"
FUSE_DIR="${FUSE_DIR:-fuse-${FUSE_VER}}"
FUSE_SRCTAR="${FUSE_SRCTAR:-${DISTDIR}/fuse-${FUSE_VER}.tar.gz}"
diff --git a/gen_compile.sh b/gen_compile.sh
index d7c417e..a968eee 100755
--- a/gen_compile.sh
+++ b/gen_compile.sh
@@ -821,30 +821,33 @@ compile_unionfs_fuse() {
}
compile_iscsi() {
- if [ -f "${ISCSI_BINCACHE}" ]
+ compile_iscsi_isns
+
+ if [[ -f "${ISCSI_BINCACHE}" && "${ISCSI_BINCACHE}" -nt
"${ISCSI_ISNS_BINCACHE}" ]]
then
- print_info 1 "$(getIndent 3)iSCSI: Using cache"
+ print_info 1 "$(getIndent 3)iscsistart: Using cache"
else
[ ! -f "${ISCSI_SRCTAR}" ] &&
- gen_die "Could not find iSCSI source tarball:
${ISCSI_SRCTAR}. Please place it there, or place another version, changing
/etc/genkernel.conf as necessary!"
+ gen_die "Could not find open-scsi source tarball:
${ISCSI_SRCTAR}. Please place it there, or place another version, changing
/etc/genkernel.conf as necessary!"
cd "${TEMP}"
rm -rf "${ISCSI_DIR}"
tar -xpf "${ISCSI_SRCTAR}"
[ ! -d "${ISCSI_DIR}" ] &&
- gen_die "ISCSI directory ${ISCSI_DIR} invalid"
- print_info 1 "$(getIndent 3)iSCSI: >> Compiling..."
+ gen_die "open-scsi directory ${ISCSI_DIR} is invalid"
+
+ rm -rf "${TEMP}/iscsi-isns" > /dev/null
+ mkdir -p "${TEMP}/iscsi-isns"
+ /bin/tar -xpf "${ISCSI_ISNS_BINCACHE}" -C "${TEMP}/iscsi-isns"
||
+ gen_die "Could not extract open-isns binary cache!"
+
cd "${TEMP}/${ISCSI_DIR}"
+ print_info 1 "$(getIndent 3)open-scsi: >> Patching..."
apply_patches iscsi ${ISCSI_VER}
- # Only build userspace
- print_info 1 "$(getIndent 3)iSCSI: >> Configuring userspace..."
- cd utils/open-isns || gen_die 'Could not enter open-isns dir'
- # we currently have a patch that changes configure.ac
- # once given patch is dropped, drop autoconf too
- autoconf || gen_die 'Could not tweak open-iscsi configuration'
- ./configure --without-slp >> ${LOGFILE} 2>&1 || gen_die 'Could
not configure userspace'
- cd ../.. || gen_die 'wtf?'
- MAKE=${UTILS_MAKE} compile_generic "user" ""
+ print_info 1 "$(getIndent 3)open-scsi: >> Compiling..."
+ CFLAGS="-I${TEMP}/iscsi-isns/usr/include" \
+ LDFLAGS="-L${TEMP}/iscsi-isns/usr/lib -lrt -lpthread" \
+ compile_generic "user" utils
# if kernel modules exist, copy them to initramfs, otherwise it
will be compiled into the kernel
mkdir -p
"${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/"
@@ -854,6 +857,7 @@ compile_iscsi() {
module=${KERNEL_OUTPUTDIR}/drivers/scsi/${modname}${KEXT}
if [ -e "${module}" ]
then
+ print_info 2 "$(getIndent 4) - Copying
${modname}${KEXT}..."
cp $module
"${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/"
fi
done
@@ -870,7 +874,52 @@ compile_iscsi() {
gen_die 'Could not copy the iscsistart binary to the
package directory, does the directory exist?'
cd "${TEMP}"
- isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}" >
/dev/null
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}"
"iscsi-isns" > /dev/null
+ return 0
+ fi
+}
+
+compile_iscsi_isns() {
+ if [ -f "${ISCSI_ISNS_BINCACHE}" ]
+ then
+ print_info 1 "$(getIndent 3)open-isns: >> Using cache"
+ else
+ [ -f "${ISCSI_ISNS_SRCTAR}" ] ||
+ gen_die "Could not find open-isns source tarball:
${ISCSI_ISNS_SRCTAR}! Please place it there, or place another version, changing
/etc/genkernel.conf as necessary!"
+ cd "${TEMP}"
+ rm -rf ${ISCSI_ISNS_DIR} > /dev/null
+ /bin/tar -xpf ${ISCSI_ISNS_SRCTAR} ||
+ gen_die 'Could not extract open-isns source tarball!'
+ [ -d "${ISCSI_ISNS_DIR}" ] ||
+ gen_die "open-isns directory ${ISCSI_ISNS_DIR} is
invalid!"
+
+ print_info 1 "$(getIndent 3)open-isns: >> Patching ..."
+ cd "${ISCSI_ISNS_DIR}" || gen_die "cannot chdir into
'${ISCSI_ISNS_DIR}'"
+ apply_patches iscsi-isns ${ISCSI_ISNS_VER}
+
+ print_info 1 "$(getIndent 3)open-isns: >> Configuring..."
+ ./configure \
+ --prefix=/usr \
+ --enable-static \
+ --without-slp \
+ >> ${LOGFILE} 2>&1 || \
+ gen_die "failed to configure open-isns"
+
+ print_info 1 "$(getIndent 3)open-isns: >> Compiling..."
+ compile_generic '' utils || gen_die "failed to build open-isns"
+
+ print_info 1 "$(getIndent 3)open-isns: >> Installing to
DESTDIR..."
+ compile_generic "DESTDIR=${TEMP}/iscsi-isns install" utils ||
gen_die "failed to install open-isns"
+ compile_generic "DESTDIR=${TEMP}/iscsi-isns install_hdrs" utils
|| gen_die "failed to install open-isns"
+ compile_generic "DESTDIR=${TEMP}/iscsi-isns install_lib" utils
|| gen_die "failed to install open-isns"
+
+ print_info 1 "$(getIndent 3)open-isns: >> Copying to
bincache..."
+ cd "${TEMP}/iscsi-isns" || gen_die "cannot chdir into
'${TEMP}/iscsi-isns'"
+ /bin/tar -cjf "${ISCSI_ISNS_BINCACHE}" . ||
+ gen_die 'Could not create open-isns binary cache'
+
+ cd "${TEMP}"
+ isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_ISNS_DIR}" >
/dev/null
return 0
fi
}
diff --git a/gen_determineargs.sh b/gen_determineargs.sh
index 40d3d2f..cdd6f2a 100755
--- a/gen_determineargs.sh
+++ b/gen_determineargs.sh
@@ -163,6 +163,7 @@ determine_real_args() {
FUSE_BINCACHE
GPG_BINCACHE
ISCSI_BINCACHE
+ ISCSI_ISNS_BINCACHE
LIBAIO_BINCACHE
LVM_BINCACHE
MDADM_BINCACHE
diff --git a/gen_funcs.sh b/gen_funcs.sh
index e471834..b105d64 100755
--- a/gen_funcs.sh
+++ b/gen_funcs.sh
@@ -524,6 +524,7 @@ check_distfiles() {
$FUSE_SRCTAR \
$GPG_SRCTAR \
$ISCSI_SRCTAR \
+ $ISCSI_ISNS_SRCTAR \
$LIBAIO_SRCTAR \
$LVM_SRCTAR \
$MDADM_SRCTAR \
diff --git a/maintenance/docmatcher.py b/maintenance/docmatcher.py
index 0aa7c81..5171737 100644
--- a/maintenance/docmatcher.py
+++ b/maintenance/docmatcher.py
@@ -19,7 +19,7 @@ NON_CONFIG_VARIABLES = ('BUILD_KERNEL', 'BUILD_MODULES',
'BUILD_RAMDISK',
EXTRA_VARIABLES = ['ARCH_OVERRIDE', 'BOOTLOADER', 'CLEAR_CACHEDIR',
'DEFAULT_KERNEL_SOURCE', 'DISTDIR', 'GK_SHARE', 'BUSYBOX_APPLETS']
-for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM',
'ISCSI', 'FUSE', 'GPG', 'MDADM'):
+for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM',
'ISCSI', 'ISCSI_ISNS', 'FUSE', 'GPG', 'MDADM'):
for prop in ('DIR', 'SRCTAR', 'VER'):
EXTRA_VARIABLES.append('%s_%s' % (app, prop))
EXTRA_VARIABLES = tuple(EXTRA_VARIABLES)
diff --git
a/patches/iscsi/2.0-872/open-iscsi-2.0.872-omg-calling-configure.patch
b/patches/iscsi/2.0-872/open-iscsi-2.0.872-omg-calling-configure.patch
deleted file mode 100644
index 185f1ac..0000000
--- a/patches/iscsi/2.0-872/open-iscsi-2.0.872-omg-calling-configure.patch
+++ /dev/null
@@ -1,11 +0,0 @@
---- open-iscsi-2.0-872.orig/Makefile
-+++ open-iscsi-2.0-872/Makefile
-@@ -27,7 +27,7 @@ IFACEFILES = etc/iface.example
- all: user kernel
-
- user: ;
-- cd utils/open-isns; ./configure; $(MAKE)
-+ cd utils/open-isns; $(MAKE)
- $(MAKE) -C utils/sysdeps
- $(MAKE) -C utils/fwparam_ibft
- $(MAKE) -C usr
diff --git a/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-ethtool-compat.patch
b/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-ethtool-compat.patch
new file mode 100644
index 0000000..12b82c7
--- /dev/null
+++ b/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-ethtool-compat.patch
@@ -0,0 +1,69 @@
+From: Anthony G. Basiel <[email protected]>
+
+diff -Naur open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/bnx2x.c
open-iscsi-2.0.874/iscsiuio/src/unix/libs/bnx2x.c
+--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/bnx2x.c 2016-09-29
18:33:24.000000000 +0000
++++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/bnx2x.c 2017-01-03
21:45:47.504035833 +0000
+@@ -42,7 +42,7 @@
+ #include <arpa/inet.h>
+ #include <linux/types.h> /* Needed for linux/ethtool.h on RHEL 5.x */
+ #include <linux/sockios.h>
+-#include <linux/ethtool.h>
++#include "ethtool-compat.h"
+ #include <sys/mman.h>
+ #include <sys/ioctl.h>
+ #include <sys/types.h>
+diff -Naur open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/ethtool-compat.h
open-iscsi-2.0.874/iscsiuio/src/unix/libs/ethtool-compat.h
+--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/ethtool-compat.h
1970-01-01 00:00:00.000000000 +0000
++++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/ethtool-compat.h 2017-01-03
21:45:23.016034980 +0000
+@@ -0,0 +1,51 @@
++/*
++ * ethtool-compat.h: adopted from
++ # ethtool.h: Defines for Linux ethtool.
++ *
++ * Copyright (C) 1998 David S. Miller ([email protected])
++ * Copyright 2001 Jeff Garzik <[email protected]>
++ * Portions Copyright 2001 Sun Microsystems ([email protected])
++ * Portions Copyright 2002 Intel ([email protected],
++ * [email protected],
++ * [email protected])
++ * Portions Copyright (C) Sun Microsystems 2008
++ */
++
++#include <linux/types.h>
++#include <netinet/if_ether.h>
++
++#define ETHTOOL_FWVERS_LEN 32
++#define ETHTOOL_BUSINFO_LEN 32
++#define ETHTOOL_EROMVERS_LEN 32
++
++struct ethtool_drvinfo {
++ __u32 cmd;
++ char driver[32];
++ char version[32];
++ char fw_version[ETHTOOL_FWVERS_LEN];
++ char bus_info[ETHTOOL_BUSINFO_LEN];
++ char erom_version[ETHTOOL_EROMVERS_LEN];
++ char reserved2[12];
++ __u32 n_priv_flags;
++ __u32 n_stats;
++ __u32 testinfo_len;
++ __u32 eedump_len;
++ __u32 regdump_len;
++};
++
++struct ethtool_tcpip4_spec {
++ __be32 ip4src;
++ __be32 ip4dst;
++ __be16 psrc;
++ __be16 pdst;
++ __u8 tos;
++};
++
++struct ethtool_ah_espip4_spec {
++ __be32 ip4src;
++ __be32 ip4dst;
++ __be32 spi;
++ __u8 tos;
++};
++
++#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
diff --git a/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-fixes.patch
b/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-fixes.patch
new file mode 100644
index 0000000..cf8b762
--- /dev/null
+++ b/patches/iscsi/2.0.875/open-iscsi-2.0.874-musl-fixes.patch
@@ -0,0 +1,51 @@
+--- ./utils/fwparam_ibft/fwparam_ppc.c 2016-09-29 13:33:24.000000000 -0500
++++ ./utils/fwparam_ibft/fwparam_ppc.c 2017-01-02 11:37:32.738351217 -0600
+@@ -356,7 +356,7 @@
+ * Sort the nics into "natural" order. The proc fs
+ * device-tree has them in somewhat random, or reversed order.
+ */
+- qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp);
++ qsort(niclist, nic_count, sizeof(char *), (int (*)(const void *, const
void *))nic_cmp);
+
+ snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases");
+ dev_count = 0;
+--- ./usr/idbm.c.orig
++++ ./usr/idbm.c
+@@ -25,6 +25,7 @@
+ #include <stdlib.h>
+ #include <string.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include <dirent.h>
+ #include <limits.h>
+ #include <sys/stat.h>
+--- a/usr/iscsiadm.c 2016-09-29 13:33:24.000000000 -0500
++++ b/usr/iscsiadm.c 2017-01-02 11:46:37.643506953 -0600
+@@ -3262,6 +3262,7 @@
+ int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0;
+ int packet_size=32, ping_count=1, ping_interval=0;
+ int do_discover = 0, sub_mode = -1;
++ int argerror = 0;
+ int portal_type = -1;
+ struct sigaction sa_old;
+ struct sigaction sa_new;
+@@ -3426,6 +3427,9 @@
+ break;
+ case 'h':
+ usage(0);
++ case '?':
++ log_error("unrecognized character '%c'", optopt);
++ argerror = 1;
+ }
+
+ if (name && value) {
+@@ -3441,8 +3445,7 @@
+ }
+ }
+
+- if (optopt) {
+- log_error("unrecognized character '%c'", optopt);
++ if (argerror) {
+ rc = ISCSI_ERR_INVAL;
+ goto free_ifaces;
+ }
diff --git
a/patches/iscsi/2.0.875/open-iscsi-2.0.875-declare-inline-best_match_bufcmp-as-static.patch
b/patches/iscsi/2.0.875/open-iscsi-2.0.875-declare-inline-best_match_bufcmp-as-static.patch
new file mode 100644
index 0000000..7bd7f9a
--- /dev/null
+++
b/patches/iscsi/2.0.875/open-iscsi-2.0.875-declare-inline-best_match_bufcmp-as-static.patch
@@ -0,0 +1,24 @@
+From ec9865c5b2a05908dff774eda352d84d6a001e1a Mon Sep 17 00:00:00 2001
+From: Lee Duncan <[email protected]>
+Date: Sat, 2 Dec 2017 14:24:52 -0800
+Subject: [PATCH] Declare inline best_match_bufcmp() as static.
+
+The 7.2.1 version of gcc seems to be more strict
+about this. See https://gcc.gnu.org/onlinedocs/gcc/Inline.html
+---
+ iscsiuio/src/uip/ipv6.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/iscsiuio/src/uip/ipv6.c b/iscsiuio/src/uip/ipv6.c
+index ced98a67..05efa73f 100644
+--- a/iscsiuio/src/uip/ipv6.c
++++ b/iscsiuio/src/uip/ipv6.c
+@@ -49,7 +49,7 @@
+ #include "dhcpv6.h"
+ #include "ping.h"
+
+-inline int best_match_bufcmp(u8_t *a, u8_t *b, int len)
++static inline int best_match_bufcmp(u8_t *a, u8_t *b, int len)
+ {
+ int i;
+
diff --git a/patches/iscsi/2.0.875/open-iscsi-2.0.875-include-sysmacros.patch
b/patches/iscsi/2.0.875/open-iscsi-2.0.875-include-sysmacros.patch
new file mode 100644
index 0000000..7c19a1e
--- /dev/null
+++ b/patches/iscsi/2.0.875/open-iscsi-2.0.875-include-sysmacros.patch
@@ -0,0 +1,21 @@
+From 6d68ef5871c94c6ebbbe6e6b1fe0bc2dce711052 Mon Sep 17 00:00:00 2001
+From: Lee Duncan <[email protected]>
+Date: Sat, 2 Dec 2017 14:19:26 -0800
+Subject: [PATCH] Include <sys/sysmacros.h> to properly define minor()
+
+---
+ iscsiuio/src/unix/libs/qedi.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
+index c6ff6e77..b81fecdf 100644
+--- a/iscsiuio/src/unix/libs/qedi.c
++++ b/iscsiuio/src/unix/libs/qedi.c
+@@ -58,6 +58,7 @@
+ #include <sys/user.h>
+ #include <fcntl.h>
+ #include <unistd.h>
++#include <sys/sysmacros.h>
+
+ #include "config.h"
+
diff --git a/patches/iscsi/2.0.875/open-iscsi-2.0.875-static-iscsistart.patch
b/patches/iscsi/2.0.875/open-iscsi-2.0.875-static-iscsistart.patch
new file mode 100644
index 0000000..c190627
--- /dev/null
+++ b/patches/iscsi/2.0.875/open-iscsi-2.0.875-static-iscsistart.patch
@@ -0,0 +1,13 @@
+diff --git a/usr/Makefile b/usr/Makefile
+index c1866b6..2990060 100644
+--- a/usr/Makefile
++++ b/usr/Makefile
+@@ -61,7 +61,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o
session_mgmt.o mntcheck
+
+ iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
+ iscsistart.o statics.o
+- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt
++ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -static -lrt
+ clean:
+ rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
+