I'm working a vendor-supplied Linux on embedded target and certain functions like make
, apt-get
etc. are missing. is it possible to install a package manager onto my embedded target board itself? is it the right way to do it? tkx!
4 Answers
Tipically embebed systems have limited resources, small RAM and very small storage space by the current standards; hence the limited environment and the lack of development tools on the system.
Often alternative libraries like uClibc instead of glibc are also used to save resources.
The goal of uClibc is to provide as much functionality as possible in a small amount of space, and it is intended primarily for embedded use. It is also highly configurable in supported features, at the cost of ABI differences for different configurations. uClibc has been designed from the ground up to be a C library for embedded Linux. We don't need to worry about things like MS-DOS support, or BeOS, or AmigaOs any other system. This lets us cut out a lot of complexity and very carefully optimize for Linux.
Typically the development phase is done outside the system via cross compilers. So there is a requirement to install/setup a toolchain/development environment in another machine, possibly a full linux development server.
In some opensource projects, the toolchain is freely available, in commercial embebed solutions often you have to get it from the vendor.
From elinux
A toolchain is a set of distinct software development tools that are linked (or chained) together by specific stages such as GCC, binutils and glibc (a portion of the GNU Toolchain). Optionally, a toolchain may contain other tools such as a Debugger or a Compiler for a specific programming language, such as ,C++.
As for packages maintainers, check if is not there a native one - as it will have an official repository associated, with more utilities and security updates for your system ; for instance in OpenWRT it is called opkg.
Opkg (Open PacKaGe Management) is a lightweight package management system based upon ipkg. It is written in C and resembles APT/dpkg in operation. It is intended for use on embedded Linux devices and is used in this capacity in the OpenEmbedded and OpenWrt projects.
If you want to install Debian packages on a system running a Linux kernel, you can install a Debian hierarchy in a chroot with debootstrap. Installing Debian packages directly at the root is highly unlikely to work because the Debian package manager would compete with the base system to decide on the contents of key system files. Only one tool gets to decide what is /bin/sh
.
Schroot is very useful to transparently execute programs installed in a chroot.
How do I run 32-bit programs on a 64-bit Debian/Ubuntu? has a tutorial on installing a Debian-like distribution as a chroot under another Debian-like distribution. It can be used with only minor adjustment if the outer system is not Debian-like; you'll just have to download debootstrap manually, or run debootstrap in two phases (see the manual): one with --foreign
on your PC to prepare a directory tree, then transfer the directory tree to the target device as you see fit, and run debootstrap --second-stage
on the target device.
But if this is an embedded device with limited resources (as opposed to, say, an Android phone), then Debian may be overweight. Rui F Ribeiro's answer has some recommendations for alternative, lighter-weight distributions.
The right way would be to install the software you want manually, without the package manager.
If a package manager is not available on your system, there are often good reasons for this. Either there are space constraints (not having make
is a good indicator this is the case), or your system is not binary-compatible with existing repositories. So your attempt to install a package manager may be just wasting time.
Even if installing a package manager on your system is practically feasible, you'll probably have trouble using it on a system which is not supporting one. You'll have to somehow tell it which files you already have, and which dependencies those files satisfy. Basically, you'll have to reinstall the whole system from scratch using packages if you want to add new software via a package manager.
Yes, it is possible. The source code of apt is available here Download and build the source and add it in your target.
A sepearate repository with packages must be maintained to use apt-get.