[Buildroot] [PATCH 2/3] raspberrypi: post-image.sh add new gpu_mem option

Gaël PORTAY gael.portay at savoirfairelinux.com
Sun Sep 24 16:49:05 UTC 2017


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.



More information about the buildroot mailing list