More advanced character device with read, write, open and release
This commit is contained in:
		
							parent
							
								
									bb9bce27f6
								
							
						
					
					
						commit
						83db8ec77e
					
				
					 3 changed files with 177 additions and 0 deletions
				
			
		
							
								
								
									
										23
									
								
								chardev/Makefile
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								chardev/Makefile
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,23 @@
 | 
			
		|||
# This is a standard makefile for building a kernel module.
 | 
			
		||||
# It looks a bit backwards compared to a normal makefile, but that's because
 | 
			
		||||
# the kernel supplies its own sub-makefile that we use to build the module.
 | 
			
		||||
# 
 | 
			
		||||
# The M= option tells the kernel's makefile where to find the module's source
 | 
			
		||||
# files, and the -C option sets the context directory for make.
 | 
			
		||||
#
 | 
			
		||||
# The obj-m variable tells the kernel's makefile what the module's object file
 | 
			
		||||
# should be called. In this case, it's demo_module.o. This is how the sub-makefile
 | 
			
		||||
# infers the name of the module's source file.
 | 
			
		||||
# 
 | 
			
		||||
# This build is highly sensitive to compiler version, and requires the system gcc
 | 
			
		||||
# to be the same version as the gcc that built the current kernel.
 | 
			
		||||
#
 | 
			
		||||
# For more info, see: https://www.kernel.org/doc/html/latest/kbuild/modules.html
 | 
			
		||||
 | 
			
		||||
obj-m = chardev.o
 | 
			
		||||
 | 
			
		||||
all:
 | 
			
		||||
	make -C /lib/modules/$(shell uname -r)/build/ M=$(PWD) modules
 | 
			
		||||
 | 
			
		||||
clean:
 | 
			
		||||
	make -C /lib/modules/$(shell uname -r)/build M=$(PWD) clean
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue