From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11008 invoked by alias); 9 Jun 2007 08:47:22 -0000 Received: (qmail 10999 invoked by uid 22791); 9 Jun 2007 08:47:22 -0000 X-Spam-Check-By: sourceware.org Received: from stelecom.gomel.by (HELO stelecom.gomel.by) (82.209.213.61) by sourceware.org (qpsmtpd/0.31) with ESMTP; Sat, 09 Jun 2007 08:47:18 +0000 Received: from localhost (localhost [127.0.0.1]) by stelecom.gomel.by (Postfix) with ESMTP id 6E4AAB010632; Sat, 9 Jun 2007 11:47:12 +0300 (EEST) Received: from stelecom.gomel.by ([127.0.0.1]) by localhost (stelecom.gomel.by [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 26520-04; Sat, 9 Jun 2007 11:47:11 +0300 (EEST) Received: from localhost (unknown [86.57.140.219]) by stelecom.gomel.by (Postfix) with ESMTP id 516A2B00DF43; Sat, 9 Jun 2007 11:47:10 +0300 (EEST) Date: Mon, 11 Jun 2007 21:15:00 -0000 From: Sergei Gavrikov To: Christopher Cordahi Cc: ecos-discuss@ecos.sourceware.org Message-ID: <20070609084618.GA9081@ubuntu> References: <20070605182958.GA8564@ubuntu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.13 (2006-08-11) X-IsSubscribed: yes Mailing-List: contact ecos-discuss-help@ecos.sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: ecos-discuss-owner@ecos.sourceware.org Subject: Re: [ECOS] Adding checksum to elf file X-SW-Source: 2007-06/txt/msg00102.txt.bz2 On Fri, Jun 08, 2007 at 10:08:28PM -0400, Christopher Cordahi wrote: > On 05/06/07, Sergei Gavrikov wrote: > >On Tue, Jun 05, 2007 at 01:49:36PM -0400, Christopher Cordahi wrote: > >> Hello ecos > >> > >> I'd like to add some sort of checksum into the .elf files. > >> Is there a standard way of doing this? > >> > >> Googling I see some mention of a .dynamic tag DT_CHECKSUM > >> but not how to use it properly > >> and a short discussion in > >> http://ecos.sourceware.org/ml/binutils/2003-02/msg00242.html > >> but it doesn't seem very standard. > >> > >> Any ideas? > > > >It seems, it's more suitable to verify ELF using a parallel md5sum file > >That is 128-bit! There are sources http://www.ietf.org/rfc/rfc1321.txt. > > Thanks, > However I only want it to detect accidental file corruption, something that > can be added to the file at file creation and can be easily verified by the > program loader (redboot). At most I was thinking about implementing a > 32 bit CRC algorithm and probably only a 16 bits. Maintaining and > distributing only 1 file is much easier than 2 so I am hoping to add the > CRC to the file in a standard way. If there is no such standard I'll have > to resort to a method similar to that mentioned in the discussion. I have an idea to do it with no blood. You won't need tweak ELF. You can use zipped ELF and use RedBoot's [fis load] command with -d option (decompress). Any corruption in your gzip file will be found by gzip layer as well. Gzip has a nice crc checking. It quite works. There is a demo below Let's do it in shell make hello gzip hello nano hello.gz ; imitate a corruption :-) and this one let's do in RedBoot load -r -b %{freememlo} fis create hello.gz fis load -d hello.gz decompression error: invalid literal/lengths set If you can see, we catch that corruption before a run! More that, I build-in GUNZIP behavior in RedBoot every time to decrease an upload time when I use Ymodem to load ELFs. Gzipped, even non-stripped ELF files don't eat my FLASH. Note: your redboot_ROM.ecm should contain such things cdl_configuration eCos { ... package CYGPKG_COMPRESS_ZLIB current ; }; ... cdl_option CYGBLD_BUILD_REDBOOT_WITH_GUNZIP { user_value 1 }; -- Sergei -- Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss