Skip to content

Commit b2b148e

Browse files
committed
Fix iSCSI support
Bump to open-scsi-2.0.875 & open-isns-0.99. Signed-off-by: Thomas Deutschmann <[email protected]>
1 parent 45a2a42 commit b2b148e

11 files changed

+250
-27
lines changed

defaults/software.sh

+5
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ ISCSI_DIR="${ISCSI_DIR:-open-iscsi-${ISCSI_VER}}"
3939
ISCSI_SRCTAR="${ISCSI_SRCTAR:-${DISTDIR}/open-iscsi-${ISCSI_VER}.tar.gz}"
4040
ISCSI_BINCACHE="${ISCSI_BINCACHE:-%%CACHE%%/iscsi-${ISCSI_VER}-%%ARCH%%.bz2}"
4141

42+
ISCSI_ISNS_VER="${ISCSI_ISNS_VER:-VERSION_ISCSI_ISNS}"
43+
ISCSI_ISNS_DIR="${ISCSI_ISNS_DIR:-open-isns-${ISCSI_ISNS_VER}}"
44+
ISCSI_ISNS_SRCTAR="${ISCSI_ISNS_SRCTAR:-${DISTDIR}/open-isns-${ISCSI_ISNS_VER}.tar.gz}"
45+
ISCSI_ISNS_BINCACHE="${ISCSI_ISNS_BINCACHE:-%%CACHE%%/open-isns-${ISCSI_ISNS_VER}-%%ARCH%%.tar.bz2}"
46+
4247
FUSE_VER="${FUSE_VER:-VERSION_FUSE}"
4348
FUSE_DIR="${FUSE_DIR:-fuse-${FUSE_VER}}"
4449
FUSE_SRCTAR="${FUSE_SRCTAR:-${DISTDIR}/fuse-${FUSE_VER}.tar.gz}"

gen_compile.sh

+64-15
Original file line numberDiff line numberDiff line change
@@ -821,30 +821,33 @@ compile_unionfs_fuse() {
821821
}
822822

823823
compile_iscsi() {
824-
if [ -f "${ISCSI_BINCACHE}" ]
824+
compile_iscsi_isns
825+
826+
if [[ -f "${ISCSI_BINCACHE}" && "${ISCSI_BINCACHE}" -nt "${ISCSI_ISNS_BINCACHE}" ]]
825827
then
826-
print_info 1 "$(getIndent 3)iSCSI: Using cache"
828+
print_info 1 "$(getIndent 3)iscsistart: Using cache"
827829
else
828830
[ ! -f "${ISCSI_SRCTAR}" ] &&
829-
gen_die "Could not find iSCSI source tarball: ${ISCSI_SRCTAR}. Please place it there, or place another version, changing /etc/genkernel.conf as necessary!"
831+
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!"
830832
cd "${TEMP}"
831833
rm -rf "${ISCSI_DIR}"
832834
tar -xpf "${ISCSI_SRCTAR}"
833835
[ ! -d "${ISCSI_DIR}" ] &&
834-
gen_die "ISCSI directory ${ISCSI_DIR} invalid"
835-
print_info 1 "$(getIndent 3)iSCSI: >> Compiling..."
836+
gen_die "open-scsi directory ${ISCSI_DIR} is invalid"
837+
838+
rm -rf "${TEMP}/iscsi-isns" > /dev/null
839+
mkdir -p "${TEMP}/iscsi-isns"
840+
/bin/tar -xpf "${ISCSI_ISNS_BINCACHE}" -C "${TEMP}/iscsi-isns" ||
841+
gen_die "Could not extract open-isns binary cache!"
842+
836843
cd "${TEMP}/${ISCSI_DIR}"
844+
print_info 1 "$(getIndent 3)open-scsi: >> Patching..."
837845
apply_patches iscsi ${ISCSI_VER}
838846

839-
# Only build userspace
840-
print_info 1 "$(getIndent 3)iSCSI: >> Configuring userspace..."
841-
cd utils/open-isns || gen_die 'Could not enter open-isns dir'
842-
# we currently have a patch that changes configure.ac
843-
# once given patch is dropped, drop autoconf too
844-
autoconf || gen_die 'Could not tweak open-iscsi configuration'
845-
./configure --without-slp >> ${LOGFILE} 2>&1 || gen_die 'Could not configure userspace'
846-
cd ../.. || gen_die 'wtf?'
847-
MAKE=${UTILS_MAKE} compile_generic "user" ""
847+
print_info 1 "$(getIndent 3)open-scsi: >> Compiling..."
848+
CFLAGS="-I${TEMP}/iscsi-isns/usr/include" \
849+
LDFLAGS="-L${TEMP}/iscsi-isns/usr/lib -lrt -lpthread" \
850+
compile_generic "user" utils
848851

849852
# if kernel modules exist, copy them to initramfs, otherwise it will be compiled into the kernel
850853
mkdir -p "${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/"
@@ -854,6 +857,7 @@ compile_iscsi() {
854857
module=${KERNEL_OUTPUTDIR}/drivers/scsi/${modname}${KEXT}
855858
if [ -e "${module}" ]
856859
then
860+
print_info 2 "$(getIndent 4) - Copying ${modname}${KEXT}..."
857861
cp $module "${TEMP}/initramfs-iscsi-temp/lib/modules/${KV}/kernel/drivers/scsi/"
858862
fi
859863
done
@@ -870,7 +874,52 @@ compile_iscsi() {
870874
gen_die 'Could not copy the iscsistart binary to the package directory, does the directory exist?'
871875

872876
cd "${TEMP}"
873-
isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}" > /dev/null
877+
isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_DIR}" "iscsi-isns" > /dev/null
878+
return 0
879+
fi
880+
}
881+
882+
compile_iscsi_isns() {
883+
if [ -f "${ISCSI_ISNS_BINCACHE}" ]
884+
then
885+
print_info 1 "$(getIndent 3)open-isns: >> Using cache"
886+
else
887+
[ -f "${ISCSI_ISNS_SRCTAR}" ] ||
888+
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!"
889+
cd "${TEMP}"
890+
rm -rf ${ISCSI_ISNS_DIR} > /dev/null
891+
/bin/tar -xpf ${ISCSI_ISNS_SRCTAR} ||
892+
gen_die 'Could not extract open-isns source tarball!'
893+
[ -d "${ISCSI_ISNS_DIR}" ] ||
894+
gen_die "open-isns directory ${ISCSI_ISNS_DIR} is invalid!"
895+
896+
print_info 1 "$(getIndent 3)open-isns: >> Patching ..."
897+
cd "${ISCSI_ISNS_DIR}" || gen_die "cannot chdir into '${ISCSI_ISNS_DIR}'"
898+
apply_patches iscsi-isns ${ISCSI_ISNS_VER}
899+
900+
print_info 1 "$(getIndent 3)open-isns: >> Configuring..."
901+
./configure \
902+
--prefix=/usr \
903+
--enable-static \
904+
--without-slp \
905+
>> ${LOGFILE} 2>&1 || \
906+
gen_die "failed to configure open-isns"
907+
908+
print_info 1 "$(getIndent 3)open-isns: >> Compiling..."
909+
compile_generic '' utils || gen_die "failed to build open-isns"
910+
911+
print_info 1 "$(getIndent 3)open-isns: >> Installing to DESTDIR..."
912+
compile_generic "DESTDIR=${TEMP}/iscsi-isns install" utils || gen_die "failed to install open-isns"
913+
compile_generic "DESTDIR=${TEMP}/iscsi-isns install_hdrs" utils || gen_die "failed to install open-isns"
914+
compile_generic "DESTDIR=${TEMP}/iscsi-isns install_lib" utils || gen_die "failed to install open-isns"
915+
916+
print_info 1 "$(getIndent 3)open-isns: >> Copying to bincache..."
917+
cd "${TEMP}/iscsi-isns" || gen_die "cannot chdir into '${TEMP}/iscsi-isns'"
918+
/bin/tar -cjf "${ISCSI_ISNS_BINCACHE}" . ||
919+
gen_die 'Could not create open-isns binary cache'
920+
921+
cd "${TEMP}"
922+
isTrue "${CMD_DEBUGCLEANUP}" && rm -rf "${ISCSI_ISNS_DIR}" > /dev/null
874923
return 0
875924
fi
876925
}

gen_determineargs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ determine_real_args() {
163163
FUSE_BINCACHE
164164
GPG_BINCACHE
165165
ISCSI_BINCACHE
166+
ISCSI_ISNS_BINCACHE
166167
LIBAIO_BINCACHE
167168
LVM_BINCACHE
168169
MDADM_BINCACHE

gen_funcs.sh

+1
Original file line numberDiff line numberDiff line change
@@ -524,6 +524,7 @@ check_distfiles() {
524524
$FUSE_SRCTAR \
525525
$GPG_SRCTAR \
526526
$ISCSI_SRCTAR \
527+
$ISCSI_ISNS_SRCTAR \
527528
$LIBAIO_SRCTAR \
528529
$LVM_SRCTAR \
529530
$MDADM_SRCTAR \

maintenance/docmatcher.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919

2020

2121
EXTRA_VARIABLES = ['ARCH_OVERRIDE', 'BOOTLOADER', 'CLEAR_CACHEDIR', 'DEFAULT_KERNEL_SOURCE', 'DISTDIR', 'GK_SHARE', 'BUSYBOX_APPLETS']
22-
for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM', 'ISCSI', 'FUSE', 'GPG', 'MDADM'):
22+
for app in ('DEVICE_MAPPER', 'UNIONFS_FUSE', 'BUSYBOX', 'DMRAID', 'LVM', 'ISCSI', 'ISCSI_ISNS', 'FUSE', 'GPG', 'MDADM'):
2323
for prop in ('DIR', 'SRCTAR', 'VER'):
2424
EXTRA_VARIABLES.append('%s_%s' % (app, prop))
2525
EXTRA_VARIABLES = tuple(EXTRA_VARIABLES)

patches/iscsi/2.0-872/open-iscsi-2.0.872-omg-calling-configure.patch

-11
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
From: Anthony G. Basiel <[email protected]>
2+
3+
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
4+
--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/bnx2x.c 2016-09-29 18:33:24.000000000 +0000
5+
+++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/bnx2x.c 2017-01-03 21:45:47.504035833 +0000
6+
@@ -42,7 +42,7 @@
7+
#include <arpa/inet.h>
8+
#include <linux/types.h> /* Needed for linux/ethtool.h on RHEL 5.x */
9+
#include <linux/sockios.h>
10+
-#include <linux/ethtool.h>
11+
+#include "ethtool-compat.h"
12+
#include <sys/mman.h>
13+
#include <sys/ioctl.h>
14+
#include <sys/types.h>
15+
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
16+
--- open-iscsi-2.0.874.orig/iscsiuio/src/unix/libs/ethtool-compat.h 1970-01-01 00:00:00.000000000 +0000
17+
+++ open-iscsi-2.0.874/iscsiuio/src/unix/libs/ethtool-compat.h 2017-01-03 21:45:23.016034980 +0000
18+
@@ -0,0 +1,51 @@
19+
+/*
20+
+ * ethtool-compat.h: adopted from
21+
+ # ethtool.h: Defines for Linux ethtool.
22+
+ *
23+
+ * Copyright (C) 1998 David S. Miller ([email protected])
24+
+ * Copyright 2001 Jeff Garzik <[email protected]>
25+
+ * Portions Copyright 2001 Sun Microsystems ([email protected])
26+
+ * Portions Copyright 2002 Intel ([email protected],
27+
28+
29+
+ * Portions Copyright (C) Sun Microsystems 2008
30+
+ */
31+
+
32+
+#include <linux/types.h>
33+
+#include <netinet/if_ether.h>
34+
+
35+
+#define ETHTOOL_FWVERS_LEN 32
36+
+#define ETHTOOL_BUSINFO_LEN 32
37+
+#define ETHTOOL_EROMVERS_LEN 32
38+
+
39+
+struct ethtool_drvinfo {
40+
+ __u32 cmd;
41+
+ char driver[32];
42+
+ char version[32];
43+
+ char fw_version[ETHTOOL_FWVERS_LEN];
44+
+ char bus_info[ETHTOOL_BUSINFO_LEN];
45+
+ char erom_version[ETHTOOL_EROMVERS_LEN];
46+
+ char reserved2[12];
47+
+ __u32 n_priv_flags;
48+
+ __u32 n_stats;
49+
+ __u32 testinfo_len;
50+
+ __u32 eedump_len;
51+
+ __u32 regdump_len;
52+
+};
53+
+
54+
+struct ethtool_tcpip4_spec {
55+
+ __be32 ip4src;
56+
+ __be32 ip4dst;
57+
+ __be16 psrc;
58+
+ __be16 pdst;
59+
+ __u8 tos;
60+
+};
61+
+
62+
+struct ethtool_ah_espip4_spec {
63+
+ __be32 ip4src;
64+
+ __be32 ip4dst;
65+
+ __be32 spi;
66+
+ __u8 tos;
67+
+};
68+
+
69+
+#define ETHTOOL_GDRVINFO 0x00000003 /* Get driver info. */
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
--- ./utils/fwparam_ibft/fwparam_ppc.c 2016-09-29 13:33:24.000000000 -0500
2+
+++ ./utils/fwparam_ibft/fwparam_ppc.c 2017-01-02 11:37:32.738351217 -0600
3+
@@ -356,7 +356,7 @@
4+
* Sort the nics into "natural" order. The proc fs
5+
* device-tree has them in somewhat random, or reversed order.
6+
*/
7+
- qsort(niclist, nic_count, sizeof(char *), (__compar_fn_t)nic_cmp);
8+
+ qsort(niclist, nic_count, sizeof(char *), (int (*)(const void *, const void *))nic_cmp);
9+
10+
snprintf(prefix, sizeof(prefix), "%s/%s", devtree, "aliases");
11+
dev_count = 0;
12+
--- ./usr/idbm.c.orig
13+
+++ ./usr/idbm.c
14+
@@ -25,6 +25,7 @@
15+
#include <stdlib.h>
16+
#include <string.h>
17+
#include <errno.h>
18+
+#include <fcntl.h>
19+
#include <dirent.h>
20+
#include <limits.h>
21+
#include <sys/stat.h>
22+
--- a/usr/iscsiadm.c 2016-09-29 13:33:24.000000000 -0500
23+
+++ b/usr/iscsiadm.c 2017-01-02 11:46:37.643506953 -0600
24+
@@ -3262,6 +3262,7 @@
25+
int tpgt = PORTAL_GROUP_TAG_UNKNOWN, killiscsid=-1, do_show=0;
26+
int packet_size=32, ping_count=1, ping_interval=0;
27+
int do_discover = 0, sub_mode = -1;
28+
+ int argerror = 0;
29+
int portal_type = -1;
30+
struct sigaction sa_old;
31+
struct sigaction sa_new;
32+
@@ -3426,6 +3427,9 @@
33+
break;
34+
case 'h':
35+
usage(0);
36+
+ case '?':
37+
+ log_error("unrecognized character '%c'", optopt);
38+
+ argerror = 1;
39+
}
40+
41+
if (name && value) {
42+
@@ -3441,8 +3445,7 @@
43+
}
44+
}
45+
46+
- if (optopt) {
47+
- log_error("unrecognized character '%c'", optopt);
48+
+ if (argerror) {
49+
rc = ISCSI_ERR_INVAL;
50+
goto free_ifaces;
51+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From ec9865c5b2a05908dff774eda352d84d6a001e1a Mon Sep 17 00:00:00 2001
2+
From: Lee Duncan <[email protected]>
3+
Date: Sat, 2 Dec 2017 14:24:52 -0800
4+
Subject: [PATCH] Declare inline best_match_bufcmp() as static.
5+
6+
The 7.2.1 version of gcc seems to be more strict
7+
about this. See https://gcc.gnu.org/onlinedocs/gcc/Inline.html
8+
---
9+
iscsiuio/src/uip/ipv6.c | 2 +-
10+
1 file changed, 1 insertion(+), 1 deletion(-)
11+
12+
diff --git a/iscsiuio/src/uip/ipv6.c b/iscsiuio/src/uip/ipv6.c
13+
index ced98a67..05efa73f 100644
14+
--- a/iscsiuio/src/uip/ipv6.c
15+
+++ b/iscsiuio/src/uip/ipv6.c
16+
@@ -49,7 +49,7 @@
17+
#include "dhcpv6.h"
18+
#include "ping.h"
19+
20+
-inline int best_match_bufcmp(u8_t *a, u8_t *b, int len)
21+
+static inline int best_match_bufcmp(u8_t *a, u8_t *b, int len)
22+
{
23+
int i;
24+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
From 6d68ef5871c94c6ebbbe6e6b1fe0bc2dce711052 Mon Sep 17 00:00:00 2001
2+
From: Lee Duncan <[email protected]>
3+
Date: Sat, 2 Dec 2017 14:19:26 -0800
4+
Subject: [PATCH] Include <sys/sysmacros.h> to properly define minor()
5+
6+
---
7+
iscsiuio/src/unix/libs/qedi.c | 1 +
8+
1 file changed, 1 insertion(+)
9+
10+
diff --git a/iscsiuio/src/unix/libs/qedi.c b/iscsiuio/src/unix/libs/qedi.c
11+
index c6ff6e77..b81fecdf 100644
12+
--- a/iscsiuio/src/unix/libs/qedi.c
13+
+++ b/iscsiuio/src/unix/libs/qedi.c
14+
@@ -58,6 +58,7 @@
15+
#include <sys/user.h>
16+
#include <fcntl.h>
17+
#include <unistd.h>
18+
+#include <sys/sysmacros.h>
19+
20+
#include "config.h"
21+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/usr/Makefile b/usr/Makefile
2+
index c1866b6..2990060 100644
3+
--- a/usr/Makefile
4+
+++ b/usr/Makefile
5+
@@ -61,7 +61,7 @@ iscsiadm: $(ISCSI_LIB_SRCS) $(DISCOVERY_SRCS) iscsiadm.o session_mgmt.o mntcheck
6+
7+
iscsistart: $(ISCSI_LIB_SRCS) $(INITIATOR_SRCS) $(FW_BOOT_SRCS) \
8+
iscsistart.o statics.o
9+
- $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -lrt
10+
+ $(CC) $(CFLAGS) $(LDFLAGS) $^ -o $@ -static -lrt
11+
clean:
12+
rm -f *.o $(PROGRAMS) .depend $(LIBSYS)
13+

0 commit comments

Comments
 (0)