Date: Mon, 22 Jun 1998 00:59:39 +0200 (CEST)
From: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>
To: Linux/m68k <linux-m68k@lists.linux-m68k.org>,
        Linux/APUS <linux-apus@SunSITE.auc.dk>
Subject: L68K: Loadable frame buffer devices
Sender: owner-linux-m68k@phil.uni-sb.de
Reply-To: Geert Uytterhoeven <Geert.Uytterhoeven@cs.kuleuven.ac.be>


This patch changes the following:

  - Allow low level console drivers (fbcon-*) to be loadable kernel modules
    again.
  - Use a trick to make sure all builtin ll console drivers get linked in: link
    them together in fbcon_ll.o first (idea stolen from drivers/pci/Makefile).
  - Be smarter when deciding which ll drivers to put in the kernel.

Can someone who has modules working in 2.1.106 please test this?

--- m68k/drivers/video/Makefile.orig	Mon Jun  8 22:49:13 1998
+++ m68k/drivers/video/Makefile	Sun Jun 21 23:10:15 1998
@@ -126,66 +126,134 @@
 
 # Generic Low Level Drivers
 
-ifdef CONFIG_FBCON_AFB
-LX_OBJS += fbcon-afb.o
-endif
-
-ifdef CONFIG_FBCON_CFB2
-LX_OBJS += fbcon-cfb2.o
-endif
-
-ifdef CONFIG_FBCON_CFB4
-LX_OBJS += fbcon-cfb4.o
-endif
-
-ifdef CONFIG_FBCON_CFB8
-LX_OBJS += fbcon-cfb8.o
-endif
-
-ifdef CONFIG_FBCON_CFB16
-LX_OBJS += fbcon-cfb16.o
-endif
-
-ifdef CONFIG_FBCON_CFB24
-LX_OBJS += fbcon-cfb24.o
-endif
-
-ifdef CONFIG_FBCON_CFB32
-LX_OBJS += fbcon-cfb32.o
-endif
-
-ifdef CONFIG_FBCON_ILBM
-LX_OBJS += fbcon-ilbm.o
-endif
-
-ifdef CONFIG_FBCON_IPLAN2P2
-LX_OBJS += fbcon-iplan2p2.o
-endif
-
-ifdef CONFIG_FBCON_IPLAN2P4
-LX_OBJS += fbcon-iplan2p4.o
-endif
-
-ifdef CONFIG_FBCON_IPLAN2P8
-LX_OBJS += fbcon-iplan2p8.o
-endif
-
-ifdef CONFIG_FBCON_MAC
-LX_OBJS += fbcon-mac.o
-endif
-
-ifdef CONFIG_FBCON_MFB
-LX_OBJS += fbcon-mfb.o
-endif
-
-ifdef CONFIG_FBCON_VGA
-LX_OBJS += fbcon-vga.o
+# Nasty trick to make sure all wanted drivers are linked in
+O_TARGET = fbcon_ll.o
+L_OBJS += fbcon_ll.o
+
+ifeq ($(CONFIG_FBCON_AFB),y)
+OX_OBJS += fbcon-afb.o
+else
+  ifeq ($(CONFIG_FBCON_AFB),m)
+  MX_OBJS += fbcon-afb.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB2),y)
+OX_OBJS += fbcon-cfb2.o
+else
+  ifeq ($(CONFIG_FBCON_CFB2),m)
+  MX_OBJS += fbcon-cfb2.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB4),y)
+OX_OBJS += fbcon-cfb4.o
+else
+  ifeq ($(CONFIG_FBCON_CFB4),m)
+  MX_OBJS += fbcon-cfb4.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB8),y)
+OX_OBJS += fbcon-cfb8.o
+else
+  ifeq ($(CONFIG_FBCON_CFB8),m)
+  MX_OBJS += fbcon-cfb8.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB16),y)
+OX_OBJS += fbcon-cfb16.o
+else
+  ifeq ($(CONFIG_FBCON_CFB16),m)
+  MX_OBJS += fbcon-cfb16.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB24),y)
+OX_OBJS += fbcon-cfb24.o
+else
+  ifeq ($(CONFIG_FBCON_CFB24),m)
+  MX_OBJS += fbcon-cfb24.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_CFB32),y)
+OX_OBJS += fbcon-cfb32.o
+else
+  ifeq ($(CONFIG_FBCON_CFB32),m)
+  MX_OBJS += fbcon-cfb32.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_ILBM),y)
+OX_OBJS += fbcon-ilbm.o
+else
+  ifeq ($(CONFIG_FBCON_ILBM),m)
+  MX_OBJS += fbcon-ilbm.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_IPLAN2P2),y)
+OX_OBJS += fbcon-iplan2p2.o
+else
+  ifeq ($(CONFIG_FBCON_IPLAN2P2),m)
+  MX_OBJS += fbcon-iplan2p2.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_IPLAN2P4),y)
+OX_OBJS += fbcon-iplan2p4.o
+else
+  ifeq ($(CONFIG_FBCON_IPLAN2P4),m)
+  MX_OBJS += fbcon-iplan2p4.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_IPLAN2P8),y)
+OX_OBJS += fbcon-iplan2p8.o
+else
+  ifeq ($(CONFIG_FBCON_IPLAN2P8),m)
+  MX_OBJS += fbcon-iplan2p8.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_IPLAN2P16),y)
+OX_OBJS += fbcon-iplan2p16.o
+else
+  ifeq ($(CONFIG_FBCON_IPLAN2P16),m)
+  MX_OBJS += fbcon-iplan2p16.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_MAC),y)
+OX_OBJS += fbcon-mac.o
+else
+  ifeq ($(CONFIG_FBCON_MAC),m)
+  MX_OBJS += fbcon-mac.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_MFB),y)
+OX_OBJS += fbcon-mfb.o
+else
+  ifeq ($(CONFIG_FBCON_MFB),m)
+  MX_OBJS += fbcon-mfb.o
+  endif
+endif
+
+ifeq ($(CONFIG_FBCON_VGA),y)
+OX_OBJS += fbcon-vga.o
+else
+  ifeq ($(CONFIG_FBCON_VGA),m)
+  MX_OBJS += fbcon-vga.o
+  endif
 endif
 
 # GSP Console
 
 ifdef CONFIG_AMIGA_GSP
-L_OBJS := $(L_OBJS) gspcon.o gspcore.o
+L_OBJS += gspcon.o gspcore.o
 endif
 
 # VGA Text Console
@@ -193,7 +261,7 @@
 ifdef CONFIG_ABSTRACT_CONSOLE
 ifdef CONFIG_VGA_CONSOLE
 ifndef CONFIG_FB_VGA
-L_OBJS := $(L_OBJS) vgacon.o
+L_OBJS += vgacon.o
 endif
 endif
 endif
@@ -201,7 +269,7 @@
 # Console Wrapper
 
 ifdef CONFIG_ABSCON_COMPAT
-L_OBJS := $(L_OBJS) compatcon.o
+L_OBJS += compatcon.o
 endif
 
 include $(TOPDIR)/Rules.make
--- m68k/drivers/video/Config.in.orig	Thu Jun 18 21:59:35 1998
+++ m68k/drivers/video/Config.in	Sun Jun 21 23:10:15 1998
@@ -60,86 +60,108 @@
   if [ "$ARCH" = "i386" ]; then
     bool 'VESA VGA graphics console' CONFIG_FB_VESA
     define_bool CONFIG_VIDEO_SELECT y
-  fi
-  if [ "$ARCH" = "i386" ]; then
     tristate 'MDA dual-headed support' CONFIG_FB_MDA
   fi
   tristate 'Virtual Frame Buffer support (ONLY FOR TESTING!)' CONFIG_FB_VIRTUAL
 
   bool 'Advanced low level driver options' CONFIG_FBCON_ADVANCED
   if [ "$CONFIG_FBCON_ADVANCED" = "y" ]; then
-    bool 'Monochrome support' CONFIG_FBCON_MFB
-    bool '2 bpp packed pixels support' CONFIG_FBCON_CFB2
-    bool '4 bpp packed pixels support' CONFIG_FBCON_CFB4
-    bool '8 bpp packed pixels support' CONFIG_FBCON_CFB8
-    bool '16 bpp packed pixels support' CONFIG_FBCON_CFB16
-    bool '24 bpp packed pixels support' CONFIG_FBCON_CFB24
-    bool '32 bpp packed pixels support' CONFIG_FBCON_CFB32
-    bool 'Amiga bitplanes support' CONFIG_FBCON_AFB
-    bool 'Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM
-    bool 'Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2
-    bool 'Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4
-    bool 'Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8
-    bool 'Mac variable bpp packed pixels support' CONFIG_FBCON_MAC
-    bool 'VGA characters/attributes support' CONFIG_FBCON_VGA
+    tristate 'Monochrome support' CONFIG_FBCON_MFB
+    tristate '2 bpp packed pixels support' CONFIG_FBCON_CFB2
+    tristate '4 bpp packed pixels support' CONFIG_FBCON_CFB4
+    tristate '8 bpp packed pixels support' CONFIG_FBCON_CFB8
+    tristate '16 bpp packed pixels support' CONFIG_FBCON_CFB16
+    tristate '24 bpp packed pixels support' CONFIG_FBCON_CFB24
+    tristate '32 bpp packed pixels support' CONFIG_FBCON_CFB32
+    tristate 'Amiga bitplanes support' CONFIG_FBCON_AFB
+    tristate 'Amiga interleaved bitplanes support' CONFIG_FBCON_ILBM
+    tristate 'Atari interleaved bitplanes (2 planes) support' CONFIG_FBCON_IPLAN2P2
+    tristate 'Atari interleaved bitplanes (4 planes) support' CONFIG_FBCON_IPLAN2P4
+    tristate 'Atari interleaved bitplanes (8 planes) support' CONFIG_FBCON_IPLAN2P8
+#   tristate 'Atari interleaved bitplanes (16 planes) support' CONFIG_FBCON_IPLAN2P16
+    tristate 'Mac variable bpp packed pixels support' CONFIG_FBCON_MAC
+    tristate 'VGA characters/attributes support' CONFIG_FBCON_VGA
   else
-    if [ "$CONFIG_FB_AMIGA" = "y" -o "$CONFIG_FB_AMIGA" = "m" -o \
-	 "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_CYBER" = "y" -o "$CONFIG_FB_CYBER" = "m" -o \
-	 "$CONFIG_FB_RETINAZ3" = "y" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
-	 "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRGE" = "m" -o \
-	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
-	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+    # Guess what we need
+    if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_AMIGA" = "y" -o \
+	 "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_CYBER" = "y" -o \
+	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_RETINAZ3" = "y" -o \
+	 "$CONFIG_FB_VIRGE" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_MFB y
+    elif [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_AMIGA" = "m" -o \
+	   "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_CYBER" = "m" -o \
+	   "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_RETINAZ3" = "m" -o \
+	   "$CONFIG_FB_VIRGE" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_MFB m
     fi
-    if [ "$CONFIG_FB_AMIGA" = "y" -o "$CONFIG_FB_AMIGA" = "m" ]; then
-      define_bool CONFIG_FBCON_ILBM y
-      define_bool CONFIG_FBCON_AFB y
-    fi
-    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" ]; then
-      define_bool CONFIG_FBCON_IPLAN2P2 y
-      define_bool CONFIG_FBCON_IPLAN2P4 y
-      define_bool CONFIG_FBCON_IPLAN2P8 y
-    fi
-    if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
-	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
-      define_bool CONFIG_FBCON_MAC  y
+    if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_MAC" = "y" -o \
+	 "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_CFB2 y
       define_bool CONFIG_FBCON_CFB4 y
-    fi
-    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_OF" = "y" -o "$CONFIG_FB_OF" = "m" -o \
-	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o  \
-	 "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_TGA" = "m" -o \
-	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VESA" = "m" -o \
-	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+    elif [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_MAC" = "m" -o \
+	   "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB2 m
+      define_bool CONFIG_FBCON_CFB4 m
+    fi
+    if [ "$CONFIG_FB_ACORN" = "y" -o "$CONFIG_FB_ATARI" = "y" -o \
+	 "$CONFIG_FB_MAC" = "y" -o  "$CONFIG_FB_OF" = "y" -o \
+	 "$CONFIG_FB_TGA" = "y" -o "$CONFIG_FB_VESA" = "y" -o \
+	 "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_CFB8 y
-    fi
-    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_ATY" = "m" -o \
-	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_MAC" = "m" -o \
-	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VESA" = "m" -o \
-	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+    elif [ "$CONFIG_FB_ACORN" = "m" -o "$CONFIG_FB_ATARI" = "m" -o \
+	   "$CONFIG_FB_MAC" = "m" -o  "$CONFIG_FB_OF" = "m" -o \
+	   "$CONFIG_FB_TGA" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
+	   "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB8 m
+    fi
+    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \
+	 "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VESA" = "y" -o \
+	 "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_CFB16 y
+    elif [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
+	   "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VESA" = "m" -o \
+	   "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB16 m
     fi
-    if [ "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+    if [ "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_CFB24 y
+    elif [ "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB24 m
     fi
-    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATARI" = "m" -o \
-	 "$CONFIG_FB_ATY" = "y" -o "$CONFIG_FB_ATY" = "m" -o \
-	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VESA" = "m" -o \
-	 "$CONFIG_FB_VIRTUAL" = "y" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+    if [ "$CONFIG_FB_ATARI" = "y" -o "$CONFIG_FB_ATY" = "y" -o \
+	 "$CONFIG_FB_VESA" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then
       define_bool CONFIG_FBCON_CFB32 y
+    elif [ "$CONFIG_FB_ATARI" = "m" -o "$CONFIG_FB_ATY" = "m" -o \
+	   "$CONFIG_FB_VESA" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_CFB32 m
     fi
-    if [ "$CONFIG_FB_ACORN" != "n" ]; then
-      define_bool CONFIG_FBCON_MFB y
-      define_bool CONFIG_FBCON_CFB2 y
-      define_bool CONFIG_FBCON_CFB4 y
-      define_bool CONFIG_FBCON_CFB8 y
+    if [ "$CONFIG_FB_AMIGA" = "y" ]; then
+      define_bool CONFIG_FBCON_AFB y
+      define_bool CONFIG_FBCON_ILBM y
+    elif [ "$CONFIG_FB_AMIGA" = "m" ]; then
+      define_bool CONFIG_FBCON_AFB m
+      define_bool CONFIG_FBCON_ILBM m
+    fi
+    if [ "$CONFIG_FB_ATARI" = "y" ]; then
+      define_bool CONFIG_FBCON_IPLAN2P2 y
+      define_bool CONFIG_FBCON_IPLAN2P4 y
+      define_bool CONFIG_FBCON_IPLAN2P8 y
+#     define_bool CONFIG_FBCON_IPLAN2P16 y
+    elif [ "$CONFIG_FB_ATARI" = "m" ]; then
+      define_bool CONFIG_FBCON_IPLAN2P2 m
+      define_bool CONFIG_FBCON_IPLAN2P4 m
+      define_bool CONFIG_FBCON_IPLAN2P8 m
+#     define_bool CONFIG_FBCON_IPLAN2P16 m
+    fi
+    if [ "$CONFIG_FB_MAC" = "y" -o "$CONFIG_FB_VIRTUAL" = "y" ]; then
+      define_bool CONFIG_FBCON_MAC  y
+    elif [ "$CONFIG_FB_MAC" = "m" -o "$CONFIG_FB_VIRTUAL" = "m" ]; then
+      define_bool CONFIG_FBCON_MAC  m
     fi
-    if [ "$CONFIG_FB_VGA" = "y" -o "$CONFIG_FB_VGA" = "m" -o \
-	 "$CONFIG_FB_MDA" = "y" -o "$CONFIG_FB_MDA" = "m" ]; then
+    if [ "$CONFIG_FB_MDA" = "y" -o "$CONFIG_FB_VGA" = "y" ]; then
       define_bool CONFIG_FBCON_VGA y
+    elif [ "$CONFIG_FB_MDA" = "m" -o "$CONFIG_FB_VGA" = "m" ]; then
+      define_bool CONFIG_FBCON_VGA m
     fi
   fi
 
Greetings,

						Geert

--
Geert Uytterhoeven                     Geert.Uytterhoeven@cs.kuleuven.ac.be
Wavelets, Linux/{m68k~Amiga,PPC~CHRP}  http://www.cs.kuleuven.ac.be/~geert/
Department of Computer Science -- Katholieke Universiteit Leuven -- Belgium

