User`s guide
60
7. Linux
Linux
3.Making driver module
(1)Copying the driver source file
Copy the driver source file to the directory which includes PCMCIA Client Driver source.
(The directory normally means pcmcia-cs clients directory)
If there is the extracted driver source file in the directory /root/cb32, type the command as written below.
# cd /usr/src/linux-2-2.12/pcmcia-cs-3.0.14/clients
# cp /root/cb32/src/* .
# cp /root/cb32/lib/* .
The cb32i850.c , cb32i850.h , cb32scsi.c , cb32scsi.h , load_fw.o files will be copied.
(2)Editing Makefile
Add the seven lines below to Makefile in the clients directory to compile cb32_cb.
cb32_cb.o : cb32i850.c cb32scsi.c cb32i850.h cb32scsi.h
$(CC) -MD -c $(XFLAGS) $(CPPFLAGS) I$(LINUX) cb32i850.c -o cb32i850.o
@mkdir -p .depfiles ; mv cb32i850.d.depfiles
$(CC) -MD -c $(XFLAGS) $(CPPFLAGS) I$(LINUX) cb32scsi.c -o cb32scsi.o
@mkdir -p .depfiles ; mv cb32scsi.d.depfiles
$(LD) r o $@ cb32i850.o cb32scsi.o load_fw.o
rm -f cb32i850.o cb32scsi.o ; chmod x $@
Refer to the Makefile in the [samples] folder.
(3)Editing proc_fs.h
Go to the include/linux directory.
# cd /usr/src/linux-2.2.12/include/linux
Edit proc_fs.h to add [PROC_SCSI_CB32, ] right after [PROC_SCSI_INIA100, ] line.
Refer to the proc_fs.h in the [samples] folder.
If you can find proc_fs.h in the directory /usr/include/linux, edit it in the same way.
(4)Compiling cb32_cb
Compile cb32_cb with make command.
# make cb32_cb.o
Caution: If you get the error message saying [Makefile:8: ../config.mk:No such file or directory make: ***
No rule to make target ‘../conifg.mk’. Stop], Move up one directory and execute [make config].
You will get config.mk. Then move back to the clients directory and execute make command.
# cd ..
# make config
# cd clients