Adding custom python script(to findout system info) to rootfs using yocto project

 Hello All,

In this article, we are going to see how we can add our custom python script( python script to find out the system information) to our root filesystem using yocto project

Before proceeding to this, you need to familiar with my previous articles, as it gives the overview about yocto build system and setup environment

pre-requisite: https://www.blogger.com/blog/posts/8695339245532547417?tab=rj

Adding custom python script (to findout system information) to rootfs using yocto:

step 1: switch to meta-mylayer/recipes-kernel directory

$ cd poky/meta-mylayer/recipes-kernel/

step 2 : create a folder called system_info

$ mkdir system_info

step 3: Inside system_info folder, create another folder called files

$ mkdir files

step 4: Inside files folder , create a file called sytem_info.py and edit as following

$ touch system_info.py

$ vi system_info.py


and save and exit it

step 5: now switch back to system_info folder

$ cd ..

step 6: create a bitbake recipe to add the system_info.py file to rootfs

$ vi system-info_0.1.bb and edit as following


save and exit the file

step 7: now add this recipe to conf file

switch to build_x86/conf/local/conf filr

$ cd ../../../build_x86/conf

$ vi local.conf and append the line IMAGE_INSTALL_append  = " python3 system-info"


save and exit the file

step 8: now compile the image as

$ bitbake core-image-minimal 


step 9: boot the image

$ runqemu nographic

and switch to /usr/bin directory

$ cd /usr/bin

$ ls 


step 10: now execute the script (system_info.py) using python3.8

$ python3.8 system_info.py


That's it now we have successfully added the sample python script to out rootfs using yocto project..!!

Hope you enjoying yocto series. Thanks.


Comments

Popular posts from this blog

Adding custom splash screen to yocto image

Adding libraries (pciutils,usbutils and util-linux) to our image using yocto project