From: Reza Arbab <arbab@linux.ibm.com>
To: buildroot@buildroot.org
Cc: Laurent Vivier <laurent@vivier.eu>, Joel Stanley <joel@jms.id.au>
Subject: [Buildroot] [PATCH v3 8/8] package/petitboot: prefer UTF-8 support
Date: Mon, 9 Oct 2023 10:17:29 -0500 [thread overview]
Message-ID: <20231009151729.2223963-9-arbab@linux.ibm.com> (raw)
In-Reply-To: <20231009151729.2223963-1-arbab@linux.ibm.com>
The petitboot UI looks much nicer in a Unicode locale:
* Items in the language selection submenu use multibyte Unicode
characters. In other locales, they say "Unable to display text in this
locale".
* The combination of TERM=linux with a UTF-8 locale is required to
trigger a special-case workaround in ncurses code[1]. Without
this, line-drawing characters in the menu look like q's.
Add a reminder that a UTF-8 locale should be generated for things to
look right. Assume C.UTF-8 by default, allowing $LANG to be overridden
(by /etc/default/petitboot or otherwise) if something else is desired.
[1] https://invisible-island.net/ncurses/ncurses.faq.html#no_line_drawing
Signed-off-by: Reza Arbab <arbab@linux.ibm.com>
---
package/petitboot/Config.in | 8 ++++++--
package/petitboot/S15pb-discover | 1 +
package/petitboot/pb-console | 1 +
package/petitboot/shell_profile | 3 +++
4 files changed, 11 insertions(+), 2 deletions(-)
diff --git a/package/petitboot/Config.in b/package/petitboot/Config.in
index 0f965e71e628..a449ed87872c 100644
--- a/package/petitboot/Config.in
+++ b/package/petitboot/Config.in
@@ -4,6 +4,7 @@ config BR2_PACKAGE_PETITBOOT
depends on BR2_PACKAGE_KEXEC_ARCH_SUPPORTS
depends on BR2_USE_MMU # lvm2
depends on BR2_USE_WCHAR # elfutils
+ depends on BR2_ENABLE_LOCALE
depends on !BR2_STATIC_LIBS # elfutils, lvm2
depends on BR2_TOOLCHAIN_HAS_THREADS # elfutils, lvm2
depends on BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC # elfutils
@@ -11,6 +12,7 @@ config BR2_PACKAGE_PETITBOOT
select BR2_PACKAGE_ELFUTILS
select BR2_PACKAGE_LVM2 # devmapper
select BR2_PACKAGE_NCURSES
+ select BR2_PACKAGE_NCURSES_WCHAR
# run-time dependencies
select BR2_PACKAGE_KEXEC if !BR2_PACKAGE_KEXEC_LITE
select BR2_PACKAGE_KEXEC_LITE if ( BR2_powerpc || BR2_powerpc64 || BR2_powerpc64le )
@@ -20,12 +22,14 @@ config BR2_PACKAGE_PETITBOOT
help
Petitboot is a small kexec-based bootloader
+ NOTE: petitboot needs a working UTF-8 locale (BR2_GENERATE_LOCALE)
+
http://www.kernel.org/pub/linux/kernel/people/geoff/petitboot/petitboot.html
-comment "petitboot needs a uClibc or glibc toolchain w/ wchar, dynamic library, threads, udev /dev management"
+comment "petitboot needs a uClibc or glibc toolchain w/ wchar, locale, dynamic library, threads, udev /dev management"
depends on BR2_PACKAGE_KEXEC_ARCH_SUPPORTS
depends on BR2_USE_MMU
- depends on !BR2_USE_WCHAR || BR2_STATIC_LIBS || \
+ depends on !BR2_USE_WCHAR || !BR2_ENABLE_LOCALE || BR2_STATIC_LIBS || \
!BR2_TOOLCHAIN_HAS_THREADS || \
!(BR2_TOOLCHAIN_USES_UCLIBC || BR2_TOOLCHAIN_USES_GLIBC) || \
!BR2_PACKAGE_HAS_UDEV
diff --git a/package/petitboot/S15pb-discover b/package/petitboot/S15pb-discover
index a37e33521f1a..15b428ce0e42 100644
--- a/package/petitboot/S15pb-discover
+++ b/package/petitboot/S15pb-discover
@@ -15,6 +15,7 @@ start() {
# shellcheck disable=SC2174 # only apply -m to deepest dir
mkdir -p -m 0775 /var/log/petitboot
chown root:petitgroup /var/log/petitboot
+ export LANG="${LANG:-C.UTF-8}"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -S -q -b -m -p "$PIDFILE" -x "/usr/sbin/$DAEMON" \
diff --git a/package/petitboot/pb-console b/package/petitboot/pb-console
index eea40163d02f..55e5462f0457 100644
--- a/package/petitboot/pb-console
+++ b/package/petitboot/pb-console
@@ -13,6 +13,7 @@ start() {
# shellcheck disable=SC2174 # only apply -m to deepest dir
mkdir -p -m 0775 /var/log/petitboot
chown root:petitgroup /var/log/petitboot
+ export LANG="${LANG:-C.UTF-8}"
# shellcheck disable=SC2086 # we need the word splitting
start-stop-daemon -S -q -x "/usr/libexec/petitboot/$DAEMON" \
diff --git a/package/petitboot/shell_profile b/package/petitboot/shell_profile
index 1ca5e6364dba..6bbe49e6d113 100644
--- a/package/petitboot/shell_profile
+++ b/package/petitboot/shell_profile
@@ -1,2 +1,5 @@
+[ -r "/etc/default/petitboot" ] && . "/etc/default/petitboot"
export ENV="/home/petituser/.shrc"
+export LANG="${LANG:-C.UTF-8}"
+
exec /usr/libexec/petitboot/pb-console
--
2.39.3
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2023-10-09 15:20 UTC|newest]
Thread overview: 23+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-09 15:17 [Buildroot] [PATCH v3 0/8] package/petitboot: misc fixes/enhancement Reza Arbab
2023-10-09 15:17 ` [Buildroot] [PATCH v3 1/8] package/petitboot: fix menu comment Reza Arbab
2023-11-09 16:59 ` Peter Korsgaard
2023-10-09 15:17 ` [Buildroot] [PATCH v3 2/8] package/petitboot: fix pb-discover pidfile creation Reza Arbab
2023-10-09 15:17 ` [Buildroot] [PATCH v3 3/8] package/petitboot: use default logfile dir Reza Arbab
2023-11-09 16:59 ` Peter Korsgaard
2023-10-09 15:17 ` [Buildroot] [PATCH v3 4/8] package/petitboot: prefer kexec-lite on powerpc Reza Arbab
2023-11-05 17:40 ` Arnout Vandecappelle via buildroot
2023-10-09 15:17 ` [Buildroot] [PATCH v3 5/8] package/petitboot: fix shutdown Reza Arbab
2023-11-05 17:57 ` Arnout Vandecappelle via buildroot
2023-11-09 16:13 ` Reza Arbab
2023-10-09 15:17 ` [Buildroot] [PATCH v3 6/8] package/petitboot: run petitboot UI on consoles Reza Arbab
2023-11-05 18:06 ` Arnout Vandecappelle via buildroot
2023-10-09 15:17 ` [Buildroot] [PATCH v3 7/8] package/petitboot: enable user separation Reza Arbab
2023-11-05 18:26 ` Arnout Vandecappelle via buildroot
2023-11-09 16:16 ` Reza Arbab
2023-11-10 9:01 ` Arnout Vandecappelle via buildroot
2023-11-14 15:25 ` Reza Arbab
2023-10-09 15:17 ` Reza Arbab [this message]
2023-11-05 18:30 ` [Buildroot] [PATCH v3 8/8] package/petitboot: prefer UTF-8 support Arnout Vandecappelle via buildroot
2023-11-09 16:17 ` Reza Arbab
2023-11-05 18:31 ` [Buildroot] [PATCH v3 0/8] package/petitboot: misc fixes/enhancement Arnout Vandecappelle via buildroot
2023-11-09 16:19 ` Reza Arbab
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=20231009151729.2223963-9-arbab@linux.ibm.com \
--to=arbab@linux.ibm.com \
--cc=buildroot@buildroot.org \
--cc=joel@jms.id.au \
--cc=laurent@vivier.eu \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.