Export all files included in defconfig - linux

I'd like to have directory tree containing only the files used by a specific Linux build.
For example if I use https://github.com/LineageOS/android_kernel_moto_shamu with make shamu_defconfig; make that'd result in the Makefile system using the includes in the buildconfig to build.
Is there an (easy) way to have the Makefile system save the files it uses to a log, or most preferably to a different directory such that I'm left with a folder that contains only the files that're used for a build.
My goal is to be able to easily determine which code for the peripherals (e.g. touchscreen driver) is used.
Thanks

Related

Include an Application Image in Yocto Build

I feel like I have done my level best to search for an answer for this but, admittedly, maybe I am not using the correct search keys.
I am building a Linux kernel using Yocto and I can see that adding lines IMAGE_INSTALL_append to local.conf, followed my the additional images that you want to include is the way that you include things like connman, dropbear, etc. That's fine.
What I want to do is include an image of the application that I have written. Let's call it HelloWorld.exe and I would like it to be tucked into it's own directory (MyHello) along with a sub-directory and the sub-directory also contains some files that are necessary for the operation of HelloWorld.
I'm sure that there are different ways of doing this but I just need one. I need to know:
Where do I position my HelloWorld.exe and its attendant files and subdirectories on my Ubuntu system where they will be picked up during the build and included in the image?
How do I alter local.conf to ensure that the final image will include my application and its support files and directories where I need it to be on the target?
Thank you. Mark
I believe it gets a bit complicated in Yocto:
You need to create your own layer. Let's say meta-hello. This folder needs to in the same place as all your other meta layers and also where your poky directory is.
You need to enable that layer in your bblayers.conf file. For that you can use bitbake-layers add-layer /path/to/meta-hello
Now within your meta-hello create a recipe in a folder recipes-hello/hello
your hello.bb file is within the above mentioned folder and your can decide to use either automake, makefile or compile it accordingly using the Dev Manual Here
Once that is done, in your BUILD dir perform bitbake hello and this will compile and provide errors if any. Resolve them and once it compiles successfully, add IMAGE_INSTALL_append = " hello" in the local.conf file.
This is one way of doing it. Another one is a bit complex using the ADT Yocto Workflow
Sorry to say there is no easier way around this as Yocto does have a steep learning and development curve.
Practical Example
You can look at this blog post by Boundary Devices which creates a simple daemonize automake example. You can find it on GitHub too.
devtools workflow
Youtube Video by Tim Orling from Intel on devtools workflow
packing external binaries
For this case use Binaries Installation in Mega Manual

Visual C++ for Linux: copy content files to build directory?

I have a Visual C++ for Linux project in VS2017 that I'm building on a Raspberry Pi running Raspbian. This project consists of a single source file (main.c) and an image (test.jpg). When building the project, I want the image file to also be deployed to the pi, so that the code in main.c can do something with it locally. However, I can't figure out how to do this
The image file's Content property is set to True, as is Included in Project. In the project properties, under Copy Sources, Sources to Copy is set to "#(SourcesToCopyRemotely)" and Copy Sources is set to "Yes". However, when I build, only main.c is copied to the Pi, and the compiler output is just a single .out file. I hoped to also see test.jpg there, but alas.
This article mentions that #(SourcesToCopyRemotely) defaults to all files in the project. However, when I evaluate the value of #(SourcesToCopyRemotely, it evaluates to just "main.c".
How do I make sure content files in my projects also end up in the build directory, along with the .out file? Preferably without having to manually enter each filename in a post-build step.
It turns out this is a bug in VC++ for Linux. A workaround, currently, is to use Additional Sources to copy. There's a caveat though: it doesn't work with remote paths that start with ~. So you can't use $(RemoteRootDir) if the Remote Build Root Directory setting is set to the default of "~/projects".
I've currently got Remote Build Root Directory set to "/home/pi/projects" and for each file I want to copy to the build directory I set Additional Sources to Copy to "[filename]:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$Configuration)/[filename]". For instance:
firstimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/firstimage.png;secondimage.png:=$(RemoteRootDir)/$(ProjectName)/bin/$(Platform)/$(Configuration)/secondimage.png
Right-clicking on the non-source code file to open it's properties page and flagging as Content in the General tab will cause the file to be copied to the remote. There is no need to add anything to the Copy Sources tab. The Copy Sources page of the project properties must show the default of #(SourcesToCopyRemotely). And when you edit this setting the macro should show an expansion with the additional files included.
I have found that it necessary to refresh the macro by clearing Source to Copy and then restoring it to the default after you have marked the additional files as content.
I have encountered problems when the additional files are not in the same folder as the C++ source files on the Windows host and/or you want to put them somewhere else on the remote. There are several open issues on the VCLinux GitHub site like this one so it will be worth reporting any problems you have on there.
[VCLinux 1.0.6 on VS Pro 2017 + Debian Jessie remote]
The "Pre-Build Event" section of the project properties offers "Additional Files To Copy". Addressing my file there (relative to the solution) showed following in the output when building:
Copying file 'C:\myfilepath\resource.png' to '/home/pi/projects/myproject/resource.png'
It is possible to move the files to the final destination then with Remote Post-Build Events (mv source destination). Not the most elegant way, but the first thing I got working..

Adding a file into the Runtime Image in WEC7

In order to include any file in the WEC7 we have to use the bib files.
In my case I created a subproject in which I wrote an application, now I want this application to be included in the run-time image. So I opened the project.bib file and wrote the following entries.
As it is an executable file, it should be in the MODULES Section
MODULES
Subproject2.exe $(_FLATRELEASEDIR)\Subproject2.exe NK
When I loaded the image on the device, I checked the Windows folder for the image, it was not present.
But when i wrote this in the FILES section
FILES
Subproject2.exe $(_FLATRELEASEDIR)\Subproject2.exe NK
It is present in the windows folder, may I know the reason?
Is it that for executables we have to keep it in the FILES section?
Or whether I'm doing anything wrong?
The MODULES section is for exe's or dll's that you may want to execute in-place, that is, without first loading them into RAM. Modules listed in this section will not be compressed in the final nk.bin image.
The FILES section on the other hand is for files that can be compressed in the image without affecting the ability to run in-place. This includes resources like bitmap images, audio and video files, and, perhaps surprisingly, also .NET exe's and dll's which are not real executables in this context (they are always loaded into memory before execution).
So generally, unmanaged/non-.NET executables should be placed in the MODULES section.
When you make changes to the .bib file be aware that, depending on the BSP, you may need to perform a platform sysgen and copy files to the release directory before generating the image.
In Platform Builder 7.0, this is done by right-clicking the Platform name in Solution Explorer and hitting Sysgen(SysgenPlatform...), followed by a trip to the Build menu and the Copy Files to Release Directory command.
You'll need to do the same if you change any .reg, .dat or .db files.
Notice that you can load the nk.bin file directly in Platform Builder to inspect its contents, files, registry entries, etc. This can potentially save some time compared to installing the image in the target. Just go through the File menu, Open, File... and navigate to the nk.bin file.

How do I move my folders created by CMake?

CMake uses absolute paths when it generates project files for Visual C++.
Sometimes, I need to move my project folder to some other drive.
But when I move the folder (and try to replace all the paths in the project files), this triggers a long, arduous recompilation process that wastes a lot of my time for absolutely no reason.
How do I move CMake project folder(s) to an arbitrary location without triggering a recompilation?
From the documentation of CMAKE_USE_RELATIVE_PATHS var:
In general, it is not possible to move CMake generated makefiles to a different location regardless of the value of this variable.

Linux file system skeleton version control

We are doing some embedded Linux project, the vendor provides us a basic filesystem skeleton, and we would like to put it into the version control system (GIT), but there are some special files which GIT does not like, for example, the device file, the pipe files, etc. I wounder if anyone have a better suggestion to put a filesystem under version control? Thanks!
Two choices;
1) either put the script which creates the nodes in /dev and the like under version control, and have your build system execute that script.
or
2) Make a dd of the basic file system to a plain file, and put that dd resulting file under version conntrol
There are some script for keeping dev files with git, eg: EtcKeeper http://kitenet.net/~joey/code/etckeeper/

Resources