summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLauri Aarnio <Lauri.Aarnio@iki.fi>2009-03-31 19:52:16 +0300
committerLauri Leukkunen <lle@rahina.org>2009-03-31 20:10:20 +0300
commit649573e61de25dcb721264396da614488951ac6d (patch)
treed22ce7f99e2f4415d10b0e32321550e6fb577f18
parent624c8a41c64b5b8231c7cccfa7133160233b0476 (diff)
sb2-init "-c" option optional
There are now default CPU transparency methods (qemu-$ARCH) for non-x86 targets.
-rwxr-xr-xutils/sb2-init44
1 files changed, 37 insertions, 7 deletions
diff --git a/utils/sb2-init b/utils/sb2-init
index ef4c698..12af14e 100755
--- a/utils/sb2-init
+++ b/utils/sb2-init
@@ -335,12 +335,9 @@ if echo "$HOST_ARCH" | grep -q "^i.86*"; then
fi
echo "sb2-init: Host architecture is '$HOST_ARCH'"
-if [ "$HOST_ARCH" != "$ARCH" -a -z "$SB2INIT_CPUTRANSP" ]; then
- SB2INIT_CPUTRANSP="qemu-$ARCH"
-fi
-
case "$ARCH" in
$HOST_ARCH*) ;;
+
arm*)
# SBOX_GCC_TARGET from gcc.config.sh..
if [ -z "$SBOX_GCC_TARGET" ]; then
@@ -351,15 +348,20 @@ case "$ARCH" in
DEBIAN_CPU=armel
fi
fi
+ DEFAULT_CPUTRANSP="qemu-$ARCH"
;;
- ppc*) ;;
- mips*) ;;
- sh*) ;;
+
+ ppc*) DEFAULT_CPUTRANSP="qemu-$ARCH" ;;
+ mips*) DEFAULT_CPUTRANSP="qemu-$ARCH" ;;
+ sh*) DEFAULT_CPUTRANSP="qemu-$ARCH" ;;
+
+ # No DEFAULT_CPUTRANSP for any of the x86 architectures:
i386*) ;;
i486*) ;;
i586*) ;;
i686*) ;;
amd64*) ;;
+
*)
echo "Unsupported target architecture: '$ARCH'"
echo "You must add support for it into preload/sb_exec.c"
@@ -369,6 +371,34 @@ case "$ARCH" in
esac
+if [ "$HOST_ARCH" != "$ARCH" -a -z "$SB2INIT_CPUTRANSP" ]; then
+ # Host arch. != target arch, and CPU transparency was not specified...
+
+ if [ -z "$DEFAULT_CPUTRANSP" ]; then
+ # ...and there is no default CPU transparency method.
+ # This may be an error, or may not be: If one has a 64-bit host,
+ # but develops for an 32-bit Intel target, the architecture
+ # strings are different but Qemu is not needed.
+ echo "sb2-init: WARNING:"
+ echo "sb2-init: ******* Host architecture is different than target architecture,"
+ echo "sb2-init: ******* but CPU transparency was not set. This may not be what"
+ echo "sb2-init: ******* you want (maybe you should run sb2-init again and"
+ echo "sb2-init: ******* specify 'qemu-$ARCH' as the CPU transparency method?)"
+ else
+ # ...try to use the default CPU transparency.
+ _cputransp=$(which $DEFAULT_CPUTRANSP)
+ if [ -n "$_cputransp" -a -e "$_cputransp" ]; then
+ SB2INIT_CPUTRANSP=$_cputransp
+ else
+ echo "sb2-init: WARNING:"
+ echo "sb2-init: ******* default CPU transparency ($DEFAULT_CPUTRANSP) can not"
+ echo "sb2-init: ******* be located or executed. Maybe you should run sb2-init "
+ echo "sb2-init: ******* again and specify a working CPU transparency method"
+ echo "sb2-init: ******* with the '-c' option?"
+ fi
+ fi
+fi
+
# defaults for SB2_INIT_DEB_BUILD_GNU_TYPE, SB2_INIT_DEB_HOST_GNU_TYPE, etc,
# and the cross-gcc prefix list:
# these may be changed by sb2rc.$MAPPING_MODE