Skip to content

Instantly share code, notes, and snippets.

@mzdluo123
Last active October 6, 2024 06:07
Show Gist options
  • Select an option

  • Save mzdluo123/9283a46bf22a33433a3fa0b05dee2964 to your computer and use it in GitHub Desktop.

Select an option

Save mzdluo123/9283a46bf22a33433a3fa0b05dee2964 to your computer and use it in GitHub Desktop.
aws install ptp and use hardware clock
# tested on Ubuntu-24.04
apt update
apt-get install dkms git gcc make linuxptp chrony -y
git clone https://github.com/amzn/amzn-drivers.git
mv amzn-drivers /usr/src/amzn-drivers-1.0.0
cat > /usr/src/amzn-drivers-1.0.0/dkms.conf <<EOF
PACKAGE_NAME="ena"
PACKAGE_VERSION="1.0.0"
CLEAN="make -C kernel/linux/ena clean"
MAKE="ENA_PHC_INCLUDE=1 make -C kernel/linux/ena/ BUILD_KERNEL=\${kernelver}"
BUILT_MODULE_NAME[0]="ena"
BUILT_MODULE_LOCATION="kernel/linux/ena"
DEST_MODULE_LOCATION[0]="/updates"
DEST_MODULE_NAME[0]="ena"
REMAKE_INITRD="yes"
AUTOINSTALL="yes"
EOF
dkms add -m amzn-drivers -v 1.0.0
dkms build -m amzn-drivers -v 1.0.0
dkms install -m amzn-drivers -v 1.0.0
cat > /etc/modprobe.d/ena.conf <<EOF
options ena phc_enable=1
EOF
tee -a /etc/chrony/chrony.conf <<EOF
refclock PHC /dev/ptp0 poll 0 delay 0.000010 prefer
EOF
systemctl restart chronyd
chronyc sources
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment