From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from ptx.hi.pengutronix.de ([2001:6f8:1178:2:5054:ff:fec0:8e10] ident=Debian-exim) by metis.ext.pengutronix.de with esmtp (Exim 4.72) (envelope-from ) id 1WkV6R-000491-Pn for ptxdist@pengutronix.de; Wed, 14 May 2014 11:03:55 +0200 Received: from ukl by ptx.hi.pengutronix.de with local (Exim 4.80) (envelope-from ) id 1WkV6X-0001eW-EM for ptxdist@pengutronix.de; Wed, 14 May 2014 11:04:01 +0200 Date: Wed, 14 May 2014 11:04:01 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= Message-ID: <20140514090401.GG16662@pengutronix.de> References: <1400054072-1680-1-git-send-email-t.gamez@phytec.de> <1400054072-1680-2-git-send-email-t.gamez@phytec.de> <20140514084735.GA13402@omega> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20140514084735.GA13402@omega> Subject: Re: [ptxdist] [PATCH 2/2] barebox_mlo: use images/barebox-*-mlo.img as images Reply-To: ptxdist@pengutronix.de List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: ptxdist-bounces@pengutronix.de Errors-To: ptxdist-bounces@pengutronix.de To: ptxdist@pengutronix.de On Wed, May 14, 2014 at 10:47:38AM +0200, Alexander Aring wrote: > On Wed, May 14, 2014 at 09:54:32AM +0200, Teresa G=E1mez wrote: > > New barebox versions may create multiple MLO images. > > Adapted barebox_mlo rule to handle this. > > = > > Signed-off-by: Teresa G=E1mez > > --- > > rules/barebox_mlo.make | 17 ++++++++++++++--- > > 1 files changed, 14 insertions(+), 3 deletions(-) > > = > > diff --git a/rules/barebox_mlo.make b/rules/barebox_mlo.make > > index 3c53575..8b2bce4 100644 > > --- a/rules/barebox_mlo.make > > +++ b/rules/barebox_mlo.make > > @@ -76,9 +76,20 @@ $(STATEDIR)/barebox_mlo.install: > > $(STATEDIR)/barebox_mlo.targetinstall: > > @$(call targetinfo) > > # #barebox renamed barebox.bin.ift to MLO, so fall back to barebox.bin= .ift > > - @ptxd_get_path "$(BAREBOX_MLO_DIR)/MLO" \ > > - "$(BAREBOX_MLO_DIR)/barebox.bin.ift" && \ > > - install -D -m644 "$${ptxd_reply}" "$(IMAGEDIR)/MLO" > > + @rm -f $(IMAGEDIR)/MLO > > + @for image in `ls $(BAREBOX_MLO_DIR)/images/barebox-*-mlo.img`; do \ > > + install -D -m644 $$image $(IMAGEDIR)/`basename $$image`; \ > > + if [ ! -e $(IMAGEDIR)/MLO ]; then \ > > + ln -sf `basename $$image` $(IMAGEDIR)/MLO; \ > > + fi; \ > > + done > > + @if [ -e $(IMAGEDIR)/MLO ]; then \ > > + :; \ > > + else \ > > + ptxd_get_path "$(BAREBOX_MLO_DIR)/MLO" \ > > + "$(BAREBOX_MLO_DIR)/barebox.bin.ift" && \ > > + install -D -m644 "$${ptxd_reply}" "$(IMAGEDIR)/MLO"; \ > > + fi > negative logic here, without explicit do nothing [if -e $(IMAGEDIR)/MLO] ? > Or we should call "exit 1" here? I don't know if ptxdist can handle this > as error or this case can ever happen. > = > And why ":;"? You need a command in the then branch: $ sh -c 'if true; then # nothing else echo jippie fi' sh: 3: Syntax error: "else" unexpected Using ":" instead of "# nothing" works fine. An option is [ ! -e $(IMAGEDIR)/MLO ];. ISTR that if ! $somecommand; then ... isn't portable, but I think [ supports ! everywhere. Apart from that, there are missing quotes, better write if [ ! -e "$(IMAGEDIR)/MLO" ]; then \ but the surrounding code seems affected, too. Best regards Uwe -- = Pengutronix e.K. | Uwe Kleine-K=F6nig | Industrial Linux Solutions | http://www.pengutronix.de/ | -- = ptxdist mailing list ptxdist@pengutronix.de