1 |
On Thu, 1 Dec 2011 11:41:50 -0500, Michael Mol wrote about Re: |
2 |
[gentoo-user] Re: Full disk encryption: |
3 |
|
4 |
> On Wed, Nov 30, 2011 at 8:23 PM, David W Noon <dwnoon@××××××××.com> |
5 |
> wrote: |
6 |
> > On Wed, 30 Nov 2011 19:39:11 -0500, Michael Mol wrote about "Re: |
7 |
> > [gentoo-user] Re: Full disk encryption": |
8 |
> > |
9 |
> > [snip] |
10 |
> >>Stupid question...Would using LZMA and a tarball reduce the size of |
11 |
> >>your initeamfs? |
12 |
> > |
13 |
> > Not really. I am already using gzip -9, and binaries don't compress |
14 |
> > especially well. Moreover, the archiver *must* be cpio, not tar. |
15 |
> |
16 |
> I don't understand initrd that well, but I understand you run an |
17 |
> init-type script inside it. |
18 |
> |
19 |
> My thought was: |
20 |
> 1) Include enough in your cpio blob to extract a .tar.xz file. Even |
21 |
> better if you can use a self-extracting, statically-linked LZMAball. |
22 |
> 2) launch a second-stage init sequence from the |
23 |
> subsequently-extracted data. |
24 |
> |
25 |
> Large groups of binaries can compress pretty well, but, obviously, it |
26 |
> depends greatly on the data in question. |
27 |
|
28 |
The initramfs is already a compressed archive. It can be compressed |
29 |
using gzip, bzip2 or lzma/xz. All of these give only modest reduction |
30 |
in size. |
31 |
|
32 |
> Also, wasn't there an ELF-specific compressor making the rounds a few |
33 |
> months ago? And I take it there are no existing tools to take a |
34 |
> dynamically-linked binary, pack in all the pulled-in files, rewrite |
35 |
> symbol tables to include only the symbols used, pull the thing all |
36 |
> into a single now-statically-linked binary, and perform something like |
37 |
> COMDAT folding to remove duplicate functions? It would seem possible, |
38 |
> at least. |
39 |
|
40 |
The problem with that is that internal references within a .so library |
41 |
are somewhat ambiguous, because the address constants have already been |
42 |
partially relocated, eliminating symbol dictionary lookups (i.e. |
43 |
references that were originally external have been made internal by |
44 |
symbol dictionary lookup and then the symbol converted into an offset |
45 |
within the load library). |
46 |
|
47 |
In contrast, an ar-format library is simply a collection of object |
48 |
decks (old mainframe term) indexed by their external symbols. Thus the |
49 |
linker is forced to keep doing symbol dictionary lookups and object |
50 |
code extraction from libraries until all the external references have |
51 |
been resolved. There are no unresolved external references left in a |
52 |
correctly linked .so library, so this process cannot be repeated. |
53 |
|
54 |
The only feasible option I can think of is to use a full delinker on |
55 |
the main program. [I wrote one of these delinkers for the IBM mainframe |
56 |
back in the 1980s, so it's a technology I understand fairly well.] This |
57 |
would reverse all the partially relocated addresses back to external |
58 |
references by a reverse lookup in the symbol dictionary and relocation |
59 |
dictionary. This could restore the original object deck(s) of the main |
60 |
program and it/they could be relinked using the static libraries (if |
61 |
they exist). |
62 |
-- |
63 |
Regards, |
64 |
|
65 |
Dave [RLU #314465] |
66 |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |
67 |
dwnoon@××××××××.com (David W Noon) |
68 |
*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-* |