Device Tree edit with Fenix

I want to know the steps to edit the Device Tree and compile the kernel with the modified files using Fenix script for ubuntu server. There is no information anywhere else, I’ve search the forum and docs!

@quatro you can edit it in the dir /path/to/fenix/linux/arch/arm64/boot/dts/amlogic/ . And then you can use make kernel to rebuild it in fenix directory.

1 Like

great, there should be a guide of this… it’s not clear which directory should be edited for customization. In my case wouldn’t it be Rockchip? I’m developing an image for Edge-V

@quatro if you want to build with Edge-V.Frist you should check you git branch is about Edge-V . Then you will find the dts in /fenix/linux/arch/arm64/boot/dts/rockchip/

Can I change the .dtb directly on the Edge-V filesystem? I mean not recompiling and flashing the image, instead, just replacing the dtb file in /boot directory… will it work?

There is no “Edge-V” git branch, but I selected Edge-V when running env/setenv.sh.

There is no fenix/linux directory, only fenix/build/linux-* or fenix/downloads/linux-*…40|690x365

should I modify “downloads” or “build” contents?

Can I change the .dtb directly on the Edge-V filesystem?

@quatro

$ cd /fenix/linux 
$ git branch -a
remotes/origin/khadas-edge-4.4.y #this is the edge branch

if you want to build ,you need to select to edge with env/setenv.sh

Thank you Frank!

linux 4.4 is the latest for edge?

can’t find /fenix/linux directory… where is it?

also no edge branch!

git branch -a
* master
  remotes/origin/HEAD -> origin/master
  remotes/origin/master

the repo I cloned is https://github.com/khadas/fenix

@quatro If you first time to clone with fenix, you need to build it first with env/setenv.sh.It will download the linux dir and uboot dir

I have done it… but there is no fenix/linux directory… the only linux directories are fenix/downloads/linux and fenix/build/linux… which one I have to modify?

@quatro did you build with it ? This is my fenix

frank@frank-pc:~/yan/git/khadas/fenix$ ls
archives  build  config  Dockerfile  downloads  env  LICENSE  linux  linux-4.9.190_0.7_arm64.changes  Makefile  packages  README.md  scripts  u-boot
frank@frank-pc:~/yan/git/khadas/fenix$

Yes, I did… This is mine:

fenix# ls
archives build config Dockerfile downloads env LICENSE Makefile packages README.md scripts

@quatro

$ cd /path/to/fenix
$ source env/setenv.sh
$ sudo make

when it build complete. check again.

Now it appears… could it be because of choosing linux-4.4?

@quatro I don’t understand what you mean?

I mean that the linux folder is now present after building and the only change I’ve made is selecting the 4.4 kernel instead of mainline

@quatro The code of the main line is not in the Linux branch. Switching branches will not cause such consequences. What instruction do you use to switch to the edge branch

I am now in the edge branch “khadas-edge-4.4.y”

I had modified the DTB in fenix/linux/arch/arm64/boot/dts/rockchip/rk3399-khadas-edge-linux.dtb

ran make, the output asks:

/home/dev/workspace/fenix/build/u-boot-mainline-2019.04
Linux: Already on branch ‘khadas-edge-4.4.y’
Warning:: Repo[/home/dev/workspace/fenix/linux] You made some modifications to file(s):
[
arch/arm64/boot/dts/rockchip/rk3399-khadas-edge.dtsi
]
Info: Try to update linux:khadas-edge-4.4.y
From GitHub - khadas/linux: Linux kernel for Khadas VIMs & Edges

  • branch khadas-edge-4.4.y → FETCH_HEAD
    Already up to date.
    Press to abort compilation, to ignore and continue

I hit Enter to continue, and the DTB is generated correctly (checked with dtc command) but the generated image does not include this change. I flashed it into the edge-v, logged in as root, ran “dtc -I fs /proc/device-tree”, also “dtc -I dtb -O dts /boot/dtb-4.4.179/rk3399-khadas-edge-linux.dtb”, and the change was not there (serial@1ffa… status=“okay”). The DTB was not the one newly generated by fenix make (checked with md5sum command).

How do I make this new DTB be compiled into the final Image?

@quatro

$ cd /fenix/linux/arch/arm64/boot
$ ls -al

check the Image file has update ?