twteamware / raspberrypi-ptp

How to run IEEE-1588 on RaspberryPi hardware
78 stars 23 forks source link

Raspberry Pi 4 - SOF_TIMESTAMPING_TX_SOFTWARE #10

Open arodriguezbg opened 4 years ago

arodriguezbg commented 4 years ago

using raspberry pi 4 can't enable SOF_TIMESTAMPING_TX_SOFTWARE

GillesC commented 4 years ago

I followed the instruction from here and it worked perfectly.

These are the commands (including saving an image to USB):

# kernel building MIDAS
sudo apt update && sudo apt upgrade
sudo apt install ethtool linuxptp git bc bison flex libssl-dev make exfat-fuse exfat-utils
sudo sed -i -e 's/time_stamping.*$/time_stamping\t\tsoftware/' /etc/linuxptp/ptp4l.conf
git clone --depth=1 --branch rpi-5.6.y https://github.com/raspberrypi/linux
cd linux
KERNEL=kernel7l
make bcm2711_defconfig
# change in .config: CONFIG_LOCALVERSION="-v7l-MIDAS_KERNEL"
make -j6 zImage modules dtbs
echo 'CONFIG_NETWORK_PHY_TIMESTAMPING=y' >> .config
echo 'CONFIG_PTP_1588_CLOCK=y' >> .config
make olddefconfig
make -j6 zImage modules dtbs
sudo make modules_install
sudo cp arch/arm/boot/dts/*.dtb /boot/
sudo cp arch/arm/boot/dts/overlays/*.dtb* /boot/overlays/
sudo cp arch/arm/boot/dts/overlays/README /boot/overlays/
sudo cp arch/arm/boot/zImage /boot/$KERNEL.img
halt

# check if correct
ethtool -T eth0

# CREATE IMAGE
#To check the partitions are what you are expecting:
lsblk
#Create the directory for mounting:
sudo mkdir /media/usb
sudo chmod 775 /media/usb

# Mount the USB connected device.  A single partition Fat32 USB stick on sdb1 in this case:
sudo mount -t exfat /dev/sda1 /media/usb -o rw,umask=0000

# Make an img file from the card inserted in the Pi microSD card slot. Will take some time:
sudo dd if=/dev/mmcblk0 of=/media/usb/imgfile.img bs=1M status=progress
steeley commented 2 years ago

You appear to be compiling twice with this line! make -j6 zImage modules dtbs

michael-gosselin commented 1 year ago

Thanks for this, @GillesC.

git clone --depth=1 --branch rpi-5.6.y https://github.com/raspberrypi/linux

... does it have to be rpi-5.6.y ? I used rpi-5.15.y (but it didn't work). When I do:

$ ethtool -T eth0

I get:

Time stamping parameters for eth0:
Capabilities:
    software-transmit
    software-receive
    software-system-clock
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none

I also notice that ptp4l is not running after I boot:

$ sudo systemctl status ptp4l

gives,

Unit ptp4l.service could not be found.

change in .config: CONFIG_LOCALVERSION="-v7l-MIDAS_KERNEL"

... I did not change my CONFIG_LOCALVERSION. I see you have this line commented out - did you modify it? What is the purpose of changing it?

I checked .config, it looks like the default is:

CONFIG_LOCALVERSION="-v7l"

I am using a raspberry pi 4B.

michael-gosselin commented 1 year ago

Ok, following up on my previous message, I built and configured with kernel 5.3.18-v7l, on the same raspberry pi 4B as before, and it seems to have worked:

$ uname -r
5.3.18-v7l
$ ethtool -T eth0
Time stamping parameters for eth0:
Capabilities:
    software-transmit     (SOF_TIMESTAMPING_TX_SOFTWARE)
    software-receive      (SOF_TIMESTAMPING_RX_SOFTWARE)
    software-system-clock (SOF_TIMESTAMPING_SOFTWARE)
PTP Hardware Clock: none
Hardware Transmit Timestamp Modes: none
Hardware Receive Filter Modes: none