- 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
- Windows Server 2019 Cookbook
- Learn Helm
- PLC控制系統(tǒng)應(yīng)用與維護(hù)
- 無(wú)蘋(píng)果不生活 The New iPad隨身寶典
- Distributed Computing with Go
- Windows Vista終極技巧金典
- Linux網(wǎng)絡(luò)操作系統(tǒng)項(xiàng)目教程(RHEL 7.4/CentOS 7.4)(第3版)(微課版)
- OpenVZ Essentials
- iOS 10快速開(kāi)發(fā):18天零基礎(chǔ)開(kāi)發(fā)一個(gè)商業(yè)應(yīng)用
- Multi-Cloud for Architects
- Linux內(nèi)核修煉之道
- 鴻蒙HarmonyOS應(yīng)用開(kāi)發(fā)入門(mén)
- Less Web Development Essentials
- 電腦辦公(Windows 7 + Office 2013)入門(mén)與提高
- 計(jì)算機(jī)操作系統(tǒng)(第3版)(微課版)