Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2 5/7] board/qemu/*/launch.sh: add qemu launch script
Date: Fri, 2 Aug 2019 23:58:29 +0200	[thread overview]
Message-ID: <20190802235829.17b89102@windsurf.home> (raw)
In-Reply-To: <1557075239-30667-6-git-send-email-jugurtha.belkalem@smile.fr>

Hello,

On Sun,  5 May 2019 18:53:57 +0200
Jugurtha BELKALEM <jugurtha.belkalem@smile.fr> wrote:

> diff --git a/board/qemu/aarch64-virt/launch.sh b/board/qemu/aarch64-virt/launch.sh
> new file mode 100755
> index 0000000..c6af589
> --- /dev/null
> +++ b/board/qemu/aarch64-virt/launch.sh
> @@ -0,0 +1,21 @@
> +#!/bin/bash
> +
> +qemu_command='qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel output/images/Image -append "root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=output/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0'
> +
> +function DisplayReadme {
> +	echo "Run the emulation with:
> +
> +${qemu_command}
> +
> +The login prompt will appear in the terminal that started Qemu.
> +
> +Tested with QEMU 2.12.0"
> +}
> +
> +if [ ! -z $1 ] && [ $1 = "-h" ]
> +then
> +	DisplayReadme
> +else
> +	
> +	echo "${qemu_command}"
> +fi

I am not thrilled by the complexity of those scripts. Why isn't the
script just a single line that runs Qemu ? Perhaps the only argument
that would be sensible to have is an optional argument to pass the
output directory.

So just:

#!/bin/bash
qemu-system-aarch64 -M virt -cpu cortex-a53 -nographic -smp 1 -kernel ${0:-output}/images/Image -append "root=/dev/vda console=ttyAMA0" -netdev user,id=eth0 -device virtio-net-device,netdev=eth0 -drive file=${0:-output}/images/rootfs.ext4,if=none,format=raw,id=hd0 -device virtio-blk-device,drive=hd0

Would be enough. But on the other hand, in the toolchain-builders
stuff, we simply use the existing readme.txt contents. We do this:

  test_qemu_cmd=$(grep qemu-system ${buildroot_dir}/board/qemu/${test_board_dir}/readme.txt)

And this gives us the Qemu command to run the qemu emulation. Perhaps
we should do this as well here, and avoid the launch.sh scripts
altogether ? In any case, we shouldn't duplicate this information
between the launch.sh script and the readme.txt file. So if you go the
launch.sh way, we need to adjust the readme.txt files accordingly.

Best regards,

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com

  reply	other threads:[~2019-08-02 21:58 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-05 16:53 [Buildroot] [PATCH v2 0/7] gitlab Qemu runtime testing Jugurtha BELKALEM
2019-05-05 16:53 ` [Buildroot] [PATCH v2 1/7] package/qemu: enable nios2 support for host-qemu Jugurtha BELKALEM
2019-05-31  6:13   ` Thomas Huth
2019-08-02 21:52   ` Thomas Petazzoni
2019-05-05 16:53 ` [Buildroot] [PATCH v2 2/7] package/qemu: enable sparc64 " Jugurtha BELKALEM
2019-05-31  6:14   ` Thomas Huth
2019-08-02 21:53   ` Thomas Petazzoni
2019-05-05 16:53 ` [Buildroot] [PATCH v2 3/7] package/qemu: remove comment about sh64 Jugurtha BELKALEM
2019-05-31  6:17   ` Thomas Huth
2019-08-02 21:53   ` Thomas Petazzoni
2019-05-05 16:53 ` [Buildroot] [PATCH v2 4/7] configs/qemu-*: add host-qemu-system Jugurtha BELKALEM
2019-08-02 21:53   ` Thomas Petazzoni
2019-08-03 13:38   ` Bernd Kuhls
2019-05-05 16:53 ` [Buildroot] [PATCH v2 5/7] board/qemu/*/launch.sh: add qemu launch script Jugurtha BELKALEM
2019-08-02 21:58   ` Thomas Petazzoni [this message]
2019-10-27 16:44     ` Romain Naour
2019-10-27 16:52       ` Thomas Petazzoni
2019-10-27 17:59         ` Romain Naour
2019-10-27 18:15           ` Thomas Petazzoni
2019-10-27 19:15             ` Romain Naour
2019-05-05 16:53 ` [Buildroot] [PATCH v2 6/7] support/scripts/qemu-boot-*: gitlab tests for Qemu Jugurtha BELKALEM
2019-08-02 22:24   ` Thomas Petazzoni
2019-10-27 14:32     ` Romain Naour
2019-10-27 14:34       ` Thomas Petazzoni
2019-05-05 16:53 ` [Buildroot] [PATCH v2 7/7] gitlab.yml.in*: enable Qemu gitlab testing Jugurtha BELKALEM

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=20190802235829.17b89102@windsurf.home \
    --to=thomas.petazzoni@bootlin.com \
    --cc=buildroot@busybox.net \
    /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