initial hello
This commit is contained in:
		
							
								
								
									
										15
									
								
								hello/Makefile
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										15
									
								
								hello/Makefile
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,15 @@
 | 
				
			|||||||
 | 
					ifneq ($(KERNELRELEASE),)
 | 
				
			||||||
 | 
					  obj-m := hello.o
 | 
				
			||||||
 | 
					else
 | 
				
			||||||
 | 
					  KERNELDIR ?= /usr/src/linux-headers-4.19.66-v7+
 | 
				
			||||||
 | 
					  PWD := $(shell pwd)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					default:
 | 
				
			||||||
 | 
						$(MAKE) -C $(KERNELDIR) M=$(PWD) modules
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.PHONY: clean
 | 
				
			||||||
 | 
					clean:
 | 
				
			||||||
 | 
						rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions modules.order Module.symvers
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					endif
 | 
				
			||||||
 | 
					
 | 
				
			||||||
							
								
								
									
										20
									
								
								hello/hello.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								hello/hello.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
				
			|||||||
 | 
					/*                                                     
 | 
				
			||||||
 | 
					 * $Id: hello.c,v 1.5 2004/10/26 03:32:21 corbet Exp $ 
 | 
				
			||||||
 | 
					 */                                                    
 | 
				
			||||||
 | 
					#include <linux/init.h>
 | 
				
			||||||
 | 
					#include <linux/module.h>
 | 
				
			||||||
 | 
					MODULE_LICENSE("GPL");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static int hello_init(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						printk(KERN_ALERT "Hello, world\n");
 | 
				
			||||||
 | 
						return 0;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static void hello_exit(void)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
						printk(KERN_ALERT "Goodbye, cruel world\n");
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					module_init(hello_init);
 | 
				
			||||||
 | 
					module_exit(hello_exit);
 | 
				
			||||||
		Reference in New Issue
	
	Block a user