Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH] qemu: add host/target Linux version check
Date: Mon, 10 Feb 2014 21:46:50 +0100	[thread overview]
Message-ID: <20140210204650.GD5239@free.fr> (raw)
In-Reply-To: <52F90717.6010103@mind.be>

Arnout, Frank, All,

On 2014-02-10 18:06 +0100, Arnout Vandecappelle spake thusly:
> On 02/08/14 22:54, Frank Hunleth wrote:
[--SNIP--]
> > +	host_version_parts=`uname -r | sed 's/\-.*//g' | sed 's/\./ /g'` ;\
> > +	host_version_code=0 ;\
> > +	multiplier=65536 ;\
> > +	for host_version_part in $$host_version_parts; do \
> > +		host_version_code=`echo "$$host_version_code + $$host_version_part * $$multiplier" | bc` ;\
> > +		multiplier=`echo "$$multiplier / 256" | bc` ;\
> 
>  Even though we do put bc in our dependencies, I'd prefer to avoid
> relying on it - not many people know it. Instead, I'd use either bash's
> let builtin, or POSIX-compliant expr.

POSIX defines (basic) mathematical expressions, eg:
  multiplier=$((multiplier/256))

See: The Open Group Base Specifications Issue 7, Shell Command Language:
    http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_04

> > +	if test $$host_version_code -lt $$target_version_code ; then \
> > +		echo "Refusing to install qemu-user since the target Linux version is newer" ;\
> > +		echo "than the host's. Missing system calls will fail." ;\
> > +		exit 1 ;\
> > +	fi
> > +endef
> > +
> > +HOST_QEMU_POST_BUILD_HOOKS += HOST_QEMU_LINUX_VERSION_CHECK
> 
>  I think a pre-configure hook is more appropriate.

Indeed.

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-02-10 20:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-08 21:54 [Buildroot] [PATCH] qemu: add host/target Linux version check Frank Hunleth
2014-02-10 17:06 ` Arnout Vandecappelle
2014-02-10 20:46   ` Yann E. MORIN [this message]
2014-02-11  3:02     ` Frank Hunleth

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=20140210204650.GD5239@free.fr \
    --to=yann.morin.1998@free.fr \
    --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