cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
bfung_2
Adventurer
Adventurer
865 Views
Registered: ‎07-02-2020

Petalinux 2020 - Add Locales

My petalinux system currently only has "C" and "POSIX" locales but my applications require additional locales, including "en US.UTF-8"

How do I configure petalinux to add in these additional locales?

I've checked https://forums.xilinx.com/t5/Embedded-Linux/How-to-add-UTF-8-Locales-to-Petalinux-package/td-p/896088 but I'm not sure about it's relevancy anymore.

 

I've added the following to petalinuxbsp.conf without success:

GLIBC_GENERATE_LOCALES = "en_US.UTF-8"
IMAGE_LINGUAS = "en-us"

0 Kudos
8 Replies
jovitac
Moderator
Moderator
829 Views
Registered: ‎05-10-2017

  1. Create a project-spec/meta-user/recipes-core/images/petalinux-user-image.bbappend file. If recipes-core/images directory doesn't exist then create one manually.
  2. Include IMAGE_LINGUAS to petalinux-user-image.bbappend
    IMAGE_LINGUAS = "en-us"
  3. #Add to petalinuxbsp.conf
    GLIBC_GENERATE_LOCALES = "en_US.UTF-8"
    IMAGE_INSTALL_append = " glibc-utils localedef"
-------------------------------------------------------------------------
Don’t forget to reply, kudo, and accept as solution.
-------------------------------------------------------------------------
bfung_2
Adventurer
Adventurer
827 Views
Registered: ‎07-02-2020

Thanks @jovitac 

When implementing your suggested additions and then running petalinux-build, I get this:

WARNING: No recipes available for:
/project-spec/meta-user/recipes-core/images/petalinux-user-image.bbappend

I'm guessing I need to reference this .bbappend file in a build script somewhere?

0 Kudos
sandeepg
Moderator
Moderator
792 Views
Registered: ‎04-24-2017

Hi @bfung_2 ,

In 2020.x and later release, PetaLinux distro image recipe are aligned with Yocto(meta-petalinux layers). Hence you need to use petalinux-image-minimal.bbappend instead of petalinux-user-image.bbappend.

Thanks,
Sandeep
PetaLinux Yocto | Embedded SW Support

---------------------------------------------------------------------------
Don’t forget to Reply, Kudo, and Accept as Solution.
---------------------------------------------------------------------------
bfung_2
Adventurer
Adventurer
739 Views
Registered: ‎07-02-2020

Thanks @sandeepg .

Following @jovitac  I've created a /project/project-spec/meta-user/recipes-core/images/petalinux-image-minimal.bbappend, adding

IMAGE_LINGUAS = "en-us"

Then I add the following to /project/project-spec/meta-user/conf/petalinuxbsp.conf

GLIBC_GENERATE_LOCALES = "en_US.UTF-8"
IMAGE_INSTALL_append = " glibc-utils localedef "

Then I run a petalinux-build, package, and then boot up my system.

I still get only 2 locales (C, POSIX) when running locale -a .

Am I missing a step somewhere? Perhaps these variables are being overwritten somewhere?

0 Kudos
bfung_2
Adventurer
Adventurer
651 Views
Registered: ‎07-02-2020

I'm wondering if there are any updates for this issue?

0 Kudos
bfung_2
Adventurer
Adventurer
554 Views
Registered: ‎07-02-2020

I'm wondering if there are any updates for this issue?
0 Kudos
bfung_2
Adventurer
Adventurer
481 Views
Registered: ‎07-02-2020

Not exactly a solution to my problem (which I'm still curious about), but I've found a temporary workaround:

I downloaded the glibc source into the root FS and just compiled and installed the locales:

localedef --no-archive -i en_US -f UTF-8 en_US.utf8

Running "locale -a" I can confirm the newly installed locale is available.

0 Kudos
isaacjt
Contributor
Contributor
188 Views
Registered: ‎05-14-2018

It seems that in Petalinux v2020.1 you need to set the following variable in petalinux-image-minimal.bbappend:

IMAGE_LINGUAS_zynqmp = "en-us"

This variable is set in build/conf/plnxtool.conf to be empty, and this takes priority over IMAGE_LINGUAS.