Received: by 10.192.165.156 with SMTP id m28csp711688imm; Mon, 16 Apr 2018 07:32:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx49sb67VuCpzmsVCINsSIZTjsKk+8RuOrmC/nt9q5N7G8kgbtNsu2w+K5KlRVWeCiFzaSbfF X-Received: by 2002:a17:902:6709:: with SMTP id f9-v6mr15548563plk.159.1523889154556; Mon, 16 Apr 2018 07:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523889154; cv=none; d=google.com; s=arc-20160816; b=thkJId/s7jMkUqJhHXtaBSUgO5tcH6T8VwFTI5PYE5zdb7dSnVdMx0yWUglZoTzq/z 2cpebJbcEaA77vDqEoK9IvRyZDeRI1sbARZp/Ad9bgNjmqz58OoAcpLNk+qB1TnSGwu1 6rD7KA0fCO2K5+Jv1AUY7l98p1cSxx7o6KDt0yR49iBVkSYoY3WL1TsytDymV8GJOIcI +WCFl5qmg+yWRNpgKQuih7tJf+jB3nG7sMDz9+4b77Wa9N5uBNSWlqxRo5uHlGrMIUFJ O56C6XNWgqa+xmBQq8L6k+viQjrLQNZyERaJtm+6HuCfqziMyxV7WhyWoDK+UKM2vdjl CPig== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=+tOMYz75FSdLvt5SwWwPaAwegjE90Sse7gRmJfM8e+0=; b=GlWRar1uwwqo2OWel489bQ4aKTnZ58Dauc8UuEfYvFN4cHzMQpFxOZgtO62cAtTRw+ TfOb787WXY+rh5xSk4lOOU1IJHiBpKolba+pG7UU2xy5t3LAZlufCg8GuEmGNnGNnPLQ F72vb51eDFhDNik/iznGF2ne/fi6XlsKYjxvztIubpH2bxtxu/hjHXOeJ+HzvnotK7TB R/zcvZAjKyGSHepjm3HdJhF5FMC0Wk9njmpiTvfYwCx2PIa5yKxHsv37ji5U2CtWW4Qw pXpPQIlRe+swrA61Ip3641B7s61veENvdUcaO4QdRn0ThIZifr7Qk3rM6t244c62lZn+ miQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=E1+1a3az; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n185si4551379pga.151.2018.04.16.07.32.19; Mon, 16 Apr 2018 07:32:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=fail header.i=@armlinux.org.uk header.s=pandora-2014 header.b=E1+1a3az; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755274AbeDPMJp (ORCPT + 99 others); Mon, 16 Apr 2018 08:09:45 -0400 Received: from pandora.armlinux.org.uk ([78.32.30.218]:36734 "EHLO pandora.armlinux.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753744AbeDPMJo (ORCPT ); Mon, 16 Apr 2018 08:09:44 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2014; h=Sender:In-Reply-To:Content-Type: MIME-Version:References:Message-ID:Subject:Cc:To:From:Date:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+tOMYz75FSdLvt5SwWwPaAwegjE90Sse7gRmJfM8e+0=; b=E1+1a3azOinVMlwzbmSZWX248 zQ4LKXk6KbsCCXJuyvGtA8rRVB8S26s+IqD5pe6m6wHdz3D8Pi2O1VnNrDKnYxfjxmg9JQqf0qS8D 9ZoP8R+tGCrsZSKbiu44PdkHWfbZJvSWa1MOCkWI3l2gnyXD/mqKCzy1N1j6Gz27hMYBs=; Received: from n2100.armlinux.org.uk ([2001:4d48:ad52:3201:214:fdff:fe10:4f86]:52493) by pandora.armlinux.org.uk with esmtpsa (TLSv1.2:ECDHE-RSA-AES128-GCM-SHA256:128) (Exim 4.90_1) (envelope-from ) id 1f82wy-00079a-ER; Mon, 16 Apr 2018 13:09:36 +0100 Received: from linux by n2100.armlinux.org.uk with local (Exim 4.90_1) (envelope-from ) id 1f82wv-00040w-9A; Mon, 16 Apr 2018 13:09:33 +0100 Date: Mon, 16 Apr 2018 13:09:30 +0100 From: Russell King - ARM Linux To: Rob Landley Cc: "linux-kernel@vger.kernel.org" , kstewart@linuxfoundation.org, pombredanne@nexb.com, tglx@linutronix.de, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, Tony Lindgren , Keerthy Subject: Re: [PATCH] Replace unnecessary perl with sed, printf, and the shell $(( )) operator. Message-ID: <20180416120930.GS16141@n2100.armlinux.org.uk> References: <9c72100c-b3e4-07ca-1784-fda2ac9d708c@landley.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <9c72100c-b3e4-07ca-1784-fda2ac9d708c@landley.net> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Apr 11, 2018 at 08:38:37PM -0500, Rob Landley wrote: > You can build a kernel in a cross compiling environment that doesn't have perl > in the $PATH. Commit 429f7a062e3b broke that for 32 bit arm. Fix it. > > Signed-off-by: Rob Landley > --- > > arch/arm/boot/compressed/Makefile | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) > > diff --git a/arch/arm/boot/compressed/Makefile b/arch/arm/boot/compressed/Makefile > index 45a6b9b..33ebeb2 100644 > --- a/arch/arm/boot/compressed/Makefile > +++ b/arch/arm/boot/compressed/Makefile > @@ -117,11 +117,10 @@ ccflags-y := -fpic -mno-single-pic-base -fno-builtin -I$(obj) > asflags-y := -DZIMAGE > > # Supply kernel BSS size to the decompressor via a linker symbol. > -KBSS_SZ = $(shell $(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ > - perl -e 'while (<>) { \ > - $$bss_start=hex($$1) if /^([[:xdigit:]]+) B __bss_start$$/; \ > - $$bss_end=hex($$1) if /^([[:xdigit:]]+) B __bss_stop$$/; \ > - }; printf "%d\n", $$bss_end - $$bss_start;') > +KBSS_SZ := $(shell echo $$(($$(printf '%d+%d' $$( \ > + $(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ > + sed -n -e 's/^\([^ ]*\) B __bss_start$$/-0x\1/p' \ > + -e 's/^\([^ ]*\) B __bss_stop$$/0x\1/p') ) )) ) This looks more complicated than necessary, and therefore less readable. What's wrong with: KBSS_SZ := $(shell echo $$(($$($(CROSS_COMPILE)nm $(obj)/../../../../vmlinux | \ sed -n -e 's/^\([^ ]*\) B __bss_start$$/-0x\1/p' \ -e 's/^\([^ ]*\) B __bss_stop$$/+0x\1/p') )) The sed command produces output such as: -0xc0955e58 +0xc10b0f9c which the shell is then able to evaluate and produce a decimal number. This seems to work fine with both bash and dash. -- RMK's Patch system: http://www.armlinux.org.uk/developer/patches/ FTTC broadband for 0.8mile line in suburbia: sync at 8.8Mbps down 630kbps up According to speedtest.net: 8.21Mbps down 510kbps up