[Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments

Gaël PORTAY gael.portay at savoirfairelinux.com
Sun Sep 24 13:25:51 UTC 2017


Arnout,

On Sun, Sep 24, 2017 at 12:04:19PM +0200, Arnout Vandecappelle wrote:
> 
> On 24-09-17 01:30, Gaël PORTAY wrote:
> > This post-image script now handles many optional arguments given
> > through the command-line.
> > 
> > Signed-off-by: Gaël PORTAY <gael.portay at savoirfairelinux.com>
> 
>  Can you evaluate how this patch interacts with [1] ? Note that I haven't looked
> at either of them in detail.
> 
> [1] http://patchwork.ozlabs.org/patch/788904/
>

Both patches does the same thing.

The only difference is that my patch parses arguments using a while loop
(and shifts the first argument), while the patch from Erik parses
argument using a for loop.

Here is a diff of both patches.

	-+: mine
	++: Erik

	@@ -27,9 +11,9 @@
	 -	if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
	 -		echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)."
	 -		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
	-+shift
	-+while [ $# -ne 0 ]; do
	-+	case "${1}" in
My patch is using a while --^ (+ shift)
	++for arg in "$@"
	++do
	++	case "${arg}" in
Erik's solution uses a for -^
	 +		--add-pi3-miniuart-bt-overlay)
	 +		if ! grep -qE '^dtoverlay=' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
	 +			echo "Adding 'dtoverlay=pi3-miniuart-bt' to config.txt (fixes ttyAMA0 serial console)."

Erik's forgot to indent the esac.

Otherwise, only the `-+ shift' would have been present is that chunk [*]. 

	@@ -71,15 +55,12 @@
	  __EOF__
	 -	fi
	 -	;;
	--esac
	 +		fi
	 +		;;
	-+	esac
	-+	shift
[*]: ---^-----------^
	-+done
	+ esac
	
	++done
	++
	  rm -rf "${GENIMAGE_TMP}"

Regards,
Gael



More information about the buildroot mailing list