Create second file system/partition in Yocto - yocto

I have a Yocto recipe to create the rootfs. I want to create another ext4 file system that includes only a few files, and merge it into the original image as a separate partition with a special mount point. wks file support this: part /myfiles --source rawcopy ... that copies files from an existing image, however, I do not know how I could generate this ext4 image in the same Yocto build step.
The Yocto - Create and populate a separate /home partition almost works, however, I want to change file permissions that does not work with this solution.
How is it possible to tackle this?

Related

Import .png as .imageset to Xcode assets on Jenkins pipeline

Swift, Xcode macOs project
I have supported configuration of assets, basically all my assets are contained on remote repo,
I am using Jenkins as CI, in one of the stages I clone all the contents of config-repo to PROJ/Resources/Assets.xcassets
Script example:
sh 'cp -a configuration/meta_configuration/assets PROJ/Resources/Assets.xcassets || echo "copy failed"'
(configuration is cloned dir of config-repo)
So now I have to make my config team to create folders inside /meta_configuration/assets folder using template: asset_name.imageset - Config.json inside it: add one - three .png files, add them to .json and upload into the directory.
I am looking for some way of automatically create .imageset from given .png (Jenkins pipeline script maybe) and overall advice how we should approach this step as currently we experiencing that a lot of footwork is needed to add/support assets into the repo.
Q: How to automatically create .imagest from given .png file(s)?
edit: added project specs

Azure DevOps AzureBlob File Copy Task Wildcard Directory Source Path

I have a Release Pipeline setup to extract my build artifact and then I use the RegEx Find & Replace task to update a few configuration files on my static website before uploading via AzureBlob File Copy task.
What I have currently works. However I have to use the full source path to the "wwwroot" folder in order to for the correct files to be uploaded.
My concern is that my builds may change the directory structure that gets dropped as a build artifact which will break my release tasks.
I've tried to use various wildcards for the source path such as:
**/wwwroot/*
*/*wwwroot/*
And many other variations to no avail.
I read in some of the docs that wildcards won't work for directory paths in this task but was hoping there was a way to work around this as I have long term concerns about the path changing over time. I looked at a few other tasks in the marketplace but nothing seems to fit the bill and I couldn't find any definitive guidance on the matter. Any suggestions?
1.You can use $(System.DefaultWorkingDirectory)/**/wwwroot/*.*(or .json,.xml...) in Source input.
(If the wwwroot folder doesn't have subfolders and all files within that folder can match format *.*)
2.Otherwise I suggest you archive the wwwroot folder first before uploading it:
Use $(System.DefaultWorkingDirectory) to get working directory and then use full path(not recommend using * here) to archive the specific wwwroot folder. Then upload the zipped folder which contains all content of your wwwroot folder.

Azure DevOps Extract Files task doesn't preserve hierarchy

I am new to ADO, so am probably misunderstanding this, or just doing it wrong, so please be patient.
I want to deploy my web site to my server via FTP. As far as I can see, the build creates a zip file, which I need to extract, and then upload the extracted file. Please correct me if I got this wrong, because if I did, then what follows is probably irrelevant.
I have set up a release pipeline (started with an empty one) and added an Extract Files agent job...
I then added an FTP Upload task to upload the extracted files to my server...
The problem is that my server ends up with all of the files in the root folder. The hierarchy has been lost completely...
There should be a wwwroot folder there with the static content. The folder doesn't exist, and the static files (such as the *.js and *.css files you see in the screenshot) are all in the root folder.
The zip file did contain this folder...
Anyone able to explain what I did wrong?
Azure DevOps Extract Files task doesn't preserve hierarchy
When you want to keep folder structure with FTP Upload task, you can select the checkbox preserve file paths in the FTP Upload task settings.
If you didn't, please check it, then the files folder structure will be preserved:
Hope this helps.

Best current practice on versioning Yocto layer set

Yocto has a set of independent repositories containing the base system (Poky) and various software components (all the meta-* repositories here, and also openembedded layer index). So when you want to build an image for specific device and purpose, you need a handful of repositories checked out.
These are all tied together by the conf/bblayers.conf and conf/local.conf files in the build directory. But that is a build directory—it is supposed to be disposable, containing only information that can be easily regenerated on request. And it does—except for the list of layers in conf/bblayers.conf and a couple of definitions like the MACHINE in the conf/local.conf that define the target system to build for.
How should I version this information?
Currently we have a rather hacky script that assembles the build directory and writes the config files, but it does not know how to properly update them when it changes.
So is there a better option? Preferably one that would avoid any additional steps between checkout/update (with submodules or repo), oe-init-build-env init script (which creates the build directory if it does not exist) and running bitbake with appropriate target image?
Actually, repo is a convenient tool for managing manifest files with all the needed repositories.
Then you can use TEMPLATECONF to version local.conf and bblayers.conf. Here is how we do it: https://pelux.io/software-factory/master/chapters/baseplatform/building-PELUX-sources.html
The Poky distribution itself uses the Combo Layer tool, which seems to be designed to address this particular problem. However, it's not very clear what the workflow is supposed to look like, when using this tool.
Regarding the default bblayers.conf and local.conf files, you can either version them anywhere in your project and have a script copy them in your build folder after calling oe-init-build-env, or simmply use meta-poky/conf/bblayers.conf.sample and meta-poky/conf/local.conf.sample, which are automatically installed by oe-init-build-env when first creating the build directory.
Now, when you make changes or add layers, you will have to clear the build directory for the changes in the .sample files to take effect.

VSTS Online Portal: Un-Nesting Build Folders on Release

I'm trying to set up automatic build + deploy for a rather large solution. The single solution produces 2 zip folders in the "$(Build.ArtifactStagingDirectory)" location, and these contain all the right files. For the purposes of testing/troubleshooting I am only looking at one of these zip files, but eventually both sites will have to be deployed this way.
However, to get to the actual files, you have to pass through 14 unnecessary subfolders. To further complicate matters, about 8 of these are variable, based on certain elements of the build configuration (some are due to folder structure in the git repo).
I don't want any of these subfolders. The other problem is that I don't actually want a 100% flat file; I need 2 folders with subfolders to be contained within the finally-extracted directory. (The final directory is a physical path for an IIS site.) Is there any way to do this?
I have tried:
Taking the generated zip file, extracting it to a temp directory, and repackaging it, all on the build machine.
To get this to work, I had to manually specify the 14 subdirectories. Also, I was unable to use "Publish Artifact" to upload the resulting zip to VSTS, so I'm not sure how to get it onto the server box.
Downloading the published zip file from VSTS, extracting it locally on the release machine, and then copying the contents to the correct directory.
This works only when I manually specify the 14 folders contained in the directory. I made an attempt to hide the 14 folders with wildcards but only succeeded in copying the excessive nesting structure - I'm guessing the "Source Folder" parameter doesn't support wildcards (I had to actually do it in the "Contents" section or the task failed).
Using the "Flatten Folders" advanced option in the copy dialog.
This removes ALL folder structure, which is not what I want. I need to end up with 2 folders containing subfolders in the final directory.
If it's not possible to only partially flatten the zip generated by the build step, I'd appreciate some help figuring out how much of this terribly convoluted path I can pull out using variables.
There is a very simple way to move the contents of only the contents and subdirectories the PackageTmp folder to the build artifacts folder while shedding the unnecessary folder structure above it, and without using the "Flatten Folders" option (since you likely want to keep the folder structure under PackageTmp intact):
First, in your Build Solution task, set the MS Build Arguments similar to the following:
/p:DeployOnBuild=true /p:WebPublishMethod=Package /p:PackageAsSingleFile=false /p:SkipInvalidConfigurations=true /p:PackageLocation="$(build.binariesdirectory)"
Notice that /p:PackageAsSingleFile=false is set to false; you don't want to zip the package up just yet. Also note the setting /p:PackageLocation="$(build.binariesdirectory). You don't want the output to go directly to the artifact staging directory, as is configured by default.
Next, add a Powershell task, and add this inline script:
$folder = Get-ChildItem -Directory -Path '.\*' -Include 'PackageTmp' -Recurse
Write-Host "##vso[task.setvariable variable=PathToPackageTmpFolder]$($folder.FullName)"
This will store the fully qualified path to the PackageTmp folder in a variable named PathToPackageTmpFolder. Under Advanced options, set the Working Directory to $(build.binariesdirectory)
Now add a Copy Files task to move only the contents of PackageTmp and its subfolders to the artifact staging directory. Set Source Folder to $(PathToPackageTmpFolder), Contents to **, and Target Folder to $(build.artifactstagingdirectory). You're all set!
That is the MSBuild deploy/publish to package action and the folder structure won’t be remain after deploying to the server.
You can specify /p:PackageTempRootDir="" msbuild argument to ignore the folder structure of project path.
Another way is that, you can publish project through FileSystem method, then archive files through Archive files task.