Linux Device Driver 学习(1)

一、搭建虚拟机开发环境

1、选择虚拟机VirtualBox,官网下载.deb包安装;

VirtualBox Linux 5.1.6

下载fedora 24 workstation iso镜像

Fedora 24 WorkStation

具体虚拟机的安装和Fedora的安装,这里不再详细描述,可以自己在网上找到。

第一次使用Fedora,估计也有很多坑。

特别的,如果使用Ubuntu在安装的时候如果没选择安装源码,则在/usr/src下虽然可以看到几个linux-headers,但是配置make oldconfig,make prepare时找不到arch文件,一样需要下载源码包.(网上有人给出不需要下载的方法,看上去比较复杂,没有尝试,以后可以实验下)

我的电脑是Ubuntu16.04,安装linux源码的方法为:

先查看可以安装的包

apt-cache search linux-source

出现:

linux-source - Linux kernel source with Ubuntu patches
linux-source-4.4.0 - Linux kernel source for version 4.4.0 with Ubuntu patches

这里选择了后面一个,

sudo apt install linux-source-4.4.0

静等安装好,会在/usr/src中多一个linux-source-4.4.0.tar.bz2,源代码都在这里,解压好后进入目录,

make oldconfig

make

make bzImage

当然,第一个make也可以不执行,直接make bzImage。执行结束后,可以看到在当前目录下生成了一个新的文件: vmlinux, 其属性为-rwxr-xr-x。

然后 :

make modules

make modules_install

这里应该会多一个内核版本,及完整的内核树

但是因为不建议直接在自己的开发机上调试内核,所以还是等虚拟机安装完再配置Fedora的开发环境。

Linux Device Driver 学习(1)的更多相关文章

  1. linux device driver —— 环形缓冲区的实现

    还是没有接触到怎么控制硬件,但是在书里看到了一个挺巧妙的环形缓冲区实现. 此环形缓冲区实际为一个大小为bufsize的一维数组,有一个rp的读指针,一个wp的写指针. 在数据满时写进程会等待读进程读取 ...

  2. how to write your first linux device driver

    how to write your first linux device driver 0. environment-ubuntu 1804 64bit 1. apt-get install linu ...

  3. Linux Device Driver && Device File

    catalog . 设备驱动程序简介 . I/O体系结构 . 访问设备 . 与文件系统关联 . 字符设备操作 . 块设备操作 . 资源分配 . 总线系统 1. 设备驱动程序简介 设备驱动程序是内核的关 ...

  4. How to learn linux device driver

    To learn device driver development, like any other new knowledge, the bestapproach for me is to lear ...

  5. <<linux device driver,third edition>> Chapter 4:Debugging Techniques

    Debugging by Printing printk lets you classify messages accoring to their severity by associating di ...

  6. <<linux device driver,third edition>> Chapter 3:Char Drivers

    The Internal Representation of Device Numbers Within the kernel,the dev_t type(defined in linux/type ...

  7. linux device driver —— ioctl

    实现了应用程序和设备驱动通过ioctl通信.还是对设备驱动没什么感觉,贴一下代码吧. 在Ubuntu 16.04 64bit中测试通过 ioctldemo.c #include <linux/m ...

  8. linux device driver —— 字符设备

    现在对linux设备驱动还没有什么认识,跟着书上敲了一个字符驱动,这里把代码贴一下. 测试环境是 Ubuntu 16.04 64bit 驱动程序: #include <linux/fs.h> ...

  9. <<linux device driver,third edition>> Chapter 2: Building and Running Modules

    Kernel Modules Versus Applications Kernel modules programming is similar to event driven programming ...

随机推荐

  1. SparseArray浅析

    HashMap是java里比较常用的一个集合类,我们一般用来缓存一些处理后的结果.但当你做一个Android项目时,在代码中定义这样一个变量,实例化时,Eclipse却给出了一个 performanc ...

  2. 一个IP绑定多个域名的实现方法

    方案一: 文字叙述: 具体步骤如下:比如讲apache服务器127.0.0.1 配置成 www.sohu.com 首先在http.conf文件中 做如下处理: ①关闭默认的 #DocumentRoot ...

  3. 豆瓣api获取图片403

    1.问题描述 豆瓣的图片资源在网页中不能正常显示,403禁止访问,把地址放到浏览器中就可以正常访问了? 原因是豆瓣现在有防盗链 2.解决问题 在页面中加上 <meta name="re ...

  4. 如何在html中引入jsx文件

    不使用webpack工具做react项目 1.引入react相关js文件 <script src="https://cdn.staticfile.org/react/16.4.0/um ...

  5. 百度地图API示例 JS

    http://developer.baidu.com/map/jsdemo.htm#c2_2

  6. lightoj 1085【离散化+树状数组】

    题意: 求所有的上升子序列种数: 思路: 我想先离散化一下,然后用树状数组维护一下. 最终答案就是sum(n) ? 卧槽,好像是:然后就过了.. #include <bits/stdc++.h& ...

  7. hoj2798 Globulous Gumdrops

    Globulous Gumdrops My Tags   (Edit)   Source : 2008 Stanford Programming Contest   Time limit : 1 se ...

  8. spring框架——依赖注入

    依赖注入:DI 又称控制反转:IoC 项目名字spring_DI 一.implement包中定义了两个接口Food和Person 1.接口Food package org.interfaces; pu ...

  9. Java 时区(转)

    http://blog.csdn.net/wangpeng047/article/details/8560690

  10. day01 包 权限修饰符 static final