The Debian package system is the underlying package-management system for the Debian distribution and is used by Ubuntu, one of the more popular Debian-based distributions. The Debian package system works much like the RPM system: you create a file with the package metadata and then combine the metadata into a package that another program uses to install the software on another system.
Debian has the notion of source and binary packages, and ideally you should build your binary package sources. However, not all projects can accommodate this, so packages can be built from binaries as well. This packaging system also has the ability to build a repository of packages that can be accessed by remote clients who can request the latest version of a package along with its dependencies. The following sections look at how to create a simple package and repository.
Creating a dpkg
You build a dpkg using a control file, similar to the way RPM files are built using a spec file.. Referencing the example project from the RPM, here’s a Debian package control file for the same binary project:
This file contains the metadata to describe the package so that the device installing it can decide whether it’s the right file, say by comparing the architecture or version of the package with that of the host. The example shown is the minimal set of information to create a package; thus, you can keep a focus on the higher-level process of creating a package and using it in a repository.
In the example package, the files are built into a directory, build/, that looks like the root file system on a device. For example:
In order to have dpkg build this directory (using default file locations, which is the easiest route by far), you name this control file DEBIAN/control, resulting in a directory structure that looks like the following:
After the control file is in the correct location,1 use the dpkg build command to build the package:
$ dpgk -b build embedded-app.deb dpkg-deb: building package `embedded-app' in `embedded-app.deb'
The file is now built and ready for use. If you want to inspect the contents, use the less command to get a quick overview:
Remote Update with Debian
After embedded-app.deb is on the target system, BusyBox contains a set of applets for installing Debian packages. Getting these packages on your system and installing them works much the same way as the RPM example: instead of using RPM, you use dpkg, and the modified part of the earlier script looks like this:
The rest of the script is exactly the same. In fact, you can make the command that performs the installation a macro so you can easily test both systems to see which one you prefer, although a resource-sensitive embedded engineer will never waste a few bytes that way.
You may not be keen on creating and maintaining a script that figures out what to download in order to update a system. It may be that the systems in the field have enough variations in their configuration that a simple script that downloads a list of packages and installs them isn’t sufficient to update the system. The Debian analogue to YUM is apt-get (part of the Debian Advanced Packaging Tool [APT] collection of utilities), and you can use it to create a pool of packages with dependency information so the user can fetch a package and all of its dependents in one operation.Creating an APT repository involves creating a set of directories to hold the packages and using a tool to create the supporting files for the APT tools to use to access the repositories. To get the necessary tools, fetch the package reprepro:
Next, create the directories for the repository. In this example, you create them in the /tmp directory, but any directory where you have write privileges can be used:
Next, the repository needs a configuration file so that when clients access the repository, they know what types of packages they can expect to find there. This is an example configuration file appropriate for the files you adding for the embedded device. This file needs to be stored as /tmp/apt/conf/distributions:Origin: Embedded Company Label: Embedded Device Software Suite: stable Codename: edasich Version: 1.0 Architectures: arm Components: main Description: This is an embedded code repository for an embedded device
After this file has been created, you can add the embedded-app file to the repository with this command:
You can verify that the package is located inside the repository by doing the following:
Now that the repository is ready, it’s a matter of getting the tools ready to run on the target board.
The apt tools are written in C++, so they don’t need additional tools like Python on the target to work(that is, if you’re not already using Python). In order to get the sources, use the apt-get source command:
The apt project uses the autoconf tools to build, so creating them for your target board should be a familiar process. For the compilation process to work correctly, you also need the curl library for your toolchain; if it isn’t present, download it and build it first:
Curl is a tool that allows high-level processing of URLs. This configuration command drops support for the LDAP and LDAPS authentication schemes, because these aren’t present in most toolchains and require additional steps to build. Unless you plan to use LDAP authentication, you can leave these out and save some space as well. After they’re installed, you can build the apt library like so:
When it’s installed on your target machine, you need to tell apt-get to use your repository when doing an update. You do so by putting an entry in the /etc/apt/sources.list file on the target machine. Using what you’ve created so far, the entry is deb file:///tmp/apt edasich.
The board can now be read from the repository and download packages when requested. This line says to check the repository at file:///tmp/apt, which contains packages for the edasich distribution, which is the label you’ve assigned to the set of packages. This file can have several lines and can use HTTP and FTP URLs. The example uses a file URL to make it as simple as possible.
Linux Embedded systems Related Tutorials
Linux Embedded systems Related Interview Questions
|Linux Embedded systems Interview Questions||Red Hat Linux Essentials Interview Questions|
|Red Hat Linux System Administration Interview Questions||Ubuntu Certified Professional Interview Questions|
|IBM AIX Interview Questions||Solaris Interview Questions|
|HP-ux 11iv3 system administration Interview Questions||Red Hat cluster Interview Questions|
|Embedded C Interview Questions||Unix/Linux Interview Questions|
|Unix Shell Scripting Interview Questions||Solaris Administrator Interview Questions|
Linux Embedded systems Related Practice Tests
|Linux Embedded systems Practice Tests||Red Hat Linux Essentials Practice Tests|
|Red Hat Linux System Administration Practice Tests||Ubuntu Certified Professional Practice Tests|
|IBM AIX Practice Tests||Solaris Practice Tests|
|HP-ux 11iv3 system administration Practice Tests|
Linux Embedded Systems Tutorial
About Embedded Linux
Configuring The Software Environment
Target Emulation And Virtual Machines
Starting Your Project
Getting Linux For Your Board
Creating A Linux Distribution From Scratch
Booting The Board
Configuring The Application Development Environment
Kernel Configuration And Development
Using Open Source Software Projects
Handling Field Updates
All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd
Wisdomjobs.com is one of the best job search sites in India.