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

|- amd64
   |- objamd64
   |- obji386

Next, in module\BUILD\ put a makefile file building the module:

library = $(module)
!if "$(targ)" == "i386"
# Anything related to i386
asobjs= \
ccarchobjs= \
#  Anything for amd64
ccobjs= \
!include $(ntos)\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.