How to build device-tree overlays using DKMS?

1.2k Views Asked by At

I am trying to build a device-tree overlay using DKMS for a running kernel (4.4). My naive Makefile is as follows:

PWD := $(shell pwd)

dtbo-y += my-awsome-overlay.dtbo
targets += $(dtbo-y)

all:
        make -C /lib/modules/${kernelver}/build M=$(PWD) dtbs

clean:
        make -C /lib/modules/${kernelver}/build M=$(PWD) clean

However, I am getting the following error:

make[1]: Entering directory '/usr/src/linux-headers-4.4.13-v7+'
/bin/sh: 1: cannot create arch/arm/boot/dts/overlays/modules.order: Permission denied

How can I fix it? It should be possible without root privileges, right?

How would a standard Makefile for building dt overlays using DKMS look like?

Edit: I think I have solved the problem, see below. However, a qualified answer would still be welcome.

1

There are 1 best solutions below

3
On BEST ANSWER
  1. Change my-awsome-overlay.dtbo to my-awsome.dtbo. Assuming the dts file name is my-awsome-overlay.dts.

  2. Add always := $(dtbo-y).

  3. Invoke make without a target (remove dtbs).

Here is a working Makefile:

PWD := $(shell pwd)

dtbo-y += my-awsome.dtbo

targets += $(dtbo-y)    
always  := $(dtbo-y)

all:
        make -C /lib/modules/${kernelver}/build M=$(PWD)

clean:
        make -C /lib/modules/${kernelver}/build M=$(PWD) clean