I have an embedded Linux device for which the stock operating system image does not include the TZ database files usually found in /usr/share/zoneinfo
.
I wish to enhance the device in order to be able to include timezone support in my application. The device does not have a package manager and does not include any of the usual timezone management utilities such as tzselect
or timedatectrl
. The main method for shifting data onto the device is via USB flash drive.
I have confirmed that the GLIBC library on the device has been built with timezone support included, and hacking around manually copying the TZ database from my machine onto the device and creating the various symlinks expected, I can get timezone support more or less working.
Everything I can find online regarding the TZ database install recommends using the platform's package manager, which in this case is not available. A complicating factor is that the device's manufacturers suggest that all user data be placed under the /opt
directory (system directories are mounted read-only), accordingly.
I'm wanting to install the database in /opt/usr/share/zoneinfo
rather than the usual /usr/share/zoneinfo
, with a /usr/share/zoneinfo
-> /opt/usr/share/zoneinfo
symlink. This means that symlinks copied from the zoneinfo
directory of my development machine won't be pointing to the right place once on target (presuming they are absolute).
So to copy the TZ database I think I need to:
- Take a temporary copy of
usr/share/zoneinfo
directory on my dev. machine - Use the
symlinks
utility to convert all absolute symlinks to the relative. - Package the directory into an archive format that maintains symlinks.
- Copy the archive over on a USB flash drive
- Unpack it into the desired location.
Is there a better/standard/proper way of doing this?
NOTE: I'm using CrossControl CCPilot VS, Yocto generated Linux OS.