Introduction
The "smart" package management system is available in Yocto Project for managing packages on a target machine. A host is configured as a server for the packages and on the target the "package-management" feature is enabled for working with the packages. The steps for setup and usage are described below.
Resources
The Yocto Project package management system will work with many hosts and targets. The following were used for creating this document:
Host
You have successfully installed a Freescale Yocto Project release. (Refer to Freescale Yocto Project Release Documentation). There are two steps for adding package management and then building:
1. Modify conf/local.conf
EXTRA_IMAGE_FEATURES = "debug-tweaks package-management"
2. Build the image:
bitbake core-image-minimal
The core-image-minimal recipe provides an image enabling the target board to boot and support a serial console.
3. Create SDCARD:
$ cd <build>/tmp/deploy/images/imx6qsabresd
$ sudo dd if=core-image-minimal-imx6qsabresd.sdcard of=/dev/sdb bs=4M && sync
Note - verify location of SDCARD on your host, /dev/sdb in this example. Examine 'cat /proc/partitions'
4. Setup web server and add link to rpm packages
A web server, lighttpd, is installed.
$ sudo apt-get install lighttpd
Provide user write capability in /var/www
$ sudo chmod 777 /var/www
Create a soft link in the default web server directory to the rpm directory from the build. Note: Please update $HOME/<build> to your actual location:
$ ln -s $HOME/<build>/tmp/deploy/rpm /var/www/imx6qsd
Target
Insert the SDCARD created from step 3 above, connect power and console cable and power on the MCIMX6Q-SDP. Login using the "root" id, no password required.
The /usr/bin/smart application is now used to setup the channels and perform package commands. For all smart options:
smart --help
1. Add channels
To add the packages from the host to your target, the smart channel --add is used:
Please enter the IP adress of your server, replacing SERVERIP below:
smart channel --add all type=rpm-md name=all baseurl=
http://SERVERIP/imx6qsd/all
smart channel --add cortexa9hf_vfp_neon type=rpm-md name=cortexa9hf_vfp_neon baseurl=
http://SERVERIP/imx6qsd/cortexa9hf_vfp_neon
smart channel --add imx6qsabresd type=rpm-md name=imx6qsabresd baseurl=
http://SERVERIP/imx6qsd/imx6qsabresd
Check the added channels:
root@imx6qsabresd:~
all
imx6qsabresd
rpmsys
cortexa9hf_vfp_neon
2. Update local package cache
Once the chanels have been added, the local package cache is updated.
Note SERVERIP below will be the host IP address in your network.
root@imx6qsabresd:~# smart update
Loading cache...
Updating cache... ######################################## [100%]
Fetching information for 'all'...
-> http://SERVERIP/imx6qsd/all/repodata/repomd.xml
repomd.xml ######################################## [ 16%]
Fetching information for 'imx6qsabresd'...
-> http://SERVERIP/imx6qsd/imx6qsabresd/repodata/repomd.xml
repomd.xml ######################################## [ 41%]
Fetching information for 'cortexa9hf_vfp_neon'...
-> http://SERVERIP/imx6qsd/cortexa9hf_vfp_neon/repodata/repomd.xml
repomd.xml ######################################## [ 66%]
Updating cache... ######################################## [100%]
Channels have no new packages.
3. Searching for packages
Let us look at all packages containing the string client
root@imx6qsabresd:~
Loading cache...
Updating cache...
libice-dbg - ICE: Inter-Client Exchange library - Debugging files
libice-dev - ICE: Inter-Client Exchange library - Development files
libice-doc - ICE: Inter-Client Exchange library - Documentation files
libice-staticdev - ICE: Inter-Client Exchange library - Development files (Static Libraries)
libice6 - ICE: Inter-Client Exchange library
libsm-dbg - SM: Session Management library - Debugging files
libsm-dev - SM: Session Management library - Development files
libsm-doc - SM: Session Management library - Documentation files
libsm-staticdev - SM: Session Management library - Development files (Static Libraries)
libsm6 - SM: Session Management library
libx11-6 - Xlib: C Language X Interface library
libx11-dbg - Xlib: C Language X Interface library - Debugging files
libx11-dev - Xlib: C Language X Interface library - Development files
libx11-doc - Xlib: C Language X Interface library - Documentation files
libx11-locale - Xlib: C Language X Interface library
libx11-staticdev - Xlib: C Language X Interface library - Development files (Static Libraries)
libx11-xcb1 - Xlib: C Language X Interface library
libxau-dbg - Xau: X Authority Database library - Debugging files
libxau-dev - Xau: X Authority Database library - Development files
libxau-doc - Xau: X Authority Database library - Documentation files
libxau-staticdev - Xau: X Authority Database library - Development files (Static Libraries)
libxau6 - Xau: X Authority Database library
python-netclient - Python Internet Protocol clients
xtrans-dbg - XTrans: X Transport library - Debugging files
xtrans-dev - XTrans: X Transport library - Development files
xtrans-doc - XTrans: X Transport library - Documentation files
Adding openssh client to core-image minimal
The core-image-minimal does not provide openssh client applications like ssh or scp. Let's add them on the host then update the target cache of packages and then install.
Host
Run bitbake to exercise all the tasks for packagegroup-core-ssh-openssh
$ bitbake packagegroup-core-ssh-openssh
After building a package individually, always update the package-index
$ bitbake package-index
Target
Run smart to update the local cache which will pickup the new packages from the bake above.
root@imx6qsabresd:~
Loading cache...
Updating cache...
Fetching information for 'all'...
->
http://SERVERIP/imx6qsd/all/repodata/repomd.xml
repomd.xml
->
http://SERVERIP/imx6qsd/all/repodata/primary.xml.gz
primary.xml.gz
->
http://SERVERIP/imx6qsd/all/repodata/filelists.xml.gz
filelists.xml.gz
Fetching information for 'imx6qsabresd'...
->
http://SERVERIP/imx6qsd/imx6qsabresd/repodata/repomd.xml
repomd.xml
->
http://SERVERIP/imx6qsd/imx6qsabresd/repodata/primary.xml.gz
->
http://SERVERIP/imx6qsd/imx6qsabresd/repodata/filelists.xml.gz
filelists.xml.gz
primary.xml.gz
Fetching information for 'cortexa9hf_vfp_neon'...
->
http://SERVERIP/imx6qsd/cortexa9hf_vfp_neon/repodata/repomd.xml
repomd.xml
->
http://SERVERIP/imx6qsd/cortexa9hf_vfp_neon/repodata/primary.xml.gz
primary.xml.gz
->
http://SERVERIP/imx6qsd/cortexa9hf_vfp_neon/repodata/filelists.xml.gz
filelists.xml.gz
Updating cache...
Channels have 15 new packages.
Saving cache...
Examine information about local cache:
root@imx6qsabresd:~
Loading cache...
Updating cache...
Installed Packages: 80
Total Packages: 3586
Total Provides: 6580
Total Requires: 1611
Total Upgrades: 3565
Total Conflicts: 25
See what ssh packages are now available:
root@imx6qsabresd:~
Loading cache...
Updating cache...
openssh - Secure rlogin/rsh/rcp/telnet replacement
openssh-dbg - Secure rlogin/rsh/rcp/telnet replacement - Debugging files
openssh-dev - Secure rlogin/rsh/rcp/telnet replacement - Development files
openssh-doc - Secure rlogin/rsh/rcp/telnet replacement - Documentation files
openssh-keygen - Secure rlogin/rsh/rcp/telnet replacement
openssh-misc - Secure rlogin/rsh/rcp/telnet replacement
openssh-ptest - Secure rlogin/rsh/rcp/telnet replacement - Package test files
openssh-scp - Secure rlogin/rsh/rcp/telnet replacement
openssh-sftp - Secure rlogin/rsh/rcp/telnet replacement
openssh-sftp-server - Secure rlogin/rsh/rcp/telnet replacement
openssh-ssh - Secure rlogin/rsh/rcp/telnet replacement
openssh-sshd - Secure rlogin/rsh/rcp/telnet replacement
packagegroup-core-ssh-openssh - OpenSSH SSH client/server
packagegroup-core-ssh-openssh-dbg - OpenSSH SSH client/server - Debugging files
packagegroup-core-ssh-openssh-dev - OpenSSH SSH client/server - Development files
Install openssh
root@imx6qsabresd:~
Loading cache...
Updating cache...
Computing transaction...
Installing packages (9):
openssh-6.7p1-r0@cortexa9hf_vfp_neon
openssh-keygen-6.7p1-r0@cortexa9hf_vfp_neon
openssh-scp-6.7p1-r0@cortexa9hf_vfp_neon
openssh-ssh-6.7p1-r0@cortexa9hf_vfp_neon
openssh-sshd-6.7p1-r0@cortexa9hf_vfp_neon
shadow-4.2.1-r0@cortexa9hf_vfp_neon
shadow-base-4.2.1-r0@cortexa9hf_vfp_neon
shadow-securetty-4.2.1-r3@imx6qsabresd
util-linux-sulogin-2.25.2-r1@cortexa9hf_vfp_neon
1.4MB of package files are needed. 3.2MB will be used.
Confirm changes? (Y/n): y
Fetching packages...
->
http://SERVERIP/imx6qsd/.../openssh-6.7p1-r0.cortexa9hf_vfp_neon.rpm
->
http://SERVERIP/imx6qsd/.../shadow-securetty-4.2.1-r3.imx6qsabresd.rpm
shadow-securetty-4.2.1-r3.imx..
->
http://SERVERIP/imx6qsd/.../openssh-scp-6.7p1-r0.cortexa9hf_vfp_neon.rpm
openssh-scp-6.7p1-r0.cortexa9..
openssh-6.7p1-r0.cortexa9hf_v..
->
http://SERVERIP/imx6qsd/.../openssh-sshd-6.7p1-r0.cortexa9hf_vfp_neon.rpm
openssh-sshd-6.7p1-r0.cortexa..
->
http://SERVERIP/imx6qsd/.../shadow-4.2.1-r0.cortexa9hf_vfp_neon.rpm
->
http://SERVERIP/imx6qsd/.../openssh-ssh-6.7p1-r0.cortexa9hf_vfp_neon.rpm
openssh-ssh-6.7p1-r0.cortexa9..
->
http://SERVERIP/imx6qsd/.../shadow-base-4.2.1-r0.cortexa9hf_vfp_neon.rpm
shadow-base-4.2.1-r0.cortexa9..
shadow-4.2.1-r0.cortexa9hf_vf..
->
http://SERVERIP/.../util-linux-sulogin-2.25.2-r1.cortexa9hf_vfp_neon.rpm
util-linux-sulogin-2.25.2-r1...
->
http://SERVERIP/.../openssh-keygen-6.7p1-r0.cortexa9hf_vfp_neon.rpm
openssh-keygen-6.7p1-r0.corte..
Committing transaction...
Preparing...
1:Installing openssh-ssh
Output from openssh-ssh-6.7p1-r0@cortexa9hf_vfp_neon:
update-alternatives: Linking /usr/bin/ssh to /usr/bin/ssh.openssh
2:Installing openssh-scp
Output from openssh-scp-6.7p1-r0@cortexa9hf_vfp_neon:
update-alternatives: Linking /usr/bin/scp to /usr/bin/scp.openssh
3:Installing shadow-secure..
4:Installing shadow-base
Output from shadow-base-4.2.1-r0@cortexa9hf_vfp_neon:
update-alternatives: Linking /usr/bin/newgrp to /usr/bin/newgrp.shadow
update-alternatives: Linking /usr/bin/groups to /usr/bin/groups.shadow
update-alternatives: Linking /bin/login to /bin/login.shadow
update-alternatives: Linking /bin/su to /bin/su.shadow
5:Installing util-linux-su..
Output from util-linux-sulogin-2.25.2-r1@cortexa9hf_vfp_neon:
update-alternatives: Linking /sbin/sulogin to /sbin/sulogin.util-linux
6:Installing openssh-keygen
7:Installing shadow
Output from shadow-4.2.1-r0@cortexa9hf_vfp_neon:
update-alternatives: Linking /usr/bin/passwd to /usr/bin/passwd.shadow
update-alternatives: Linking /usr/bin/chfn to /usr/bin/chfn.shadow
update-alternatives: Linking /usr/bin/chsh to /usr/bin/chsh.shadow
update-alternatives: Linking /usr/sbin/chpasswd to /usr/sbin/chpasswd.shadow
update-alternatives: Linking /sbin/vipw to /sbin/vipw.shadow
update-alternatives: Linking /sbin/vigr to /sbin/vigr.shadow
Output from openssh-sshd-6.7p1-r0@cortexa9hf_vfp_neon:
Removing any system startup links for sshd ...
Running useradd commands...
NOTE: Performing useradd with [ --system --no-create-home --home-dir /var/run/sshd --shell /bin/false --user-group sshd] and 10 times of retry
8:Installing openssh-sshd
Adding system startup for /etc/init.d/sshd.
Starting OpenBSD Secure Shell server: sshd
generating ssh RSA key...
generating ssh ECDSA key...
generating ssh DSA key...
generating ssh ED25519 key...
done.
9:Installing openssh
Check for the scp command:
root@imx6qsabresd:~
/usr/bin/scp
Summary
To add a new package on the server host, run bitbake <recipe> then bitbake package-index to update the rpm tracking information. On the target board, run smart update and then smart install <package>. Use smart search <regular expression string> to hunt for a package to install.