暂无图片
暂无图片
暂无图片
暂无图片
暂无图片
busybox.pdf
213
13页
0次
2023-08-30
10墨值下载
CHAPTER 14
BusyBox and Linux initialization
Chapter Outline
Introducing BusyBox 220
Configuring and Installing BusyBox 220
BusyBox Settings 222
Applets 224
Building and Installing 225
Using BusyBox 226
User Space Initialization 226
Stage 1 Boot Loader 226
Stage 2 MLO 227
U-Boot 227
Linux Kernel 227
Systemd 228
User Space Initialization, the “Old Way” 230
Resources 231
Linux: the choice of a GNU generation
ksh@cis.ufl.edu put this on T-shirts in 1993
Very often the biggest problem in an embedded environment is the lack of resources,
specifically memory and storage space. As you have no doubt observed, either in the course
of reading this book, or from other experience, Linux is big! The kernel itself is often in the
range of two to four megabytes, and then there is the root file system, with its utility
programs and configuration files. Granted, our BBB is running a full Debian distro, but
still, we are limited to the 4 GB eMMC, or a microSD card.
In this chapter, we will look at a powerful tool for substantially reducing the overall
“footprint” of Linux to make it fit in limited resource embedded devices. The other topic
we will address in this chapter is User Space initialization, and specifically the question of
how to get our thermostat application to start at boot up.
219
Linux for Embedded and Real-time Applications.
DOI:
http://dx.doi.org/10.1016/B978-0-12-811277-9.00014-6
© 2018 Elsevier Inc. All rights reserved.
Introducing BusyBox
Even if your embedded device is “headless,” that is it has no screen and/or keyboard in the
usual sense for user interaction, you still need a minimal set of command line utilities. You
will no doubt need
mount, ifconfig, and probably several others to get the system up and
running. Remember that every shell command line utility is a separate program, with its
own executable file.
The idea behind BusyBox is brilliantly simple. Rather than have every utility be a separate
program with its attendant overhead, why not simply write one program that implements all
the utilities? Well, perhaps not all, but a very large number of the most common utilities.
Most utilities require the same set of “helper” functionality, such as parsing command lines
and converting ASCII to binary. Rather than duplicating these functions in hundreds of
files, BusyBox implements them exactly once.
The BusyBox project began in 1996, with the goal of putting a complete Linux system on a
single floppy disk that could serve as a rescue disk or an installer for the Debian Linux
distribution. A rescue disk is used to repair a Linux system that has become unbootable.
This means the rescue disk must be able to boot the system and mount the hard disk file
systems, and it must provide sufficient command line tools to bring the hard disk root file
system back to a bootable state.
Subsequently, embedded developers figured out that this was an obvious way to reduce the
Linux footprint in resource-constrained embedded environments. So the project grew well
beyond its Debian roots, and today BusyBox is a part of almost every commercial
embedded Linux offering, and is found in a wide array of Linux-based products, including
numerous routers, and media players.
BusyBox calls itself the “Swiss army knife” of embedded Linux because, like the knife, it
is an all-purpose tool. Technically, the developers refer to it as a “multi-call binary,”
meaning that the program is invoked in multiple ways to execute different commands. This
is done with symbolic links named for the various utilities. These links then all point to the
BusyBox executable.
Configuring and Installing BusyBox
The version of BusyBox running on my BBB is 1.20.2. Go to the website in the
“Resources” section and download that version, or any other one that matches your board
or strikes your fancy. Oddly, even though the BBB incorporates BusyBox, it appears there
are only two links to it. This may be because we are running a Debian distro, and Debian
itself does not use BusyBox.
220 Chapter 14
of 13
10墨值下载
【版权声明】本文为墨天轮用户原创内容,转载时必须标注文档的来源(墨天轮),文档链接,文档作者等基本信息,否则作者和墨天轮有权追究责任。如果您发现墨天轮中有涉嫌抄袭或者侵权的内容,欢迎发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论

关注
最新上传
暂无内容,敬请期待...
下载排行榜
Top250 周榜 月榜