Patch: remove DB dependence of linux-2.4.9/drives/scsi/aic7xxx/aicasm
Subsystems (2)
First of all, thanks for the quick reply, Justin.
Quoted 8 lines
Quoted 1 line
= Adam Richter
= Justin Gibbs
Quoted 4 lines
Currently, building Justin Gibbs's otherwise excellent
aic7xxx driver requires the Berkeley DB library, because the aic7xxx assembler that is used in the build process uses db basically just to implement associative arrays in memory.
Quoted 5 lines
You don't need to use the assembler. Compiled firmware is provided in every distrubution I've made, including the one in the 2.4.9 kernel. The default is to *not* build the firmware. Just make sure that you don't have this option inadvertantly turned on in your config and you should be happy.
I understand, and that is helpful, but I want to build
everything from sources.
Quoted 9 lines
A wise CS proff once said, "Smart programmers are lazy. They re-use stuff rather than write it over and over again." In this case, I was able to implement my symbol table in all of 5 mintues without the need to debug the code that implements its core. It may seem like overkill, but it allowed me to focus on the important things, like making the assembler useful. The assember dates from 1995, which might explain why it uses the dbv1 interface.
"If it ain't broke, don't fix it."
That was probably a good use of your time, and those are
good reasons in the absense of arguments to the contrary. However, in this case, there are arguments to the contrary, so it is a question of which arguments outweigh the others. The arguments for accepting a trival DB implementation (I'm not asking you to write it) are:
1. It eliminates another dependence for doing a complete source build.
2. It potentially eliminates a dependence on a GPL'ed library, a policy preference of at least one Linux distribution that I can think of (Debian), and probably a preference of some users.
3. (New) it's a handy fallback in case somone finds a buggy DB implementation.
Anyhow, I've done it. I have verified that the following
patch builds and produces the same aic7xxx_seq.h file, and produces a aic7xxx_regs.h file that differs only in the order that the "#define" statements are emitted (I checked by sorting both files and seeing that the results were identical). The new trivialdb.{c,h} files compile under gcc-3.0 without complaint, even with "-Wall".
I ask that you please include this patch, and/or tell Linus that
you think it's OK to apply. If you don't like this patch, how about using this patch, but with the "CONFIG_AICASM_TRIVALDB=y" line in the Makefile commented out? That will produce the old behavior but allow use of trivialdb.{c,h} by just uncommenting one line.
Signature · 4 lines
Adam J. Richter __ ______________ 4880 Stevens Creek Blvd, Suite 104 [email protected] \ / 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."
drivers/scsi/aic7xxx/aicasm/Makefile +15 -2
@@ -5,10 +5,20 @@ DEPHDRS= aicdb.h GENHDRS= y.tab.h aicdb.h +# Comment out the next line to use your system's local Berkeley DB functions. +CONFIG_AICASM_TRIVIALDB=y +ifeq ($(CONFIG_AICASM_TRIVIALDB),y) + HAVE_TRIVIALDB=true + GENSRCS += trivialdb.c +else + HAVE_TRIVIALDB=false + AICASM_DB=-ldb +endif + SRCS= ${GENSRCS} ${CSRCS} CLEANFILES= ${GENSRCS} ${GENHDRS} y.output # Override default kernel CFLAGS. This is a userland app. -AICASM_CFLAGS:= -I/usr/include -I. -ldb +AICASM_CFLAGS:= -I/usr/include -I. $(AICASM_DB) YFLAGS= -d NOMAN= noman
@@ -31,7 +41,9 @@ $(AICASM_CC) $(AICASM_CFLAGS) $(SRCS) -o $(PROG) aicdb.h: - @if [ -e "/usr/include/db3/db_185.h" ]; then \ + if $(HAVE_TRIVIALDB) ; then \ + echo "#include \"trivialdb.h\"" > aicdb.h; \ + elif [ -e "/usr/include/db3/db_185.h" ]; then \ echo "#include <db3/db_185.h>" > aicdb.h; \ elif [ -e "/usr/include/db2/db_185.h" ]; then \ echo "#include <db2/db_185.h>" > aicdb.h; \
@@ -45,3 +57,4 @@ clean: rm -f $(CLEANFILES) $(PROG) +
drivers/scsi/aic7xxx/aicasm/trivialdb.h +64 -0
64 lines not on this page · raw message
drivers/scsi/aic7xxx/aicasm/trivialdb.c +149 -0
149 lines not on this page · raw message
Quoted 10 lines
Quoted 9 lines
A wise CS proff once said, "Smart programmers are lazy. They re-use stuff rather than write it over and over again." In this case, I was able to implement my symbol table in all of 5 mintues without the need to debug the code that implements its core. It may seem like overkill, but it allowed me to focus on the important things, like making the assembler useful. The assember dates from 1995, which might explain why it uses the dbv1 interface.
"If it ain't broke, don't fix it."
Quoted 7 lines
That was probably a good use of your time, and those are
good reasons in the absense of arguments to the contrary. However, in this case, there are arguments to the contrary, so it is a question of which arguments outweigh the others. The arguments for accepting a trival DB implementation (I'm not asking you to write it) are:1. It eliminates another dependence for doing a complete source build.
In the past, although firmware was available in source form, the tools were not. You always had to rely on the precompiled firmware to build a kernel. If you really insist on building the firmware, you're probably an aic7xxx developer (okay, you're an exception, but I don't understand why your so interested in building it...), and are willing to understand what's involved in tweaking the firmware, its assembler, etc. Prior to the new driver coming into the tree, did you pull down the FreeBSD sources to the aicasm utility and port it to Linux so you could build everything from source? 8-)
Quoted 3 lines
2. It potentially eliminates a dependence on a GPL'ed library, a policy preference of at least one Linux distribution that I can think of (Debian), and probably a preference of some users.
DB v1.85 isn't GPLed.
Quoted 2 lines
3. (New) it's a handy fallback in case somone finds a buggy DB implementation.
There is always DB 1.85...
Quoted 1 line
Anyhow, I've done it.
And unfortunately its GPLed. The rest of the driver and assembler are available, optionally, under the more lenient BSD style copyright. As the driver runs on multiple platforms, many of which dislike the GPL, I cannot allow GPL only code into the core portions of the driver.
Additional code, is, well, additional code - to understand and/or maintain. Libraries were invented to avoid this problem. So I used a library, along with several other tools (yacc, lex), to make my life easier. These decisions don't make aicasm a good bootstraping utility, but aicasm isn't needed to bootstrap the system. It isn't needed to build the kernel. You seem to have a solution in search of a problem.
--
Justin