Following the previous blog : Create Hello World recipe and Custom Meta Layer. We now have a simple program to run on the HIO-board. But before we run it, we have to install the Hello World program.
There are many ways to install program in Yocto. The first one, we can just copy all the files into the rootfs. This way is not good at all if the applications are scattered and have a lot of configurations. Another better way is to use IMAGE_INSTALL_append. In build/conf/local.conf, we can add application into the rootfs by using IMAGE_INSTALL_append = ” your_favorite_app” . Make sure that we have a space in front because this list is comprehensive from the previous. When we are building an image recipe, we are putting a bunch of application together with IMAGE_INSTALL_append. For example, if we want to use the text editor, we use nano, vi; for sound, we use alsa etc.. We can also install libraries through this way. But, using IMAGE_INSTALL_append only good when you are starting from scratch. Which mean, we will need to rebuild our image every time we need a new application when we use IMAGE_INSTALL_append. This is definitely troublesome since building an image required a lot of time and you do not want to lose all the data from the previous build.
OPKG Package management is the best way to manage those applications. All we need is to build an image with OPKG install. Then we can use OPKG install your-favorite-application and we will get the same effect as “sudo apt-get install your-favorite-application”. We can also update and patch more easily. Compiling will take much less time since we only compile a specific application. We can have multiple versions of the application and we can control which version we want to install or update. This is like creating our own mini Google Play Store, but for our own Yocto Device.
For more information, please visit http://wiki.hioproject.org/index.php?title=Yocto:_Opkg_Package_Management_System_Set_Up