- 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 2012 Hyper-V:Deploying the Hyper-V Enterprise Server Virtualization Platform
- Modern Web Testing with TestCafe
- 阿里云數(shù)字新基建系列:云原生操作系統(tǒng)Kubernetes
- Linux從零開(kāi)始學(xué)(視頻教學(xué)版)
- 操作系統(tǒng)基礎(chǔ)與實(shí)踐:基于openEuler平臺(tái)
- Windows Server 2012 Hyper-V Cookbook
- Ganglia系統(tǒng)監(jiān)控
- Linux Shell編程從入門(mén)到精通(第2版)
- Linux就該這么學(xué)
- Docker+Kubernetes應(yīng)用開(kāi)發(fā)與快速上云
- Instant Optimizing Embedded Systems using Busybox
- STM32庫(kù)開(kāi)發(fā)實(shí)戰(zhàn)指南:基于STM32F4
- Windows 7應(yīng)用入門(mén)與技巧
- Windows 10從新手到高手
- Linux從入門(mén)到精通(視頻教學(xué)版)