
linux kernel
CaspianSea
这个作者很懒,什么都没留下…
展开
-
modprobe: module '/lib/modules/4.9.13/tun.ko' not found
原因是 modules.dep没有更新。执行 depmod 后就行了。原创 2017-03-12 19:57:08 · 1942 阅读 · 0 评论 -
linux 进程的最大线程个数
1. 可以通过下面的方法查到:cat /proc/sys/kernel/threads-max 15882另外,一个进程实际的线程个数,可以从 /proc/{PID}/status里得出:/proc/544#cat status Name: kpsmousedState: S (sleeping)Tgid: 544Pid: 544PPid: 2TracerPid: 0原创 2015-01-15 02:51:05 · 2443 阅读 · 0 评论 -
What is LTSI
About LTSILTSI is an industry-wide project created and supported by Hitachi, LG Electronics, NEC, Panasonic, Qualcomm Atheros, Renesas Electronics Corporation, Samsung Electronics, Sony and Toshiba转载 2014-12-22 23:32:33 · 1184 阅读 · 0 评论 -
Profiling the kernel
There are several facilities to see where the kernel spendsits resources. A simple one is the profiling function, thatstores the current EIP (instruction pointer) at each clock tick.Boot the kernel转载 2015-01-12 02:04:37 · 1139 阅读 · 0 评论 -
mmap系统调用的实现
1. GLIBC 文件 sysdeps/unix/sysv/linux/generic/wordsize-32/mmap.c:__ptr_t__mmap (__ptr_t addr, size_t len, int prot, int flags, int fd, off_t offset){ if (offset & ((1 << MMAP_PAGE_SHIFT) - 1))原创 2015-01-11 12:45:59 · 1983 阅读 · 0 评论 -
linux 内存映射 remap_pfn_range操作
下面是 mmap的读写例子:转载 2014-11-06 09:08:03 · 1680 阅读 · 0 评论 -
Linux内核和用户空间通信的方式(一)— proc文件和mmap共享内存
动态的将内核空间的物理地址和大小传给用户空间。本文也演示了内核空间和用户空间进行通信可以使用的两种常用方法:proc文件系统和mmap共享内存。整个内核模块,在模块插入时建立proc文件,分配内存。卸载模块的时候将用户空间写入的内容打印出来。以下是内核模块的代码和用户空间的测试代码。转载 2014-11-05 00:19:58 · 2675 阅读 · 2 评论 -
Deep Dive into Contiguous Memory Allocator
This is the first part of an extended versionof an LWN article onCMA. It contains much more detail on how to use CMA, and a lot ofboring code samples. Should you be more interested in an overview,co转载 2014-10-15 02:55:28 · 2838 阅读 · 0 评论 -
arm linux中一些重要的宏及地址定义
1)TEXT_OFFSET 内核在RAM中的起始位置相对于RAM起始地址偏移。值为0x00008000./arch/arm/Makefile111 textofs-y := 0x00008000112 textofs-$(CONFIG_ARCH_CLPS711X):= 0x00028000113 # We don't want the htc bootload转载 2014-09-28 20:32:45 · 1384 阅读 · 0 评论 -
Debug 内核 Oops
内核的Oops有点像用户态的 段错误(segfaults). 通常,CPU寄存器和调用栈信息会被dump出来。利用这些信息,能够查出来发生问题的代码。下面一一个例子来说明。1. 首先,写一个简单的内核模块代码:#include #include #include static void create_oops() { *(int *)0 = 0;} st原创 2013-11-16 03:05:19 · 2791 阅读 · 0 评论 -
内核编译的优化
如果在 make menuconfig里面选择 "Optimize for size",原创 2014-08-14 01:43:26 · 2381 阅读 · 0 评论 -
proc/meminfo新增了 MemAvailable(3.14内核)
这个是 3.14内核的一个新的功能。在3.14的内核上,你能看到一个新的内存指标:available memory. 它和 free memory是不一样的:#cat /proc/meminfo MemTotal: 1033332 kBMemFree: 1022060 kBMemAvailable: 1018904 kBBuffers:原创 2014-09-10 07:06:26 · 12923 阅读 · 0 评论 -
Debugging the Linux Kernel with debugfs
debugfs is a simple memory-based filesystem, designed specifically to debug Linux kernel code, and not to be confused with the debugfs filesystem utility. Introduced by Greg Kroah-Hartman in December转载 2015-01-06 03:08:40 · 1026 阅读 · 0 评论 -
Linked Lists and Work Queues
By Sreekrishnan Venkateswaran Wednesday, March 15th, 2006Several useful helper interfaces exist in the kernel to make life easier for developers. One example is the doubly-link转载 2015-01-06 11:27:05 · 841 阅读 · 0 评论 -
How module init function is called when the module is loaded
It depends on whether the driver is a built-in module or compiled as a loadable module. I'll be talking about a built-in module in this answer (one with y in .config):module_init expands to转载 2015-01-06 00:28:09 · 1080 阅读 · 0 评论 -
Linux kernel 4+ version with QEMU
在最新的 linux kernel上,使用 QMEU模拟 arm vexpress a9的时候,一开始就 stuck了。。 没有任何输出可以看到。问题应该是vexpress的配置文件有问题了。可以通过 指定 DTB 文件来绕过。./qemu-2.8.0/arm-softmmu/qemu-system-arm -M vexpress-a9 -kernel ./linux-4.9.13原创 2017-02-28 02:44:31 · 735 阅读 · 0 评论 -
Device Drivers, Part 1: Linux Device Drivers for Your Girl Friend
This series on Linux device drivers aims to present the usually technical topic in a way that is more interesting to a wider cross-section of readers.“After a week of hard work, we finally got our转载 2016-06-27 10:09:06 · 707 阅读 · 0 评论 -
Writing a Linux device driver module for kernels 2.6 or later with udev
This is a short tutorial for a sample character device module aimed at Linux kernels 2.6 and later (including 3.x and 4.x) using udev.I thought might as well produce my own tutorial, after finding转载 2016-06-27 03:42:41 · 759 阅读 · 0 评论 -
Kdbus Details
Kdbus DetailsJan 15th, 2014 Now that linux.conf.au is over, there has been a bunch of informationrunning around about the status ofkdbus and the integration ofit with systemd. So, here’s a sho转载 2016-05-24 23:41:17 · 973 阅读 · 0 评论 -
How to translate virtual to physical addresses through /proc/pid/pagemap
How to translate virtual to physical addresses through /proc/pid/pagemapI currently work on a project where I need to make translations for virtual addresses of user-level application to physical转载 2015-10-18 10:32:35 · 2343 阅读 · 0 评论 -
Linux Kenrel Network maillist and git
1) mailist:netdev@vger.kernel.orghttp://www.spinics.net/lists/netdev/2)git:for fixes to existing code already in the mainline tree:http://git.kernel.org/cgit/linux/kernel/git/davem/net.g原创 2015-03-10 22:13:25 · 1128 阅读 · 0 评论 -
内核模块参数
在代码中,可以这样写:static int cfg_value = 3;module_param(cfg_value, int, 0764);然后,加载内核的时候,可以添上制定的参数值(不加的话,就是代码的数值)。insmod module_name cfg_value=100内核模块加进来之后,可以在 /sys/module/{module_name}/parameters原创 2015-03-09 22:11:11 · 630 阅读 · 0 评论 -
Linux Kernel Programming–Linked List
Linux kernel has linked-list as a built-in data structure defined in /lib/modules/$(uname -r)/build/include/linux/list.h. Compared with common implementations of linked list, the Linux kernel version转载 2015-03-06 09:08:05 · 1032 阅读 · 0 评论 -
Soft Irqs And Tasklets
Tasklets are implemented on top of softirqs. In kernel source code, both SoftIrq andTaskLet are displayed in "softirq"statically allocated, while tasklets can also be allocated and initialized转载 2015-03-05 21:26:15 · 1005 阅读 · 0 评论 -
中断处理函数和可重入特性
Interrupt handlers in Linux need not be reentrant. When a given interrupt handler is executing, the corresponding interrupt line is masked out on all processors, preventing another interrupt on the sa原创 2015-03-05 00:27:56 · 1740 阅读 · 0 评论 -
A new I/O memory access mechanism
Most reasonably current cards for the PCI bus (and others) provide one ormore I/O memory regions to the bus. By accessing those regions, theprocessor can communicate with the peripheral and make thing转载 2015-03-01 13:28:52 · 538 阅读 · 0 评论 -
内核 OOPS分析
今天在启动 QEMU箱系统的时候,去原创 2014-09-08 21:28:17 · 4733 阅读 · 0 评论 -
QEMU 调试 内核模块(without kgdb)
1. 以 debug模式 启动 QEMU:de/charles@taotao:~/code$ sudo ./qemu-2.0.0/arm-softmmu/qemu-system-arm -S -s -M vexpress-a9 -m 1024 -kernel ./linux-3.10.28/arch/arm/boot/zImage -sd rootfs.img --append "roo原创 2014-09-08 14:25:41 · 1211 阅读 · 0 评论 -
内核里读写文件
不能直接用 sys_read, sys_open, 因为这些函数没有 export出来。可以使用 vfs_原创 2014-06-08 00:41:56 · 810 阅读 · 0 评论 -
SLUB Debug
1。 测试代码如下:#include #include #include #include MODULE_LICENSE("GPL");struct slab_obj { int aa; int bb; int cc;};typedef struct slab_obj *slab_obj_t;slab_obj_t memblk = NULL;struct k原创 2014-05-15 00:48:30 · 6445 阅读 · 0 评论 -
OOM
今天遇到了一个OOM的问题。log如下:原创 2014-04-05 09:19:49 · 1257 阅读 · 0 评论 -
The Kernel Newbie Corner: Kernel and Module Debugging with gdb
This week, we're going to demonstrate how to do some very basic debugging of both your running kernel and a loaded module using the gdb debugger running in user space. But before you get too involved转载 2014-04-06 08:45:15 · 1262 阅读 · 0 评论 -
QEMU + KGDB调试内核模块
1. 以 KGDB模式启动内核:原创 2014-04-06 11:53:55 · 2821 阅读 · 0 评论 -
QEMU 下的命令输出
QEMU窗口默认的缓冲区太小,不知道怎么改变。这带来的一个问题是,原创 2014-04-05 08:45:29 · 3770 阅读 · 0 评论 -
Linux内核spin_lock与spin_lock_irq分析
在Linux内核中何时使用spin_lock,何时使用spin_lock_irqsave很容易混淆。首先看一下代码是如何实现的。spin_lock的调用关系 spin_lock | + -----> raw_spin_lock |+------> _raw_spin_lock转载 2014-02-28 07:57:54 · 839 阅读 · 0 评论 -
What are the __init* and __exit* macros ?
What are the __init* and __exit* macros ?The ''init* and exit* macros are widely used in the kernel. These macros are defined in include/linux/init.h :#define __init __attribute__ ((_转载 2014-02-28 03:45:30 · 952 阅读 · 0 评论 -
QEMU 模拟 MIPS
一直想用QEMU 模拟 MIPS, 尝试了很多次,今天终于有了进展.执行命令:sudo ./qemu/mipsel-softmmu/qemu-system-mipsel -M malta -kernel ./linux-3.12/vmlinux -hda mips_rootfs.img --append "root=/dev/hda rw rootfs=ext3 rootdelay=3原创 2014-01-29 00:10:30 · 10032 阅读 · 2 评论 -
QEMU 调试内核
这个比较简单,首先,启动 qemu的时候,加上 -S -s 参数: qemu-system-arm -S -s -M vexpress-a9 -kernel ./linux-3.2/arch/arm/boot/zImage -sd rootfs.img --append "root=/dev/mmcblk0 rw rootfs=ext3 rootdelay=3 physmap.enabled原创 2013-12-16 09:13:22 · 1775 阅读 · 0 评论 -
使用 QEMU 测试 U-BOOT
还是模拟 VEXPRESS-A9.起初,我用的还是qemu官网里的最新代码变出的qemu程序。u-boot从下面的网址获得:http://ftp.denx.de/pub/u-boot/取得是最新的代码。解压后,配置,编译:make vexpress_ca9x4_configexport ARCH=armexport CROSS_COMPILE=arm-linux-gnu原创 2013-10-24 02:22:11 · 6903 阅读 · 0 评论 -
使用 GIT 获得Linux Kernel的代码并查看,追踪历史记录
Linux kernel 的官方 GIT地址是:http://git.kernel.org/cgit/linux/kernel/git/stable/linux-stable.git可以从这个地址拿到 kernel 的 代码仓库。1. 拿代码仓库git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux原创 2014-05-07 02:55:06 · 14782 阅读 · 1 评论