- Linux Device Driver Development Cookbook
- Rodolfo Giometti
- 396字
- 2021-06-24 13:54:05
Conventions used
There are a number of text conventions used throughout this book.
Code words in text folder names, filenames, file extensions, pathnames, dummy URLs and user input are shown as follows: "To get the preceding kernel messages, we can use both the dmesg and tail -f /var/log/kern.log commands."
A block of code is set as follows:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello World!\n");
return 0;
}
You should note that most code in this book has 4-space indentation, while the example code you can find in the files provided with this book on the GitHub or Packt sites uses 8-space indentation. So, the preceding code will look as follows:
#include <stdio.h>
int main(int argc, char *argv[])
{
printf("Hello World!\n");
return 0;
}
Obviously, they are perfectly equivalent in practice!
Any command-line input or output on the embedded kit used in this book is presented as follows:
# make CFLAGS="-Wall -O2" helloworld
cc -Wall -O2 helloworld.c -o helloworld
Commands are in bold, while their output is in normal text. You should also notice that the prompt string has been removed due to space constraints; in fact, on your Terminal, the complete prompt should look like the following:
root@espressobin:~# make CFLAGS="-Wall -O2" helloworld
cc -Wall -O2 helloworld.c -o helloworld
Note also that due to space constraints in the book, you may encounter very long command lines as follows:
$ make CFLAGS="-Wall -O2" \
CC=aarch64-linux-gnu-gcc \
chrdev_test
aarch64-linux-gnu-gcc -Wall -O2 chrdev_test.c -o chrdev_test
Otherwise, I have had to break the command line. However, in some special cases, you can find broken output lines (especially on kernel messages) as follows:
[ 526.318674] mem_alloc:mem_alloc_init: kmalloc(..., GFP_KERNEL) =ffff80007982f
000
[ 526.325210] mem_alloc:mem_alloc_init: kmalloc(..., GFP_ATOMIC) =ffff80007982f
000
Unluckily, these lines cannot easily be reproduced in a printed book, but you should consider them as a single line.
Any command-line input or output given on my host computer as a non-privileged user is written as follows:
$ tail -f /var/log/kern.log
When I need to give a command as a privileged user (root) on my host computer, the command-line input or output is then written as follows:
# insmod mem_alloc.ko
You should note that all privileged commands can be executed by a normal user, too, by using the sudo command in the following format:
$ sudo <command>
So, the preceding command can be executed by a normal user as follows:
$ sudo /insmod mem_alloc.ko
- Linux系統架構與運維實戰
- 鴻蒙生態:開啟萬物互聯的智慧新時代
- Mobile-first Bootstrap
- Google系統架構解密:構建安全可靠的系統
- Kali Linux滲透測試全流程詳解
- Hands-On DevOps with Vagrant
- vSphere Virtual Machine Management
- 巧學活用Windows 7
- 一學就會:Windows Vista應用完全自學手冊
- Red Hat Enterprise Linux 6.4網絡操作系統詳解
- Raspberry Pi入門指南
- Learn Quantum Computing with Python and IBM Quantum Experience
- Azure Resource Manager Templates Quick Start Guide
- Learning Joomla! 3 Extension Development(Third Edition)
- Hadoop Operations and Cluster Management Cookbook