From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Neal Frager <neal.frager@amd.com>
Cc: luca@lucaceresoli.net, giulio.benetti@benettiengineering.com,
wesley@sonifex.co.uk, michal.simek@amd.com,
buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v1 1/4] board/zynqmp/post-build.sh: auto-generate extlinux.conf
Date: Wed, 25 May 2022 10:57:17 +0200 [thread overview]
Message-ID: <20220525085717.GC301044@scaer> (raw)
In-Reply-To: <20220522131535.1498502-1-neal.frager@amd.com>
Neal, All,
On 2022-05-22 07:15 -0600, Neal Frager via buildroot spake thusly:
> This patch uses the BR2_ROOTFS_POST_SCRIPT_ARGS to auto-generate the
> extlinux.conf file, so developers will only need to modify the
> board_defconfig file to change the console and boot file system locations.
>
> Signed-off-by: Neal Frager <neal.frager@amd.com>
> ---
> board/zynqmp/post-build.sh | 14 ++++++++++++++
> 1 file changed, 14 insertions(+)
>
> diff --git a/board/zynqmp/post-build.sh b/board/zynqmp/post-build.sh
> index 9fd8bbf2c8..749784c3f3 100755
> --- a/board/zynqmp/post-build.sh
> +++ b/board/zynqmp/post-build.sh
> @@ -4,5 +4,19 @@
> # in the binaries directory
>
> BOARD_DIR="$(dirname $0)"
> +CONSOLE=$2
> +ROOT=$3
> +
> +FILE=$BOARD_DIR/extlinux.conf
> +if test -f "$FILE"; then
> + echo "$FILE aready exists."
> +else
> + cat << __HEADER_EOF >> $BOARD_DIR/extlinux.conf
Why would you need append-redirection >> ? Afterall, you just tested
that the file did not already exist... Anyway, see below...
> +label linux
> + kernel /Image
> + devicetree /system.dtb
> + append console=$CONSOLE root=/dev/$ROOT rw rootwait
> +__HEADER_EOF
> +fi
>
> install -m 0644 -D $BOARD_DIR/extlinux.conf $BINARIES_DIR/extlinux.conf
We try to avoid generating files in the source tree.
Instead, why not just:
FILE="${BOARD_DIR}/extlinux.conf"
if test -f "$FILE"; then
install -m 0644 -D "${BOARD_DIR}/extlinux.conf" "${BINARIES_DIR}/extlinux.conf"
else
mkdir -p "${BINARIES_DIR}"
cat <<-__HEADER_EOF >"${BINARIES_DIR}/extlinux.conf"
TAB>label linux
TAB> kernel /Image
TAB> devicetree /system.dtb
TAB> append console=${CONSOLE} root=/dev/${ROOT} rw rootwait
TAB>__HEADER_EOF
fi
Note: the <<- rediretion removes leading TABs, so it is allows a nicer
indentation (so, replace TAB> above with an actual TAB, of course).
Also, please always evaluate variables using curly braces and quote the
expansion, like so: "${foo}" (in the here-document, quotes are not
needed, of course).
Eventualy, at the end of this series, the script will always be used for
boards that do not already have an extlinux.conf, the condition can be
dropped in a final patch, to just only keep the else part of the
condition, don't you think?
Regards,
Yann E. MORIN.
> --
> 2.17.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
next prev parent reply other threads:[~2022-05-25 8:57 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-22 13:15 [Buildroot] [PATCH v1 1/4] board/zynqmp/post-build.sh: auto-generate extlinux.conf Neal Frager via buildroot
2022-05-22 13:15 ` [Buildroot] [PATCH v1 2/4] configs/zynqmp_zcu102_defconfig: add parameters to generate extlinux.conf Neal Frager via buildroot
2022-05-25 12:14 ` Luca Ceresoli
2022-05-25 13:34 ` Neal Frager
2022-05-22 13:15 ` [Buildroot] [PATCH v1 3/4] configs/zynqmp_zcu106_defconfig: " Neal Frager via buildroot
2022-05-22 13:15 ` [Buildroot] [PATCH v1 4/4] configs/zynqmp_kria_kv260_defconfig: " Neal Frager via buildroot
2022-05-25 8:57 ` Yann E. MORIN [this message]
2022-05-25 12:12 ` [Buildroot] [PATCH v1 1/4] board/zynqmp/post-build.sh: auto-generate extlinux.conf Luca Ceresoli
2022-05-25 13:33 ` Neal Frager
2022-05-25 13:59 ` Luca Ceresoli
2022-05-25 14:02 ` Neal Frager
2022-05-25 13:31 ` Neal Frager
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220525085717.GC301044@scaer \
--to=yann.morin.1998@free.fr \
--cc=buildroot@buildroot.org \
--cc=giulio.benetti@benettiengineering.com \
--cc=luca@lucaceresoli.net \
--cc=michal.simek@amd.com \
--cc=neal.frager@amd.com \
--cc=wesley@sonifex.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox