A bb recipe to add file to both initramfs and root - yocto

I am trying to edit my bb recipe to install my app to initramfs as well as the root. The issue i am facing is do_install() I don't think i can have the install copy to ${D} as well as initramfs-basic/1.0-r0/rootfs/bin (I don't know the variable for that location unless its ${base_sbindir} but it doesn't show up there).
It will only show up in the root bin directory after the system has booted but nothing i do with also copy it to the initramfs drive. How can i copy to both locations?

It turns out initramfs is just another image recipe. adding IMAGE_INSTALL_append = " myapp " added it to the initramfs as well as the root.

Related

Replace sshd_config file with the custom one in Yocto

I use Yocto Zeus to build an embedded Linux for my board. So far I need to replace the /etc/ssh/sshd_config with my custom one.
Unfortunately I couldn't find any useful information about that. Just found some help on the Internet.
I've created a custom layer and add an recipe as following:
sources
mylayer
mylayer-recipes
recipes-connectivity
openssh
openssh_%.bbappend
openssh
sshd_config
openssh_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"
SRC_URI += "file://sshd_config"
after this I've try to rebuild the image
bitbake core-image-minimal
But nothing happens. No error and no change of the sshd_config file in the image.
What I do wrong? Actually I only want to replace the system /etc/ssh/sshd_config with the custom one, nothing else.
Ok, I've finally solved the issue. It's turned out that I haven't follow the full path to the *.bb but only the top level although the doc says "...This implies that you must have the supporting directory structure set up that will contain any files or patches you will be including from the layer." in the 5.1.5. Using .bbappend Files section. So the final folders structure looks like this:
sources
mylayer
mylayer-recipes
openssh
openssh_%.bbappend
openssh
sshd_config <----- the file that replaces the original one
poky
recipes-connectivity
openssh
openssh_8.0p1.bb
openssh
sshd_config <----- the original file
....
i.e. I just added folder openssh to mylayer-recipes folder and now that works as expected

Yocto project, try to add my device driver config into the Linux kernel configuration file

I am trying to add my own device driver to Linux kernel with Yocto Project.
I added my configuration like CONFIG_MY_DRIVER=y into the defconfig file in the BSP layer folder, meta-bsp/recipes-kernel/linux/linux-my/ and modified the bb file by adding SRC_URI += "file://defconfig".
After BitBake, I found that the .config file in the build directory didn't have CONFIG_MY_DRIVER=y, but the .config.old file did. It seems that the .config file has been overwritten by some background task. I am not familiar with it, can anyone help me to figure out it?
At the same you have to copy the CONFIG_MY_DRIVER=y into receipe-kernel/linux/linux-my/defconfig ,defconfig should reflected after adding the option into the yocto layer, Then fetch into kernel .bblayer
SRC_URI = "git address file://defconfig"
then start the bitbake server.

how to delete deploy/images/beaglebone dir in yocto

In my yocto source deploy/images/beaglebone dir is nearly 100GB so i want to free that memory
Please help me how can I delete that deploy dir either manually or via command line
I want to clean all images(*.tar.gz,*.sdcard, *.ubifs) of previous compilation in yocto deploy/images/beaglebone/
Maybe when you are with 100GB in the deploy directory, things have gone too far already.
Check your IMAGE_FSTYPES variable. My experience says it is safe to delete all images of these files that are not symlinks, or symlinks targets. Avoid the last one generated to avoid breaking the last build link, and any related with bootloaders and configuration files, as they could be rarely regenerated.
If you are keeping more than one build with the same set of layers, then you can use a common download folder for builds.
DL_DIR ?= "common_dir_across_all_builds/downloads/"
And afterwards:
To keep your /deploy clean:
RM_OLD_IMAGE: Reclaims disk space by removing previously built versions of the same image from the images directory pointed to by the DEPLOY_DIR variable.Set this variable to "1" in your local.conf file to remove these images:
RM_OLD_IMAGE = "1"
IMAGE_FSTYPES Remove the image types that you do not plan to use, you can always enable a particular one when you need it:
IMAGE_FSTYPES_remove = "tar.bz2"
IMAGE_FSTYPES_remove = "rpi-sdimg"
IMAGE_FSTYPES_remove = "ext3"
For /tmp/work, do not need all the workfiles of all recipes. You can specify which ones you are interested in your development.
RM_WORK_EXCLUDE:
With rm_work enabled, this variable specifies a list of recipes whose work directories should not be removed. See the "rm_work.bbclass" section for more details.
INHERIT += "rm_work"
RM_WORK_EXCLUDE += "home-assistant widde"
try this from your build root rm -fr deploy/images. Here is a good discussion on the topic
I just removed the files manually like below
1. goto build/deploy/images/beaglebone
2. $ ll : you will find the softlinks of rootfs with time like
......*20170811091521.rootfs.tar.gz
......*-20170811091521.rootfs.sdcard etc
3. Dont delete recently compiled files. except these this you can remove all *.tar.gz, *.sdcard,*.ext4 manually like below,
4. rm beaglebone-20170811091521.rootfs.tar.gz
rm beaglebone-20170811091521.rootfs.sdcard
rm beaglebone-20170811091521.rootfs.ext4 etc.

Building poky-tiny for the i.MX6 Ultra Lite Evaluation Kit

I'm currently trying to build poky-tiny for imx6ulevk (using the BSP Yocto Project Environment provided by NXP).
I first followed the Quick Start Guide, tested and everything worked just fine. I then went to the usual local.conf file (/build/conf/local.conf) and changed the DISTRO variable to poky-tiny.
In poky-tiny distro file (/sources/poky/meta-yocto/conf/distro/poky-tiny.conf), I changed the virtual/kernel in the variable PREFERRED_PROVIDER_virtual/kernel to linux-imx and the PREFERRED_VERSION_linux-imx to 3.14.38 which is compatible (I think).
I finally added to the local.conf the variable IMAGE_FSTYPES with the value tar.bz2 ext3 sdcard.
At this point I tried to build using:
bitbake core-image-minimal
this runs without any problems. But it doesn't generate sdcard image or any u-boot images as is expected. The only files generated are:
core-image-minimal-imx6ulevk-20160517152114.rootfs.cpio.gz
core-image-minimal-imx6ulevk-20160517152114.rootfs.manifest
core-image-minimal-imx6ulevk.cpio.gz
core-image-minimal-imx6ulevk.manifest
modules-imx6ulevk.tgz
zImage
zImage--3.14.38-r0-imx6ul-14x14-evk-20160517152114.dtb
zImage--3.14.38-r0-imx6ul-14x14-evk-csi-20160517152114.dtb
zImage--3.14.38-r0-imx6ulevk-20160517152114.bin
zImage-imx6ul-14x14-evk-csi.dtb
zImage-imx6ul-14x14-evk.dtb
zImage-imx6ulevk.bin
And I got stuck without knowing how to deploy to the imx6ulevk. What did I do wrong? Why is yocto not generating the usual sdcard image?
If anyone gets this what worked for me was the following:
Turns out poky-tiny for imx6ulevk does not create sdcard images normally. So what you need to do, once you build it with a proper kernel, is to manually create a bootable sdcard. This can be done by using gparted cleaning everything in it and adding 2 partitions, then proceed as follow:
1 - First you use gunzip in the file core-image-minimal-imx6ulevk-...-rootfs.cpio.gz.
2 - Call cpio on the generated file: cpio -i -vd < core-image-minimal...-.cpio
3 - You just generated the root file system copy everything into one of the partitions.
4 - the zImage...* files are the generated kernel for the poky-tiny distro. Copy all but the symbolic links to the second partition. You might need to rename the files (I had to) if you're not sure what to rename to, first build regular poky using sdcard image and check out the proper names.
That's pretty much it, you should be able to boot imx6ulevk using the provided files.

How do I edit the system definition files for quicklisp

I'm trying to install FUF/SURGE on my windows computer, and got stuck on a step.
Instruct quicklisp where to find the system definition files to load
fuf and dependent modules. Create a file in this folder:
~/.config/common-lisp/source-registry.conf.d with this content:
(:source-registry
(:tree (:home "fuf"))
:inherit-configuration)
I was wondering how do I get to the file listed above and how do i edit it? I have emacs installed with quicklisp/slime.
OK so you need to make these subfolders in your home directory. I'm guessing you installed under windows as I saw your comment on my video! Remember that part of the install was created a home folder and setting it's path in your environment variables.
~ is the symbol for the home directory so you need to create directories for this path ~/.config/common-lisp/source-registry.conf.d\ which for my setup would be c:\home.config\common-lisp\source-registry.conf.d\
Inside that create directory creare a fuf.conf file and paste the lines from the instructions.
I haven’t got a windows machine to hand but hopefully that's enough to get you going!