LINUX.ORG.RU

сборка модуля 9p под RHEL / CentOS

 , , , ,


0

2

Нужно подключить общую папку от хоста к виртуалке в KVM (.

Из коробки в RHEL 7 отсутствует модуль для 9p ФС. Собираю сам.

Порядок действий:

# Поставил зависимости:

[root:root] yum install asciidoc audit-libs-devel bash binutils binutils-devel bison bzip2 diffutils elfutils-devel elfutils-libelf-devel findutils flex gawk gcc gnupg gzip hmaccalc m4 make module-init-tools net-tools newt-devel patch patchutils perl perl-ExtUtils-Embed python python-devel redhat-rpm-config rpm-build sh-utils tar xmlto zlib-devel kernel-devel

# Далее от простого пользователя:

mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}

echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros

rpm -i http://vault.centos.org/7.6.1810/updates/Source/SPackages/kernel-3.10.0-957.12.1.el7.src.rpm 2>&1 | grep -v exist

cd ~/rpmbuild/SPECS

rpmbuild -bp --target=$(uname -m) kernel.spec

cd ~/rpm*/BUI*/ker*/lin*

make oldconfig

make menuconfig

# Включил:
Networking Support -> Plan 9 Resource sharing support <M> -> {9P Virtio Transport <M>, 9P RDMA Transport <M>}

File Systems -> Network File Systems -> Plan 9 Resource Sharing Support <M>

# Всё ещё от пользователя:
make prepare

make modules_prepare

make M=fs/9p

strip --strip-debug fs/9p/9p.ko

# От рута:

cp fs/9p/9p.ko /lib/modules/`uname -r`/extra

depmod -a

По идее, модуль на месте и ядро о нём знает. Запускаю

modprobe 9p

И получаю в ответ:

modprobe: ERROR: could not insert ‘9p’: Exec format error

Что я сделал неправильно?

Ответ на: комментарий от post-factum
modinfo fs/9p/9p.ko

filename:       /home/artur/rpmbuild/BUILD/kernel-3.10.0-957.12.1.el7/linux-3.10.0-957.12.1.el7.x86_64/fs/9p/9p.ko
alias:          fs-9p
license:        GPL
author:         Ron Minnich <rminnich@lanl.gov>
author:         Eric Van Hensbergen <ericvh@gmail.com>
author:         Latchesar Ionkov <lucho@ionkov.net>
retpoline:      Y
rhelversion:    7.6
srcversion:     FAEE52F186E95D8D9665EC2
depends:        
vermagic:       3.10.0 SMP mod_unload modversions 
the_real_kinik ()
Ответ на: комментарий от post-factum
modinfo ext4
filename:       /lib/modules/3.10.0-957.12.1.el7.x86_64/kernel/fs/ext4/ext4.ko.xz
license:        GPL
description:    Fourth Extended Filesystem
author:         Remy Card, Stephen Tweedie, Andrew Morton, Andreas Dilger, Theodore Ts'o and others
alias:          fs-ext4
alias:          ext3
alias:          fs-ext3
alias:          ext2
alias:          fs-ext2
retpoline:      Y
rhelversion:    7.6
srcversion:     234974CD0CC69FA7926DA2B
depends:        mbcache,jbd2
intree:         Y
vermagic:       3.10.0-957.12.1.el7.x86_64 SMP mod_unload modversions 
signer:         Red Hat Enterprise Linux kernel signing key
sig_key:        91:54:24:43:35:94:2D:F5:6D:53:0B:35:50:81:BD:D9:34:88:F2:62
sig_hashalgo:   sha256
the_real_kinik ()
Ответ на: комментарий от post-factum
[   26.572377] Netfilter messages via NETLINK v0.30.
[   26.583508] ip_set: protocol 6
[   52.497460] input: spice vdagent tablet as /devices/virtual/input/input5
[   80.771762] fuse init (API version 7.22)
[   84.733523] input: spice vdagent tablet as /devices/virtual/input/input6
[   94.391146] TCP: lp registered
[  114.382601] 9p: no symbol version for module_layout

Это последние несколько строчек dmesg.

the_real_kinik ()
Ответ на: комментарий от the_real_kinik

Погуглил по этой ошибке из dmesg. На askubuntu предлагали 2 варианта:

  1. собрать ядро целиком и скопировать Modules.symvers в текущее ядро;

  2. запустить modprobe -f ....

После второго действия в dmesg следущее:

[  280.326003] 9p: module_layout: kernel tainted.
[  280.326005] Disabling lock debugging due to kernel taint
[  280.326006] 9p: loading out-of-tree module taints kernel.
[  280.326103] 9p: module verification failed: signature and/or required key missing - tainting kernel
[  280.326137] 9p: Unknown symbol p9_client_getattr_dotl (err 0)
[  280.326147] 9p: Unknown symbol p9_client_wstat (err 0)
[  280.326156] 9p: Unknown symbol p9_client_open (err 0)
[  280.326165] 9p: Unknown symbol p9_client_rename (err 0)
[  280.326181] 9p: Unknown symbol p9_client_remove (err 0)
[  280.326192] 9p: Unknown symbol p9_client_renameat (err 0)
[  280.326205] 9p: Unknown symbol p9_client_fcreate (err 0)
[  280.326214] 9p: Unknown symbol p9_is_proto_dotu (err 0)
[  280.326224] 9p: Unknown symbol p9_client_disconnect (err 0)
[  280.326234] 9p: Unknown symbol p9_client_attach (err 0)
[  280.326244] 9p: Unknown symbol p9stat_free (err 0)
[  280.326255] 9p: Unknown symbol p9_client_create (err 0)
[  280.326268] 9p: Unknown symbol p9_client_setattr (err 0)
[  280.326277] 9p: Unknown symbol p9_client_xattrwalk (err 0)
[  280.326287] 9p: Unknown symbol p9_client_destroy (err 0)
[  280.326295] 9p: Unknown symbol p9_client_unlinkat (err 0)
[  280.326307] 9p: Unknown symbol p9_client_mkdir_dotl (err 0)
[  280.326316] 9p: Unknown symbol p9_client_xattrcreate (err 0)
[  280.326325] 9p: Unknown symbol p9_client_create_dotl (err 0)
[  280.326334] 9p: Unknown symbol p9_client_lock_dotl (err 0)
[  280.326346] 9p: Unknown symbol p9_client_write (err 0)
[  280.326355] 9p: Unknown symbol p9_client_walk (err 0)
[  280.326391] 9p: Unknown symbol p9_client_read (err 0)
[  280.326400] 9p: Unknown symbol p9_client_fsync (err 0)
[  280.326409] 9p: Unknown symbol p9dirent_read (err 0)
[  280.326430] 9p: Unknown symbol p9_client_symlink (err 0)
[  280.326442] 9p: Unknown symbol p9_client_readlink (err 0)
[  280.326451] 9p: Unknown symbol p9_is_proto_dotl (err 0)
[  280.326463] 9p: Unknown symbol p9_client_clunk (err 0)
[  280.326471] 9p: Unknown symbol p9stat_read (err 0)
[  280.326481] 9p: Unknown symbol p9_client_statfs (err 0)
[  280.326491] 9p: Unknown symbol p9_client_link (err 0)
[  280.326501] 9p: Unknown symbol p9_client_stat (err 0)
[  280.326513] 9p: Unknown symbol p9_client_begin_disconnect (err 0)
[  280.326544] 9p: Unknown symbol p9_client_getlock_dotl (err 0)
[  280.326555] 9p: Unknown symbol p9_client_readdir (err 0)
[  280.326583] 9p: Unknown symbol p9_client_mknod_dotl (err 0)

the_real_kinik ()