Jetson NANO iSCSI module

Hello, folks!
I tried to build a kernel with iSCSI modules from these sources

And the buld failed with error:


  CC      drivers/scsi/libiscsi_tcp.o
In file included from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/asm-generic/bug.h:13:0,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/include/asm/bug.h:67,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/linux/bug.h:4,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/include/asm/cmpxchg.h:21,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/arch/arm64/include/asm/atomic.h:41,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/linux/atomic.h:4,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/linux/crypto.h:21,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/crypto/hash.h:16,
                 from /home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/scsi/libiscsi_tcp.c:29:
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/scsi/libiscsi_tcp.c: In function ‘iscsi_tcp_segment_init_sg’:
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/linux/kernel.h:741:16: error: comparison of distinct pointer types lacks a cast [-Werror]
  (void) (&min1 == &min2);   \
                ^
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/include/linux/kernel.h:744:2: note: in expansion of macro ‘__min’
  __min(typeof(x), typeof(y),   \
  ^~~~~
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/drivers/scsi/libiscsi_tcp.c:102:18: note: in expansion of macro ‘min’
  segment->size = min(sg->length - offset,
                  ^~~
cc1: all warnings being treated as errors
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/Makefile.build:335: recipe for target 'drivers/scsi/libiscsi_tcp.o' failed
make[3]: *** [drivers/scsi/libiscsi_tcp.o] Error 1
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/scripts/Makefile.build:649: recipe for target 'drivers/scsi' failed
make[2]: *** [drivers/scsi] Error 2
/home/user/jetson_kernel/Linux_for_Tegra/source/public/kernel/kernel-4.9/Makefile:1121: recipe for target 'drivers' failed
make[1]: *** [drivers] Error 2
make[1]: Leaving directory '/home/user/jetson_kernel/Linux_for_Tegra/source/public/iscsi_kernel'
Makefile:171: recipe for target 'sub-make' failed
make: *** [sub-make] Error 2

Simple patch to the kernel-4.9/drivers/scsi/libiscsi_tcp.c makes the job done:


--- libiscsi_tcp.c.orig 2021-07-14 13:37:16.532860580 +0300
+++ libiscsi_tcp.c      2021-07-14 12:37:29.604669166 +0300
@@ -100,7 +100,7 @@
        segment->sg = sg;
        segment->sg_offset = offset;
        segment->size = min(sg->length - offset,
-                           segment->total_size - segment->total_copied);
+                           (size_t) segment->total_size - segment->total_copied);
        segment->data = NULL;
 }

Hope that helps someone.

4 Likes

Thanks for your kind share.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.