lkml.org 
[lkml]   [2011]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [PATCH] scripts: add extract-vmlinux
From
On Thu, Aug 11, 2011 at 3:33 PM, Michal Marek <mmarek@suse.cz> wrote:
> On 11.8.2011 15:08, Corentin Chary wrote:
>> On Thu, Aug 11, 2011 at 1:28 PM, Paul Bolle <pebolle@tiscali.nl> wrote:
>>> On Thu, 2011-08-11 at 10:53 +0200, Corentin Chary wrote:
>>>> +try_decompress()
>>>> +{
>>>> +     for     pos in `tr "$1\n$2" "\n$2=" < "$img" | grep -abo "^$2"`
>>>> +     do
>>>> +             pos=${pos%%:*}
>>>> +             tail -c+$pos "$img" | $3 > $tmp 2> /dev/null
>>>
>>> Perhaps a few comments on the above lines would be nice. Without those
>>> comments I must guess you're finding compressed data somewhere in the
>>> input file. It also seems you're looping through the entire input file.
>>> Or are (sequences of) commands like the above considered obvious?
>>
>> It's copied from extract-ikconfig, there was no comment in it, so I
>> assumed it's obvious.
>> Basically it uses brute force (tm) to find well known headers and try
>> to decompress from here.
>
> And explanation of the "tr" trick would not hurt though. It replaces the
> binary magic with an ascii sequence on a new line (for older grep
> versions to get it right) and tries all occurrences of that sequence, am
> I right? But I wouldn't call it "obvious" :).

It's that commented in the header of both scripts ? (I can move down
the command if wanted)

>
>>>> +# That didn't work, so retry after decompression.
>>>> +try_decompress '\037\213\010' xy    gunzip
>>>> +try_decompress '\3757zXZ\000' abcde unxz
>>>> +try_decompress 'BZh'          xy    bunzip2
>>>> +try_decompress '\135\0\0\0'   xxx   unlzma
>>>> +try_decompress '\211\114\132' xy    'lzop -d'
>>>
>>> Perhaps you could first test whether these commands are available before
>>> running try_decompress() with them?
>>
>> Same as before, if it's ok for extract-ikconfig not to check the
>> command, then it's ok for me.
>> If it's not, then we should patch both.
>
> Also, if you have lzma to build a lzma-compressed kernel, then you very
> likely also have unlzma.
>
> Michal
>



--
Corentin Chary
http://xf.iksaif.net
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2011-08-11 16:25    [W:0.052 / U:0.092 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site