Message ID | 20231102024001.1671273-1-lizhi.xu@windriver.com |
---|---|
State | New |
Headers | show |
Series | tzdata: Reduced time zone configuration | expand |
On Thu, 2 Nov 2023 at 03:40, Xu, Lizhi via lists.openembedded.org <Lizhi.Xu=windriver.com@lists.openembedded.org> wrote: > The tzdata.bb by default pulls in all possible timezone data packages which > increases size of the final root filesystem considerably. > The customer would like to have extra timezones configurable so that only > tzdata-core is chosen by default and rest of the zones are optional. > This change would make the fs size a lot smaller. Thank you for the contribution. To be considered for inclusion in oe-core, there need to be two improvements: - please quantify wording like "increases size considerably" and "makes sizes a lot smaller". What kind of numbers are those and under what conditions? - the changes need to be integrated directly into tzdata recipe, and default behavior needs to remain as it is now. Alex
I noticed that Debian is building their tzdata quite differently these days, and Systemd expects new files that are not produced by Yocto also. (Yocto ends up on the "legacy" path.) I wrote a little about it on bugzilla here: https://bugzilla.yoctoproject.org/show_bug.cgi?id=15172 And you can see what Debian does here: https://salsa.debian.org/glibc-team/tzdata/-/blob/sid/debian/rules Perhaps you would be interested in looking into this while you're working in the area? Just a suggestion! Regards //Ernst Den tors 2 nov. 2023 kl 10:43 skrev Alexander Kanavin < alex.kanavin@gmail.com>: > On Thu, 2 Nov 2023 at 03:40, Xu, Lizhi via lists.openembedded.org > <Lizhi.Xu=windriver.com@lists.openembedded.org> wrote: > > The tzdata.bb by default pulls in all possible timezone data packages > which > > increases size of the final root filesystem considerably. > > The customer would like to have extra timezones configurable so that only > > tzdata-core is chosen by default and rest of the zones are optional. > > This change would make the fs size a lot smaller. > > Thank you for the contribution. To be considered for inclusion in > oe-core, there need to be two improvements: > > - please quantify wording like "increases size considerably" and > "makes sizes a lot smaller". What kind of numbers are those and under > what conditions? > - the changes need to be integrated directly into tzdata recipe, and > default behavior needs to remain as it is now. > > Alex > > -=-=-=-=-=-=-=-=-=-=-=- > Links: You receive all messages sent to this group. > View/Reply Online (#190072): > https://lists.openembedded.org/g/openembedded-core/message/190072 > Mute This Topic: https://lists.openembedded.org/mt/102334804/4947266 > Group Owner: openembedded-core+owner@lists.openembedded.org > Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [ > ernstp@gmail.com] > -=-=-=-=-=-=-=-=-=-=-=- > >
diff --git a/meta/recipes-extended/timezone/README.txt b/meta/recipes-extended/timezone/README.txt new file mode 100644 index 0000000000..e0c6bfdc2e --- /dev/null +++ b/meta/recipes-extended/timezone/README.txt @@ -0,0 +1,8 @@ +# Timezones Config +Set the parameter "OP_TZ" in the file "tzd.inc" to increase or +decrease the time zone in rootfs, as shown in the following example: + +1. Add time zone Asia and Americas, set OP_TZ=" tzdata-asia tzdata-americas" + +2. Delete time zone Americas, set OP_TZ=" tzdata-asia" + diff --git a/meta/recipes-extended/timezone/tzd.inc b/meta/recipes-extended/timezone/tzd.inc new file mode 100644 index 0000000000..fd59531063 --- /dev/null +++ b/meta/recipes-extended/timezone/tzd.inc @@ -0,0 +1,3 @@ +OP_TZ=" tzdata-americas \ + tzdata-asia \ +" diff --git a/meta/recipes-extended/timezone/tzdata.bbappend b/meta/recipes-extended/timezone/tzdata.bbappend new file mode 100644 index 0000000000..c57e961392 --- /dev/null +++ b/meta/recipes-extended/timezone/tzdata.bbappend @@ -0,0 +1,115 @@ +FILESEXTRAPATHS:append := "${THISDIR}/files:" +require tzd.inc +# Packages are primarily organized by directory with a major city in most time +# zones in the base package +TZ_PACKAGES = " \ + tzdata-core \ + ${OP_TZ} \ +" + +# delete posix +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-posix" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/posix + fi +} + +# delete right +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-right" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/right + fi +} + +# delete america +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-americas" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/America + rm -rf ${D}${datadir}/zoneinfo/US + rm -rf ${D}${datadir}/zoneinfo/Brazil + rm -rf ${D}${datadir}/zoneinfo/Canada + rm -rf ${D}${datadir}/zoneinfo/Mexico + rm -rf ${D}${datadir}/zoneinfo/Chile + fi +} + +# delete europe +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-europe" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Europe + fi +} + +# delete africa +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-africa" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Africa + fi +} + +# delete atlantic +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-atlantic" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Atlantic + fi +} + +# delete pacific +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-pacific" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Pacific + fi +} + +# delete antarctica +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-antarctica" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Antarctica + fi +} + +# delete australia +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-australia" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Australia + fi +} + +# delete arctic +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-arctic" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Arctic + fi +} + +# delete misc +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-misc" 2>&1; then + rm ${D}${datadir}/zoneinfo/Cuba + rm ${D}${datadir}/zoneinfo/Egypt + rm ${D}${datadir}/zoneinfo/Eire + rm ${D}${datadir}/zoneinfo/Factory + rm ${D}${datadir}/zoneinfo/GB-Eire + rm ${D}${datadir}/zoneinfo/Hongkong + rm ${D}${datadir}/zoneinfo/Iceland + rm ${D}${datadir}/zoneinfo/Iran + rm ${D}${datadir}/zoneinfo/Israel + rm ${D}${datadir}/zoneinfo/Jamaica + rm ${D}${datadir}/zoneinfo/Japan + rm ${D}${datadir}/zoneinfo/Kwajalein + rm ${D}${datadir}/zoneinfo/Libya + rm ${D}${datadir}/zoneinfo/Navajo + rm ${D}${datadir}/zoneinfo/Poland + rm ${D}${datadir}/zoneinfo/Portugal + rm ${D}${datadir}/zoneinfo/Singapore + rm ${D}${datadir}/zoneinfo/Turkey + fi +} + +# delete asia +do_install:append() { + if ! echo "${TZ_PACKAGES}" | grep -c "tzdata-asia" 2>&1; then + rm -rf ${D}${datadir}/zoneinfo/Asia + rm -rf ${D}${datadir}/zoneinfo/Indian + fi +}
The tzdata.bb by default pulls in all possible timezone data packages which increases size of the final root filesystem considerably. The customer would like to have extra timezones configurable so that only tzdata-core is chosen by default and rest of the zones are optional. This change would make the fs size a lot smaller. Signed-off-by: Lizhi Xu <lizhi.xu@windriver.com> --- meta/recipes-extended/timezone/README.txt | 8 ++ meta/recipes-extended/timezone/tzd.inc | 3 + .../recipes-extended/timezone/tzdata.bbappend | 115 ++++++++++++++++++ 3 files changed, 126 insertions(+) create mode 100644 meta/recipes-extended/timezone/README.txt create mode 100644 meta/recipes-extended/timezone/tzd.inc create mode 100644 meta/recipes-extended/timezone/tzdata.bbappend