summaryrefslogtreecommitdiffstats
path: root/dev/todo/removing-libbb-from-opkg.mdwn
blob: f505b1fd04507c1c9123e922eb880370ca73ab90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
[[!meta title="Removing libbb from opkg"]]

Upstream has done this, but in a different way.  [Instead
of][opkg-devel-dropped] including an ancient
and patched copy of libbb, [opkg][opkg-git-add-dep] now [links
against][opkg-git-convert] libarchive.

**The rest of this page is kept only for reference and historical purposes.**

[opkg-devel-dropped]: https://groups.google.com/forum/?_escaped_fragment_=topic/opkg-devel/HYBBK8YeazI#!topic/opkg-devel/HYBBK8YeazI
[opkg-git-add-dep]: http://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=55a5c61
[opkg-git-convert]: http://git.yoctoproject.org/cgit/cgit.cgi/opkg/commit/?id=8e21478

---

opkg includes and is statically linked with [a copy of libbb][opkg-libbb],
BusyBox's helper library.  Of course, BusyBox is also linked against its own
copy of libbb.  This is a bad idea in general, since duplicated code makes
maintenance more difficult and is often subject to bit rot (resulting in
long-standing bugs and security problems).  It's an even larger problem (no pun
intended) in embedded systems, where saving space is important.

The Good News
-------------

libbb can be built as a shared library by setting the `CONFIG_BUILD_LIBBUSYBOX`
option to `y` in BusyBox's configuration.  So, we can make `libbusybox.N` and
`libbusybox.N-dev` binary packages that provide this shared library and its
header files, modify opkg to dynamically link against this library (instead of
statically linking against its own copy), and add dependency information to the
`opkg` source package and its binary packages.

The Bad News
------------

The copy of libbb in opkg hasn't been updated from its upstream source since at
least 2008, when opkg development began from the old ipkg sources.  Three months
later, [an attempt][opkg-devel-libbb] was made by Koen Kooi to update the copy
of libbb, but it was determined that BusyBox had changed significantly since the
code was added to ipkg.  Things have most likely gotten much worse in the more
than three years since then.

To make matters slightly worse, many of the libbb files have been patched in
opkg.  Any files in [/trunk/libbb][opkg-libbb] newer than revision 3 have opkg
modifications.

The Plan
--------

  * Build a shared libbusybox library and set of binary packages.
  * Port opkg to work with more recent versions of BusyBox's shared library.
  * Modify opkg to dynamically link against libbusybox.
  * Add `Build-Depends` and `Depends` fields to the `opkg` source package.
  * Investigate API and ABI stability of libbusybox.  This may require
    coordination with BusyBox developers.
  * Look at each patch in opkg against libbb.  If it's still useful in newer
    versions, then refresh it, apply it to the `busybox` source package, and
    forward it upstream to BusyBox.


[opkg-libbb]: https://code.google.com/p/opkg/source/browse/trunk/libbb
[opkg-devel-libbb]: https://groups.google.com/group/opkg-devel/browse_thread/thread/fe5c620bc339ba63