Search code examples
yoctoopenembedded

ntp recipe didn't install ntpdate files


I have included ntp package.

When yocto OS image comes out, it has only ntp, there is no ntpdate.

I found someone has the same problem but no solution:

https://forums.xilinx.com/t5/Embedded-Linux/How-to-install-ntpdate-command/td-p/1052770

Why it has only ntp? The recipe did include ntpdate.

https://git.congatec.com/yocto/meta-openembedded/blob/ddd3ccd63949f9a24040eb39c136ef9730f2662a/meta-networking/recipes-support/ntp/ntp_4.2.8.bb

ex:

 install -m 755 ${WORKDIR}/ntpdate ${D}${bindir}/ntpdate-sync
 ...
 install -m 0644 ${WORKDIR}/ntpdate.service ${D}${systemd_unitdir}/system/

Solution

  • ntp and ntpdate are two packages of the ntp recipe. If you want to add ntpdate, just add to your image:

    IMAGE_INSTALL += "ntpdate"
    

    Explanation: Take a look at the recipe, and at the PACKAGES variable:

    PACKAGES += "ntpdate sntp ${PN}-tickadj ${PN}-utils"
    

    It means that the ntp recipe contains the packages: ntp (default ${PN}), ntpdate, sntp, ntp-tickadj, ntp-utils.

    You can also take a look at the environment of the ntp recipe:

    $ bitbake ntp -e |grep ^PACKAGES=            
    PACKAGES="ntp-src ntp-dbg ntp-staticdev ntp-dev ntp-doc ntp-locale  ntp ntpdate sntp ntpq ntp-tickadj ntp-utils"