UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Participant jhon
Participant
1,219 Views
Registered: ‎11-27-2018

How to change timezone in petalinux?

Jump to solution

Dear all:

How to change the default timezone in petalinux 2018.2? I can't find /etc/timezone, /etc/localtime, the system time is in UTC.

Thanks.

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Explorer
Explorer
1,083 Views
Registered: ‎10-21-2015

Re: How to change timezone in petalinux?

Jump to solution

The setting about tzdata is correct.

I suspect your built image

After doing petalinux-build, check images/linux/rootfs.tar.gz

$ mkdir tmp
$ cd tmp
$ tar xvzf ../images/linux/rootfs.tar.gz
$ cat etc/timezone
Asia/Seoul
$ ls -l etc/localtime
lrwxrwxrwx 1 hokim hokim 30  1월 25 20:24 etc/localtime -> /usr/share/zoneinfo/Asia/Seoul

 

I figured out why timezon is not changed

It  is due to your warning

WARNING: The tzdata:do_install sig is computed to be aaf9bd3c2cfef153468847d94347e4e7, but the sig is locked to 4aafb230f32f002ac18be13e505783ea in SIGGEN_LOCKEDSIGS_t-allarch

Add the following to <petalinux-project>/project-spec/meta-user/conf/petalinuxbsp.conf

SIGGEN_UNLOCKED_RECIPES += "tzdata"

It will remove the warning and update tzdata correctly

Refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug1144-petalinux-tools-reference-guide.pdf p. 71

10 Replies
Explorer
Explorer
1,182 Views
Registered: ‎10-21-2015

Re: How to change timezone in petalinux?

Jump to solution

Hi

<petalinux-project>/project-spec/meta-user/recipes-extended/tzdata/tzdata_%.bbappend 

DEFAULT_TIMEZONE = "Asia/Seoul"

 <petalinux-project>/project-spec/meta-user/recipes-core/images/petalinux-user-image.bbappend 

IMAGE_INSTALL_append = " tzdata"

Then petalinux-build

Participant jhon
Participant
1,149 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

Seems not work, I enabled the rootfs config option:

Filesystem Packages -> base -> tzdata ->tzdata and tzdata-asia

and followed your post, after build, I find in the rootfs.tar.gz (I've not burn the flash), the file /etc/localtime is zero sized, and /etc/timezone has: "America/Los_Angeles" in it.

The building log is as follows (there are 2 warnings):

user@ubuntu:~/zynq-rec$ petalinux-build
[INFO] building project
[INFO] sourcing bitbake
INFO: bitbake petalinux-user-image
Loading cache: 100% |############################################| Time: 0:00:03
Loaded 3426 entries from dependency cache.
Parsing recipes: 100% |##########################################| Time: 0:00:27
Parsing of 2554 .bb files complete (2519 cached, 35 parsed). 3427 targets, 148 skipped, 0 masked, 0 errors.
NOTE: Resolving any missing task queue dependencies
Initialising tasks: 100% |#######################################| Time: 0:00:34
Checking sstate mirror object availability: 100% |###############| Time: 0:00:01
WARNING: The tzdata:do_install sig is computed to be aaf9bd3c2cfef153468847d94347e4e7, but the sig is locked to 4aafb230f32f002ac18be13e505783ea in SIGGEN_LOCKEDSIGS_t-allarch
NOTE: Executing SetScene Tasks
NOTE: Executing RunQueue Tasks
WARNING: petalinux-user-image-1.0-r0 do_rootfs: [log_check] petalinux-user-image: found 1 warning message in the logfile:
[log_check] warning: %post(sysvinit-inittab-2.88dsf-r10.plnx_zynq7) scriptlet failed, exit status 1

NOTE: Tasks Summary: Attempted 3017 tasks of which 2999 didn't need to be rerun and all succeeded.

Summary: There were 2 WARNING messages shown.
INFO: Copying Images from deploy to images
NOTE: Successfully copied built images to tftp dir:  /tftpboot
[INFO] successfully built project
user@ubuntu:~/zynq-rec$

I checked the file:

<petalinux install dir>/components/yocto/source/aarch64/layers/core/meta/recipes-extended/tzdata/tzdata_2017c.bb

there is a line:

DEFAULT_TIMEZONE ?= "Universal"

I guess you want to change this variable, but it seems not work. The assignment is "?=", means if not assigned, then assign to "Universal", if assigned, then keep the old one. Does this "?=" prevent the replacement of the new default timezone?

Thanks.

0 Kudos
Explorer
Explorer
1,142 Views
Registered: ‎10-21-2015

Re: How to change timezone in petalinux?

Jump to solution

Probably you forgot to do this

$ vi <petalinux-project>/project-spec/meta-user/recipes-extended/tzdata/tzdata_%.bbappend 
DEFAULT_TIMEZONE = "<your timezone>"

 "America/Los_Angeles" is timezone overriden by 

<petalinux install dir>/components/yocto/source/aarch64/layers/meta-petalinux/recipes-extended/tzdata/tzdata_%.bbappend

You can override it again with your bbappend file.

DEFAULT_TIMEZONE ?= "Universal"

 means if DEFAULT_TIMEZONE is not set  previousely, DEFAULT_TIMEZONE is set to "Universal"

DEFAULT_TIMEZONE is changed like the following

Universal -> (if tzdata is installed) America/Los_Angeles -> (if there exists your bbappend)<your timezone>

If you add your bbappend file like the above, finally DEFAULT_TIME becomes <your timezone>

Participant jhon
Participant
1,118 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

hi hokim, thanks for your quick reply, but I did as you wrote in your post:

 

user@ubuntu:~/zynq-rec$ cat ./project-spec/meta-user/recipes-core/images/petalinux-user-image.bbappend
IMAGE_INSTALL_append = " tzdata"
user@ubuntu:~/zynq-rec$ cat ./project-spec/meta-user/recipes-extended/tzdata/tzdata_%.bbappend 
DEFAULT_TIMEZONE = "Asia/Shanghai"
user@ubuntu:~/zynq-rec$ 

in the folder "project-spec/meta-user/recipes-core/images/", there is a file "petalinux-image.bbappend", where user applications are listed:

user@ubuntu:~/zynq-rec$ cat ./project-spec/meta-user/recipes-core/images/petalinux-image.bbappend
#Note: Mention Each package in individual line
#      cascaded representation with line breaks are not valid in this file.
IMAGE_INSTALL_append = " peekpoke"
IMAGE_INSTALL_append = " gpio-demo"
IMAGE_INSTALL_append = " can-utils"
IMAGE_INSTALL_append = " myconf"

First I added the " tzdata" line in this file, but not work. Then I noticed the file name shuold be "petalinux-user-image.bbappend", so I created one, and add the tzdata line, but still not works.

user@ubuntu:~/zynq-rec$ ls ./project-spec/meta-user/recipes-core/images/
petalinux-image.bbappend  petalinux-user-image.bbappend
user@ubuntu:~/zynq-rec$ 

 

0 Kudos
Participant jhon
Participant
989 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

I noticed that, after config -c rootfs, there is a file "petalinux-user-image.bb" created: 

user@ubuntu:~/zynq-rec$ petalinux-config -c rootfs
[INFO] sourcing bitbake
[INFO] generating plnxtool conf
[INFO] generating meta-plnx-generated layer
[INFO] generating machine configuration
[INFO] configuring: rootfs
[INFO] generating kconfig for Rootfs
[INFO] menuconfig rootfs


*** End of the configuration.
*** Execute 'make' to start the build or try 'make help'.

[INFO] generating petalinux-user-image.bb
[INFO] successfully configured rootfs
user@ubuntu:~/zynq-rec$

so I checeked this file, and find "tzdata" and "tzdata-asia" have already listed (because I selected them in "Filesystem Packages -> base -> tzdata"):

user@ubuntu:~/zynq-rec$ find -name petalinux-user-image.bb
./project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb user@ubuntu:~/zynq-rec$ cat ./project-spec/meta-plnx-generated/recipes-core/images/petalinux-user-image.bb DESCRIPTION = "PETALINUX image definition for Xilinx boards" LICENSE = "MIT" require recipes-core/images/petalinux-image-common.inc inherit extrausers IMAGE_LINGUAS = " " IMAGE_INSTALL = "\ kernel-modules \ i2c-tools \ mtd-utils \ tzdata \ tzdata-asia \ openssh-sftp-server \ pciutils \ run-postinsts \ udev-extraconf \ packagegroup-core-boot \ packagegroup-core-ssh-dropbear \ tcf-agent \ bridge-utils \ myconf \ can-utils \ " EXTRA_USERS_PARAMS = "usermod -P root root;" user@ubuntu:~/zynq-rec$

So I think I don't need the file petalinux-user-image.bbappend, I removed it, and the build result has no change.

In the generated rootfs.tar.gz, the content of /etc/timezone is still "America/Los_Angeles"

 

0 Kudos
Explorer
Explorer
1,103 Views
Registered: ‎10-21-2015

Re: How to change timezone in petalinux?

Jump to solution

Could you show the result of the followings ?

$ petalinux-build -c "-e tzdata" | grep ^DEFAULT_TIMEZONE=
$ petalinux-build -c "-e tzdata" | grep ^BBINCLUDED=
0 Kudos
Participant jhon
Participant
1,098 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

The first command output is:

DEFAULT_TIMEZONE="Asia/Shanghai"

The 2nd output is very long, I attached it as log.txt

 

0 Kudos
Participant jhon
Participant
1,094 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

I checked the log.txt, and find 2 lines with "tzdata_%.bbappend"

/home/uesr/petalinux/components/yocto/source/arm/layers/meta-petalinux/recipes-extended/tzdata/tzdata_%.bbappend
/home/uesr/zynq-rec/project-spec/meta-user/recipes-extended/tzdata/tzdata_%.bbappend

the first one has one line inside:

user@ubuntu:~$ cat petalinux/components/yocto/source/arm/layers/meta-petalinux/recipes-extended/tzdata/tzdata_%.bbappend
DEFAULT_TIMEZONE  = "America/Los_Angeles"
user@ubuntu:~$ 

the 2nd is mine:

user@ubuntu:~$ cat zynq-rec/project-spec/meta-user/recipes-extended/tzdata/tzdata_%.bbappend
DEFAULT_TIMEZONE = "Asia/Shanghai"
uesr@ubuntu:~$ 
0 Kudos
Highlighted
Explorer
Explorer
1,084 Views
Registered: ‎10-21-2015

Re: How to change timezone in petalinux?

Jump to solution

The setting about tzdata is correct.

I suspect your built image

After doing petalinux-build, check images/linux/rootfs.tar.gz

$ mkdir tmp
$ cd tmp
$ tar xvzf ../images/linux/rootfs.tar.gz
$ cat etc/timezone
Asia/Seoul
$ ls -l etc/localtime
lrwxrwxrwx 1 hokim hokim 30  1월 25 20:24 etc/localtime -> /usr/share/zoneinfo/Asia/Seoul

 

I figured out why timezon is not changed

It  is due to your warning

WARNING: The tzdata:do_install sig is computed to be aaf9bd3c2cfef153468847d94347e4e7, but the sig is locked to 4aafb230f32f002ac18be13e505783ea in SIGGEN_LOCKEDSIGS_t-allarch

Add the following to <petalinux-project>/project-spec/meta-user/conf/petalinuxbsp.conf

SIGGEN_UNLOCKED_RECIPES += "tzdata"

It will remove the warning and update tzdata correctly

Refer to https://www.xilinx.com/support/documentation/sw_manuals/xilinx2018_2/ug1144-petalinux-tools-reference-guide.pdf p. 71

Participant jhon
Participant
1,058 Views
Registered: ‎11-27-2018

Re: How to change timezone in petalinux?

Jump to solution

It finally works!

Thank you very much for your patient and kind guidance. Without your help, I think I'll be stuck with it for weeks.
0 Kudos