Error installing NVIDIA 470 driver on Ubuntu 24.04 LTS

I’m trying to install the NVIDIA 470 DKMS driver on Ubuntu 24.04 LTS. I spun up an EC2 instance using a g6.2xlarge with a single NVIDIA L4 GPU.

I downloaded the driver from here: Driver Details | NVIDIA

In the driver installation log, I see this error during DKMS compilation:

cat /var/lib/dkms/nvidia/470.256.02/build/make.log
nvidia/os-mlock.c: In function 'nv_follow_pfn':
nvidia/os-mlock.c:23:12: error: implicit declaration of function 'follow_pfn'; did you mean 'folio_pfn'? [-Werror=implicit-function-declaration]
   23 |     return follow_pfn(vma, address, pfn);
      |            ^~~~~~~~~~
      |            folio_pfn
cc1: some warnings being treated as errors
make[4]: *** [/usr/src/linux-headers-6.14.0-1018-aws/scripts/Makefile.build:207: nvidia/os-mlock.o] Error 1
make[4]: *** Waiting for unfinished jobs....

Any suggestions on how to get this installed successfully?