# How to compile a newly created file while building kernel



## jr.santhoshkumar (May 15, 2019)

I have created a new file called /usr/src/sys/amd64/amd64/hibernate_machdep.c
In this file, I have defined a function and I declare that function in /usr/src/sys/sys/hibernate.h
I called that function in acpi.c file 
I have included  this header in file in both "hibernate_machdep.c" and "acpi.c"
while building kernel, it shows an error of unable to find the definition.

Please give solution for compiling that newly created file while building.


----------



## ralphbsz (May 16, 2019)

Find the make file in the directory.  Update it.  I assume you know about make file syntax, and how the kernel make system works?  If not, you are in for an interesting voyage of discovery.


----------



## jr.santhoshkumar (May 17, 2019)

There is a file called files.amd64
This file has the entry of what are all the files which is inside the directory of "/usr/src/sys/amd64/amd64/ " has to be compiled while building kernel

If we create a new entry for our newly created file, while building our newly created file also get compiled.


----------



## Barney (Jul 22, 2019)

Note that you have to run config when you add new files for the new files to get included in the Makefile.


----------

