[{"id":1774123,"web_url":"http://patchwork.ozlabs.org/comment/1774123/","msgid":"<f843fcf3-4bc0-53ec-8b75-34694270bab1@mind.be>","list_archive_url":null,"date":"2017-09-24T10:04:19","subject":"Re: [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many\n\targuments","submitter":{"id":11809,"url":"http://patchwork.ozlabs.org/api/people/11809/","name":"Arnout Vandecappelle","email":"arnout@mind.be"},"content":"On 24-09-17 01:30, Gaël PORTAY wrote:\n> This post-image script now handles many optional arguments given\n> through the command-line.\n> \n> Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>\n\n Can you evaluate how this patch interacts with [1] ? Note that I haven't looked\nat either of them in detail.\n\n[1] http://patchwork.ozlabs.org/patch/788904/\n\n\n Regards,\n Arnout\n\n> ---\n>  board/raspberrypi/post-image.sh | 42 ++++++++++++++++++++++-------------------\n>  1 file changed, 23 insertions(+), 19 deletions(-)\n> \n> diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh\n> index de972998b0..1b49f0ea30 100755\n> --- a/board/raspberrypi/post-image.sh\n> +++ b/board/raspberrypi/post-image.sh\n> @@ -5,38 +5,42 @@ BOARD_NAME=\"$(basename ${BOARD_DIR})\"\n>  GENIMAGE_CFG=\"${BOARD_DIR}/genimage-${BOARD_NAME}.cfg\"\n>  GENIMAGE_TMP=\"${BUILD_DIR}/genimage.tmp\"\n>  \n> -case \"${2}\" in\n> -\t--add-pi3-miniuart-bt-overlay)\n> -\tif ! grep -qE '^dtoverlay=' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> -\t\techo \"Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console).\"\n> -\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n> +shift\n> +while [ $# -ne 0 ]; do\n> +\tcase \"${1}\" in\n> +\t\t--add-pi3-miniuart-bt-overlay)\n> +\t\tif ! grep -qE '^dtoverlay=' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> +\t\t\techo \"Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console).\"\n> +\t\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n>  \n>  # fixes rpi3 ttyAMA0 serial console\n>  dtoverlay=pi3-miniuart-bt\n>  __EOF__\n> -\tfi\n> -\t;;\n> -\t--aarch64)\n> -\t# Run a 64bits kernel (armv8)\n> -\tsed -e '/^kernel=/s,=.*,=Image,' -i \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n> -\tif ! grep -qE '^arm_control=0x200' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> -\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n> +\t\tfi\n> +\t\t;;\n> +\t\t--aarch64)\n> +\t\t# Run a 64bits kernel (armv8)\n> +\t\tsed -e '/^kernel=/s,=.*,=Image,' -i \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n> +\t\tif ! grep -qE '^arm_control=0x200' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> +\t\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n>  \n>  # enable 64bits support\n>  arm_control=0x200\n>  __EOF__\n> -\tfi\n> +\t\tfi\n>  \n> -\t# Enable uart console\n> -\tif ! grep -qE '^enable_uart=1' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> -\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n> +\t\t# Enable uart console\n> +\t\tif ! grep -qE '^enable_uart=1' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n> +\t\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n>  \n>  # enable rpi3 ttyS0 serial console\n>  enable_uart=1\n>  __EOF__\n> -\tfi\n> -\t;;\n> -esac\n> +\t\tfi\n> +\t\t;;\n> +\tesac\n> +\tshift\n> +done\n>  \n>  rm -rf \"${GENIMAGE_TMP}\"\n>  \n>","headers":{"Return-Path":"<buildroot-bounces@busybox.net>","X-Original-To":["incoming@patchwork.ozlabs.org","buildroot@lists.busybox.net"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","buildroot@osuosl.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=busybox.net\n\t(client-ip=140.211.166.133; helo=hemlock.osuosl.org;\n\tenvelope-from=buildroot-bounces@busybox.net;\n\treceiver=<UNKNOWN>)","Received":["from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0N9r1tGDz9sPr\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 20:04:48 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id EE1E388A58;\n\tSun, 24 Sep 2017 10:04:45 +0000 (UTC)","from hemlock.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id o4ZVUfm4pOBA; Sun, 24 Sep 2017 10:04:44 +0000 (UTC)","from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby hemlock.osuosl.org (Postfix) with ESMTP id 4D0FA88A24;\n\tSun, 24 Sep 2017 10:04:44 +0000 (UTC)","from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id DD0171C3F88\n\tfor <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 10:04:42 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id D7CFE886C2\n\tfor <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 10:04:42 +0000 (UTC)","from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id T7JjoAWWGyLu for <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 10:04:41 +0000 (UTC)","from exchange.essensium.com (220.77.144.195.ipv4.evonet.be\n\t[195.144.77.220])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id 2E19D82BA1\n\tfor <buildroot@buildroot.org>; Sun, 24 Sep 2017 10:04:40 +0000 (UTC)","from [10.8.0.14] (10.3.7.11) by beleexch01.local.ess-mail.com\n\t(10.3.7.8) with Microsoft SMTP Server (TLS) id 15.0.847.32;\n\tSun, 24 Sep 2017 12:04:20 +0200"],"X-Virus-Scanned":["amavisd-new at osuosl.org","amavisd-new at osuosl.org"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","To":"=?utf-8?q?Ga=C3=ABl_PORTAY?= <gael.portay@savoirfairelinux.com>,\n\t<buildroot@buildroot.org>, Zoltan Gyarmati\n\t<mr.zoltan.gyarmati@gmail.com>, Erik Stromdahl <erik.stromdahl@gmail.com>","References":"<20170923233007.13772-1-gael.portay@savoirfairelinux.com>\n\t<20170923233007.13772-2-gael.portay@savoirfairelinux.com>","From":"Arnout Vandecappelle <arnout@mind.be>","Organization":"Essensium/Mind","Message-ID":"<f843fcf3-4bc0-53ec-8b75-34694270bab1@mind.be>","Date":"Sun, 24 Sep 2017 12:04:19 +0200","User-Agent":"Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101\n\tThunderbird/52.3.0","MIME-Version":"1.0","In-Reply-To":"<20170923233007.13772-2-gael.portay@savoirfairelinux.com>","Content-Language":"en-GB","X-Originating-IP":"[10.3.7.11]","X-ClientProxiedBy":"beleexch01.local.ess-mail.com (10.3.7.8) To\n\tbeleexch01.local.ess-mail.com (10.3.7.8)","Subject":"Re: [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many\n\targuments","X-BeenThere":"buildroot@busybox.net","X-Mailman-Version":"2.1.18-1","Precedence":"list","List-Id":"Discussion and development of buildroot <buildroot.busybox.net>","List-Unsubscribe":"<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>","List-Archive":"<http://lists.busybox.net/pipermail/buildroot/>","List-Post":"<mailto:buildroot@busybox.net>","List-Help":"<mailto:buildroot-request@busybox.net?subject=help>","List-Subscribe":"<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>","Content-Type":"text/plain; charset=\"utf-8\"","Content-Transfer-Encoding":"base64","Errors-To":"buildroot-bounces@busybox.net","Sender":"\"buildroot\" <buildroot-bounces@busybox.net>"}},{"id":1774186,"web_url":"http://patchwork.ozlabs.org/comment/1774186/","msgid":"<20170924132551.uvxo7nhtxbvbggo5@gportay>","list_archive_url":null,"date":"2017-09-24T13:25:51","subject":"Re: [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many\n\targuments","submitter":{"id":70334,"url":"http://patchwork.ozlabs.org/api/people/70334/","name":"Gaël PORTAY","email":"gael.portay@savoirfairelinux.com"},"content":"Arnout,\n\nOn Sun, Sep 24, 2017 at 12:04:19PM +0200, Arnout Vandecappelle wrote:\n> \n> On 24-09-17 01:30, Gaël PORTAY wrote:\n> > This post-image script now handles many optional arguments given\n> > through the command-line.\n> > \n> > Signed-off-by: Gaël PORTAY <gael.portay@savoirfairelinux.com>\n> \n>  Can you evaluate how this patch interacts with [1] ? Note that I haven't looked\n> at either of them in detail.\n> \n> [1] http://patchwork.ozlabs.org/patch/788904/\n>\n\nBoth patches does the same thing.\n\nThe only difference is that my patch parses arguments using a while loop\n(and shifts the first argument), while the patch from Erik parses\nargument using a for loop.\n\nHere is a diff of both patches.\n\n\t-+: mine\n\t++: Erik\n\n\t@@ -27,9 +11,9 @@\n\t -\tif ! grep -qE '^dtoverlay=' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n\t -\t\techo \"Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console).\"\n\t -\t\tcat << __EOF__ >> \"${BINARIES_DIR}/rpi-firmware/config.txt\"\n\t-+shift\n\t-+while [ $# -ne 0 ]; do\n\t-+\tcase \"${1}\" in\nMy patch is using a while --^ (+ shift)\n\t++for arg in \"$@\"\n\t++do\n\t++\tcase \"${arg}\" in\nErik's solution uses a for -^\n\t +\t\t--add-pi3-miniuart-bt-overlay)\n\t +\t\tif ! grep -qE '^dtoverlay=' \"${BINARIES_DIR}/rpi-firmware/config.txt\"; then\n\t +\t\t\techo \"Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console).\"\n\nErik's forgot to indent the esac.\n\nOtherwise, only the `-+ shift' would have been present is that chunk [*]. \n\n\t@@ -71,15 +55,12 @@\n\t  __EOF__\n\t -\tfi\n\t -\t;;\n\t--esac\n\t +\t\tfi\n\t +\t\t;;\n\t-+\tesac\n\t-+\tshift\n[*]: ---^-----------^\n\t-+done\n\t+ esac\n\t\n\t++done\n\t++\n\t  rm -rf \"${GENIMAGE_TMP}\"\n\nRegards,\nGael","headers":{"Return-Path":"<buildroot-bounces@busybox.net>","X-Original-To":["incoming@patchwork.ozlabs.org","buildroot@lists.busybox.net"],"Delivered-To":["patchwork-incoming@bilbo.ozlabs.org","buildroot@osuosl.org"],"Authentication-Results":"ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=busybox.net\n\t(client-ip=140.211.166.137; helo=fraxinus.osuosl.org;\n\tenvelope-from=buildroot-bounces@busybox.net;\n\treceiver=<UNKNOWN>)","Received":["from fraxinus.osuosl.org (smtp4.osuosl.org [140.211.166.137])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y0Sf45G9pz9sRV\n\tfor <incoming@patchwork.ozlabs.org>;\n\tSun, 24 Sep 2017 23:26:04 +1000 (AEST)","from localhost (localhost [127.0.0.1])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id EE47587214;\n\tSun, 24 Sep 2017 13:26:00 +0000 (UTC)","from fraxinus.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id Z_AD-YNJNL9U; Sun, 24 Sep 2017 13:25:59 +0000 (UTC)","from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby fraxinus.osuosl.org (Postfix) with ESMTP id DBB42871A4;\n\tSun, 24 Sep 2017 13:25:58 +0000 (UTC)","from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138])\n\tby ash.osuosl.org (Postfix) with ESMTP id D3EC41C0167\n\tfor <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 13:25:56 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n\tby whitealder.osuosl.org (Postfix) with ESMTP id CF04887F8D\n\tfor <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 13:25:56 +0000 (UTC)","from whitealder.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id jfvDlYb8eHCZ for <buildroot@lists.busybox.net>;\n\tSun, 24 Sep 2017 13:25:55 +0000 (UTC)","from mail.savoirfairelinux.com (mail.savoirfairelinux.com\n\t[208.88.110.44])\n\tby whitealder.osuosl.org (Postfix) with ESMTPS id B32CF87F6E\n\tfor <buildroot@buildroot.org>; Sun, 24 Sep 2017 13:25:55 +0000 (UTC)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 240419C1CB2;\n\tSun, 24 Sep 2017 09:25:53 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10032)\n\twith ESMTP id 62c_N3yobx82; Sun, 24 Sep 2017 09:25:52 -0400 (EDT)","from localhost (localhost [127.0.0.1])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTP id 4A3909C20ED;\n\tSun, 24 Sep 2017 09:25:52 -0400 (EDT)","from mail.savoirfairelinux.com ([127.0.0.1])\n\tby localhost (mail.savoirfairelinux.com [127.0.0.1]) (amavisd-new,\n\tport 10026)\n\twith ESMTP id ZROKG2xM7eq2; Sun, 24 Sep 2017 09:25:52 -0400 (EDT)","from gportay (modemcable013.17-177-173.mc.videotron.ca\n\t[173.177.17.13])\n\tby mail.savoirfairelinux.com (Postfix) with ESMTPSA id 143D49C1CB2;\n\tSun, 24 Sep 2017 09:25:52 -0400 (EDT)"],"X-Virus-Scanned":["amavisd-new at osuosl.org","amavisd-new at osuosl.org","amavisd-new at mail.savoirfairelinux.com"],"X-Greylist":"domain auto-whitelisted by SQLgrey-1.7.6","Date":"Sun, 24 Sep 2017 09:25:51 -0400","From":"=?iso-8859-1?q?Ga=EBl?= PORTAY <gael.portay@savoirfairelinux.com>","To":"Arnout Vandecappelle <arnout@mind.be>","Message-ID":"<20170924132551.uvxo7nhtxbvbggo5@gportay>","References":"<20170923233007.13772-1-gael.portay@savoirfairelinux.com>\n\t<20170923233007.13772-2-gael.portay@savoirfairelinux.com>\n\t<f843fcf3-4bc0-53ec-8b75-34694270bab1@mind.be>","MIME-Version":"1.0","Content-Disposition":"inline","In-Reply-To":"<f843fcf3-4bc0-53ec-8b75-34694270bab1@mind.be>","User-Agent":"NeoMutt/20161104 (1.7.1)","Cc":"Erik Stromdahl <erik.stromdahl@gmail.com>, buildroot@buildroot.org","Subject":"Re: [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many\n\targuments","X-BeenThere":"buildroot@busybox.net","X-Mailman-Version":"2.1.18-1","Precedence":"list","List-Id":"Discussion and development of buildroot <buildroot.busybox.net>","List-Unsubscribe":"<http://lists.busybox.net/mailman/options/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=unsubscribe>","List-Archive":"<http://lists.busybox.net/pipermail/buildroot/>","List-Post":"<mailto:buildroot@busybox.net>","List-Help":"<mailto:buildroot-request@busybox.net?subject=help>","List-Subscribe":"<http://lists.busybox.net/mailman/listinfo/buildroot>,\n\t<mailto:buildroot-request@busybox.net?subject=subscribe>","Content-Type":"text/plain; charset=\"iso-8859-1\"","Content-Transfer-Encoding":"quoted-printable","Errors-To":"buildroot-bounces@busybox.net","Sender":"\"buildroot\" <buildroot-bounces@busybox.net>"}}]