From 5876d0ade10d53abe4e9c6666c5117ca73a211f6 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Thu, 12 Sep 2024 22:37:29 +0200 Subject: kernel/dtm: Add an example on the kernel DT API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This comes in the form of a simple kernel module which iterates over CPUs and prints the contents of some device tree nodes. Signed-off-by: Miquel Sabaté Solà --- kernel/dtm/README.md | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 kernel/dtm/README.md (limited to 'kernel/dtm/README.md') diff --git a/kernel/dtm/README.md b/kernel/dtm/README.md new file mode 100644 index 0000000..593c1d2 --- /dev/null +++ b/kernel/dtm/README.md @@ -0,0 +1,29 @@ +# Device Tree Module + +This is a simple kernel module which show cases some of the kernel API functions +for manipulating device tree nodes. + +In order to build this module you need either a local build of the Linux kernel, +or the the source that you can get from your Linux distribution (e.g. +`kernel-source` on openSUSE). For the former you will need to specify the path +to your local development tree with the `KERNEL` variable. So: + +``` +$ make KERNEL= +``` + +This will produce a `dtm.ko` file, which you will need to `insmod` on your +target machine. Then you will get this output from `dmesg`: + +``` +[ 571.298548] [ T813] dtm: loading out-of-tree module taints kernel. +[ 571.305842] [ T813] Inside of VisionFive2 +[ 571.309945] [ T813] RISC-V ISA for 'cpu@1': rv64imafdc_zba_zbb +[ 571.315826] [ T813] parent: cpus +[ 571.319091] [ T813] RISC-V ISA for 'cpu@2': rv64imafdc_zba_zbb +[ 571.324962] [ T813] parent: cpus +[ 571.328224] [ T813] RISC-V ISA for 'cpu@3': rv64imafdc_zba_zbb +[ 571.334092] [ T813] parent: cpus +[ 571.337354] [ T813] RISC-V ISA for 'cpu@4': rv64imafdc_zba_zbb +[ 571.343228] [ T813] parent: cpus +``` -- cgit v1.2.3