Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save SamCyanide/780afff4c3e1a9e105264c2a476e037c to your computer and use it in GitHub Desktop.
Save SamCyanide/780afff4c3e1a9e105264c2a476e037c to your computer and use it in GitHub Desktop.
Amazon Elastic Network Adapter (ENA) on CentOS 6
sudo su
yum --enablerepo=extras install epel-release
yum -y install patch dkms kernel-devel perl
yum update
reboot
curl -o ena_linux_1.5.0.tar.gz https://codeload.github.com/amzn/amzn-drivers/tar.gz/ena_linux_1.5.0
tar zxvf ena_linux_1.5.0.tar.gz
mv amzn-drivers-ena_linux_1.5.0 /usr/src/ena-1.5.0
cat <<EOF > /usr/src/ena-1.5.0/dkms.conf
PACKAGE_NAME="ena"
PACKAGE_VERSION="1.5.0"
AUTOINSTALL="yes"
REMAKE_INITRD="yes"
BUILT_MODULE_LOCATION[0]="kernel/linux/ena"
BUILT_MODULE_NAME[0]="ena"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_NAME[0]="ena"
CLEAN="cd kernel/linux/ena; make clean"
MAKE="cd kernel/linux/ena; make BUILD_KERNEL=\${kernelver}"
EOF
dkms add -m ena -v 1.5.0
dkms build -m ena -v 1.5.0
dkms install -m ena -v 1.5.0
dracut -f --add-drivers ena
[root@ip-172-31-11-124 centos]# modinfo ena
filename: /lib/modules/2.6.32-696.23.1.el6.x86_64/extra/ena.ko
version: 1.5.0g
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
retpoline: Y
srcversion: 45908797EEF26FC3CC25173
alias: pci:v00001D0Fd0000EC21sv*sd*bc*sc*i*
alias: pci:v00001D0Fd0000EC20sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00001EC2sv*sd*bc*sc*i*
alias: pci:v00001D0Fd00000EC2sv*sd*bc*sc*i*
depends:
vermagic: 2.6.32-696.23.1.el6.x86_64 SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
aws ec2 modify-instance-attribute --instance-id i-0123456789abcdef --ena-support
@SamCyanide
Copy link
Author

Fixes this issue with dkms build failing due to different kernel versions after updating via yum.

Detail below:

[root@ip-172-31-11-124 tmp]# dkms add -m ena -v 1.1.3

Creating symlink /var/lib/dkms/ena/1.1.3/source ->
                 /usr/src/ena-1.1.3

DKMS: add completed.
[root@ip-172-31-11-124 tmp]# dkms build -m ena -v 1.1.3
Error! echo
Your kernel headers for kernel 2.6.32-696.18.7.el6.x86_64 cannot be found at
/lib/modules/2.6.32-696.18.7.el6.x86_64/build or /lib/modules/2.6.32-696.18.7.el6.x86_64/source.
[root@ip-172-31-11-124 tmp]# uname -a
Linux ip-172-31-11-124 2.6.32-696.18.7.el6.x86_64 #1 SMP Thu Jan 4 17:31:22 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@ip-172-31-11-124 tmp]# ls -l /lib/modules/2.6.32-696.18.7.el6.x86_64/build 
lrwxrwxrwx. 1 root root 51 Jan  8 16:15 /lib/modules/2.6.32-696.18.7.el6.x86_64/build -> ../../../usr/src/kernels/2.6.32-696.18.7.el6.x86_64
[root@ip-172-31-11-124 tmp]# ls -l /lib/modules/2.6.32-696.18.7.el6.x86_64/source 
lrwxrwxrwx. 1 root root 5 Jan  8 16:15 /lib/modules/2.6.32-696.18.7.el6.x86_64/source -> build
[root@ip-172-31-11-124 tmp]# ls -l /usr/src/kernels/2.6.32-696.18.7.el6.x86_64
ls: cannot access /usr/src/kernels/2.6.32-696.18.7.el6.x86_64: No such file or directory
[root@ip-172-31-11-124 tmp]# ls -l /usr/src/kernels/
total 4
drwxr-xr-x. 22 root root 4096 Mar 28 13:31 2.6.32-696.23.1.el6.x86_64

@Ray33
Copy link

Ray33 commented May 17, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment