Last active
July 7, 2020 10:17
-
-
Save 7171u/dd77833a008f0965280f to your computer and use it in GitHub Desktop.
Random Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
For a linux kernel below 3.2.0-22.25 | |
yum install kernel-devel automake autoconf gcc glib make ncurses-devel ncurses sysfsutils | |
yum install rpm-build redhat-rpm-config asciidoc hmaccalc perl-ExtUtils-Embed xmlto | |
yum install audit-libs-devel binutils-devel elfutils-devel elfutils-libelf-devel | |
yum install newt-devel python-devel zlib-devel | |
Download sysfsutils-2.1.0.tar.gz | |
tar xvf sysfsutils-2.1.0.tar.gz | |
cd sysfsutils-2.1.0 | |
./configure | |
make | |
make install | |
#Module build | |
Download the correct linux-`uname -r`.tar.bz2 from vault.centos.org | |
Login as a diffrent user other than root | |
tar xvf linux-`uname -r`.tar.bz2 -C ~/ | |
cp /usr/src/kernels/<uname -r>/Module.symvers ~/linux-`uname -r` | |
cd ~/linux-`uname -r` | |
make oldconfig | |
make menuconfig | |
>>Device Drivers>>Statging>USBIP ( Select M) | |
make prepare | |
make M=drivers/staging/usbip/ | |
sudo cp drivers/staging/usbip/*.ko /lib/modules/`uname -r`/extra/ | |
sudo modprobe vhci-hcd | |
sudo modprobe usbip_common_mod | |
sudo modprobe usbip | |
#Binary file build | |
Download http://sourceforge.net/projects/usbip/files/usbip/0.1.7/usbip-0.1.7.tar.gz/download | |
tar xvf usbip-0.1.7.tar.gz -C /tmp | |
cd /tmp/usbip-0.1.7/src/ | |
./autogen.sh | |
make | |
ls | |
./configure | |
make | |
sudo make install | |
Ref: | |
http://sourceforge.net/p/usbip/discussion/418507/thread/86706429/ | |
http://askubuntu.com/questions/14627/no-symbol-version-for-module-layout-when-trying-to-load-usbhid-ko | |
https://bugs.launchpad.net/ubuntu/+source/linux/+bug/900384 | |
http://wiki.centos.org/HowTos/I_need_the_Kernel_Source | |
http://wiki.centos.org/HowTos/BuildingKernelModules | |
On CentOS 6.6 (and probably all others) you also need to:
make scripts
Before compiling the module, else you'll get a failure like:
/bin/sh: scripts/genksyms/genksyms: No such file or directory
And before "sudo modprobe vhci-hcd
" you also need to
depmod -a
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Successful steps on CentOS Linux release 7.3.1611 (Core) 3.10.0-514.2.2.el7.x86_64 to compile the modules:
(for some people, some steps might not be needed)
The following gets you past the well-known errors such as:
1. No rule to make target `arch/x86/syscalls/syscall_32.tbl',
2. /bin/sh: scripts/genksyms/genksyms: No such file or directory
3. insmod: ERROR: could not insert module /lib/modules/3.10.0-514.2.2.el7.x86_64/extra/usbip-core.ko: Invalid module format
and
4. insmod: ERROR: could not insert module /lib/modules/3.10.0-514.2.2.el7.x86_64/extra/vhci-hcd.ko: Unknown symbol in module
Under root (or another super/sudo user):
sudo yum install kernel-tools kernel-tools-libs kernel-devel kernel-headers
Note: Bear in mind you might need some additional packages described here and also we need the full kernel source as these modules fail to compile otherwise hence the error listed by number 1 in the above mentioned.
Under non-root user (I used the user builder):
export OS_VER="7.3.1611"
export KERNEL_VER="3.10.0-514.2.2.el7"
export KERNEL_ARCH="x86_64"
wget http://vault.centos.org/$OS_VER/updates/Source/SPackages/kernel-$KERNEL_VER.src.rpm
rpm -i kernel-$KERNEL_VER.src.rpm
mkdir -p ~/rpmbuild/{BUILD,BUILDROOT,RPMS,SOURCES,SPECS,SRPMS}
echo '%_topdir %(echo $HOME)/rpmbuild' > ~/.rpmmacros
cd ~/rpmbuild/SPECS/
rpmbuild -bp --target=$(uname -m) kernel.spec
cd ~/rpmbuild/BUILD/kernel-$KERNEL_VER/linux-$KERNEL_VER.$KERNEL_ARCH/
-------------------------------
ONLY IF YOU ARE RECOMPILING OR FAILED SOMEWHERE BELOW THIS POINT GET BACK TO HERE AND DO A
make mrproper
-------------------------------
cp /usr/src/kernels/$KERNEL_VER.$KERNEL_ARCH/Module.symvers .
cp /boot/config-$KERNEL_VER.$KERNEL_ARCH .config
make oldconfig
make menuconfig
make prepare
make scripts
make M=drivers/staging/usbip/
Again, under root (or another super/sudo user):
export KERNEL_VER="3.10.0-514.2.2.el7"
export KERNEL_ARCH="x86_64"
sudo cp /home/builder/rpmbuild/BUILD/kernel-$KERNEL_VER/linux-$KERNEL_VER.$KERNEL_ARCH/drivers/staging/usbip/*.ko /lib/modules/$KERNEL_VER.$KERNEL_ARCH/extra/
sudo insmod /lib/modules/$KERNEL_VER.$KERNEL_ARCH/extra/usbip-core.ko
sudo insmod /lib/modules/$KERNEL_VER.$KERNEL_ARCH/extra/usbip-host.ko
sudo insmod /lib/modules/$KERNEL_VER.$KERNEL_ARCH/extra/vhci-hcd.ko
And there you go! You finally have working USB/IP Modules.