From: Jim Huang Date: Fri, 24 Sep 2021 18:09:13 +0000 (+0800) Subject: Always run "dmesg" with sudo X-Git-Tag: latest~91 X-Git-Url: https://www.ivnss.com/gitweb/?a=commitdiff_plain;h=707e193cbe6b5b532d31025e1f1fc6e045771d38;p=lkmpg Always run "dmesg" with sudo The dmesg command allows you to review the messages that are stored in the ring buffer. Some Linux distributions have strict requirements for dmesg, and you need to use sudo to use dmesg. --- diff --git a/lkmpg.tex b/lkmpg.tex index 7869139..85357e2 100644 --- a/lkmpg.tex +++ b/lkmpg.tex @@ -412,7 +412,7 @@ It takes two parameters: a variable name and a free form string describing that I would recommend playing around with this code: \begin{verbatim} $ sudo insmod hello-5.ko mystring="bebop" myintarray=-1 -$ dmesg -t | tail -7 +$ sudo dmesg -t | tail -7 myshort is a short integer: 1 myint is an integer: 420 mylong is a long integer: 9999 @@ -422,11 +422,11 @@ myintarray[1] = 420 got 1 arguments for myintarray. $ sudo rmmod hello-5 -$ dmesg -t | tail -1 +$ sudo dmesg -t | tail -1 Goodbye, world 5 $ sudo insmod hello-5.ko mystring="supercalifragilisticexpialidocious" myintarray=-1,-1 -$ dmesg -t | tail -7 +$ sudo dmesg -t | tail -7 myshort is a short integer: 1 myint is an integer: 420 mylong is a long integer: 9999 @@ -436,7 +436,7 @@ myintarray[1] = -1 got 2 arguments for myintarray. $ sudo rmmod hello-5 -$ dmesg -t | tail -1 +$ sudo dmesg -t | tail -1 Goodbye, world 5 $ sudo insmod hello-5.ko mylong=hello @@ -1684,12 +1684,11 @@ Here is a demonstration of how to calculate a sha256 hash within a kernel module \samplec{examples/cryptosha256.c} -Make and install the module: +Install the module: \begin{codebash} -make sudo insmod cryptosha256.ko -dmesg +sudo dmesg \end{codebash} And you should see that the hash was calculated for the test string.