device tree generation for embedded linux on Zedboard - linux-kernel

I am working on ZedBoard(having Zync series SoC from Xilinx) and want to create a device tree for the embedded linux which i am planning to boot on this Zedboard. I followed the two links
http://xillybus.com/tutorials/device-tree-zynq-1
http://www.wiki.xilinx.com/Build+Device+Tree+Blob
They both gave me insight of device tree.
Now I have two options:
I got one prebuilt device tree .dts file for the Zedboard. So, can I use this directly without changing anything and only add mine needed drivers in this and it will work?
or
Should i start from scratch and generate mine own device tree .dts file.
What i want to ask/confirm that: device tree(.dts) file is not project specific and the content of .dts file will be unique for the particular board(which is in our case is ZedBoard). So i can take one working .dts file(as in option 1) as a basic platform for mine project and add mine device node in this .dts file (if it is not there) and it will work?
Please suggest and correct me.

I agree with the #sawdust's comment. Please find the pictorial representation of the same.
I have shamelessly copied it from the presentation here.
To answer your question, you should create your own ".dts" file which includes all the necessary parents (i.e. SOC specific and needed) dtsi files. And compile your ".dts" file using DTC compiler (either from linux/scripts/dtc/dtc in Linux Source tree or by using the package like "device-tree-compiler").
In most cases you can modify the existing device tree file and re-compile it for your purpose. For your case, I think you can have to modify this zynq-zed.dts.

Related

Yocto - Device tree incompatibility when changing Kernels in an ARM processor

I'm creating images for iMX chipsets and had downloaded the sources from NXP, and then created a core-image-minimal using Yocto. I then proceeded to sucessfully boot the image in a board.
After that, my interest was to apply the EVL project on an image. I did the following:
Download the sources from EVL Core. Those sources consist of a Kernel with EVL on top of it.
Created a workspace folder using devtool, and added the folder linux-imx, which contains the code for the kernel.
Completely replaced the contents of the folder for those of EVL. The rest of Yocto files remained unchanged.
Rebuilt the image and flashed it.
However, when booting, I get the following message:
Starting kernel ...
E/TC:0 0 dt_find_ocram_tz_addr:71 Cannot find fsl,optee-lpm-sram node in the dev ice tree
E/TC:0 0 Panic at core/arch/arm/plat-imx/imx_ocram.c:73 <dt_find_ocram_tz_addr>
E/TC:0 0 Call stack:
E/TC:0 0 0x14005411
I checked the EVL kernel code, and in arch/arm it contains no folder named plat-imx. This is rather confusing, since the problem appears in a line of code that doesn't exist in my workspace folder.
I tried checking the defconfig files in order to see where Yocto was taking the kernel code from, but couldn't find anything meaningful.
Any help is greatly appreciated.
Thanks in advance
As said in the comments, the problem was the following:
I couldn't find the folder plat-imx because it was not in the Kernel folder, but rather in the OP-TEE folder.
OP-TEE, which is a safety environment, runs before the boot checking the device tree and updating some memory addresses based on that.
Since the device tree had changed, he was now unable to find some elements and therefore it crashed before boot.
After adding some missing files to the DTS folder, the Bootloader worked correctly. Other problems during boot due to the kernel change appear remain to be solved.

Connecting dots from self-contained Java application to Mac OS installation

I am not a Mac owner and am putting myself through a crash course to get up to speed (e.g., reading "Switching to the Mac"), to give you an indication of my current level of understanding. The access I have to a physical Mac is limited, so I am trying to connect as many dots as possible before my next session with my friend's computer.
I have: a file folder containing all resources needed for a self-contained application written with Java (OpenJDK 11, JavaFX 11). The JLINK tool was successfully used to create this file folder, and it holds all necessary Java libraries as well as the code I wrote for the application. The executable resides in a subfolder: /bin. The program runs perfectly well on the Mac when the executable is run.
I want: something that is easy to download, install and run.
I'm unclear about what needs to be done to get this. The road map seems to have two main steps:
the file folder needs to be converted into something that responds as if it were an application (e.g., a Bundle? or an .app?)
the resulting folder-as-executable can be shipped via either .dmg or .pkg
For the second part, I've researched and found tools such as Packages or create-dmg. It seems to me these tools are pretty straightforward and shouldn't be too difficult to learn to use. (Just have to pick one or the other or something similar.)
For the first part, I'm on shaky conceptual ground. I've found info about Bundles, but no tutorials, walk-throughs or examples. It looks like a key step is understanding how to make a proper Info.plist file, but doing this properly looks tricky. Also, I'm not clear on how the resulting Bundle will become an .app file or if it needs to, or if there is another, more direct way to make my file folder be viewed by the OS as an application.
Some hand-holding or references to tutorials or even assurance that I am on the right track (if that is the case) would be much appreciated. Thanks!
The Java Deployment guide from Oracle relies heavily on ANT, but doesn't cover the case of a self-contained, customized JVM via JLINK well enough for me to decipher. So, I've taken the approach of trying to learn/understand the necessary steps using command-line commands.
While creating a Bundle is certainly an option, there is an easier way.
Step one is to make an .app manually. An answer to this question: "How to make a Mac OS X .app with a shell script?" goes over the basic steps. The Java file system that results from jlinking has a folder /bin in which there is a bash file that runs the program. This file should be moved to the outermost folder, and it should be named the desired name of the application. The bash file itself will have to be edited and "/bin" added to the address in last command so that the executable will be found. In addition, the folder itself will have to be renamed to be the same as the bash file, but with .app added as an extension.
The next thing I wanted to have was a custom icon. The question "Include icon in manually created app bundle" shows how to do this.
For the next step I made use of the program "Packages". I'm a bit confused about where I downloaded this from (there seem to be multiple sites), but here is a link to the manual. This tool allowed me to create a .pkg file that, when executed, installs my .app in the Applications folder. Then I compressing the .pkg file (to .zip) and made it available at a URL for downloading.
I've had a friend do a test download and install, and the program works!
This isn't meant to be a complete tutorial, and there are a few steps more that I want to figure out pertaining to sandboxing and sealing, but I believe this is a reasonable roadmap that can be used for simpler jlinked Java applications for Mac distribution.

Yocto kernel config propagation

In my Yocto system, I have a layer defining a bunch of patches on the linux kernel, as well as a file "defconfig" containing kernel configuration. When I modify this file, changes are reflected in the image I build.
However, a few changes are being overruled and I have a hard time figuring out how or where. I do find a bunch of defconfig files in other layers, but is there any easy way to figure out which ones are applied and in what order?
Thanks
It is not other defconfigs that overrule your configuration (at least not in an even only remotely sane setup), but configuration fragments (creating fragments). You can find out what happens exactly like that:
bitbake -e virtual/kernel | less
(you can of course choose another pager, or redirect to a file for additional processing)
And look for:
KERNEL_FEATURES
--> here you can find a list of kernel configuration fragments in the form of .scc files that are applied to your build
SRC_URI
--> this should mention the path to your defconfig file, and no second one.
Please note that this description only holds entirely true for setups that include a kernel defconfig. If you are working without one, things can be different.

Difference between kernel source and root

This a certainly a dumb question, but when I look at the sources of the linux kernel of raspberry pi (here : https://github.com/raspberrypi/linux), this is not the same as the root organisation (that you can find here : http://labor-liber.org/en/gnu-linux/introduction/tree). However, there are some similarities (ex : usr repository).
Do someone know why?
Thank you!
Kernel sources are files for build the kernel. Usually, these files are located in some directory. After building (and installing) sources can be safetly cleaned.
Root directory is the top-level directory for working OS.
Most of subdirectory names common between between kernel sources and root directory are just accidental coincidence.
First link only contains the kernel source code; which you need to compile and then you can replace the kernel image and modules on the target.
While the second link shows the filesystem tree; it means how the files and directories are organised in the linux.
In some cases (depend upon the type of flashed OS ) you can see your kernel source code (which you have mentioned in the first link) in your running OS as well inside the /usr/src/<kerne_path> directory.

Linking against an existing binary

I'm working on a project which aims to modify a Pentax DSLR's firmware in order to provide additional functionality.
As part of this I'm writing/documenting the existing camera's API in C.
I can compile my own code using these API's providing it isn't linked into an ELF binary.
In order for this code to run I need to link it with the existing bare metal firmware. A process that I perform manually by copying the object code into the existing binary and fixing the branch instructions.
Is it possible to use the existing GNU toolchain to link against a pre-existing binary and make the manual process automatic.
I can guess that I would need to provide the following:
an offset into the existing binary file to use as a base address
the addresses for all the undefined symbols
I can't see these options in GNU LD.
Is it possible to link a against an existing binary file?
AFAIK re-linking of a binary file is not possible.
Linking is actually the step that creates the binary and therefore re-linking of a binary is not possible.
If you could gather the objects files (the product of assembler) you may be able to create a new binary file.
For more information regarding the build process: http://www.tenouk.com/ModuleW.html

Resources