Building the AWS ENA driver ena.ko

Tried to load the Clear Linux AMI onto an EC2 i3en instance and it was forbidden by AWS, most likely because the kernel was not stamped with supporting the ENA interface. ENA is Amazon’s enhanced network adaptor.

https://docs.aws.amazon.com/en_pv/AWSEC2/latest/UserGuide/enhanced-networking-ena.html

I didn’t think it would be easy but I tried to follow the Amazon build instructions for the ena.ko module while running on an i3 instance with an updated Clear Linux ami but because it didn’t have specific instructions for the Clear Linux case, I used the generic Linux example but at the point where root would run make in the driver directory that was pulled from GitHub, the make failed.

I had also run sudo bundle-add make vimm git c-basic linux-dev

and uname -r reported 5.2.16-160.aws

/home/clear/amzn-drivers/kernel/linux/ena # make
make -C /lib/modules/5.2.16-160.aws/build M=/home/clear/amzn-drivers/kernel/linux/ena modules
make[1]: *** /lib/modules/5.2.16-160.aws/build: No such file or directory. Stop.
make: *** [Makefile:38: all] Error 2

I naively made the build directory it complained was not there but then the next make error showed there is more that should be going on.

/home/clear/amzn-drivers/kernel/linux/ena # make
make -C /lib/modules/5.2.16-160.aws/build M=/home/clear/amzn-drivers/kernel/linux/ena modules
make[1]: Entering directory ‘/usr/lib/modules/5.2.16-160.aws/build’
make[1]: *** No rule to make target ‘modules’. Stop.
make[1]: Leaving directory ‘/usr/lib/modules/5.2.16-160.aws/build’
make: *** [Makefile:38: all] Error 2

Should it be relatively easy to build this kernel module and then create my own ami from the official Clear Linux ami or am I falling down a rabbit hole? I already see this module would need to be rebuilt any time the Clear Linux kernel was updated and I might not be able to log in to perform the recompile if the network interface isn’t working. So this would not be for the kind of instance I couldn’t afford to destroy and build again.

Also wondering if there might be a plan to build an official Clear Linux ami that works on their ena instances in the future.

Hi @FrankReh you should checkout dkms. This will allow you to update the kernel module with every kernel update.

https://docs.01.org/clearlinux/latest/guides/kernel/kernel-modules-dkms.html

But uname -r returns 5.2.16-160.aws
while the Clear Linux DKMS install says " Only the native and lts kernels are enabled to build and load out-of-tree kernel modules with DKMS."

I went ahead and installed both the native and lts kernel dkms bundles and built a dkms.conf file by hand and created the driver directory usr /usr/src but when it came time to run dkms with add or build, the commands would hang with an error “Vim: Warning: Output is not to a terminal”.

Haven’t figured out what is causing that vim error or hang of dkms yet but the fact these instructions are not for an aws kernel bundle makes me wonder if it would work anyway.

DKMS does not support the AWS kernel.

You need to compile your own AWS kernel, and then include the ENA driver.

1 Like

Thanks @ahkok for the correct info.

Yes, thank you for the clarification. I think I would be taking this too far afield by trying to take on a process that rebuilt my own kernel whenever there were kernel updates so I will put off trying to use this further for aws. Sorry for the noise. Seems like a great project in general. The boot times and cleaned up user set for servers and auto update and module update designs are very nice.

2 Likes