Skip to content

Instantly share code, notes, and snippets.

@kwilczynski
Last active September 29, 2020 09:13
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 5 You must be signed in to fork a gist
  • Save kwilczynski/36914ee29e31f7dbd27b4f6742dc96b3 to your computer and use it in GitHub Desktop.
Save kwilczynski/36914ee29e31f7dbd27b4f6742dc96b3 to your computer and use it in GitHub Desktop.
Amazon Elastic Network Adapter (ENA) on CentOS 6
yum -y install patch dkms kernel-devel
wget https://github.com/amzn/amzn-drivers/archive/ena_linux_1.1.3.tar.gz
tar zxvf ena_linux_1.1.3.tar.gz -C /usr/src/
mv /usr/src/amzn-drivers-ena_linux_1.1.3 /usr/src/ena-1.1.3
cat <<EOF > /usr/src/ena-1.1.3/dkms.conf
PACKAGE_NAME="ena"
PACKAGE_VERSION="1.1.3"
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.1.3
dkms build -m ena -v 1.1.3
dkms install -m ena -v 1.1.3
dracut -f --add-drivers ena
[root@testing-db004 /usr/src]# modinfo ena
filename: /lib/modules/2.6.32-642.15.1.el6.x86_64/extra/ena.ko
version: 1.1.3
license: GPL
description: Elastic Network Adapter (ENA)
author: Amazon.com, Inc. or its affiliates
srcversion: 95D68BE3C0E363A5CDA8E13
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-642.15.1.el6.x86_64 SMP mod_unload modversions
parm: debug:Debug level (0=none,...,16=all) (int)
@shanielh
Copy link

Don't forget to

yum --enablerepo=extras install epel-release

@SamCyanide
Copy link

SamCyanide commented Mar 28, 2018

Make sure you reboot if your kernel version is updated (which it probably will be due to installing kernel-devel and yum update).
See here for updated gist.
See below for issue that rebooting fixed:

Build not working.

[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

@kwilczynski
Copy link
Author

Thank you everyone for keeping this Gist alive! <3

@frank3427
Copy link

kwilczynski,

Have you tried this as a bash script in a packer build?

@kwilczynski
Copy link
Author

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