Skip to content
This repository was archived by the owner on Feb 27, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
110 changes: 110 additions & 0 deletions buildroot/package/fbset/03_con2fbmap.patch
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
--- /dev/null
+++ b/con2fbmap.c
@@ -0,0 +1,66 @@
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <linux/fb.h>
+
+#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);
+}
103 changes: 103 additions & 0 deletions buildroot/package/fbset/10_build.patch
Original file line number Diff line number Diff line change
@@ -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
+
1 change: 1 addition & 0 deletions buildroot/package/fbset/fbset.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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))
23 changes: 23 additions & 0 deletions buildroot/package/recovery/init
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,29 @@ 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"
/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"
Expand Down
1 change: 1 addition & 0 deletions buildroot/package/rpi-firmware/config.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ start_file=recovery.elf
fixup_file=fixup_rc.dat

[pi4]
max_framebuffers=2
start_file=recover4.elf
fixup_file=fixup4rc.dat
1 change: 1 addition & 0 deletions buildroot/package/rpi-userland/rpi-userland.mk
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down