This is the fourth part of the WRK series. For your convenience you can find other parts in the table of contents in Part 1 — Compiling and debugging
To create a new module, you need to prepare some directories and a make file. First, create the following structure in base\ntos
1 2 3 4 5 6 |
module |- amd64 |- BUILD |- objamd64 |- obji386 |-i386 |
Next, in module\BUILD\
put a makefile
file building the module:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
library = $(module) !if "$(targ)" == "i386" # Anything related to i386 asobjs= \ $(OBJ)\x86asmmodule.obj ccarchobjs= \ $(OBJ)\x86cmodule.obj !else # Anything for amd64 !endif ccobjs= \ $(OBJ)\module.obj !include $(ntos)\BUILD\makefile.build |
At the end, you need to tell the global makefile to include your module in the building process. Go to base\ntos\makefile
and add your module in line 26 (list of modules modules = rtl …).
Recompile and you are good to go.