From 402e7752b8a92e933c0486e43967aa1f5a9fb3a2 Mon Sep 17 00:00:00 2001 From: procount Date: Thu, 5 Nov 2020 22:55:23 +0000 Subject: [PATCH 1/5] Added auto HDMI switching Tidy up profile --- buildroot/.config | 1 + buildroot/package/Config.in | 1 + buildroot/package/con2fbmap/Config.in | 7 +++ buildroot/package/con2fbmap/con2fbmap.mk | 25 +++++++++ buildroot/package/recovery/init | 24 +++++++++ buildroot/package/recovery/profile | 2 + buildroot/package/recovery/recovery.mk | 2 + buildroot/package/rpi-firmware/config.txt | 1 + con2fbmap/Makefile | 10 ++++ con2fbmap/con2fbmap.1 | 29 ++++++++++ con2fbmap/con2fbmap.c | 66 +++++++++++++++++++++++ 11 files changed, 168 insertions(+) create mode 100644 buildroot/package/con2fbmap/Config.in create mode 100644 buildroot/package/con2fbmap/con2fbmap.mk create mode 100644 buildroot/package/recovery/profile create mode 100644 con2fbmap/Makefile create mode 100644 con2fbmap/con2fbmap.1 create mode 100644 con2fbmap/con2fbmap.c diff --git a/buildroot/.config b/buildroot/.config index c531629a..242a870e 100644 --- a/buildroot/.config +++ b/buildroot/.config @@ -343,6 +343,7 @@ BR2_PACKAGE_P7ZIP=y BR2_PACKAGE_PARTCLONE=y BR2_PACKAGE_RECOVERY=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y +BR2_PACKAGE_CON2FBMAP=y # # Audio and video applications diff --git a/buildroot/package/Config.in b/buildroot/package/Config.in index 71e4dd53..aafc28fa 100644 --- a/buildroot/package/Config.in +++ b/buildroot/package/Config.in @@ -6,6 +6,7 @@ menu "Target packages" source "package/partclone/Config.in" source "package/recovery/Config.in" source "package/rpi-wifi-firmware/Config.in" + source "package/con2fbmap/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in" diff --git a/buildroot/package/con2fbmap/Config.in b/buildroot/package/con2fbmap/Config.in new file mode 100644 index 00000000..7bec3838 --- /dev/null +++ b/buildroot/package/con2fbmap/Config.in @@ -0,0 +1,7 @@ +config BR2_PACKAGE_CON2FBMAP + bool "con2fbmap" + ### build dependencies + ### runtime dependencies + help + Change tty console to a different framebuffer device /dev/fbX + diff --git a/buildroot/package/con2fbmap/con2fbmap.mk b/buildroot/package/con2fbmap/con2fbmap.mk new file mode 100644 index 00000000..64818cb9 --- /dev/null +++ b/buildroot/package/con2fbmap/con2fbmap.mk @@ -0,0 +1,25 @@ +############################################################# +# +# con2fbmap system +# +############################################################# + + +CON2FBMAP_VERSION = 1.0 +CON2FBMAP_SITE = $(TOPDIR)/../con2fbmap +CON2FBMAP_SITE_METHOD = local +CON2FBMAP_LICENSE = BSD-3c +CON2FBMAP_LICENSE_FILES = LICENSE.txt +CON2FBMAP_INSTALL_STAGING = NO + +define CON2FBMAP_BUILD_CMDS + cd $(@D) + $(MAKE) -C $(@D) all + $(TARGET_STRIP) $(@D)/con2fbmap +endef + +define CON2FBMAP_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 $(@D)/con2fbmap $(TARGET_DIR)/usr/bin/con2fbmap +endef + +$(eval $(generic-package)) diff --git a/buildroot/package/recovery/init b/buildroot/package/recovery/init index 88032861..bc73cd4a 100755 --- a/buildroot/package/recovery/init +++ b/buildroot/package/recovery/init @@ -33,6 +33,30 @@ echo 2 >/sys/module/vt/parameters/cur_default # Enable syslog /etc/init.d/S01logging start > /dev/null +present=`tvservice -l | sed -n -e 's|^Display Number \(.*\),.*$|\1| p'` +for dev in $present; do + fitted=`tvservice -n -v $dev 2>/dev/null` + if [[ "$fitted" != "" ]]; then + case $dev in + 0) #7in Touchscreen + export QWS_DISPLAY="LinuxFb:/dev/fb0" + break; + ;; + 2) #normal HDMI0 + export QWS_DISPLAY="LinuxFb:/dev/fb0" + break; + ;; + 7) #Secondary HDMI1 + export QWS_DISPLAY="LinuxFb:/dev/fb1" + /usr/bin/con2fbmap 2 1 + /usr/bin/con2fbmap 3 1 + break; + ;; + esac + fi +done + + if grep -q vncinstall /proc/cmdline; then # VNC server mode. Mainly useful for making screenshots export QWS_DISPLAY="VNC:size=800x600:depth=32:0" diff --git a/buildroot/package/recovery/profile b/buildroot/package/recovery/profile new file mode 100644 index 00000000..c47e2658 --- /dev/null +++ b/buildroot/package/recovery/profile @@ -0,0 +1,2 @@ +export PS1="\u@\h:\w# " + diff --git a/buildroot/package/recovery/recovery.mk b/buildroot/package/recovery/recovery.mk index d27ab000..3114ef48 100644 --- a/buildroot/package/recovery/recovery.mk +++ b/buildroot/package/recovery/recovery.mk @@ -33,6 +33,8 @@ define RECOVERY_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 package/recovery/unicode-fonts/NanumBarunGothicBold.ttf $(TARGET_DIR)/usr/lib/fonts/NanumBarunGothicBold.ttf $(INSTALL) -m 0755 package/recovery/data/data $(TARGET_DIR)/usr/data $(INSTALL) -m 0644 $(@D)/cmdline.txt $(BINARIES_DIR)/cmdline.txt + $(INSTALL) -m 0755 package/recovery/profile $(TARGET_DIR)/root/.profile + mkdir -p $(TARGET_DIR)/keymaps/ $(INSTALL) -m 0755 package/recovery/keymaps/* $(TARGET_DIR)/keymaps/ $(INSTALL) -m 0644 package/recovery/wpa_supplicant.conf $(TARGET_DIR)/etc/wpa_supplicant.conf diff --git a/buildroot/package/rpi-firmware/config.txt b/buildroot/package/rpi-firmware/config.txt index 1fc7335d..dbada745 100644 --- a/buildroot/package/rpi-firmware/config.txt +++ b/buildroot/package/rpi-firmware/config.txt @@ -5,3 +5,4 @@ fixup_file=fixup_rc.dat [pi4] start_file=recover4.elf fixup_file=fixup4rc.dat +max_framebuffers=2 diff --git a/con2fbmap/Makefile b/con2fbmap/Makefile new file mode 100644 index 00000000..eba94fe0 --- /dev/null +++ b/con2fbmap/Makefile @@ -0,0 +1,10 @@ +CC=$(PWD)/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc + +all: con2fbmap + $(MAKE) $(AM_MAKEFLAGS) con2fbmap + +con2fbmap: con2fbmap.c + $(CC) -static con2fbmap.c -o con2fbmap + + + diff --git a/con2fbmap/con2fbmap.1 b/con2fbmap/con2fbmap.1 new file mode 100644 index 00000000..e0b94169 --- /dev/null +++ b/con2fbmap/con2fbmap.1 @@ -0,0 +1,29 @@ +.TH con2fbmap 1 2006-01-18 2.1 "Linux frame buffer utils" +.SH NAME +con2fbmap \- shows and sets mapping between consoles and framebuffer devices. +.SH SYNOPSIS +.B con2fbmap +.RI console +.RI [ framebuffer ] +.SH DESCRIPTION +.B This documentation is not finished +.PP +.B con2fbmap +is a system utility to show or change the mapping of the consoles to the +frame buffer device. The frame buffer device provides a simple and unique +interface to access different kinds of graphic displays. +.PP +Frame buffer devices are accessed via special device nodes located in the +/dev directory. The naming scheme for these nodes is always +.IR \fBfb < n >, +where +.I n +is the number of the used frame buffer device. +.PP +.SH OPTIONS +The first option must be there, and identify the console on which to work. +If the second option is not set, con2fbmap shows the current mapping of +identified console. If the second argument is given (as a number) con2fbmap +maps the identified console to said framebuffer device. +.TP +Sven LUTHER diff --git a/con2fbmap/con2fbmap.c b/con2fbmap/con2fbmap.c new file mode 100644 index 00000000..4d2c908b --- /dev/null +++ b/con2fbmap/con2fbmap.c @@ -0,0 +1,66 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#define DEFAULT_FRAMEBUFFER "/dev/fb0" +#define DEFAULT_FRAMEBUFFER_DEVFS "/dev/fb/0" + +const char *programname; + +void Usage(void) +{ + fprintf(stderr, "\nUsage: %s console [framebuffer]\n\n", programname); + exit(1); +} + +int main(int argc, char *argv[]) +{ + int do_write = 0; + char *fbpath; /* any frame buffer will do */ + int fd; + struct fb_con2fbmap map; + + programname = argv[0]; + switch (argc) { + case 3: + do_write = 1; + map.framebuffer = atoi(argv[2]); + case 2: + map.console = atoi(argv[1]); + break; + default: + Usage(); + } + + if (access("/dev/.devfsd", F_OK) == 0) /* devfs detected */ + fbpath = DEFAULT_FRAMEBUFFER_DEVFS; + else + fbpath = DEFAULT_FRAMEBUFFER; + + if ((fd = open(fbpath, O_RDONLY)) == -1) { + fprintf(stderr, "open %s: %s\n", fbpath, strerror(errno)); + exit(1); + } + if (do_write) { + if (ioctl(fd, FBIOPUT_CON2FBMAP, &map)) { + fprintf(stderr, "ioctl FBIOPUT_CON2FBMAP: %s\n", strerror(errno)); + exit(1); + } + } else { + if (ioctl(fd, FBIOGET_CON2FBMAP, &map)) { + fprintf(stderr, "ioctl FBIOGET_CON2FBMAP: %s\n", strerror(errno)); + exit(1); + } + printf("console %d is mapped to framebuffer %d\n", map.console, + map.framebuffer); + } + close(fd); + exit(0); +} From a61ed6c8f5969f1ed7b411f6b9b6548181007bc9 Mon Sep 17 00:00:00 2001 From: procount Date: Tue, 10 Nov 2020 16:21:11 +0000 Subject: [PATCH 2/5] Update con2fmap license & attributions Remove PS1 --- buildroot/package/con2fbmap/con2fbmap.mk | 6 ++-- buildroot/package/recovery/profile | 2 -- buildroot/package/recovery/recovery.mk | 1 - con2fbmap/copyright | 44 ++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 6 deletions(-) delete mode 100644 buildroot/package/recovery/profile create mode 100644 con2fbmap/copyright diff --git a/buildroot/package/con2fbmap/con2fbmap.mk b/buildroot/package/con2fbmap/con2fbmap.mk index 64818cb9..74cf523f 100644 --- a/buildroot/package/con2fbmap/con2fbmap.mk +++ b/buildroot/package/con2fbmap/con2fbmap.mk @@ -5,11 +5,11 @@ ############################################################# -CON2FBMAP_VERSION = 1.0 +CON2FBMAP_VERSION = 2.1 CON2FBMAP_SITE = $(TOPDIR)/../con2fbmap CON2FBMAP_SITE_METHOD = local -CON2FBMAP_LICENSE = BSD-3c -CON2FBMAP_LICENSE_FILES = LICENSE.txt +CON2FBMAP_LICENSE = GPL-2 +CON2FBMAP_LICENSE_FILES = copyright CON2FBMAP_INSTALL_STAGING = NO define CON2FBMAP_BUILD_CMDS diff --git a/buildroot/package/recovery/profile b/buildroot/package/recovery/profile deleted file mode 100644 index c47e2658..00000000 --- a/buildroot/package/recovery/profile +++ /dev/null @@ -1,2 +0,0 @@ -export PS1="\u@\h:\w# " - diff --git a/buildroot/package/recovery/recovery.mk b/buildroot/package/recovery/recovery.mk index 3114ef48..1f083c67 100644 --- a/buildroot/package/recovery/recovery.mk +++ b/buildroot/package/recovery/recovery.mk @@ -33,7 +33,6 @@ define RECOVERY_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 package/recovery/unicode-fonts/NanumBarunGothicBold.ttf $(TARGET_DIR)/usr/lib/fonts/NanumBarunGothicBold.ttf $(INSTALL) -m 0755 package/recovery/data/data $(TARGET_DIR)/usr/data $(INSTALL) -m 0644 $(@D)/cmdline.txt $(BINARIES_DIR)/cmdline.txt - $(INSTALL) -m 0755 package/recovery/profile $(TARGET_DIR)/root/.profile mkdir -p $(TARGET_DIR)/keymaps/ $(INSTALL) -m 0755 package/recovery/keymaps/* $(TARGET_DIR)/keymaps/ diff --git a/con2fbmap/copyright b/con2fbmap/copyright new file mode 100644 index 00000000..d2f82daf --- /dev/null +++ b/con2fbmap/copyright @@ -0,0 +1,44 @@ +The upstream source was downloaded from: + + as a patch <03_con2fbmap.patch> to fbset. + +Copyright Holder of fbset: + + Copyright © 1995-1998 Geert Uytterhoeven + +License: + + This file is subject to the terms and conditions of the GNU General Public + License. See the file COPYING in the main directory of the Linux + distribution for more details. + +--------------- Clarification ---------------------------------------- + +From Geert.Uytterhoeven@sonycom.com Tue Jan 21 19:59:02 2003 +Date: Tue, 21 Jan 2003 17:06:11 +0100 (MET) +From: Geert Uytterhoeven +Sender: geert@sonycom.com +To: Guillem Jover +Subject: Re: fbset: GPL version +In-Reply-To: <20030120063657.GA6650@zulo.hadrons.org> +Message-ID: + + Hi Guillem, + +> I'm the new Debian maintainer for fbset. A Debian user has filed a bug +> reporting that the sources doesn't specify the GPL version. So could +> you be so kind to tell me what version they obey? + +The source files refer to `the file COPYING in the main directory of the Linux +distribution', so that must be the GNU General Public License Version 2. + +--------------- Clarification ---------------------------------------- + +On Debian GNU/Linux systems, the complete text of the GNU General +Public License can be found in '/usr/share/common-licenses/GPL-2'. + +--------------- Con2fbmap -------------------------------------------- + +Con2fbmap had no specific copyright, therefore I assume it falls under +fbset's GPLv2 copyright and is attributed as such to Sven Luther. + From cdd3d6b18bcd3b4e21cde81cc4877a3801af9f43 Mon Sep 17 00:00:00 2001 From: procount Date: Tue, 10 Nov 2020 23:52:05 +0000 Subject: [PATCH 3/5] improve build for con2fbamp --- buildroot/package/con2fbmap/con2fbmap.mk | 4 +--- con2fbmap/Makefile | 9 +-------- 2 files changed, 2 insertions(+), 11 deletions(-) diff --git a/buildroot/package/con2fbmap/con2fbmap.mk b/buildroot/package/con2fbmap/con2fbmap.mk index 74cf523f..8591728a 100644 --- a/buildroot/package/con2fbmap/con2fbmap.mk +++ b/buildroot/package/con2fbmap/con2fbmap.mk @@ -4,7 +4,6 @@ # ############################################################# - CON2FBMAP_VERSION = 2.1 CON2FBMAP_SITE = $(TOPDIR)/../con2fbmap CON2FBMAP_SITE_METHOD = local @@ -13,8 +12,7 @@ CON2FBMAP_LICENSE_FILES = copyright CON2FBMAP_INSTALL_STAGING = NO define CON2FBMAP_BUILD_CMDS - cd $(@D) - $(MAKE) -C $(@D) all + $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) $(TARGET_STRIP) $(@D)/con2fbmap endef diff --git a/con2fbmap/Makefile b/con2fbmap/Makefile index eba94fe0..1ee19402 100644 --- a/con2fbmap/Makefile +++ b/con2fbmap/Makefile @@ -1,10 +1,3 @@ -CC=$(PWD)/output/host/usr/bin/arm-buildroot-linux-uclibcgnueabi-gcc - -all: con2fbmap - $(MAKE) $(AM_MAKEFLAGS) con2fbmap - con2fbmap: con2fbmap.c - $(CC) -static con2fbmap.c -o con2fbmap - - + $(CC) con2fbmap.c -o con2fbmap From 66376e3a0f3570fc79bf4c65d1a28949c09cc3b5 Mon Sep 17 00:00:00 2001 From: procount Date: Wed, 11 Nov 2020 09:13:13 +0000 Subject: [PATCH 4/5] Remove redundant blank line --- buildroot/package/recovery/recovery.mk | 1 - 1 file changed, 1 deletion(-) diff --git a/buildroot/package/recovery/recovery.mk b/buildroot/package/recovery/recovery.mk index 1f083c67..d27ab000 100644 --- a/buildroot/package/recovery/recovery.mk +++ b/buildroot/package/recovery/recovery.mk @@ -33,7 +33,6 @@ define RECOVERY_INSTALL_TARGET_CMDS $(INSTALL) -m 0755 package/recovery/unicode-fonts/NanumBarunGothicBold.ttf $(TARGET_DIR)/usr/lib/fonts/NanumBarunGothicBold.ttf $(INSTALL) -m 0755 package/recovery/data/data $(TARGET_DIR)/usr/data $(INSTALL) -m 0644 $(@D)/cmdline.txt $(BINARIES_DIR)/cmdline.txt - mkdir -p $(TARGET_DIR)/keymaps/ $(INSTALL) -m 0755 package/recovery/keymaps/* $(TARGET_DIR)/keymaps/ $(INSTALL) -m 0644 package/recovery/wpa_supplicant.conf $(TARGET_DIR)/etc/wpa_supplicant.conf From 5c1b0e3b59ff0888e83437867cc1a605c2b993bc Mon Sep 17 00:00:00 2001 From: Serge Schneider Date: Wed, 12 Jan 2022 08:48:52 +0000 Subject: [PATCH 5/5] Use Debian's con2fbmap patches directly --- buildroot/.config | 1 - buildroot/package/Config.in | 1 - buildroot/package/con2fbmap/Config.in | 7 -- buildroot/package/con2fbmap/con2fbmap.mk | 23 ---- buildroot/package/fbset/03_con2fbmap.patch | 110 ++++++++++++++++++ buildroot/package/fbset/10_build.patch | 103 ++++++++++++++++ buildroot/package/fbset/fbset.mk | 1 + buildroot/package/recovery/init | 11 +- buildroot/package/rpi-firmware/config.txt | 2 +- .../package/rpi-userland/rpi-userland.mk | 1 + con2fbmap/Makefile | 3 - con2fbmap/con2fbmap.1 | 29 ----- con2fbmap/con2fbmap.c | 66 ----------- con2fbmap/copyright | 44 ------- 14 files changed, 221 insertions(+), 181 deletions(-) delete mode 100644 buildroot/package/con2fbmap/Config.in delete mode 100644 buildroot/package/con2fbmap/con2fbmap.mk create mode 100644 buildroot/package/fbset/03_con2fbmap.patch create mode 100644 buildroot/package/fbset/10_build.patch delete mode 100644 con2fbmap/Makefile delete mode 100644 con2fbmap/con2fbmap.1 delete mode 100644 con2fbmap/con2fbmap.c delete mode 100644 con2fbmap/copyright diff --git a/buildroot/.config b/buildroot/.config index 242a870e..c531629a 100644 --- a/buildroot/.config +++ b/buildroot/.config @@ -343,7 +343,6 @@ BR2_PACKAGE_P7ZIP=y BR2_PACKAGE_PARTCLONE=y BR2_PACKAGE_RECOVERY=y BR2_PACKAGE_RPI_WIFI_FIRMWARE=y -BR2_PACKAGE_CON2FBMAP=y # # Audio and video applications diff --git a/buildroot/package/Config.in b/buildroot/package/Config.in index aafc28fa..71e4dd53 100644 --- a/buildroot/package/Config.in +++ b/buildroot/package/Config.in @@ -6,7 +6,6 @@ menu "Target packages" source "package/partclone/Config.in" source "package/recovery/Config.in" source "package/rpi-wifi-firmware/Config.in" - source "package/con2fbmap/Config.in" menu "Audio and video applications" source "package/alsa-utils/Config.in" diff --git a/buildroot/package/con2fbmap/Config.in b/buildroot/package/con2fbmap/Config.in deleted file mode 100644 index 7bec3838..00000000 --- a/buildroot/package/con2fbmap/Config.in +++ /dev/null @@ -1,7 +0,0 @@ -config BR2_PACKAGE_CON2FBMAP - bool "con2fbmap" - ### build dependencies - ### runtime dependencies - help - Change tty console to a different framebuffer device /dev/fbX - diff --git a/buildroot/package/con2fbmap/con2fbmap.mk b/buildroot/package/con2fbmap/con2fbmap.mk deleted file mode 100644 index 8591728a..00000000 --- a/buildroot/package/con2fbmap/con2fbmap.mk +++ /dev/null @@ -1,23 +0,0 @@ -############################################################# -# -# con2fbmap system -# -############################################################# - -CON2FBMAP_VERSION = 2.1 -CON2FBMAP_SITE = $(TOPDIR)/../con2fbmap -CON2FBMAP_SITE_METHOD = local -CON2FBMAP_LICENSE = GPL-2 -CON2FBMAP_LICENSE_FILES = copyright -CON2FBMAP_INSTALL_STAGING = NO - -define CON2FBMAP_BUILD_CMDS - $(MAKE) CC="$(TARGET_CC)" LD="$(TARGET_LD)" -C $(@D) - $(TARGET_STRIP) $(@D)/con2fbmap -endef - -define CON2FBMAP_INSTALL_TARGET_CMDS - $(INSTALL) -m 0755 $(@D)/con2fbmap $(TARGET_DIR)/usr/bin/con2fbmap -endef - -$(eval $(generic-package)) diff --git a/buildroot/package/fbset/03_con2fbmap.patch b/buildroot/package/fbset/03_con2fbmap.patch new file mode 100644 index 00000000..30fdf757 --- /dev/null +++ b/buildroot/package/fbset/03_con2fbmap.patch @@ -0,0 +1,110 @@ +Status: not-sent +# This supposedly does not need to be sent upstream as there's fbutils, +# although its development has stagnated. + +--- + con2fbmap.1 | 29 ++++++++++++++++++++++++++ + con2fbmap.c | 66 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + 2 files changed, 95 insertions(+) + +--- /dev/null ++++ b/con2fbmap.1 +@@ -0,0 +1,29 @@ ++.TH con2fbmap 1 2006-01-18 2.1 "Linux frame buffer utils" ++.SH NAME ++con2fbmap \- shows and sets mapping between consoles and framebuffer devices. ++.SH SYNOPSIS ++.B con2fbmap ++.RI console ++.RI [ framebuffer ] ++.SH DESCRIPTION ++.B This documentation is not finished ++.PP ++.B con2fbmap ++is a system utility to show or change the mapping of the consoles to the ++frame buffer device. The frame buffer device provides a simple and unique ++interface to access different kinds of graphic displays. ++.PP ++Frame buffer devices are accessed via special device nodes located in the ++/dev directory. The naming scheme for these nodes is always ++.IR \fBfb < n >, ++where ++.I n ++is the number of the used frame buffer device. ++.PP ++.SH OPTIONS ++The first option must be there, and identify the console on which to work. ++If the second option is not set, con2fbmap shows the current mapping of ++identified console. If the second argument is given (as a number) con2fbmap ++maps the identified console to said framebuffer device. ++.TP ++Sven LUTHER +--- /dev/null ++++ b/con2fbmap.c +@@ -0,0 +1,66 @@ ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++#define DEFAULT_FRAMEBUFFER "/dev/fb0" ++#define DEFAULT_FRAMEBUFFER_DEVFS "/dev/fb/0" ++ ++const char *programname; ++ ++void Usage(void) ++{ ++ fprintf(stderr, "\nUsage: %s console [framebuffer]\n\n", programname); ++ exit(1); ++} ++ ++int main(int argc, char *argv[]) ++{ ++ int do_write = 0; ++ char *fbpath; /* any frame buffer will do */ ++ int fd; ++ struct fb_con2fbmap map; ++ ++ programname = argv[0]; ++ switch (argc) { ++ case 3: ++ do_write = 1; ++ map.framebuffer = atoi(argv[2]); ++ case 2: ++ map.console = atoi(argv[1]); ++ break; ++ default: ++ Usage(); ++ } ++ ++ if (access("/dev/.devfsd", F_OK) == 0) /* devfs detected */ ++ fbpath = DEFAULT_FRAMEBUFFER_DEVFS; ++ else ++ fbpath = DEFAULT_FRAMEBUFFER; ++ ++ if ((fd = open(fbpath, O_RDONLY)) == -1) { ++ fprintf(stderr, "open %s: %s\n", fbpath, strerror(errno)); ++ exit(1); ++ } ++ if (do_write) { ++ if (ioctl(fd, FBIOPUT_CON2FBMAP, &map)) { ++ fprintf(stderr, "ioctl FBIOPUT_CON2FBMAP: %s\n", strerror(errno)); ++ exit(1); ++ } ++ } else { ++ if (ioctl(fd, FBIOGET_CON2FBMAP, &map)) { ++ fprintf(stderr, "ioctl FBIOGET_CON2FBMAP: %s\n", strerror(errno)); ++ exit(1); ++ } ++ printf("console %d is mapped to framebuffer %d\n", map.console, ++ map.framebuffer); ++ } ++ close(fd); ++ exit(0); ++} diff --git a/buildroot/package/fbset/10_build.patch b/buildroot/package/fbset/10_build.patch new file mode 100644 index 00000000..ce7e343d --- /dev/null +++ b/buildroot/package/fbset/10_build.patch @@ -0,0 +1,103 @@ +Status: sent-upstream +# Sent part of it, not the indentation fixes, nor the con2fbmap. + +--- + Makefile | 88 +++++++++++++++++++++++++++++++++++++-------------------------- + 1 file changed, 53 insertions(+), 35 deletions(-) + +--- a/Makefile ++++ b/Makefile +@@ -2,40 +2,58 @@ + # Linux Frame Buffer Device Configuration + # + +-CC = gcc -Wall -O2 -I. +-BISON = bison -d +-FLEX = flex +-INSTALL = install +-RM = rm -f +- +-All: fbset +- +- +-fbset: fbset.o modes.tab.o lex.yy.o +- +-fbset.o: fbset.c fbset.h fb.h +-modes.tab.o: modes.tab.c fbset.h fb.h +-lex.yy.o: lex.yy.c fbset.h modes.tab.h +- +-lex.yy.c: modes.l +- $(FLEX) modes.l +- +-modes.tab.c: modes.y +- $(BISON) modes.y +- +-install: fbset +- if [ -f /sbin/fbset ]; then rm /sbin/fbset; fi +- $(INSTALL) fbset /usr/sbin +- $(INSTALL) fbset.8 /usr/man/man8 +- $(INSTALL) fb.modes.5 /usr/man/man5 +- if [ ! -c /dev/fb0 ]; then mknod /dev/fb0 c 29 0; fi +- if [ ! -c /dev/fb1 ]; then mknod /dev/fb1 c 29 32; fi +- if [ ! -c /dev/fb2 ]; then mknod /dev/fb2 c 29 64; fi +- if [ ! -c /dev/fb3 ]; then mknod /dev/fb3 c 29 96; fi +- if [ ! -c /dev/fb4 ]; then mknod /dev/fb4 c 29 128; fi +- if [ ! -c /dev/fb5 ]; then mknod /dev/fb5 c 29 160; fi +- if [ ! -c /dev/fb6 ]; then mknod /dev/fb6 c 29 192; fi +- if [ ! -c /dev/fb7 ]; then mknod /dev/fb7 c 29 224; fi ++srcdir = . ++ ++CC = gcc ++CFLAGS = -Wall -O2 ++BISON = bison -d ++FLEX = flex ++INSTALL = install ++INSTALL_PROGRAM = $(INSTALL) -m 755 ++INSTALL_DATA = $(INSTALL) -m 644 ++RM = rm -f ++ ++all: fbset con2fbmap ++ ++fbset: fbset.o modes.tab.o lex.yy.o ++ ++fbset.o: fbset.c fbset.h fb.h ++modes.tab.o: modes.tab.c fbset.h fb.h ++lex.yy.o: lex.yy.c fbset.h modes.tab.h ++ ++lex.yy.c: modes.l ++ $(FLEX) $< ++ ++modes.tab.c modes.tab.h: modes.y ++ $(BISON) $< ++ ++con2fbmap: con2fbmap.o ++con2fbmap.o: con2fbmap.c ++ ++install: fbset ++ $(INSTALL) -d $(DESTDIR)/etc ++ $(INSTALL) -d $(DESTDIR)/bin ++ $(INSTALL) -d $(DESTDIR)/usr/share/man/man1 ++ $(INSTALL) -d $(DESTDIR)/usr/share/man/man5 ++ $(INSTALL_DATA) $(srcdir)/etc/fb.modes.ATI $(DESTDIR)/etc/fb.modes ++ $(INSTALL_DATA) $(srcdir)/fb.modes.5 $(DESTDIR)/usr/share/man/man5 ++ $(INSTALL_PROGRAM) fbset $(DESTDIR)/bin ++ $(INSTALL_DATA) $(srcdir)/fbset.8 $(DESTDIR)/usr/share/man/man1/fbset.1 ++ $(INSTALL_PROGRAM) $(srcdir)/modeline2fb $(DESTDIR)/bin ++ $(INSTALL_DATA) $(srcdir)/modeline2fb.1 $(DESTDIR)/usr/share/man/man1 ++ $(INSTALL_PROGRAM) con2fbmap $(DESTDIR)/bin ++ $(INSTALL_DATA) $(srcdir)/con2fbmap.1 $(DESTDIR)/usr/share/man/man1 ++ ++install-devices: ++ if [ ! -c /dev/fb0 ]; then mknod $(DESTDIR)/dev/fb0 c 29 0; fi ++ if [ ! -c /dev/fb1 ]; then mknod $(DESTDIR)/dev/fb1 c 29 32; fi ++ if [ ! -c /dev/fb2 ]; then mknod $(DESTDIR)/dev/fb2 c 29 64; fi ++ if [ ! -c /dev/fb3 ]; then mknod $(DESTDIR)/dev/fb3 c 29 96; fi ++ if [ ! -c /dev/fb4 ]; then mknod $(DESTDIR)/dev/fb4 c 29 128; fi ++ if [ ! -c /dev/fb5 ]; then mknod $(DESTDIR)/dev/fb5 c 29 160; fi ++ if [ ! -c /dev/fb6 ]; then mknod $(DESTDIR)/dev/fb6 c 29 192; fi ++ if [ ! -c /dev/fb7 ]; then mknod $(DESTDIR)/dev/fb7 c 29 224; fi + + clean: +- $(RM) *.o fbset lex.yy.c modes.tab.c modes.tab.h ++ $(RM) *.o fbset con2fbmap lex.yy.c modes.tab.c modes.tab.h ++ diff --git a/buildroot/package/fbset/fbset.mk b/buildroot/package/fbset/fbset.mk index 16581c41..b9eecd48 100644 --- a/buildroot/package/fbset/fbset.mk +++ b/buildroot/package/fbset/fbset.mk @@ -20,6 +20,7 @@ endef define FBSET_INSTALL_TARGET_CMDS $(INSTALL) -D -m 755 $(@D)/fbset $(TARGET_DIR)/usr/sbin/fbset + $(INSTALL) -D -m 755 $(@D)/con2fbmap $(TARGET_DIR)/bin/con2fbmap endef $(eval $(generic-package)) diff --git a/buildroot/package/recovery/init b/buildroot/package/recovery/init index bc73cd4a..b71d1796 100755 --- a/buildroot/package/recovery/init +++ b/buildroot/package/recovery/init @@ -33,11 +33,11 @@ echo 2 >/sys/module/vt/parameters/cur_default # Enable syslog /etc/init.d/S01logging start > /dev/null -present=`tvservice -l | sed -n -e 's|^Display Number \(.*\),.*$|\1| p'` +present=$(tvservice -l | sed -n -e 's|^Display Number \(.*\),.*$|\1| p') for dev in $present; do - fitted=`tvservice -n -v $dev 2>/dev/null` + fitted=$(tvservice -n -v "$dev" 2>/dev/null) if [[ "$fitted" != "" ]]; then - case $dev in + case "$dev" in 0) #7in Touchscreen export QWS_DISPLAY="LinuxFb:/dev/fb0" break; @@ -48,15 +48,14 @@ for dev in $present; do ;; 7) #Secondary HDMI1 export QWS_DISPLAY="LinuxFb:/dev/fb1" - /usr/bin/con2fbmap 2 1 - /usr/bin/con2fbmap 3 1 + /bin/con2fbmap 2 1 + /bin/con2fbmap 3 1 break; ;; esac fi done - if grep -q vncinstall /proc/cmdline; then # VNC server mode. Mainly useful for making screenshots export QWS_DISPLAY="VNC:size=800x600:depth=32:0" diff --git a/buildroot/package/rpi-firmware/config.txt b/buildroot/package/rpi-firmware/config.txt index dbada745..83cf0d12 100644 --- a/buildroot/package/rpi-firmware/config.txt +++ b/buildroot/package/rpi-firmware/config.txt @@ -3,6 +3,6 @@ start_file=recovery.elf fixup_file=fixup_rc.dat [pi4] +max_framebuffers=2 start_file=recover4.elf fixup_file=fixup4rc.dat -max_framebuffers=2 diff --git a/buildroot/package/rpi-userland/rpi-userland.mk b/buildroot/package/rpi-userland/rpi-userland.mk index 3ca2ada6..793b2999 100644 --- a/buildroot/package/rpi-userland/rpi-userland.mk +++ b/buildroot/package/rpi-userland/rpi-userland.mk @@ -22,6 +22,7 @@ endef endif define RPI_USERLAND_INSTALL_TARGET_CMDS + $(INSTALL) -m 0755 $(STAGING_DIR)/usr/lib/libbcm_host.so $(TARGET_DIR)/usr/lib $(INSTALL) -m 0755 $(STAGING_DIR)/usr/lib/libvchiq_arm.so $(TARGET_DIR)/usr/lib $(INSTALL) -m 0755 $(STAGING_DIR)/usr/lib/libvcos.so $(TARGET_DIR)/usr/lib $(INSTALL) -m 0755 $(STAGING_DIR)/usr/lib/libvchostif.so $(TARGET_DIR)/usr/lib diff --git a/con2fbmap/Makefile b/con2fbmap/Makefile deleted file mode 100644 index 1ee19402..00000000 --- a/con2fbmap/Makefile +++ /dev/null @@ -1,3 +0,0 @@ -con2fbmap: con2fbmap.c - $(CC) con2fbmap.c -o con2fbmap - diff --git a/con2fbmap/con2fbmap.1 b/con2fbmap/con2fbmap.1 deleted file mode 100644 index e0b94169..00000000 --- a/con2fbmap/con2fbmap.1 +++ /dev/null @@ -1,29 +0,0 @@ -.TH con2fbmap 1 2006-01-18 2.1 "Linux frame buffer utils" -.SH NAME -con2fbmap \- shows and sets mapping between consoles and framebuffer devices. -.SH SYNOPSIS -.B con2fbmap -.RI console -.RI [ framebuffer ] -.SH DESCRIPTION -.B This documentation is not finished -.PP -.B con2fbmap -is a system utility to show or change the mapping of the consoles to the -frame buffer device. The frame buffer device provides a simple and unique -interface to access different kinds of graphic displays. -.PP -Frame buffer devices are accessed via special device nodes located in the -/dev directory. The naming scheme for these nodes is always -.IR \fBfb < n >, -where -.I n -is the number of the used frame buffer device. -.PP -.SH OPTIONS -The first option must be there, and identify the console on which to work. -If the second option is not set, con2fbmap shows the current mapping of -identified console. If the second argument is given (as a number) con2fbmap -maps the identified console to said framebuffer device. -.TP -Sven LUTHER diff --git a/con2fbmap/con2fbmap.c b/con2fbmap/con2fbmap.c deleted file mode 100644 index 4d2c908b..00000000 --- a/con2fbmap/con2fbmap.c +++ /dev/null @@ -1,66 +0,0 @@ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define DEFAULT_FRAMEBUFFER "/dev/fb0" -#define DEFAULT_FRAMEBUFFER_DEVFS "/dev/fb/0" - -const char *programname; - -void Usage(void) -{ - fprintf(stderr, "\nUsage: %s console [framebuffer]\n\n", programname); - exit(1); -} - -int main(int argc, char *argv[]) -{ - int do_write = 0; - char *fbpath; /* any frame buffer will do */ - int fd; - struct fb_con2fbmap map; - - programname = argv[0]; - switch (argc) { - case 3: - do_write = 1; - map.framebuffer = atoi(argv[2]); - case 2: - map.console = atoi(argv[1]); - break; - default: - Usage(); - } - - if (access("/dev/.devfsd", F_OK) == 0) /* devfs detected */ - fbpath = DEFAULT_FRAMEBUFFER_DEVFS; - else - fbpath = DEFAULT_FRAMEBUFFER; - - if ((fd = open(fbpath, O_RDONLY)) == -1) { - fprintf(stderr, "open %s: %s\n", fbpath, strerror(errno)); - exit(1); - } - if (do_write) { - if (ioctl(fd, FBIOPUT_CON2FBMAP, &map)) { - fprintf(stderr, "ioctl FBIOPUT_CON2FBMAP: %s\n", strerror(errno)); - exit(1); - } - } else { - if (ioctl(fd, FBIOGET_CON2FBMAP, &map)) { - fprintf(stderr, "ioctl FBIOGET_CON2FBMAP: %s\n", strerror(errno)); - exit(1); - } - printf("console %d is mapped to framebuffer %d\n", map.console, - map.framebuffer); - } - close(fd); - exit(0); -} diff --git a/con2fbmap/copyright b/con2fbmap/copyright deleted file mode 100644 index d2f82daf..00000000 --- a/con2fbmap/copyright +++ /dev/null @@ -1,44 +0,0 @@ -The upstream source was downloaded from: - - as a patch <03_con2fbmap.patch> to fbset. - -Copyright Holder of fbset: - - Copyright © 1995-1998 Geert Uytterhoeven - -License: - - This file is subject to the terms and conditions of the GNU General Public - License. See the file COPYING in the main directory of the Linux - distribution for more details. - ---------------- Clarification ---------------------------------------- - -From Geert.Uytterhoeven@sonycom.com Tue Jan 21 19:59:02 2003 -Date: Tue, 21 Jan 2003 17:06:11 +0100 (MET) -From: Geert Uytterhoeven -Sender: geert@sonycom.com -To: Guillem Jover -Subject: Re: fbset: GPL version -In-Reply-To: <20030120063657.GA6650@zulo.hadrons.org> -Message-ID: - - Hi Guillem, - -> I'm the new Debian maintainer for fbset. A Debian user has filed a bug -> reporting that the sources doesn't specify the GPL version. So could -> you be so kind to tell me what version they obey? - -The source files refer to `the file COPYING in the main directory of the Linux -distribution', so that must be the GNU General Public License Version 2. - ---------------- Clarification ---------------------------------------- - -On Debian GNU/Linux systems, the complete text of the GNU General -Public License can be found in '/usr/share/common-licenses/GPL-2'. - ---------------- Con2fbmap -------------------------------------------- - -Con2fbmap had no specific copyright, therefore I assume it falls under -fbset's GPLv2 copyright and is attributed as such to Sven Luther. -