public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [PATCH] rootfs: use LOCALE_DEFAULT with default "C" for locale exports
@ 2025-09-10  9:22 'Badrikesh Prusty' via isar-users
  0 siblings, 0 replies; only message in thread
From: 'Badrikesh Prusty' via isar-users @ 2025-09-10  9:22 UTC (permalink / raw)
  To: isar-users; +Cc: Badrikesh Prusty

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.

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2025-09-10  9:23 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-09-10  9:22 [PATCH] rootfs: use LOCALE_DEFAULT with default "C" for locale exports 'Badrikesh Prusty' via isar-users

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox