Skip to content

Commit 59972f3

Browse files
authored
Merge pull request #1459 from JonathonHall-Purism/hires_scale
Scale fbwhiptail and console font for high resolution displays
2 parents f42070a + 98fc0cb commit 59972f3

File tree

11 files changed

+74
-3
lines changed

11 files changed

+74
-3
lines changed

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -518,6 +518,7 @@ bin_modules-$(CONFIG_BASH) += bash
518518
bin_modules-$(CONFIG_POWERPC_UTILS) += powerpc-utils
519519
bin_modules-$(CONFIG_IO386) += io386
520520
bin_modules-$(CONFIG_IOPORT) += ioport
521+
bin_modules-$(CONFIG_KBD) += kbd
521522
bin_modules-$(CONFIG_ZSTD) += zstd
522523

523524
$(foreach m, $(bin_modules-y), \

boards/librem_15v4/librem_15v4.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ CONFIG_CRYPTSETUP2=y
1111
CONFIG_FLASHROM=y
1212
CONFIG_FLASHTOOLS=y
1313
CONFIG_GPG2=y
14+
CONFIG_KBD=y
1415
CONFIG_KEXEC=y
1516
CONFIG_UTIL_LINUX=y
1617
CONFIG_LVM2=y

boards/librem_mini/librem_mini.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CONFIG_FLASHROM=y
1212
CONFIG_FLASHTOOLS=y
1313
CONFIG_GPG2=y
1414
CONFIG_IOPORT=y
15+
CONFIG_KBD=y
1516
CONFIG_KEXEC=y
1617
CONFIG_UTIL_LINUX=y
1718
CONFIG_LVM2=y

boards/librem_mini_v2/librem_mini_v2.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ CONFIG_FLASHROM=y
1212
CONFIG_FLASHTOOLS=y
1313
CONFIG_GPG2=y
1414
CONFIG_IOPORT=y
15+
CONFIG_KBD=y
1516
CONFIG_KEXEC=y
1617
CONFIG_UTIL_LINUX=y
1718
CONFIG_LVM2=y

boards/x230-hotp-maximized-fhd_edp/x230-hotp-maximized-fhd_edp.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONFIG_CRYPTSETUP2=y
3333
CONFIG_FLASHROM=y
3434
CONFIG_FLASHTOOLS=y
3535
CONFIG_GPG2=y
36+
CONFIG_KBD=y
3637
CONFIG_KEXEC=y
3738
CONFIG_UTIL_LINUX=y
3839
CONFIG_LVM2=y

boards/x230-maximized-fhd_edp/x230-maximized-fhd_edp.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ CONFIG_CRYPTSETUP2=y
3333
CONFIG_FLASHROM=y
3434
CONFIG_FLASHTOOLS=y
3535
CONFIG_GPG2=y
36+
CONFIG_KBD=y
3637
CONFIG_KEXEC=y
3738
CONFIG_UTIL_LINUX=y
3839
CONFIG_LVM2=y

config/coreboot-librem_15v4.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ CONFIG_NO_GFX_INIT=y
1010
CONFIG_TPM_MEASURED_BOOT=y
1111
CONFIG_PAYLOAD_LINUX=y
1212
CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage"
13-
CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 video=eDP-1:1920x1080 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0"
13+
CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0"
1414
CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz"

initrd/bin/setconsolefont.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/bin/bash
2+
3+
set -eo pipefail
4+
. /etc/functions
5+
6+
TRACE "Under /bin/setconsolefont.sh"
7+
8+
# If the board ships setfont, and the console size is >=1600 lines tall,
9+
# increase the console font size.
10+
if [ ! -x /bin/setfont ]; then
11+
DEBUG "Board does not ship setfont, not checking console font"
12+
exit 0
13+
fi
14+
15+
if [ ! -f /sys/class/graphics/fb0/virtual_size ]; then
16+
DEBUG "fb0 virtual size is not known"
17+
exit 0
18+
fi
19+
20+
CONSOLE_HEIGHT="$(cut -d, -f2 /sys/class/graphics/fb0/virtual_size)"
21+
22+
# Deciding scale based on resolution is inherently heuristic, as the scale
23+
# really depends on resolution, physical size, how close the display is to the
24+
# user, and personal preference.
25+
#
26+
# fbwhiptail starts using 1.5x scale at 1350 lines, but we can only choose 1x
27+
# or 2x (without shipping more fonts). Err toward making the console too large
28+
# rather than too small and go to 2x at 1350 lines.
29+
if [ "$CONSOLE_HEIGHT" -ge 1350 ]; then
30+
DEBUG "Double console font size due to framebuffer height $CONSOLE_HEIGHT"
31+
# Double the default font size by reading it out, then applying it again
32+
# with setfont's -d option (double font size)
33+
setfont -O /tmp/default_font
34+
setfont -d /tmp/default_font
35+
rm /tmp/default_font
36+
else
37+
DEBUG "Keep default console font size due to framebuffer height $CONSOLE_HEIGHT"
38+
fi

initrd/init

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ if [ ! -z "$CONFIG_BOOT_DEV" ]; then
153153
echo >> /etc/fstab "$CONFIG_BOOT_DEV /boot auto defaults,ro 0 0"
154154
fi
155155

156+
# Set the console font if needed
157+
[ -x /bin/bash ] && setconsolefont.sh
158+
156159
if [ "$CONFIG_BASIC" = "y" ]; then
157160
CONFIG_BOOTSCRIPT=/bin/gui-init-basic
158161
export CONFIG_HOTPKEY=n

modules/fbwhiptail

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@ modules-$(CONFIG_FBWHIPTAIL) += fbwhiptail
22

33
fbwhiptail_depends := cairo $(musl_dep)
44

5-
fbwhiptail_version := 99fe815fb35d7650873aa413a3024ef1496fe4a3
5+
fbwhiptail_version := 1b3ee5ca1e297a977d9ebab49df942c51d619ecd
66
fbwhiptail_dir := fbwhiptail-$(fbwhiptail_version)
77
fbwhiptail_tar := fbwhiptail-$(fbwhiptail_version).tar.gz
88
fbwhiptail_url := https://source.puri.sm/firmware/fbwhiptail/-/archive/$(fbwhiptail_version)/fbwhiptail-$(fbwhiptail_version).tar.gz
9-
fbwhiptail_hash := bd210b52b0916eb081219a312a6fa1b3acd8582ca6198a196e232f8aa55bbce9
9+
fbwhiptail_hash := f7691a82dac3aca6592ca85cbd7ec116bd7c2eae5b834f95c76967532c9aec79
1010

1111
fbwhiptail_target := \
1212
$(MAKE_JOBS) \

0 commit comments

Comments
 (0)