Skip to content

Instantly share code, notes, and snippets.

@danthegoodman1
Last active July 4, 2025 18:36
Show Gist options
  • Select an option

  • Save danthegoodman1/4cabedec66846f30bf6c350f93652d0d to your computer and use it in GitHub Desktop.

Select an option

Save danthegoodman1/4cabedec66846f30bf6c350f93652d0d to your computer and use it in GitHub Desktop.
Setup AWS Timesync with the PTP clock for Ubuntu (x86 and arm tested)
#!/usr/bin/env bash
set -euo pipefail
echo "[1/6] Install build deps…"
sudo apt-get update -qq
sudo apt-get install -y --no-install-recommends \
build-essential git linux-headers-$(uname -r)
echo "[2/6] Fetch & compile ENA with PHC…"
workdir=$(mktemp -d)
git -C "$workdir" clone --depth 1 https://github.com/amzn/amzn-drivers.git
cd "$workdir"/amzn-drivers/kernel/linux/ena
ENA_PHC_INCLUDE=1 make -j"$(nproc)" # pulls in PHC support
echo "[3/6] Install the new module…"
sudo mkdir -p /lib/modules/$(uname -r)/updates
sudo cp -f ena.ko /lib/modules/$(uname -r)/updates/
sudo depmod -a
echo "[4/6] Enable PHC on load…"
echo "options ena phc_enable=1" | sudo tee /etc/modprobe.d/ena-phc.conf
echo "[5/6] Re-generate initramfs…"
sudo update-initramfs -u -k $(uname -r)
echo "[6/6] Done – rebooting to activate PHC-enabled ENA."
sleep 5
sudo reboot
@danthegoodman1
Copy link
Author

clockbound should automatically use the ptp clock once you tell chronyd to use the PHC (ptp hardware clock)

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