Bug 13424

Summary: kernel build fails when agp driver configured as built-in
Product: [Retired] Red Hat Linux Reporter: kevan
Component: kernelAssignee: Michael K. Johnson <johnsonm>
Status: CLOSED DEFERRED QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: 6.2CC: alan, b-nordquist, gaburici, kevan
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2000-08-16 16:48:56 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
gaburici@cs.pub.ro patches in one easy-to-use file none

Description kevan 2000-07-03 21:55:05 UTC
Selecting agp driver support (e.g. for the Intel 810e chipset) to be built
into the kernel (rather than as a module) will cause the kernel rebuild to
fail because it doesn't know how to properly make
/usr/src/linux/drivers/char/agp/agpgart.o for kernel 2.2.16-3.

The agpgart.o module is properly built only if agp support is selected as a
module.  Probable file in error is /usr/src/linux/drivers/char/Makefile or
possibly /usr/src/linux/drivers/char/agp/Makefile.

A work-around is possible by building agpgart.o as a module, but the
makefile should be fixed or it should not be possible to select agp support
as builtin in 'make menuconfig'.

Comment 1 Vasile Gaburici 2000-07-05 18:01:02 UTC
Yep, the same thing happened to me. This worked with the older 2.2.14-12, but it
seems broken again in 2.2.16-3...


Comment 2 Vasile Gaburici 2000-07-06 11:45:18 UTC
I've fixed this. There were actually two bugs.

1) The first one was in drivers/char/agp/Makefile. The upper level
   Makefile (drivers/char) looked for agp/agpgart.o. Note that the
   explicit rule for agpgart.o was redundant, so I removed it.

=======================================================================
--- Makefile.orig       Tue Jun 20 00:32:10 2000
+++ Makefile    Thu Jul  6 13:44:30 2000
@@ -3,7 +3,8 @@
 # space ioctl interface to use agp memory.  It also adds a kernel interface
 # that other drivers could use to manipulate agp memory.

-O_TARGET       := agp.o
+O_TARGET       := agpgart.o
+M_OBJS          := $(O_TARGET)

 ifeq ($(CONFIG_AGP),y)
   O_OBJS += agpgart_fe.o
@@ -12,11 +13,9 @@
   ifeq ($(CONFIG_AGP), m)
     MI_OBJS += agpgart_fe.o
     MIX_OBJS += agpgart_be.o
-    M_OBJS += agpgart.o
   endif
 endif

-include $(TOPDIR)/Rules.make
+all:            all_targets 
 
-agpgart.o: agpgart_be.o agpgart_fe.o
-       $(LD) $(LD_RFLAG) -r -o $@ agpgart_be.o agpgart_fe.o
+include $(TOPDIR)/Rules.make
=======================================================================


2) The second bug was in agpgart_be.c, where agp_initialize() was
   mistakenly declared static, although it is called from init/main.c.

=======================================================================
--- agpgart_be.c.orig   Thu Jul  6 13:46:11 2000
+++ agpgart_be.c        Thu Jul  6 13:47:16 2000
@@ -2131,7 +2131,7 @@
 extern int agp_frontend_initialize(void);
 extern void agp_frontend_cleanup(void);

-static int __init agp_initialize(void)
+int __init agp_initialize(void)
 {
        int ret_val;
=======================================================================


Comment 3 Brent Nordquist 2000-07-12 18:00:42 UTC
Thanks for the patches!  Got me over this hurdle.  I'm going to attach them as
one file, relative to /usr/src/linux, for easier patching.

Comment 4 Brent Nordquist 2000-07-12 18:05:22 UTC
Created attachment 1027 [details]
gaburici.ro patches in one easy-to-use file

Comment 5 Michael K. Johnson 2000-08-08 03:35:29 UTC
*** Bug 15229 has been marked as a duplicate of this bug. ***

Comment 6 Michael K. Johnson 2000-08-08 03:56:41 UTC
Thanks for the patch, I have included it in our kernel
source tree.

Comment 7 Michael K. Johnson 2000-08-08 18:15:54 UTC
That patch breaks dynamic building, even if I leave the
explicit agpgart.o rule in place.  I'm removing it from
our kernel.  Building dynamic is far more important to us
than building static.

Comment 8 Vasile Gaburici 2000-08-09 14:33:35 UTC
johnsonm is right, modular build was broken as I have submitted the
patch. The problem actually lies in Rules.make, because there is no
rule how to build the M_OBJS from MI_OBJS and MIX_OBJS so defining
those two is not enough, an explicit rule is needed in the agpgart
Makefile, but I had it removed :-(

The problem is further complicated because O_TARGET and M_OBJS cannot
be the same if an explicit rule is given on how to build M_OBJS,
because O_TARGET does have an explicit rule in Rules.make. To
compensate for this change, the upper level Makefile must also be
tweaked.

Refix to allow both static and modular builds:

1) Fix agpgart_be.c as described previously.

2) Fix drivers/char/Makefile:
=======================================================================
--- Makefile.orig       Wed Aug  9 15:22:38 2000
+++ Makefile    Wed Aug  9 16:08:06 2000
@@ -372,7 +372,7 @@
 endif

 ifeq ($(CONFIG_AGP),y)
-L_OBJS += agp/agpgart.o
+L_OBJS += agp/agp.o
 ALL_SUB_DIRS += agp
 SUB_DIRS += agp
 else
=======================================================================

3) Leave the Makefile in drivers/char/agp/ in it's original
   form. Actually one can make more obvious what's going on by
   patching it like this:
=======================================================================
--- Makefile.orig       Tue Jun 20 00:32:10 2000
+++ Makefile    Wed Aug  9 16:11:04 2000
@@ -3,20 +3,23 @@
 # space ioctl interface to use agp memory.  It also adds a kernel interface
 # that other drivers could use to manipulate agp memory.

-O_TARGET       := agp.o
-
-ifeq ($(CONFIG_AGP),y)
+ifeq ($(CONFIG_AGP), y)
+  O_TARGET := agp.o
   O_OBJS += agpgart_fe.o
   OX_OBJS += agpgart_be.o
 else
   ifeq ($(CONFIG_AGP), m)
+    M_OBJS  := agpgart.o
     MI_OBJS += agpgart_fe.o
     MIX_OBJS += agpgart_be.o
-    M_OBJS += agpgart.o
   endif
 endif

-include $(TOPDIR)/Rules.make
+# Special rule to build the composite module

+ifeq ($(CONFIG_AGP), m)
 agpgart.o: agpgart_be.o agpgart_fe.o
        $(LD) $(LD_RFLAG) -r -o $@ agpgart_be.o agpgart_fe.o
+endif
+
+include $(TOPDIR)/Rules.make
=======================================================================

I have tested these patches both for modular and monolithic builds and
things were fine.

(Sorry for submitting fragmented diffs instead of one for the whole
tree, but I don't have enough disk space for two kernel trees...)


Comment 9 Michael K. Johnson 2000-08-16 16:43:24 UTC
Alan, want to suck this into your official 2.2.17pres?

Comment 10 Alan Cox 2000-08-16 16:48:54 UTC
AGP is not considered in a fit state to merge with 2.2 standard - yet


Comment 11 Alan Cox 2000-09-15 18:40:47 UTC
An alternative set of fixes are going into 2.2.18pre and AGP/DRM will be in
2.2.18 barring disasters