ar -x *.ipk
. βββ control.tar.gz βββ data.tar.gz βββ debian-binary
git clone git://git.yoctoproject.org/opkg.git cd opkg
tar xzf opkg-0.3.1.tar.gz cd opkg-0.3.1/
./autogen.sh
./autogen.sh
with the --clean
parameter, then all works on the project configuration will be deleted.
./autogen.sh
, the configure
script appears in the source directory, it will configure the package, determine and set system-dependent variables. As a result of the script, a Makefile is created. You can view all script options in the standard way:
./configure --help
make install
, the script scatters all useful files (binaries, scripts, documentation) in the root directory: /etc
, /usr/local
, which is completely useless to us. We're not going to use opkg to configure packages on the current system? In addition, having installed the manager in the system folders, to use the utilities, you will need superuser rights, in my opinion, this is unnecessary when setting up the embedded linux image. The configure.sh
script allows you to specify a prefix for the package installation directory. Specifying any working directory as a prefix, we will inform the installer where to put the package. If necessary, you can separately specify the prefix for architecture-dependent (binaries and libraries) and architecture-independent (scripts and documentation) files.
mkdir ${HOME}/opkg_offline
./configure --prefix=${HOME}/opkg_offline
libarchive-dev
, libcurl4-gnutls-dev
, libssl-dev
, libgpgme11-dev
to build successfully.
sudo apt-get install libarchive-dev sudo apt-get install libcurl4-gnutls-dev sudo apt-get install libssl-dev sudo apt-get install libgpgme11-dev
make make install
opkg_offline βββ bin β βββ opkg β βββ opkg-check-config β βββ opkg-key βββ lib β βββ libopkg.a β βββ libopkg.la β βββ libopkg.so -> libopkg.so.1.0.0 β βββ libopkg.so.1 -> libopkg.so.1.0.0 β βββ libopkg.so.1.0.0 β βββ pkgconfig β βββ libopkg.pc βββ share βββ man β βββ man1 β βββ opkg.1 β βββ opkg-key.1 βββ opkg βββ intercept βββ depmod βββ ldconfig βββ update-modules
./bin/opkg
.
opkg update
command, the utility reads configuration files that are located by default in /etc/opkg
and have the extension .conf. From these files, the system determines the type of architecture, for example, armv5hf-vfp or armv5tehf-vfp (there may be several supported architectures, you can set a priority for each), a list of repositories, and some settings of the program itself. Next, for each repository from the list, an archive of the type *_Packages.gz
. Default archives are placed in the var/cache/opkg/
. After unpacking, the contents are placed in var/lib/opkg/lists
. Each archive contains a text file with a list of packages in the repository. For each package, in addition to the name, there is a version, architecture, size, short description, license, and most importantly, dependencies. Based on these files, the package manager can provide information about the required package upon request, and when installing it, determine all dependencies and resolve them.
opkg list
command opkg list
all packages available for installation; The opkg list-installed
command opkg list-installed
will show only installed packages, the opkg info
command will show information about the specified package, and if it is installed, then the installation time.
opkg install packname
. As a result, the required package from the repository will be downloaded to the temporary directory and distributed. All files from the data.tar.gz archive will go to rootfs in their places, and based on the contents of control.tar.gz, service files will be created in the var/lib/opkg/info
packname.control
: packname.control
- complete information about the package, packname.list
- the list of directories in which the files from data.tar.gz went (this list will go through opkg when the package is deleted), and script files such as packname.postinst
, packname.preinst
, packname.prerm
, packname.postrm
, whose purposes are clear from the title. Information about the installed package will be added to the var/lib/opkg/status
file as (example for the popular minicom ):
Package: minicom Version: 2.6.2-r0.2 Depends: libtinfo5 (>= 5.9), libc6 (>= 2.17) Status: install ok installed Architecture: armv7ahf-vfp-neon Installed-Time: 1454529423
Status
. If the package was installed according to all the rules: all files are copied to their place, all scripts are executed, then the status will be Status: install ok installed
. When working offline, all files will be copied, but the scripts will not be executed, such packages will be marked as Status: install ok unpacked
.
opkg configure <packname>
. If you specify the name of a specific package, the scripts from var / lib / opkg / info will be executed for this package; if the name is omitted, the manager will configure for all packages whose status is Status: install ok unpacked
. Thus, when installing packages to the host in offline mode, when you first load the operating system on the target, you should run opkg configure
. You can entrust this either to a special script or, if systemd is used, to a special service.
etc/opkg
directory * .conf. If it is not there, or for some reason we do not want to use the configuration from rootfs, we can use the parameter to specify which settings file to use: -f etc/opkg/opkg.conf
. The path to the target file system is passed through the parameter --offline-root /path/to/rootfs
.
bin/opkg update --offline-root /path/to/rootfs
bin/opkg list --offline-root ~/board/rootfs/angstrom/rootfs-v2015.10 | grep minicom minicom - 2.7-r0.0 - Text-based modem control and terminal emulation program Minicom is a minicom-dbg - 2.7-r0.0 - Text-based modem control and terminal emulation program - Debugging files minicom-dev - 2.7-r0.0 - Text-based modem control and terminal emulation program - Development minicom-doc - 2.7-r0.0 - Text-based modem control and terminal emulation program - Documentation
bin/opkg info minicom --offline-root ~/board/rootfs/angstrom/rootfs-v2015.10
Package: minicom Version: 2.7-r0.0 Depends: libtinfo5 (>= 5.9), libc6 (>= linaro-2.20) Status: unknown ok not-installed Section: console/network Architecture: armv7at2hf-vfp-neon Maintainer: Angstrom Developers <angstrom-distro-devel@linuxtogo.org> MD5Sum: e4d11b7277fbc1c7db6bbd97ac52ca2c Size: 79354 Filename: minicom_2.7-r0.0_armv7at2hf-vfp-neon.ipk Description: Text-based modem control and terminal emulation program Minicom is a text-based modem control and terminal emulation program for Unix-like operating systems
bin/opkg install minicom --offline-root ~/board/rootfs/angstrom/rootfs-v2015.10
var/lib/opkg
appeared in the var/lib/opkg
file:
Package: minicom Version: 2.7-r0.0 Depends: libtinfo5 (>= 5.9), libc6 (>= linaro-2.20) Status: install user unpacked Architecture: armv7at2hf-vfp-neon Installed-Time: 1454594718
opkg configure
command opkg configure
, the entry in the file changed:
Package: minicom Version: 2.7-r0.0 Depends: libtinfo5 (>= 5.9), libc6 (>= linaro-2.20) Status: install user installed Architecture: armv7at2hf-vfp-neon Installed-Time: 1454594718
rm -rvf ~/board/rootfs/angstrom/rootfs-v2015.10/var/cache/opkg/* rm -rvf ~/board/rootfs/angstrom/rootfs-v2015.10/var/lib/opkg/lists/*
--volatile-cache
will allow clearing the cache automatically upon completion of work.
opkg configure
command runs only \*.postinst
opkg configure
for execution, but the question remains with the execution of \*.preinst
. Due to the fact that \*.preinst
is quite rare in packages, for me it is acceptable to view the scripts manually, and, if necessary, to work them out when you first start the target system (special services for systemd). I would be grateful for the advice.
Source: https://habr.com/ru/post/276609/