At Tue, 17 Jan 2012 21:22:24 +0000, Sad Clouds
<cryintothebluesky%googlemail.com@localhost> wrote:
Subject: alc(4) for NetBSD-5.1.1
>
> Hi, any idea how simple it would be to back-port alc(4) driver from
> NetBSD-current to 5.1.1?
>
> If it's relatively straight forward, a brief how-to would be much
> appreciated.
The simplest thing to try is to just copy the source files for the
driver from -current to a working directory for netbsd-5 that you can
build a kernel from, and then also make any other edits to the netbsd-5
tree that had been made to -current at the time those files were first
added.
For alc(4) this seems to be src/sys/dev/pci/if_alc*.*, and an edit to
src/sys/dev/pci/files.pci, as well as of course edit your kernel config
file and maybe copy src/share/misc/man/man4/alc.4 and edit
distrib/sets/lists/man/mi too. You might also need to edit
src/sys/dev/pci/pcidevs as well and then run "make -f TOOL_AWK=awk
Makefile.pcidevs" in src/sys/dev/pci.
In an ideal world all the edits needed to add such a driver are
committed with one CVS commit and thus the one e-mail message from the
source-changes list should show everything that was done. However I
can't seem to find the CVS commit e-mail containing the commit message
for the initial revision of if_alc.c let alone anything else related
(just using google -- I don't have a local archive of source-changes).
You'll also need to back-port the CFATTACH_*() macro. Here's an example
of how I did it when I tried backporting the wm(4) driver:
+
+#ifdef CFATTACH_DECL3_NEW
CFATTACH_DECL3_NEW(wm, sizeof(struct wm_softc),
wm_match, wm_attach, wm_detach, NULL, NULL, NULL, DVF_DETACH_SHUTDOWN);
+#else
+# ifdef CFATTACH_DECL2_NEW
+CFATTACH_DECL2_NEW(wm, sizeof(struct wm_softc),
+ wm_match, wm_attach, wm_detach, NULL, NULL, NULL);
+# else
+# ifdef CFATTACH_DECL /* #if __NetBSD_Version__ >= 106080000
*/
+CFATTACH_DECL_NEW(wm, sizeof(struct wm_softc),
+ wm_match, wm_attach, NULL, NULL);
+# else
+const struct cfattach wm_pci_ca = {
+ sizeof(struct wm_softc), wm_match, wm_attach
+};
+# endif
+# endif
+#endif
+
The if_ether stuff got a major rework in NetBSD-current too and for
wm(4) I just commented out the new ifflags stuff like this (i.e. the two
places where the compile failed and then the resulting unused func):
+#if __NetBSD_Version__ >= 599003700 /* actually part of the major if_ether
rework? */
ether_set_ifflags_cb(&sc->sc_ethercom, wm_ifflags_cb);
+#endif
(I didn't go far enough on wm(4) to find out if there was something
different needed to be done here -- the latest version of wm(4) seemed
to have too many other problems to ever work right for netbsd-5.
Hopefully things aren't so complex with alc(4).)
Then build your kernel and try booting it! :-)
--
Greg A. Woods
Planix, Inc.
<woods%planix.com@localhost> +1 250 762-7675 http://www.planix.com/
Attachment:
pgpDLV0hhyRYN.pgp
Description: PGP signature