Merge pull request #1459 from JonathonHall-Purism/hires_scale

Scale fbwhiptail and console font for high resolution displays
This commit is contained in:
tlaurion 2023-08-11 14:53:04 -04:00 committed by GitHub
commit 59972f3972
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
11 changed files with 74 additions and 3 deletions

View File

@ -518,6 +518,7 @@ bin_modules-$(CONFIG_BASH) += bash
bin_modules-$(CONFIG_POWERPC_UTILS) += powerpc-utils bin_modules-$(CONFIG_POWERPC_UTILS) += powerpc-utils
bin_modules-$(CONFIG_IO386) += io386 bin_modules-$(CONFIG_IO386) += io386
bin_modules-$(CONFIG_IOPORT) += ioport bin_modules-$(CONFIG_IOPORT) += ioport
bin_modules-$(CONFIG_KBD) += kbd
bin_modules-$(CONFIG_ZSTD) += zstd bin_modules-$(CONFIG_ZSTD) += zstd
$(foreach m, $(bin_modules-y), \ $(foreach m, $(bin_modules-y), \

View File

@ -11,6 +11,7 @@ CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y CONFIG_GPG2=y
CONFIG_KBD=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y CONFIG_LVM2=y

View File

@ -12,6 +12,7 @@ CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y CONFIG_GPG2=y
CONFIG_IOPORT=y CONFIG_IOPORT=y
CONFIG_KBD=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y CONFIG_LVM2=y

View File

@ -12,6 +12,7 @@ CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y CONFIG_GPG2=y
CONFIG_IOPORT=y CONFIG_IOPORT=y
CONFIG_KBD=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y CONFIG_LVM2=y

View File

@ -33,6 +33,7 @@ CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y CONFIG_GPG2=y
CONFIG_KBD=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y CONFIG_LVM2=y

View File

@ -33,6 +33,7 @@ CONFIG_CRYPTSETUP2=y
CONFIG_FLASHROM=y CONFIG_FLASHROM=y
CONFIG_FLASHTOOLS=y CONFIG_FLASHTOOLS=y
CONFIG_GPG2=y CONFIG_GPG2=y
CONFIG_KBD=y
CONFIG_KEXEC=y CONFIG_KEXEC=y
CONFIG_UTIL_LINUX=y CONFIG_UTIL_LINUX=y
CONFIG_LVM2=y CONFIG_LVM2=y

View File

@ -10,5 +10,5 @@ CONFIG_NO_GFX_INIT=y
CONFIG_TPM_MEASURED_BOOT=y CONFIG_TPM_MEASURED_BOOT=y
CONFIG_PAYLOAD_LINUX=y CONFIG_PAYLOAD_LINUX=y
CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage" CONFIG_PAYLOAD_FILE="@BOARD_BUILD_DIR@/bzImage"
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" CONFIG_LINUX_COMMAND_LINE="iommu=pt quiet loglevel=2 drm_kms_helper.drm_leak_fbdev_smem=1 i915.enable_fbc=0"
CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz" CONFIG_LINUX_INITRD="@BOARD_BUILD_DIR@/initrd.cpio.xz"

38
initrd/bin/setconsolefont.sh Executable file
View File

@ -0,0 +1,38 @@
#!/bin/bash
set -eo pipefail
. /etc/functions
TRACE "Under /bin/setconsolefont.sh"
# If the board ships setfont, and the console size is >=1600 lines tall,
# increase the console font size.
if [ ! -x /bin/setfont ]; then
DEBUG "Board does not ship setfont, not checking console font"
exit 0
fi
if [ ! -f /sys/class/graphics/fb0/virtual_size ]; then
DEBUG "fb0 virtual size is not known"
exit 0
fi
CONSOLE_HEIGHT="$(cut -d, -f2 /sys/class/graphics/fb0/virtual_size)"
# Deciding scale based on resolution is inherently heuristic, as the scale
# really depends on resolution, physical size, how close the display is to the
# user, and personal preference.
#
# fbwhiptail starts using 1.5x scale at 1350 lines, but we can only choose 1x
# or 2x (without shipping more fonts). Err toward making the console too large
# rather than too small and go to 2x at 1350 lines.
if [ "$CONSOLE_HEIGHT" -ge 1350 ]; then
DEBUG "Double console font size due to framebuffer height $CONSOLE_HEIGHT"
# Double the default font size by reading it out, then applying it again
# with setfont's -d option (double font size)
setfont -O /tmp/default_font
setfont -d /tmp/default_font
rm /tmp/default_font
else
DEBUG "Keep default console font size due to framebuffer height $CONSOLE_HEIGHT"
fi

View File

@ -153,6 +153,9 @@ if [ ! -z "$CONFIG_BOOT_DEV" ]; then
echo >> /etc/fstab "$CONFIG_BOOT_DEV /boot auto defaults,ro 0 0" echo >> /etc/fstab "$CONFIG_BOOT_DEV /boot auto defaults,ro 0 0"
fi fi
# Set the console font if needed
[ -x /bin/bash ] && setconsolefont.sh
if [ "$CONFIG_BASIC" = "y" ]; then if [ "$CONFIG_BASIC" = "y" ]; then
CONFIG_BOOTSCRIPT=/bin/gui-init-basic CONFIG_BOOTSCRIPT=/bin/gui-init-basic
export CONFIG_HOTPKEY=n export CONFIG_HOTPKEY=n

View File

@ -2,11 +2,11 @@ modules-$(CONFIG_FBWHIPTAIL) += fbwhiptail
fbwhiptail_depends := cairo $(musl_dep) fbwhiptail_depends := cairo $(musl_dep)
fbwhiptail_version := 99fe815fb35d7650873aa413a3024ef1496fe4a3 fbwhiptail_version := 1b3ee5ca1e297a977d9ebab49df942c51d619ecd
fbwhiptail_dir := fbwhiptail-$(fbwhiptail_version) fbwhiptail_dir := fbwhiptail-$(fbwhiptail_version)
fbwhiptail_tar := fbwhiptail-$(fbwhiptail_version).tar.gz fbwhiptail_tar := fbwhiptail-$(fbwhiptail_version).tar.gz
fbwhiptail_url := https://source.puri.sm/firmware/fbwhiptail/-/archive/$(fbwhiptail_version)/fbwhiptail-$(fbwhiptail_version).tar.gz fbwhiptail_url := https://source.puri.sm/firmware/fbwhiptail/-/archive/$(fbwhiptail_version)/fbwhiptail-$(fbwhiptail_version).tar.gz
fbwhiptail_hash := bd210b52b0916eb081219a312a6fa1b3acd8582ca6198a196e232f8aa55bbce9 fbwhiptail_hash := f7691a82dac3aca6592ca85cbd7ec116bd7c2eae5b834f95c76967532c9aec79
fbwhiptail_target := \ fbwhiptail_target := \
$(MAKE_JOBS) \ $(MAKE_JOBS) \

24
modules/kbd Normal file
View File

@ -0,0 +1,24 @@
modules-$(CONFIG_KBD) += kbd
kbd_version := 2.6.1
kbd_dir := kbd-$(kbd_version)
kbd_tar := kbd-$(kbd_version).tar.gz
kbd_url := https://www.kernel.org/pub/linux/utils/kbd/$(kbd_tar)
kbd_hash := aaed530a1490d63d041448372e2ad4f38c3179042903251000b71d527c46e945
kbd_configure := CFLAGS=-Os ./configure \
$(CROSS_TOOLS) \
--prefix "" \
--host i386-elf-linux \
--disable-optional-progs \
--disable-libkeymap \
--disable-libkfont \
--disable-vlock \
kbd_target := \
$(MAKE_JOBS) $(CROSS_TOOLS)
kbd_output := \
src/setfont
kbd_depends := $(musl_dep)