[Vm-dev] [commit][3012] Make the spur image bootstrap work on linux.

commits at squeakvm.org commits at squeakvm.org
Sun Jun 22 04:00:51 UTC 2014


Revision: 3012
Author:   eliot
Date:     2014-06-21 21:00:44 -0700 (Sat, 21 Jun 2014)
Log Message:
-----------
Make the spur image bootstrap work on linux.
Suggest reading a suitable README when the linux VM fails to spawn the heartbeat
thread. Make revisionAsString global to assist.

Modified Paths:
--------------
    branches/Cog/image/buildspurtrunkimage.sh
    branches/Cog/image/envvars.sh
    branches/Cog/image/get2897spurvm.sh
    branches/Cog/image/get2897vm.sh
    branches/Cog/image/getsqueak45.sh
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
    branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/image/buildspurtrunkimage.sh
===================================================================
--- branches/Cog/image/buildspurtrunkimage.sh	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/image/buildspurtrunkimage.sh	2014-06-22 04:00:44 UTC (rev 3012)
@@ -3,9 +3,6 @@
 ./getsqueak45.sh
 . ./get2897vm.sh
 
-./getsqueak45.sh
-. ./get2897vm.sh
-
 cp -p $SQUEAK45.image trunk46forspur.image
 cp -p $SQUEAK45.changes trunk46forspur.changes
 

Modified: branches/Cog/image/envvars.sh
===================================================================
--- branches/Cog/image/envvars.sh	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/image/envvars.sh	2014-06-22 04:00:44 UTC (rev 3012)
@@ -18,3 +18,6 @@
 	CPU=`uname -m`
 	OSREL=`uname -r | sed 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*$/\1.\2.\3/'`
 fi
+
+test "$OS" = Darwin && function quietmd5 () { /sbin/md5 -q "$1"; }
+test "$OS" = Darwin || function quietmd5 () { /usr/bin/md5sum "$1" | sed 's/ .*$//'; }

Modified: branches/Cog/image/get2897spurvm.sh
===================================================================
--- branches/Cog/image/get2897spurvm.sh	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/image/get2897spurvm.sh	2014-06-22 04:00:44 UTC (rev 3012)
@@ -60,7 +60,7 @@
 CYGWIN*)
 	VM=cogwin/SqueakConsole.exe
 	VMHASH=a68a3eab7db6713bed9f1560759f73ae
-	VMARC=cogwin-14.23.2987.tgz
+	VMARC=cogwin-14.23.2987.zip
 	ARCHASH=acd8291859bfe10a52d6ecb28271a673
 	if [ ! -d "`dirname $VM`" \
 			-o "`/usr/bin/md5sum "$VM" | sed 's/ .*$//'`" != $VMHASH ]; then

Modified: branches/Cog/image/get2897vm.sh
===================================================================
--- branches/Cog/image/get2897vm.sh	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/image/get2897vm.sh	2014-06-22 04:00:44 UTC (rev 3012)
@@ -17,18 +17,18 @@
 Darwin)
 	VM=Cog.app/Contents/MacOS/Squeak
 	VMHASH=ec2962db9518aaea4fee1bc92007e635
-	if [ ! -d Cog.app -o "`/sbin/md5 -q $VM`" != $VMHASH ]; then
+	if [ ! -d Cog.app -o "`quientmd5 $VM`" != $VMHASH ]; then
 		VMARC=Cog.app-14.23.2987.tgz
 		ARCHASH=0f84cf23e98ea03ee7e87ccc8ba756ec
-		if [ ! -f "$VMARC" -o "`/sbin/md5 -q "$VMARC"`" != $ARCHASH ]; then
+		if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 			wget -c "$URL/$VMARC"
-			if [ ! -f "$VMARC" -o "`/sbin/md5 -q "$VMARC"`" != $ARCHASH ]; then
+			if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 				echo failed to get $VMARC \; file corrupted\? 1>&2
 				exit 2
 			fi
 		fi
 		tar xzf "$VMARC"
-		if [ ! -d Cog.app -o "`/sbin/md5 -q $VM`" != $VMHASH ]; then
+		if [ ! -d Cog.app -o "`quietmd5 $VM`" != $VMHASH ]; then
 			echo failed to correctly extract Cog.app from $VMARC 1>&2
 			exit 3
 		fi
@@ -45,20 +45,16 @@
 		VMARC=coglinux-14.23.2987.tgz
 		ARCHASH=19d9c28860758db4e2f25642837de3c3
 	fi
-	if [ ! -d "`dirname $VM`" -o \
-		"`/usr/bin/md5sum "$VM" | sed 's/ .*$//'`" != $VMHASH ]; then
-		if [ ! -f "$VMARC" \
-			-o "`/usr/bin/md5sum "$VMARC" | sed 's/ .*$//'`" != $ARCHASH ]; then
+	if [ ! -d "`dirname $VM`" -o "`quietmd5 $VM`" != $VMHASH ]; then
+		if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 			wget -c "$URL/$VMARC"
-			if [ ! -f "$VMARC" \
-				-o "`/usr/bin/md5sum "$VMARC" | sed 's/ .*$//'`" != $ARCHASH ]; then
+			if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 				echo failed to get $VMARC \; file corrupted\? 1>&2
 				exit 2
 			fi
 		fi
 		tar xzf "$VMARC"
-		if [ ! -d "`dirname $VM`" \
-			-o "`/usr/bin/md5sum $VM | sed 's/ .*$//'`" != $VMHASH ]; then
+		if [ ! -d "`dirname $VM`" -o "`quietmd5 $VM`" != $VMHASH ]; then
 			echo failed to correctly extract "`dirname $VM`" from $VMARC 1>&2
 			exit 3
 		fi
@@ -71,22 +67,18 @@
 CYGWIN*)
 	VM=cogwin/SqueakConsole.exe
 	VMHASH=a68a3eab7db6713bed9f1560759f73ae
-	VMARC=cogwin-14.23.2987.tgz
+	VMARC=cogwin-14.23.2987.zip
 	ARCHASH=acd8291859bfe10a52d6ecb28271a673
-	if [ ! -d "`dirname $VM`" \
-			-o "`/usr/bin/md5sum "$VM" | sed 's/ .*$//'`" != $VMHASH ]; then
-		if [ ! -f "$VMARC" \
-			-o "`/usr/bin/md5sum "$VMARC" | sed 's/ .*$//'`" != $ARCHASH ]; then
+	if [ ! -d "`dirname $VM`" -o "`quietmd5 $VM`" != $VMHASH ]; then
+		if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 			wget -c "$URL/$VMARC"
-			if [ ! -f "$VMARC" \
-				-o "`/usr/bin/md5sum "$VMARC" | sed 's/ .*$//'`" != $ARCHASH ]; then
+			if [ ! -f "$VMARC" -o "`quietmd5 $VMARC`" != $ARCHASH ]; then
 				echo failed to get $VMARC \; file corrupted\? 1>&2
 				exit 2
 			fi
 		fi
 		unzip -q "$VMARC"
-		if [ ! -d "`dirname $VM`" \
-			-o "`/usr/bin/md5sum $VM | sed 's/ .*$//'`" != $VMHASH ]; then
+		if [ ! -d "`dirname $VM`" -o "`quietmd5 $VM`" != $VMHASH ]; then
 			echo failed to correctly extract "`dirname $VM`" from $VMARC 1>&2
 			exit 3
 		fi

Modified: branches/Cog/image/getsqueak45.sh
===================================================================
--- branches/Cog/image/getsqueak45.sh	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/image/getsqueak45.sh	2014-06-22 04:00:44 UTC (rev 3012)
@@ -1,9 +1,12 @@
 #!/bin/bash
 . ./envvars.sh
 
-if [ "`md5 -q \"$SQUEAK45\".image`" != 1d0d4320224b741da1f56c6871963702 ]; then
+IMAGEHASH=1d0d4320224b741da1f56c6871963702
+ZIPHASH=b90e0303ab61e928a5d997b22d18b468
+
+if [ "`quietmd5 \"$SQUEAK45\".image`" != $IMAGEHASH ]; then
 	ZIP=Squeak-4.5-All-in-One.zip
-	if [ "`md5 -q $ZIP`" != b90e0303ab61e928a5d997b22d18b468 ]
+	if [ "`quietmd5 $ZIP`" != $ZIPHASH ]
 	then
 		if wget --help >/dev/null; then
 			true

Modified: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
===================================================================
--- branches/Cog/platforms/Cross/vm/sqSCCSVersion.h	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/platforms/Cross/vm/sqSCCSVersion.h	2014-06-22 04:00:44 UTC (rev 3012)
@@ -33,7 +33,7 @@
 static char SvnRawRepositoryURL[] = "$URL$";
 # define URL_START (SvnRawRepositoryURL + 6)
 
-static char *
+char *
 revisionAsString()
 {
 	char *maybe_space = strchr(REV_START,' ');
@@ -62,7 +62,7 @@
 # undef REV_START
 # undef URL_START
 #else /* SUBVERSION */
-static char *
+char *
 revisionAsString() { return "?"; }
 
 static char *


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Thu Jun 19 14:10:46 PDT 2014
   + Sat Jun 21 20:59:34 PDT 2014

Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c	2014-06-20 18:20:08 UTC (rev 3011)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c	2014-06-22 04:00:44 UTC (rev 3012)
@@ -28,6 +28,7 @@
 #include "sqMemoryFence.h"
 #include <errno.h>
 #include <pthread.h>
+#include <stdio.h> /* for fprintf */
 #include <sys/types.h>
 #include <sys/time.h>
 
@@ -357,12 +358,18 @@
 	if ((er = pthread_setschedparam(pthread_self(),
 									stateMachinePolicy,
 									&stateMachinePriority))) {
-		/* linux pthreads as of 2009 does not support setting the priority of
+		/* Linux pthreads as of 2009 does not support setting the priority of
 		 * threads other than with real-time scheduling policies.  But such
 		 * policies are only available to processes with superuser privileges.
+		 * Linux kernels >= 2.6.13 support different thread priorities, but
+		 * require a suitable /etc/security/limits.d/VMNAME.conf.
 		 */
+		extern char *revisionAsString();
 		errno = er;
-		perror("pthread_setschedparam failed; consider using ITIMER_HEARTBEAT");
+		perror("pthread_setschedparam failed");
+		fprintf(stderr,
+				"Read e.g. http://www.mirandabanda.org/files/Cog/VM/VM.r%s/README.%s\n",
+				revisionAsString(), revisionAsString());
 		exit(errno);
 	}
 	beatState = active;



More information about the Vm-dev mailing list