Ubuntu下编译Hello World驱动并运行全过程
#include<linux/init.h> //初始换函数#include<linux/kernel.h> //内核头文件#include<linux/module.h> //模块的头文件static int hello_init(void){printk("aldrich Hello, world\n");return0;}staticvoid hello_exit(void){printk("aldrich Goodbye,Hello world\n");}module_init(hello_init);module_exit(hello_exit);MODULE_LICENSE("BSD/GPL");
obj-m:=hello.oKERNELDIR:=/lib/modules/`uname -r`/buildPWD :=$(shell pwd)modules:$(MAKE) -C $(KERNELDIR) M=$(PWD) modulesclean:rm -rf *o *.mod.c *.order *.symvers
sudo make
make -C /lib/modules/`uname -r`/build M=/home/aldrich/work/hello modulesmake[1]:Entering directory '/usr/src/linux-headers-4.4.0-31-generic'CC [M]/home/aldrich/work/hello/hello.oBuilding modules, stage 2.MODPOST 1 modulesCC /home/aldrich/work/hello/hello.mod.oLD [M]/home/aldrich/work/hello/hello.komake[1]:Leaving directory '/usr/src/linux-headers-4.4.0-31-generic'
hello.c hello.mod.c hello.o modules.orderhello.ko hello.mod.o MakefileModule.symvers
sudo insmod hello.ko
sudo lsmod
Module Size Used byhello 16384 0
sudo rmmod hello
cat /var/log/syslog |grep world
Feb2019:33:17 tom kernel:[3792.439223] aldrich Hello, worldFeb2019:33:50 tom kernel:[3824.708500] aldrich Goodbye,Hello world
Ubuntu下编译Hello World驱动并运行全过程的更多相关文章
- Ubuntu下编译C++ OpenCV程序并运行
因为想试跑yolov3的缘故,所以装了ubuntu系统,直接通过U盘装的,并不像他们说的“折腾”,反而一切非常顺利,比装软件还简单.然后就是要用C++跑opencv的程序用于比赛,出于 ...
- 【转】在Ubuntu下编译Android源码并运行Emulator
原文网址:http://www.mcuos.com/thread-4553-1-1.html 建立编译环境 1.在VirtualBox上安装Ubuntu 2.安装JDK $ sudo apt-ge ...
- ubuntu下编译VLC
ubuntu下编译VLC 标签(空格分隔): ubuntu vlc 视频 编译 [TOC] 1.下载VLC源码包并解压 VLC的源码包在VLC的官网有,可以直接下载.也可以使用git来clone一个. ...
- Ubuntu下安装nvidia显卡驱动
layout: post title: Ubuntu下安装nvidia显卡驱动 date: 2015-10-02 17:19:06 categories: 常用命令 tags: 显卡 驱动 最近一直在 ...
- 在Ubuntu下编译Assimp库
在Ubuntu下编译Assimp库 怎样在Ubuntu下编译Assimp库?这是我曾经编译成功后做的笔记,供參考. 1.去以下的站点去下载Assimp库: http://assimp.sourcefo ...
- ubuntu下编译java程序
ubuntu下编译java程序 首先需要安装jdk,并配置好相应环境变量 下面以简单的HelloWorld为例 文件名为HelloWorld.java java代码: public class Hel ...
- ubuntu下编译VLC源码
http://blog.csdn.net/beitiandijun/article/details/9225591ubuntu下编译VLC源码 分类: 视频处理 2013-07-02 17:33 57 ...
- ubuntu下编译caffe
Ubuntu下编译caffe 纯粹是个人编译的记录.不用CUDA(笔记本是amd卡,万恶的nvidia):不手动编译依赖包(apt-get是用来干啥的?用来直接装二进制包,以及自动解决依赖项的) ca ...
- 在Ubuntu下编译wpa_supplicant
最近在研究WiFi联盟的多屏互动协议Miracast,其中需要用到wpa_supplicant,编译中遇到了一些问题,经过一下午的折腾也都解决了,下面分享给各位. 一.编译需要用到三个库源码包,分别是 ...
随机推荐
- POJ 2914 Minimum Cut (全局最小割)
[题目链接] http://poj.org/problem?id=2914 [题目大意] 求出一个最小边割集,使得图不连通 [题解] 利用stoerwagner算法直接求出全局最小割,即答案. [代码 ...
- Mybatis中的XML中需要用到的转义符号整理
使用这么久的Mybatis中需要转义的符号整理一下,小结一下: 1. < 小于符号 < 2. <= 小于等于 ...
- 使用ARC也可能发生内存泄露
1,循环参照 A有个属性参照B,B有个属性参照A,如果都是strong参照的话,两个对象都无法释放. 这种问题常发生于把delegate声明为strong属性了. 例, @interface Samp ...
- linux之ssh命令
ssh命令用于远程登录上Linux主机. 常用格式:ssh [-l login_name] [-p port] [user@]hostname更详细的可以用ssh -h查看. 不指定用户: ssh 1 ...
- ASP.NET 5基础之中间件
来源https://docs.asp.net/en/latest/fundamentals/middleware.html 一些可以整合进http请求管道的小的应用组件称做中间件.ASP.NET 5集 ...
- [置顶]
kubernetes资源对象--ResourceQuotas
概念 Resource Quotas(资源配额,简称quota)是对namespace进行资源配额,限制资源使用的一种策略. K8S是一个多用户架构,当多用户或者团队共享一个K8S系统时,SA使用qu ...
- 设计模式之过滤器模式(php实现)
/** * github地址:https://github.com/ZQCard/design_pattern * 过滤器模式(Filter Pattern)或标准模式(Criteria Patter ...
- RSA加密解密及数字签名Java实现
http://my.oschina.net/jiangli0502/blog/171263
- 在elasticsearch里如何高效的使用filter
今天在做查询category的时候,遇到一个问题,查询出来的cateogry为food,fun的形式.但是我需要的只是food或者fun 不包含逗号. 开始想着在aggs后再做过滤,这样有些麻烦.遂在 ...
- ElasticSearch的内存设置
编辑ElasticSearch中bin目录下 vi elasticsearch中 加上 export ES_HEAP_SIZE=24g 修改配置文件 config/elasticsearch.ya ...