统信UOS和银河麒麟V10x86版编译安装scst和zfs过程

最近国产化是趋势,我们的服务也准备适配国产化平台,首先先在x86处理器版本的国产系统下尝试一下编译安装:

统信和银河麒麟都下的是x86server版,虽然内核版本不太一样,但是差大版本都是4.19,差不多,操作过程一样:

git clone https://github.com/openzfs/zfs.git
安装一些编译需要的依赖包:
yum install epel-release

yum install autoconf automake gettext createrepo libuuid-devel libblkid-devel openssl-devel libtirpc-devel lz4-devel libzstd-devel zlib-devel kernel-devel-$(uname -r) elfutils-libelf-devel libaio-devel libattr-devel libudev-devel python3-devel libffi-devel ncompress python2-devel python-cffi python-setuptools wget

yum groupinstall -y "Development"

下载好后进入下载的路径:

./autogen.sh
./configure
make rpm

编译需要一些时间,成功后进行本地安装:

创建本地yum源
cat > /etc/yum.repos.d/zfs-local.repo << EOF
[zfs-local]
name=ZFS Local
baseurl=file:///var/lib/zfs.repo
enabled=1
gpgcheck=0
EOF

制作本地安装repo文件
mkdir -p /var/lib/zfs.repo
createrepo /var/lib/zfs.repo
cp *.rpm /var/lib/zfs.repo/
createrepo --update /var/lib/zfs.repo

本地安装
yum --enablerepo=zfs-local install zfs
加载模块
/sbin/modprobe zfs
检查模块是否已加载
lsmod | grep zfs


接下来就可以使用zfs了~

接下来安装 scst的过程:

我是在这下载下来了scst3.5.0的版本源码:

https://sourceforge.net/projects/scst/files/

解压之后看INSTALL.md进行编译,因为我想编译成rpm包离线安装,所以选择make rpm

但是会报错:

make[4]: Entering directory '/usr/src/kernels/4.19.0-91.82.132.uelc20.x86_64'
  CC [M]  /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/scst_copy_mgr.o
In file included from /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/../include/scst.h:64,
                 from /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/scst_copy_mgr.c:17:
/usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/../include/backport.h:917:20: error: static declaration of 'percpu_ref_resurrect' follows non-static declaration
 static inline void percpu_ref_resurrect(struct percpu_ref *ref)
                    ^~~~~~~~~~~~~~~~~~~~
In file included from ./include/linux/genhd.h:17,
                 from ./include/linux/blkdev.h:11,
                 from /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/../include/scst.h:37,
                 from /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/scst_copy_mgr.c:17:
./include/linux/percpu-refcount.h:119:6: note: previous declaration of 'percpu_ref_resurrect' was here
 void percpu_ref_resurrect(struct percpu_ref *ref);
      ^~~~~~~~~~~~~~~~~~~~
make[5]: *** [scripts/Makefile.build:304: /usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src/scst_copy_mgr.o] Error 1
make[4]: *** [Makefile:1529: _module_/usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src] Error 2
make[4]: Leaving directory '/usr/src/kernels/4.19.0-91.82.132.uelc20.x86_64'
make[3]: *** [Makefile:75: all] Error 2
make[3]: Leaving directory '/usr/src/packages/BUILD/scst-3.8.0.68461f58/scst/src'
make[2]: *** [Makefile:36: all] Error 2
make[2]: Leaving directory '/usr/src/packages/BUILD/scst-3.8.0.68461f58/scst'
错误:/var/tmp/rpm-tmp.GOcl9S (%build) 退出状态不好


RPM 构建错误:
    /var/tmp/rpm-tmp.GOcl9S (%build) 退出状态不好
make[1]: *** [Makefile:348:scst-rpm] 错误 1
make[1]: 离开目录“/root/wangzhao/scst”
make: *** [Makefile:383:rpm] 错误 2

这个问题是“percpu_ref_recure”的静态声明位于非静态声明之后”,解决方法就比较简单粗暴,直接把出问题的那段给注释掉。首尾添加了一个#if 0和#endif ,这个错误有两处,另一处也以同样的方式改掉,就可以编译成功了。

   1213 #if 0
   1214 static inline void percpu_ref_resurrect(struct percpu_ref *ref)
   1215 {
   1216 #if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 17, 0) ||   \
   1217         (defined(RHEL_MAJOR) && RHEL_MAJOR -0 >= 7)
   1218         percpu_ref_reinit(ref);
   1219 #else
   1220         unsigned __percpu *pcpu_count = (unsigned __percpu *)
   1221                 ((uintptr_t)ref->pcpu_count & ~PCPU_REF_DEAD);
   1222         int cpu;
   1223 
   1224         BUG_ON(!pcpu_count);
   1225         //WARN_ON(!percpu_ref_is_zero(ref));
   1226 
   1227         atomic_set(&ref->count, 1 + PERCPU_COUNT_BIAS);
   1228 
   1229         /*
   1230          * Restore per-cpu operation. The barrier guarantees that the zeroing
   1231          * is visible to all percpu accesses which can see the following
   1232          * PCPU_REF_DEAD clearing.
   1233          */
   1234         for_each_possible_cpu(cpu)
   1235                 *per_cpu_ptr(pcpu_count, cpu) = 0;
   1236 
   1237         ref->pcpu_count = (unsigned __percpu *)
   1238                 ((uintptr_t)ref->pcpu_count & ~PCPU_REF_DEAD);
   1239         smp_mb();
   1240 #endif
   1241 }
   1242 #endif
   2118 #if 0
   2119 static inline void
   2120 fc_host_fpin_rcv(struct Scsi_Host *shost, u32 fpin_len, char *fpin_buf)
   2121 {
   2122 }
   2123 #endif
   2124 #endif

编译完之后,显示rpm包已写至:/usr/src/packages/RPMS/x86_64/scstadmin-1.0.0-1.ky10.x86_64.rpm

去这个路径下就能找到scst的安装包~
 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值