All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3
@ 2017-09-23 23:30 Gaël PORTAY
  2017-09-23 23:30 ` [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments Gaël PORTAY
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-23 23:30 UTC (permalink / raw)
  To: buildroot

Hi all,

This patch serie fixes a run-time issue with Qt WebEngine on a RPI3.

	# cd /usr/lib/qt/examples/webengine/quicknanobrowser/
	# ./quicknanobrowser https://www.buildroot.org/
	(...)
	#0 0x0000742c63de <unknown>
	#1 0x0000742d0c38 <unknown>
	#2 0x0000749d7bde <unknown>
	#3 0x0000749e3c70 <unknown>
	#4 0x00007530227c <unknown>
	#5 0x000075302480 <unknown>
	#6 0x0000752fb1e4 <unknown>
	#7 0x00007430f878 <unknown>
	#8 0x0000742d5fee <unknown>
	#9 0x0000742d6f44 <unknown>
	#10 0x0000742d721e <unknown>
	#11 0x0000742d7ad6 <unknown>
	#12 0x0000742d57b2 <unknown>
	#13 0x0000742e74f6 <unknown>
	#14 0x0000742f6a74 <unknown>
	#15 0x0000742f41dc <unknown>

	Received signal 6
	#0 0x0000742c63de <unknown>
	#1 0x0000742c66a0 <unknown>
	#2 0x0000725b5d10 <unknown>
	[end of stack trace]
	qml: Render process exited with code 256 (abnormal exit)

The first patch converts the raspberrypi post-image script so it handles many
arguments.

The second patch adds the new optional argument --gpu_mem_XXX to raspberrypi
post-image script; XXX is the amount of memory available on board 256/512/1024.

The third patch adds the additional argument --gpu_mem_1024=200 to post-image
script for the raspberrypi3_qt5we config.

Cc: Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com>

Regards,
Ga?l PORTAY (3):
  raspberrypi: post-image.sh handles many arguments
  raspberrypi: post-image.sh add new gpu_mem option
  configs/raspberrypi3_qt5we: set gpu-mem to 200

 board/raspberrypi/post-image.sh      | 47 +++++++++++++++++++++---------------
 configs/raspberrypi3_qt5we_defconfig |  2 +-
 2 files changed, 29 insertions(+), 20 deletions(-)

-- 
2.13.2

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments
  2017-09-23 23:30 [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Gaël PORTAY
@ 2017-09-23 23:30 ` Gaël PORTAY
  2017-09-24 10:04   ` Arnout Vandecappelle
  2017-09-23 23:30 ` [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option Gaël PORTAY
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-23 23:30 UTC (permalink / raw)
  To: buildroot

This post-image script now handles many optional arguments given
through the command-line.

Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 board/raspberrypi/post-image.sh | 42 ++++++++++++++++++++++-------------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index de972998b0..1b49f0ea30 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -5,38 +5,42 @@ BOARD_NAME="$(basename ${BOARD_DIR})"
 GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
 GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
 
-case "${2}" in
-	--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)."
-		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+shift
+while [ $# -ne 0 ]; do
+	case "${1}" in
+		--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)."
+			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
 
 # fixes rpi3 ttyAMA0 serial console
 dtoverlay=pi3-miniuart-bt
 __EOF__
-	fi
-	;;
-	--aarch64)
-	# Run a 64bits kernel (armv8)
-	sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
-	if ! grep -qE '^arm_control=0x200' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
-		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+		fi
+		;;
+		--aarch64)
+		# Run a 64bits kernel (armv8)
+		sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
+		if ! grep -qE '^arm_control=0x200' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
 
 # enable 64bits support
 arm_control=0x200
 __EOF__
-	fi
+		fi
 
-	# Enable uart console
-	if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
-		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
+		# Enable uart console
+		if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
+			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
 
 # enable rpi3 ttyS0 serial console
 enable_uart=1
 __EOF__
-	fi
-	;;
-esac
+		fi
+		;;
+	esac
+	shift
+done
 
 rm -rf "${GENIMAGE_TMP}"
 
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option
  2017-09-23 23:30 [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Gaël PORTAY
  2017-09-23 23:30 ` [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments Gaël PORTAY
@ 2017-09-23 23:30 ` Gaël PORTAY
  2017-09-24 10:15   ` Arnout Vandecappelle
  2017-09-23 23:30 ` [Buildroot] [PATCH 3/3] configs/raspberrypi3_qt5we: set gpu-mem to 200 Gaël PORTAY
  2017-09-27 20:12 ` [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Arnout Vandecappelle
  3 siblings, 1 reply; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-23 23:30 UTC (permalink / raw)
  To: buildroot

The amount of GPU memory can be set using the new option --gpu_mem_XXX
(where XXX is the total amount of memory available on the board).

Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 board/raspberrypi/post-image.sh | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
index 1b49f0ea30..9091476ced 100755
--- a/board/raspberrypi/post-image.sh
+++ b/board/raspberrypi/post-image.sh
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 
 BOARD_DIR="$(dirname $0)"
 BOARD_NAME="$(basename ${BOARD_DIR})"
@@ -38,6 +38,11 @@ enable_uart=1
 __EOF__
 		fi
 		;;
+		--gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*)
+		# Set GPU memory
+		gpu_mem="${1:2}"
+		sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"
+		;;
 	esac
 	shift
 done
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 3/3] configs/raspberrypi3_qt5we: set gpu-mem to 200
  2017-09-23 23:30 [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Gaël PORTAY
  2017-09-23 23:30 ` [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments Gaël PORTAY
  2017-09-23 23:30 ` [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option Gaël PORTAY
@ 2017-09-23 23:30 ` Gaël PORTAY
  2017-09-27 20:12 ` [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Arnout Vandecappelle
  3 siblings, 0 replies; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-23 23:30 UTC (permalink / raw)
  To: buildroot

Qt WebEngine requires more GPU memory than initial setup.

This fixes crashes such as this one.

	#0 0x0000742c63de <unknown>
	#1 0x0000742d0c38 <unknown>
	#2 0x0000749d7bde <unknown>
	#3 0x0000749e3c70 <unknown>
	#4 0x00007530227c <unknown>
	#5 0x000075302480 <unknown>
	#6 0x0000752fb1e4 <unknown>
	#7 0x00007430f878 <unknown>
	#8 0x0000742d5fee <unknown>
	#9 0x0000742d6f44 <unknown>
	#10 0x0000742d721e <unknown>
	#11 0x0000742d7ad6 <unknown>
	#12 0x0000742d57b2 <unknown>
	#13 0x0000742e74f6 <unknown>
	#14 0x0000742f6a74 <unknown>
	#15 0x0000742f41dc <unknown>

	Received signal 6
	#0 0x0000742c63de <unknown>
	#1 0x0000742c66a0 <unknown>
	#2 0x0000725b5d10 <unknown>
	[end of stack trace]
	qml: Render process exited with code 256 (abnormal exit)

Reported-by: Zoltan Gyarmati <mr.zoltan.gyarmati@gmail.com>
Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
---
 configs/raspberrypi3_qt5we_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/raspberrypi3_qt5we_defconfig b/configs/raspberrypi3_qt5we_defconfig
index 9df14c5307..8724f25a0d 100644
--- a/configs/raspberrypi3_qt5we_defconfig
+++ b/configs/raspberrypi3_qt5we_defconfig
@@ -47,4 +47,4 @@ BR2_TARGET_ROOTFS_EXT2_SIZE="360M"
 BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
 BR2_ROOTFS_POST_BUILD_SCRIPT="board/raspberrypi3/post-build.sh"
 BR2_ROOTFS_POST_IMAGE_SCRIPT="board/raspberrypi3/post-image.sh"
-BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay"
+BR2_ROOTFS_POST_SCRIPT_ARGS="--add-pi3-miniuart-bt-overlay --gpu_mem_1024=200"
-- 
2.13.2

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments
  2017-09-23 23:30 ` [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments Gaël PORTAY
@ 2017-09-24 10:04   ` Arnout Vandecappelle
  2017-09-24 13:25     ` Gaël PORTAY
  0 siblings, 1 reply; 11+ messages in thread
From: Arnout Vandecappelle @ 2017-09-24 10:04 UTC (permalink / raw)
  To: buildroot



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@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/


 Regards,
 Arnout

> ---
>  board/raspberrypi/post-image.sh | 42 ++++++++++++++++++++++-------------------
>  1 file changed, 23 insertions(+), 19 deletions(-)
> 
> diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
> index de972998b0..1b49f0ea30 100755
> --- a/board/raspberrypi/post-image.sh
> +++ b/board/raspberrypi/post-image.sh
> @@ -5,38 +5,42 @@ BOARD_NAME="$(basename ${BOARD_DIR})"
>  GENIMAGE_CFG="${BOARD_DIR}/genimage-${BOARD_NAME}.cfg"
>  GENIMAGE_TMP="${BUILD_DIR}/genimage.tmp"
>  
> -case "${2}" in
> -	--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)."
> -		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
> +shift
> +while [ $# -ne 0 ]; do
> +	case "${1}" in
> +		--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)."
> +			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
>  
>  # fixes rpi3 ttyAMA0 serial console
>  dtoverlay=pi3-miniuart-bt
>  __EOF__
> -	fi
> -	;;
> -	--aarch64)
> -	# Run a 64bits kernel (armv8)
> -	sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
> -	if ! grep -qE '^arm_control=0x200' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
> -		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
> +		fi
> +		;;
> +		--aarch64)
> +		# Run a 64bits kernel (armv8)
> +		sed -e '/^kernel=/s,=.*,=Image,' -i "${BINARIES_DIR}/rpi-firmware/config.txt"
> +		if ! grep -qE '^arm_control=0x200' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
> +			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
>  
>  # enable 64bits support
>  arm_control=0x200
>  __EOF__
> -	fi
> +		fi
>  
> -	# Enable uart console
> -	if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
> -		cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
> +		# Enable uart console
> +		if ! grep -qE '^enable_uart=1' "${BINARIES_DIR}/rpi-firmware/config.txt"; then
> +			cat << __EOF__ >> "${BINARIES_DIR}/rpi-firmware/config.txt"
>  
>  # enable rpi3 ttyS0 serial console
>  enable_uart=1
>  __EOF__
> -	fi
> -	;;
> -esac
> +		fi
> +		;;
> +	esac
> +	shift
> +done
>  
>  rm -rf "${GENIMAGE_TMP}"
>  
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option
  2017-09-23 23:30 ` [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option Gaël PORTAY
@ 2017-09-24 10:15   ` Arnout Vandecappelle
  2017-09-24 14:12     ` Gaël PORTAY
  0 siblings, 1 reply; 11+ messages in thread
From: Arnout Vandecappelle @ 2017-09-24 10:15 UTC (permalink / raw)
  To: buildroot



On 24-09-17 01:30, Ga?l PORTAY wrote:
> The amount of GPU memory can be set using the new option --gpu_mem_XXX
> (where XXX is the total amount of memory available on the board).
> 
> Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> ---
>  board/raspberrypi/post-image.sh | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
> index 1b49f0ea30..9091476ced 100755
> --- a/board/raspberrypi/post-image.sh
> +++ b/board/raspberrypi/post-image.sh
> @@ -1,4 +1,4 @@
> -#!/bin/sh
> +#!/bin/bash
>  
>  BOARD_DIR="$(dirname $0)"
>  BOARD_NAME="$(basename ${BOARD_DIR})"
> @@ -38,6 +38,11 @@ enable_uart=1
>  __EOF__
>  		fi
>  		;;
> +		--gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*)
> +		# Set GPU memory
> +		gpu_mem="${1:2}"
> +		sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"

 In the end, the config.txt is just for one board, right? So can't we just have
a single --gpu_mem=XXX option and do

		sed -i -e "/^gpu_mem_[0-9]*=/s/=.*/${1##*=}/" \
			"${BINARIES_DIR}/rpi-firmware/config.txt"

 Note that you no longer need to strip off the -- and that you no longer need bash.

 As you can see in the example, I also prefer if the options (-i) come in the
beginning, and to use / as the delimiter unless there actually are /-es in any
of the strings. But that's just personal preference.


 Regards,
 Arnout

> +		;;
>  	esac
>  	shift
>  done
> 

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments
  2017-09-24 10:04   ` Arnout Vandecappelle
@ 2017-09-24 13:25     ` Gaël PORTAY
  0 siblings, 0 replies; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-24 13:25 UTC (permalink / raw)
  To: buildroot

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@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option
  2017-09-24 10:15   ` Arnout Vandecappelle
@ 2017-09-24 14:12     ` Gaël PORTAY
  2017-09-24 14:20       ` Arnout Vandecappelle
  0 siblings, 1 reply; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-24 14:12 UTC (permalink / raw)
  To: buildroot

Arnout,

On Sun, Sep 24, 2017 at 12:15:09PM +0200, Arnout Vandecappelle wrote:
> 
> On 24-09-17 01:30, Ga?l PORTAY wrote:
> > The amount of GPU memory can be set using the new option --gpu_mem_XXX
> > (where XXX is the total amount of memory available on the board).
> > 
> > Signed-off-by: Ga?l PORTAY <gael.portay@savoirfairelinux.com>
> > ---
> >  board/raspberrypi/post-image.sh | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/board/raspberrypi/post-image.sh b/board/raspberrypi/post-image.sh
> > index 1b49f0ea30..9091476ced 100755
> > --- a/board/raspberrypi/post-image.sh
> > +++ b/board/raspberrypi/post-image.sh
> > @@ -1,4 +1,4 @@
> > -#!/bin/sh
> > +#!/bin/bash
> >  
> >  BOARD_DIR="$(dirname $0)"
> >  BOARD_NAME="$(basename ${BOARD_DIR})"
> > @@ -38,6 +38,11 @@ enable_uart=1
> >  __EOF__
> >  		fi
> >  		;;
> > +		--gpu_mem_256=*|--gpu_mem_512=*|--gpu_mem_1024=*)
> > +		# Set GPU memory
> > +		gpu_mem="${1:2}"
> > +		sed -e "/^${gpu_mem%=*}=/s,=.*,=${gpu_mem##*=}," -i "${BINARIES_DIR}/rpi-firmware/config.txt"
> 
>  In the end, the config.txt is just for one board, right? So can't we just have
> a single --gpu_mem=XXX option and do
> 
> 		sed -i -e "/^gpu_mem_[0-9]*=/s/=.*/${1##*=}/" \
> 			"${BINARIES_DIR}/rpi-firmware/config.txt"
> 

If we consider the output is only for one target (rpi, rpi2, rpi3 or
rpi3-64), so yes we can have only a single gpu_mem option; but we have
to remove all gpu_mem_xxx= in the config.txt (rpi-firmware). If set,
these options overrides gpu_mem= (if unset, it default value is 64).

According the config.txt memory documentation [*]:

	gpu_mem
	
	GPU memory in megabytes. This sets the memory split between the CPU and GPU; the CPU gets the remaining memory. Minimum value is 16; maximum value is 192, 448, or 944, depending on whether you are using a 256M, 512MB, or 1024MB Pi. The default value is 64.
	
	Setting gpu_mem to low values may automatically disable certain firmware features, as there are some things the GPU cannot do if it has access to too little memory. So if a feature you are trying to use isn't working, try setting a larger GPU memory split.
	
	Using gpu_mem_256, gpu_mem_512, and gpu_mem_1024 allows you to swap the same SD card between 256MB, 512MB, and 1024MB Pis without having to edit config.txt each time:

>  Note that you no longer need to strip off the -- and that you no longer need bash.
>

Indeed.

In the end, what I would like to have is to give config.txt options as
arguments to post-image.sh; that are echo'ed to the file. Because some
options are already presents in the config.txt file, we have either to
sed or to echo/cat.

Something arround...

	$ post-image.sh skip-first-arg enable_uart=1 dtoverlay=pi3-miniuart-bt gpu_mem=200

and...

	shift
	while [ $# -eq 0 ]; do
		echo "$1" >>$BINARIES_DIR/rpi-firmware/config.txt
		shift
	done

	genimage ...

So we no longer needs to update the script each time we need to add a
new argument that plays with the config.txt.

What do you think?

>  As you can see in the example, I also prefer if the options (-i) come in the
> beginning, and to use / as the delimiter unless there actually are /-es in any
> of the strings. But that's just personal preference.
> 

Okay. It is fine for me, I will update it.

>  Regards,
>  Arnout
> 
> > +		;;
> >  	esac
> >  	shift
> >  done
> > 

Regards,
Gael

[*]: https://www.raspberrypi.org/documentation/configuration/config-txt/memory.md

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option
  2017-09-24 14:12     ` Gaël PORTAY
@ 2017-09-24 14:20       ` Arnout Vandecappelle
  2017-09-24 16:49         ` Gaël PORTAY
  0 siblings, 1 reply; 11+ messages in thread
From: Arnout Vandecappelle @ 2017-09-24 14:20 UTC (permalink / raw)
  To: buildroot



On 24-09-17 16:12, Ga?l PORTAY wrote:
> In the end, what I would like to have is to give config.txt options as
> arguments to post-image.sh; that are echo'ed to the file. Because some
> options are already presents in the config.txt file, we have either to
> sed or to echo/cat.
> 
> Something arround...
> 
> 	$ post-image.sh skip-first-arg enable_uart=1 dtoverlay=pi3-miniuart-bt gpu_mem=200
> 
> and...
> 
> 	shift
> 	while [ $# -eq 0 ]; do
> 		echo "$1" >>$BINARIES_DIR/rpi-firmware/config.txt
> 		shift
> 	done
> 
> 	genimage ...
> 
> So we no longer needs to update the script each time we need to add a
> new argument that plays with the config.txt.
> 
> What do you think?

 Well, then it's probably easier to just copy a config.txt, no? Perhaps adding
options for custom config.txt to rpi-firmware?

 Regards,
 Arnout

-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option
  2017-09-24 14:20       ` Arnout Vandecappelle
@ 2017-09-24 16:49         ` Gaël PORTAY
  0 siblings, 0 replies; 11+ messages in thread
From: Gaël PORTAY @ 2017-09-24 16:49 UTC (permalink / raw)
  To: buildroot

On Sun, Sep 24, 2017 at 04:20:41PM +0200, Arnout Vandecappelle wrote:
> On 24-09-17 16:12, Ga?l PORTAY wrote:
> > In the end, what I would like to have is to give config.txt options as
> > arguments to post-image.sh; that are echo'ed to the file. Because some
> > options are already presents in the config.txt file, we have either to
> > sed or to echo/cat.
> > 
> > Something arround...
> > 
> > 	$ post-image.sh skip-first-arg enable_uart=1 dtoverlay=pi3-miniuart-bt gpu_mem=200
> > 
> > and...
> > 
> > 	shift
> > 	while [ $# -eq 0 ]; do
> > 		echo "$1" >>$BINARIES_DIR/rpi-firmware/config.txt
> > 		shift
> > 	done
> > 
> > 	genimage ...
> > 
> > So we no longer needs to update the script each time we need to add a
> > new argument that plays with the config.txt.
> > 
> > What do you think?
> 
>  Well, then it's probably easier to just copy a config.txt, no? Perhaps adding
> options for custom config.txt to rpi-firmware?
>

Yes. For now, it is simple to have one config.txt per rpi-board as there
is a limited number of raspberrypi config. But, the config.txt will
probably be duplicated many times.

For a user point of view, my suggestion makes the customization more
versatile.

If the user have a rpi3 with a lirc-rpi module (do not know what it is),
he will have to edit manually the config.txt.

	# cat <<EOF >output/images/rpi-firmare/config.txt
	dtoverlay=lirc-rpi
	EOF

This is fair.

If the user want it to be mainlined, he will have to add an extra option
in the post-image script. And we probably have to maintain many (all? or
at least dtoverlays) config.txt options.

With my suggestion, the user is able to add dtoverlay=lirc-rpi to the
list of post-scripts arguments.

	BR2_ROOTFS_POST_SCRIPT_ARGS="... dtoverlay=lirc-rpi"

Thus we do not need to maintain all config.txt options in the script
post-image.sh. The config.txt can be tunned using make menuconfig. 

	shift
	while [ $# -eq ]; do
		case "$1" in
		# keep legacy cases (--add-pi3-miniuart-bt-overlay, --aarch64...)
		*) # or *=*)
			echo "$1" >>${BINARIES_DIR}/rpi-firmware/config.txt
			# or sed -i -e "/^${1#=}/d;\$a$1" ${BINARIES_DIR}/rpi-firmware/config.txt
			;;
		esac
		shift
	done

Note: Maybe, we should reduce the config.txt to the bare minimum set of
option and rely on default values.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3
  2017-09-23 23:30 [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Gaël PORTAY
                   ` (2 preceding siblings ...)
  2017-09-23 23:30 ` [Buildroot] [PATCH 3/3] configs/raspberrypi3_qt5we: set gpu-mem to 200 Gaël PORTAY
@ 2017-09-27 20:12 ` Arnout Vandecappelle
  3 siblings, 0 replies; 11+ messages in thread
From: Arnout Vandecappelle @ 2017-09-27 20:12 UTC (permalink / raw)
  To: buildroot



On 24-09-17 01:30, Ga?l PORTAY wrote:
> This patch serie fixes a run-time issue with Qt WebEngine on a RPI3.

 Series applied, except for the first patch I took Erik's version, thanks.

 If you consider my suggested simplification of --gpu_mem, that can be done in a
follow-up patch.

 Regards,
 Arnout
-- 
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-09-27 20:12 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23 23:30 [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Gaël PORTAY
2017-09-23 23:30 ` [Buildroot] [PATCH 1/3] raspberrypi: post-image.sh handles many arguments Gaël PORTAY
2017-09-24 10:04   ` Arnout Vandecappelle
2017-09-24 13:25     ` Gaël PORTAY
2017-09-23 23:30 ` [Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option Gaël PORTAY
2017-09-24 10:15   ` Arnout Vandecappelle
2017-09-24 14:12     ` Gaël PORTAY
2017-09-24 14:20       ` Arnout Vandecappelle
2017-09-24 16:49         ` Gaël PORTAY
2017-09-23 23:30 ` [Buildroot] [PATCH 3/3] configs/raspberrypi3_qt5we: set gpu-mem to 200 Gaël PORTAY
2017-09-27 20:12 ` [Buildroot] [PATCH 0/3] Fix Qt WE run-time issue on RPI3 Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.