From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yann E. MORIN Date: Mon, 10 Feb 2014 21:46:50 +0100 Subject: [Buildroot] [PATCH] qemu: add host/target Linux version check In-Reply-To: <52F90717.6010103@mind.be> References: <1391896471-28299-1-git-send-email-fhunleth@troodon-software.com> <52F90717.6010103@mind.be> Message-ID: <20140210204650.GD5239@free.fr> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: buildroot@busybox.net 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. | '------------------------------^-------^------------------^--------------------'