[Buildroot] [PATCH] qemu: add host/target Linux version check

Yann E. MORIN yann.morin.1998 at free.fr
Mon Feb 10 20:46:50 UTC 2014


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.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list