Enc28j60 NIC Driver Module is added to Linux kernel, Kconfig, Makefile configuration process, enc28j60kconfig
Here we want. You only need to modify the configuration script files in the kernel directory, such as Makefile, Kconfig, And. config.
Several files used by the enc28j60 NIC Driver Module:
Enc28j60. c
Enc28j60_h1_h
Spi_bitbang.c
Spi_s3c24xx.c
Spi_platform_dev.c
In fact, spi_bitbang.c and spi_s3c24xx.c are kernel native files and do not need to be modified. In. Therefore, you need to manually load the two files.
Here, we add
Enc28j60. c
Enc28j60_h1_h
Spi_platform_dev.c
These three files are enough.
The two files enc28j60. c, enc28j60_h1_h are platform-independent network drivers, so they are placed under the linux-2.6.22.6/drivers/net directory.
Spi_platform_dev.c is directly related to the platform hardware, so it is placed in the linux-2.6.22.6/arch/arm/plat-s3c24xx directory.
1. Add the spi module to the kernel
A. Go to the linux-2.6.22.6 source code directory
Make makeconfig
In this way, the Kernel configuration menu of the graphic interface is displayed in the middle end, And the SPI-related configuration is found:
Device Drivers --->
SPI support --->
[*] SPI support
[*] SPI Master Support
<*> Bitbanging SPI master
<*> Samsung S3C24XX series SPI
<M> Samsung S3C24XX series SPI by GPIO
In the [] or <> entry, press the Space key. The "*" symbol indicates that the related module files are added to the kernel. The "M" symbol indicates that the related files are compiled into modules without being added to the kernel, space indicates not configuring: as shown in Figure
[*] SPI support settings Add the linux-2.6.22.6 \ drivers \ spi directory to the upper drivers directory
[*] Added SPI. c to kernel in spi Master Support settings
<*> Added spi_bitbang.c to the kernel in the Bitbanging SPI master Settings.
<*> Added spi_s3c24xx.c to the kernel and added the hardware SPI for Samsung S3C24XX series SPI settings.
<M> Samsung S3C24XX series SPI by GPIO is set to generate the spi_s3c24xx_gpio.c module to simulate SPI
B. Exit the configuration menu, save, will generate the. config file under the linux-2.6.22.6 source directory.
Vi. config
Find the SPI Configuration:
## SPI support#CONFIG_SPI=y# CONFIG_SPI_DEBUG is not setCONFIG_SPI_MASTER=y## SPI Master Controller Drivers#CONFIG_SPI_BITBANG=y# CONFIG_SPI_BUTTERFLY is not setCONFIG_SPI_S3C24XX=yCONFIG_SPI_S3C24XX_GPIO=m## SPI Protocol Masters## CONFIG_SPI_AT25 is not set# CONFIG_SPI_SPIDEV is not set
Correspondence:
[*] Configure CONFIG_SPI = y for SPI support
[*] Configuration CONFIG_SPI_MASTER = y corresponding to SPI Master Support
<*> Bitbanging SPI master generates CONFIG_SPI_BITBANG = y
.......
[] Or <> it contains spaces, corresponding to generating CONFIG_XXX is not set
That is to say, if you do not use the make menuconfig GUI, you can directly modify the. config file.
C. The configuration relationship between Kconfig and Makefile at each layer
Linux-2.6.22.6 \ drivers \ Kconfig
... ...source "drivers/spi/Kconfig"... ...
Linux-2.6.22.6 \ drivers \ Makefile
... ...obj-$(CONFIG_SPI) += spi/... ...
Linux-2.6.22.6 \ drivers \ spi \ Kconfig, the configuration in this file is used to make the menu items in menuconfig display, such as after make menuconfig. "Config SPI" generates a macro for CONFIG_SPI in linux-2.6.22.6 \. config,
[*] SPI support in make menuconfig corresponds to the configuration CONFIG_SPI = y
... ...config SPI bool "SPI support" help The "Serial Peripheral Interface" is a low level synchronous protocol. Chips that support SPI can have data transfer rates up to several tens of Mbit/sec. Chips are addressed with a controller and a chipselect. Most SPI slaves don't support dynamic device discovery; some are even write-only or read-only. SPI is widely used by microcontrollers to talk with sensors, eeprom and flash memory, codecs and various other controller chips, analog to digital (and d-to-a) converters, and more. MMC and SD cards can be accessed using SPI protocol; and for DataFlash cards used in MMC sockets, SPI must always be used. SPI is one of a family of similar protocols using a four wire interface (select, clock, data in, data out) including Microwire (half duplex), SSP, SSI, and PSP. This driver framework should work with most such devices and controllers.... ...config SPI_MASTER boolean "SPI Master Support" help If your system has an master-capable SPI controller (which provides the clock and chipselect), you can enable that controller and the protocol drivers for the SPI slave chips that are connected.... ...config SPI_BITBANG tristate "Bitbanging SPI master" depends on SPI_MASTER && EXPERIMENTAL help With a few GPIO pins, your system can bitbang the SPI protocol. Select this to get SPI support through I/O pins (GPIO, parallel port, etc). Or, some systems' SPI master controller drivers use this code to manage the per-word or per-transfer accesses to the hardware shift registers. This is library code, and is automatically selected by drivers that need it. You only need to select this explicitly to support driver modules that aren't part of this kernel tree.... ...config SPI_S3C24XX tristate "Samsung S3C24XX series SPI" depends on SPI_MASTER && ARCH_S3C2410 && EXPERIMENTAL help SPI driver for Samsung S3C24XX series ARM SoCs... ...
Linux-2.6.22.6 \ drivers \ spi \ Makefile
... ...obj-$(CONFIG_SPI_MASTER) += spi.o... ...obj-$(CONFIG_SPI_BITBANG) += spi_bitbang.o... ... obj-$(CONFIG_SPI_S3C24XX) += spi_s3c24xx.o... ...
D. After modifying the preceding configuration, enter:
Make uImage
Compile and wait patiently ..............
After compilation, observe the compilation output information to verify whether the data has been compiled into the kernel. It is hard to find too much output information for the first compilation. Yes
Spi_bitbang.c
Spi_s3c24xx.c
Enter a space in the blank space, save the space, and compile the two files. The following information is displayed:
... ... CC drivers/spi/spi_bitbang.o CC drivers/spi/spi_s3c24xx.o... ...
Now, the SPI driver has been added to the kernel.
2. The method for adding an enc28j60 driver is similar. Here, we only show the modifications based on the JZ2440 built-in kernel. We will not analyze the configuration relationship between Kconfig and Makefile.
Linux-2.6.22.6 \ drivers \ net \ Kconfig
... ...config ENC28J60 tristate "ENC28J60 support" depends on NET_ETHERNET ---help--- Support for ENC28J60 chipset. To compile this driver as a module, choose M here and read <file:Documentation/networking/net-modules.txt>. The module will be called enc28j60.... ...
Linux-2.6.22.6 \ drivers \ net \ Makefile
... ... obj-$(CONFIG_ENC28J60) += enc28j60.o... ...
Make menuconfig
Device Drivers ---> Network device support ---> Ethernet (10 or 100Mbit) ---> <*> ENC28J60 support
Linux-2.6.22.6 \ arch \ arm \ plat-s3c24xx \ Makefile
... ... obj-$(CONFIG_CPU_S3C244X) += s3c244x.o spi_platform_dev.o... ...
3. recompile
Make uImage
4. Burn writing
Burn uImage TO THE DEVELOPMENT BOARD
5. Start
A. Check the kernel print information after it is started:
View driver Loading
B. Configure eth1 (enc28j60) after mounting the system file)
Vi/etc/init. d/rcS
Add:
Ifconfig eth1 192.168.1.12 netmask 255.255.255.0 up
Restart to check Network Configuration
Disable eth0 and automatically switch to eth1 to mount nfs
Now, enc28j60 is working properly.