Patch: proposed modularization of drivers/acpi

From: Adam J. Richter (adam@yggdrasil.com)
Date: Tue Jul 11 2000 - 05:07:25 EDT

  • Next message: Adam J. Richter: "Re: [PATCH] Re: Compile Errors on 2.4.0-test3 final"

    [Sorry if this is a duplicate. vger.rutgers.edu sent me a "policy
    analysis error" that did not indicate what the error was. --Adam.]

            I looks like the new drivers/acpi has modularization code in it
    and that it just needed some adjustments to the build procedure. So,
    here is a patch to do that. When I loaded the resulting module, it
    complained that the computer on which I tried did not have ACPI,
    which I believe is true (it has a 440BX-based motherboard).

            I think the intent of the authors of the kernel kernel code
    is that CONFIG_ACPI determines whenther acpi support is built in,
    built as a module or excluded, and CONFIG_ACPI_INTERPRETER determines
    whether or not the ACPI interpreter is used or whether the interface
    to the machine's BIOS is used. That is the logic behind the adjustment
    to linux/Makefile.

            More interestingly, the drivers/acpi code exposed problems
    in two of the linux build rules, which are fixed by this patch.
    For this reason, the changes to linux/Rules.make should be applied
    even if there is some reason not to apply the rest of this patch.

            The first problem was that while all other rules for compiling C
    code in Rules.make pass a "-o" flag to the C compiler in a way that preserves
    the directory prefix of the .c file, the rule for compiling C code
    that exports module symbols does not, so the .o files were being
    dumped in the current working directory.

            The second problem was that EXTRA_CFLAGS was not being used by
    the rule that calls genksyms, so that genksyms cannot find all of the
    referenced include files in that references extra include directories
    via EXTRA_CFLAGS.

            Anyhow, here is the patch.

    Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104
    adam@yggdrasil.com \ / San Jose, California 95129-1034
    +1 408 261-6630 | g g d r a s i l United States of America
    fax +1 408 261-6631 "Free Software For The Rest Of Us."

    --- linux-2.4.0-test3/Makefile Mon Jul 10 15:37:07 2000
    +++ linux/Makefile Mon Jul 10 20:59:48 2000
    @@ -168,7 +172,9 @@
     DRIVERS-$(CONFIG_IRDA) += drivers/net/irda/irda_drivers.a
     DRIVERS-$(CONFIG_I2C) += drivers/i2c/i2c.o
     DRIVERS-$(CONFIG_PHONE) += drivers/telephony/telephony.a
    -DRIVERS-$(CONFIG_ACPI_INTERPRETER) += drivers/acpi/acpi.o
    +ifeq ($(CONFIG_ACPI_INTERPRETER),y)
    + DRIVERS-$(CONFIG_ACPI) += drivers/acpi/acpi.o
    +endif
     
     DRIVERS += $(DRIVERS-y)
     
    --- linux-2.4.0-test3/Rules.make Thu Jun 22 07:09:44 2000
    +++ linux/Rules.make Mon Jul 10 03:55:39 2000
    @@ -204,10 +204,11 @@
     endif
     
     $(MODINCL)/%.ver: %.c
    + -mkdir -p $$(dirname $@)
             @if [ ! -r $(MODINCL)/$*.stamp -o $(MODINCL)/$*.stamp -ot $< ]; then \
    - echo '$(CC) $(CFLAGS) -E -D__GENKSYMS__ $<'; \
    + echo '$(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $<'; \
                     echo '| $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp'; \
    - $(CC) $(CFLAGS) -E -D__GENKSYMS__ $< \
    + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) -E -D__GENKSYMS__ $< \
                     | $(GENKSYMS) $(genksyms_smp_prefix) -k $(VERSION).$(PATCHLEVEL).$(SUBLEVEL) > $@.tmp; \
                     if [ -r $@ ] && cmp -s $@ $@.tmp; then echo $@ is unchanged; rm -f $@.tmp; \
                     else echo mv $@.tmp $@; mv -f $@.tmp $@; fi; \
    @@ -245,7 +246,7 @@
     
     ifneq "$(strip $(SYMTAB_OBJS))" ""
     $(SYMTAB_OBJS): $(SYMTAB_OBJS:.o=.c) $(TOPDIR)/include/linux/modversions.h
    - $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c)
    + $(CC) $(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB -c $(@:.o=.c) -o $@
             @ ( \
                 echo 'ifeq ($(strip $(subst $(comma),:,$(CFLAGS) $(EXTRA_CFLAGS) $(CFLAGS_$@) -DEXPORT_SYMTAB)),$$(strip $$(subst $$(comma),:,$$(CFLAGS) $$(EXTRA_CFLAGS) $$(CFLAGS_$@) -DEXPORT_SYMTAB)))' ; \
                 echo 'FILES_FLAGS_UP_TO_DATE += $@' ; \
    --- linux-2.4.0-test3/arch/i386/config.in Fri Jul 7 17:55:02 2000
    +++ linux/arch/i386/config.in Sat Jul 8 04:43:03 2000
    @@ -211,7 +211,7 @@
     
     bool 'Power Management support' CONFIG_PM
     
    -dep_bool ' ACPI support' CONFIG_ACPI $CONFIG_PM
    +dep_tristate ' ACPI support' CONFIG_ACPI $CONFIG_PM
     if [ "$CONFIG_ACPI" != "n" ]; then
        if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
           bool ' ACPI interpreter (EXPERIMENTAL)' CONFIG_ACPI_INTERPRETER
    diff -r -u linux-2.4.0-test3/drivers/acpi/Makefile linux/drivers/acpi/Makefile
    --- linux-2.4.0-test3/drivers/acpi/Makefile Wed Jul 5 11:23:12 2000
    +++ linux/drivers/acpi/Makefile Mon Jul 10 03:20:51 2000
    @@ -7,7 +7,6 @@
     MOD_IN_SUB_DIRS :=
     ALL_SUB_DIRS := $(SUB_DIRS)
     
    -O_TARGET := acpi.o
     O_OBJS :=
     M_OBJS :=
     
    @@ -18,7 +17,15 @@
     
     # if the interpreter is used, it overrides arch/i386/kernel/acpi.c
     ifeq ($(CONFIG_ACPI_INTERPRETER),y)
    - O_OBJS += $(ACPI_OBJS)
    + ifeq ($(CONFIG_ACPI),y)
    + O_OBJS += $(ACPI_OBJS)
    + O_TARGET := acpi.o
    + else
    + MIX_OBJS += $(ACPI_OBJS)
    + M_OBJS += acpi.o
    + acpi.o: $(ACPI_OBJS)
    + $(LD) $(EXTRA_LDFLAGS) -r -o $@ $(ACPI_OBJS)
    + endif
     endif
     
     include $(TOPDIR)/Rules.make

    --BAA14202.963302794/freya.yggdrasil.com--

    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.rutgers.edu
    Please read the FAQ at http://www.tux.org/lkml/



    This archive was generated by hypermail 2b29 : Tue Jul 11 2000 - 05:11:55 EDT