linux-device-driver

What is the difference between a Linux platform driver and normal device driver?

半世苍凉 提交于 2019-11-26 12:35:03
问题 I previously had a thought about the platform driver as well as normal device driver like : Platform driver is for those devices that are on chip. Normal device driver are for those that are interfaced to the processor chip. Before coming across one i2c driver... But here, I am reading through multi function i2c driver defined as platform driver. I had gone through https://www.kernel.org/doc/Documentation/driver-model/platform.txt. But still could not get clear idea to come to an conclusion

Just black screen after running Qemu

萝らか妹 提交于 2019-11-26 10:03:24
问题 I have just installed QEMU and compiled linux kernel with ARM support but when I run below command qemu-system-arm -M versatilepb -m 128M -kernel /home/arit/QEMU/linux-3.8.4/arch/arm/boot/uImage -append \"console=tty1\" I could only see Black screen ,I also tried what is being suggested in below thread Qemu shows a black screen But still it didn\'t work. Following is the output of make command which I run to compile kernel Source make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage -s

kernel stack and user space stack

╄→尐↘猪︶ㄣ 提交于 2019-11-26 08:40:26
问题 What\'s the difference between kernel stack and user stack? Why kernel stack is used? If a local variable is declared in an ISR, where it will be stored? Does each process has its own kernel stack? Then how the process coordinates between both these stacks? 回答1: What's the difference between kernel stack and user stack ? In short, nothing - apart from using a different location in memory (and hence a different value for the stackpointer register), and usually different memory access

cat function calling read() infinite times

瘦欲@ 提交于 2019-11-26 08:39:19
问题 I am working on simple character device driver. I have implemented read and write functions in the module, the problem is when I try to read the device file using cat /dev/devicefile it is going into infinite loop i.e. reading the same data repeatedly. Can someone suggest me any solution to this problem? Below is my driver code. #include<linux/module.h> #include<linux/fs.h> #include<linux/string.h> #include<asm/uaccess.h> #include<linux/init.h> MODULE_LICENSE(\"GPL\"); MODULE_DESCRIPTION(\

How to mmap a Linux kernel buffer to user space?

人盡茶涼 提交于 2019-11-26 08:15:12
问题 Let\'s say the buffer is allocated using a page based scheme. One way to implement mmap would be to use remap_pfn_range but LDD3 says this does not work for conventional memory. It appears we can work around this by marking the page(s) reserved using SetPageReserved so that it gets locked in memory. But isn\'t all kernel memory already non-swappable i.e. already reserved? Why the need to set the reserved bit explicitly? Does this have something to do with pages allocated from HIGH_MEM? 回答1:

How to use netlink socket to communicate with a kernel module?

て烟熏妆下的殇ゞ 提交于 2019-11-26 03:47:09
问题 I am trying to write a linux kernel module that communicates with user process using netlink. I am using netlink because the user program I want to communicate to communicates only using sockets and I cant change that to add ioctl() or anything. Problem is that I cant figure out how to do that. I have googled but all examples I found are for old like this one and no longer valid for current kernel versions. I have also looked at this SO question but the sample here uses libnl for socket