From: "'Badrikesh Prusty' via isar-users" <isar-users@googlegroups.com>
To: isar-users@googlegroups.com
Cc: Badrikesh Prusty <badrikesh.prusty@siemens.com>
Subject: [PATCH] rootfs: use LOCALE_DEFAULT with default "C" for locale exports
Date: Wed, 10 Sep 2025 05:22:50 -0400 [thread overview]
Message-ID: <20250910092250.179144-1-badrikesh.prusty@siemens.com> (raw)
Some packages, such as console-setup, fail to set a valid CHARMAP according
to the locale. For example, image-locales-extension.bbclass sets the default
locale to "en_US.UTF-8".
However, rootfs.bbclass was exporting hardcoded locale values as "C".
Because of this, when console-setup is installed in non-interactive mode
during image creation, it sets the CHARMAP based on the "C" locale, causing
a configuration mismatch.
Set LOCALE_DEFAULT to "C" by default in rootfs.bbclass so it can be overridden
by image-locales-extension.bbclass with "en_US.UTF-8", enabling proper CHARMAP
setup in console-setup.
Signed-off-by: Badrikesh Prusty <badrikesh.prusty@siemens.com>
---
RECIPE-API-CHANGELOG.md | 20 ++++++++++++++++++++
meta/classes/rootfs.bbclass | 7 ++++---
2 files changed, 24 insertions(+), 3 deletions(-)
diff --git a/RECIPE-API-CHANGELOG.md b/RECIPE-API-CHANGELOG.md
index 8468717d..c6b5a997 100644
--- a/RECIPE-API-CHANGELOG.md
+++ b/RECIPE-API-CHANGELOG.md
@@ -727,3 +727,23 @@ Changes in next
This was never documented and never had practical relevance. `oci-archive` is
the useful OCI image format that can be imported, e.g., by podman.
+
+### Configure Locale Exports Using LOCALE_DEFAULT
+
+The LOCALE_DEFAULT variable is now used to export LANG, LANGUAGE, and LC_ALL
+in the rootfs.bbclass, replacing the previous hardcoded "C" values. It is
+weakly assigned a default value of "C". This value can be overridden by image
+recipes via the image-locales-extension class (inherited by the image class),
+for example, to set it to "en_US.UTF-8".
+
+This enables configuring the default locale and keyboard layout at build time.
+Additionally, if console-setup is installed in the rootfs during the build, it
+will be configured based on the locale exports.
+
+To set a locale other than "C" or "en_US.UTF-8" (generated by default), define
+the following variables in your image recipe. For example, to use German, add:
+
+```
+LOCALE_GEN = "de_DE.UTF-8 UTF-8\n"
+LOCALE_DEFAULT = "de_DE.UTF-8"
+```
diff --git a/meta/classes/rootfs.bbclass b/meta/classes/rootfs.bbclass
index 7b7859b9..9eb09012 100644
--- a/meta/classes/rootfs.bbclass
+++ b/meta/classes/rootfs.bbclass
@@ -30,9 +30,10 @@ ROOTFS_STUBS_DIR = "/usr/local/isar-sbin"
export E = "${@ isar_export_proxies(d)}"
export DEBIAN_FRONTEND = "noninteractive"
# To avoid Perl locale warnings:
-export LANG = "C"
-export LANGUAGE = "C"
-export LC_ALL = "C"
+LOCALE_DEFAULT ??= "C"
+export LANG = "${LOCALE_DEFAULT}"
+export LANGUAGE = "${LOCALE_DEFAULT}"
+export LC_ALL = "${LOCALE_DEFAULT}"
rootfs_do_mounts[weight] = "3"
rootfs_do_mounts() {
--
2.39.5
--
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion visit https://groups.google.com/d/msgid/isar-users/20250910092250.179144-1-badrikesh.prusty%40siemens.com.
reply other threads:[~2025-09-10 9:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250910092250.179144-1-badrikesh.prusty@siemens.com \
--to=isar-users@googlegroups.com \
--cc=badrikesh.prusty@siemens.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox