Patchwork Fwd: [patch] tint payload update

login
register
about
Submitter Marc Jones
Date 2010-09-15 18:42:35
Message ID <AANLkTi=Wx3XQjwMQ4Jbcd1O-kpDixP+bTRQYrvqXUS4s@mail.gmail.com>
Download mbox | patch
Permalink /patch/1950/
State Not Applicable
Headers show

Comments

Marc Jones - 2010-09-15 18:42:35
ping


---------- Forwarded message ----------
From: Marc Jones <marcj303@gmail.com>
Date: Mon, Aug 23, 2010 at 6:37 PM
Subject: Re: [coreboot] Trouble compiling tint payload
To: Andrew Guertin <lists@dolphinling.net>
Cc: coreboot@coreboot.org


On Mon, Aug 23, 2010 at 12:08 PM, Marc Jones <marcj303@gmail.com> wrote:
> On Mon, Aug 23, 2010 at 8:33 AM, Andrew Guertin <lists@dolphinling.net> wrote:
>> I figured out the problem right after sending this: when I set $CC, it
>> overwrites the makefile variable that tells it to use lpgcc, so lpgcc isn't
>> getting used.
>>
>> I changed all occurrences of "CC" in the tint makefile to "MYCC", and it
>> compiled correctly.
>>
>> Is there a less hackish way I should solve it, and then submit a patch? Or
>> does someone who knows what they're doing better want to take care of it?
>
> Hi Andrew,
>
> I have some patches for tint to add xcompile and some other build
> changes to match what has gone into libpayload. I'll try to post them
> later today.

This patch is based on Uwe's, but patching a patch seems odd to me, so
here is a new patch that builds on the previous one. Start with a
clean tint0.03b and put it in the coreboot payloads directory. You no
longer need to build libpayload. The make handles it for you.


Add default libpayload build, xcompile, and lpgcc setup to tint.

Signed-off-by: Marc Jones <marc.jones@gmail.com>

Let me know how it goes.

Marc



--
http://se-eng.com
Myles Watson - 2010-09-15 18:53:04
Picky observation: there are a couple of extra #if 0 #endif pairs.
Combining them would make the patch simpler.

@@ -337,7 +339,9 @@ static void getname (char *name)
         name[NAMELEN - 1] = '\0';
      }
 }
+#endif

+#if 0
 static void err1 ()
 {
    fprintf (stderr,"Error creating %s\n",scorefile);

I haven't tested it, but it looks fine.

Acked-by: Myles Watson <mylesgw@gmail.com>

Thanks,
Myles
Peter Stuge - 2010-09-15 18:55:11
Marc Jones wrote:
> ping
..

> Add default libpayload build, xcompile, and lpgcc setup to tint.
> 
> Signed-off-by: Marc Jones <marc.jones@gmail.com>

Maybe that halt should be made into a sleep followed by returning to
e.g. SeaBIOS?

All those #if 0 are not so pretty.

Maybe some headers can be kept now with the libpayload changes in
that area.

And maybe the cpp:ed out code can be made #ifndef LIBPAYLOAD or so,
to get the changes into upstream.

I understand that you may not have touched any of this, Marc.

As for the build things, can we not get around stuffing all of that
into each payload?


//Peter
Marc Jones - 2010-09-15 19:59:57
On Wed, Sep 15, 2010 at 12:55 PM, Peter Stuge <peter@stuge.se> wrote:

> As for the build things, can we not get around stuffing all of that
> into each payload?

What do you mean? It seems to me that we want each payload responsible
for building its own version of libpayload.

Marc
Peter Stuge - 2010-09-15 21:09:16
Marc Jones wrote:
> > As for the build things, can we not get around stuffing all of that
> > into each payload?
> 
> What do you mean? It seems to me that we want each payload
> responsible for building its own version of libpayload.

I hadn't thought of that! Do we? Interesting.

In a way it makes sense because different payloads need different
parts of libpayload. But thinking of it as a replacement for glibc or
at least crt0 then it isn't so nice to have more than one. This is
how I've always thought of it until now.

But ok, say we want local libpayload per payload, then I think we
should still try to simplify things.

Maybe provide a payload.inc Makefile stub in libpayload which the
payload Makefile simply includes after setting a variable name or
two?

That's a different patch(set) though. :)

Acked-by: Peter Stuge <peter@stuge.se>


//Peter
Marc Jones - 2010-09-16 21:37:24
On Wed, Sep 15, 2010 at 3:09 PM, Peter Stuge <peter@stuge.se> wrote:
> Marc Jones wrote:
>> > As for the build things, can we not get around stuffing all of that
>> > into each payload?
>>
>> What do you mean? It seems to me that we want each payload
>> responsible for building its own version of libpayload.
>
> I hadn't thought of that! Do we? Interesting.
>
> In a way it makes sense because different payloads need different
> parts of libpayload. But thinking of it as a replacement for glibc or
> at least crt0 then it isn't so nice to have more than one. This is
> how I've always thought of it until now.
>
> But ok, say we want local libpayload per payload, then I think we
> should still try to simplify things.
>
> Maybe provide a payload.inc Makefile stub in libpayload which the
> payload Makefile simply includes after setting a variable name or
> two?
>
> That's a different patch(set) though. :)
>
> Acked-by: Peter Stuge <peter@stuge.se>
>
>
> //Peter

Thanks Myles and Peter.

r5816

Updating the wiki now.


Marc
Uwe Hermann - 2010-09-19 22:47:53
On Thu, Sep 16, 2010 at 03:37:24PM -0600, Marc Jones wrote:
> On Wed, Sep 15, 2010 at 3:09 PM, Peter Stuge <peter@stuge.se> wrote:
> > Marc Jones wrote:
> >> > As for the build things, can we not get around stuffing all of that
> >> > into each payload?
> >>
> >> What do you mean? It seems to me that we want each payload
> >> responsible for building its own version of libpayload.
> >
> > I hadn't thought of that! Do we? Interesting.
> >
> > In a way it makes sense because different payloads need different
> > parts of libpayload. But thinking of it as a replacement for glibc or
> > at least crt0 then it isn't so nice to have more than one. This is
> > how I've always thought of it until now.

There are pros and cons to both variants, but I think we cannot make a
fully generic libpayload build that gets installed somewhere and then
used by multiple payloads directly.

We could drop most "Add support for xyz" kconfig options from libpayload
that simply add new functions to the API and just always compile them in
directly, and let the linker do its magic to only link in those
functions the respective payloads actually uses.
This is possible (but not yet in the Makefiles I think).

However, there are various options (and more will follow) that modify
the _behavior_ of libpayload functions thus making it impossible to
satisfy all possible payloads from one libpayload build.

Example: There's a kconfig option which decides whether libpayload
printf()/putchar() etc. should print to both serial and VGA or only one
of them. The putchar() function is always compiled in, but it's
behaviour is different.
Another example: Some boards (VIA I think) need different CMOS/NVRAM
config port locations (0x72/0x73 vs. 0x74/0x75). And there are others.

So I think one libpayload build/checkout per payload will be indeed
required usually.


> > But ok, say we want local libpayload per payload, then I think we
> > should still try to simplify things.

Yes, definately.


> Updating the wiki now.

Marc, can you please add the full build instructions to the wiki page,
including how and where libpayload should be checked out
(or "svn export"ed) relative to tint, whether or not libpayload should
use the "make install" step before building tint etc. etc.

The current code in svn plus wiki instructions didn't work for me,
various issues it seems. First the "libpayloadbin" is never found (if
you do "make install" in the libpayload dir it installs into an
"install" subdir of the libpayload dir currently. Also, in some
situations lpgcc yields errors as $CC seems to be not set or similar
(probably due to incorrect placement of the libpayload dir?)


Maybe it's simpler to just assume a full coreboot checkout for building
payloads per default? I.e. in payloads/external/tint, we assume a
../../libpayload to be there and contain a built libpayload per default?

Of course, there should be an option to override this and build a
payload by itself with only a libpayload checkout (without the full
coreboot checkout).


Thanks, Uwe.
Marc Jones - 2010-09-20 20:19:22
On Sun, Sep 19, 2010 at 4:47 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> Marc, can you please add the full build instructions to the wiki page,
> including how and where libpayload should be checked out
> (or "svn export"ed) relative to tint, whether or not libpayload should
> use the "make install" step before building tint etc. etc.
>
> The current code in svn plus wiki instructions didn't work for me,
> various issues it seems. First the "libpayloadbin" is never found (if
> you do "make install" in the libpayload dir it installs into an
> "install" subdir of the libpayload dir currently. Also, in some
> situations lpgcc yields errors as $CC seems to be not set or similar
> (probably due to incorrect placement of the libpayload dir?)
>
>
> Maybe it's simpler to just assume a full coreboot checkout for building
> payloads per default? I.e. in payloads/external/tint, we assume a
> ../../libpayload to be there and contain a built libpayload per default?
>
> Of course, there should be an option to override this and build a
> payload by itself with only a libpayload checkout (without the full
> coreboot checkout).

I had updated the instructions and then you changed them.  It is
automatic if you have tint in the payloads directory. The tint build
calls the libpayload make and installs in the tint directory.

Marc
Uwe Hermann - 2010-09-20 23:01:53
On Mon, Sep 20, 2010 at 02:19:22PM -0600, Marc Jones wrote:
> I had updated the instructions and then you changed them.  It is
> automatic if you have tint in the payloads directory. The tint build
> calls the libpayload make and installs in the tint directory.

Ah, I probably missed that you should do

 cd coreboot/payloads

instead of

 cd coreboot/payloads/external/tint

as I would have expected.

But still, the build fails for me on a fresh checkout with your
instructions from the wiki (before I changed stuff there):

svn co svn://coreboot.org/coreboot/trunk coreboot
cd coreboot/payloads
wget http://ftp.debian.org/debian/pool/main/t/tint/tint_0.03b.tar.gz
tar xfvz tint_0.03b.tar.gz
cd tint-0.03b
svn export svn://coreboot.org/coreboot/trunk/payloads/external/tint/libpayload_tint.patch
patch -p1 < libpayload_tint.patch
make

Building libpayload @ ../libpayload.
make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
*** Default configuration is based on 'configs/defconfig'
*
* libpayload Configuration
*
*
* Generic Options
*
Experimental Options (EXPERIMENTAL) [N/y/?] n
[...]
make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
  CC      build/arch/i386/head.S.o
  CC      build/arch/i386/main.o
[...]
  CC      build/curses/colors.o
  AR      build/lib/libpayload.a
  CP      build/lib/i386/head.o
  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/lib
  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/include
  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/bin
make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
  LPCC      tint.o
basename: missing operand
Try `basename --help' for more information.
  LPCC      engine.o
basename: missing operand
Try `basename --help' for more information.
  LPCC      io.o
basename: missing operand
Try `basename --help' for more information.
io.c: In function ‘io_init’:
io.c:102: warning: array subscript is above array bounds
io.c:103: warning: array subscript is above array bounds
  LPCC      utils.o
basename: missing operand
Try `basename --help' for more information.
  LPCC      tint.elf
basename: missing operand
Try `basename --help' for more information.
make: only-keep-debug: Command not found
make: [tint.elf] Error 127 (ignored)
make: strip-debug: Command not found
make: [tint.elf] Error 127 (ignored)
/bin/sh: add-gnu-debuglink=tint.debug: not found
make: [tint.elf] Error 127 (ignored)


This is the problem where $CC is not being set for some reason and thus
"basename $CC" becomes just "basename", hence the error.


Uwe.
Marc Jones - 2010-09-20 23:23:14
On Mon, Sep 20, 2010 at 5:01 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> On Mon, Sep 20, 2010 at 02:19:22PM -0600, Marc Jones wrote:
>> I had updated the instructions and then you changed them.  It is
>> automatic if you have tint in the payloads directory. The tint build
>> calls the libpayload make and installs in the tint directory.
>
> Ah, I probably missed that you should do
>
>  cd coreboot/payloads
>
> instead of
>
>  cd coreboot/payloads/external/tint
>
> as I would have expected.
>
> But still, the build fails for me on a fresh checkout with your
> instructions from the wiki (before I changed stuff there):
>
> svn co svn://coreboot.org/coreboot/trunk coreboot
> cd coreboot/payloads
> wget http://ftp.debian.org/debian/pool/main/t/tint/tint_0.03b.tar.gz
> tar xfvz tint_0.03b.tar.gz
> cd tint-0.03b
> svn export svn://coreboot.org/coreboot/trunk/payloads/external/tint/libpayload_tint.patch
> patch -p1 < libpayload_tint.patch
> make
>
> Building libpayload @ ../libpayload.
> make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
> make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
> make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
> *** Default configuration is based on 'configs/defconfig'
> *
> * libpayload Configuration
> *
> *
> * Generic Options
> *
> Experimental Options (EXPERIMENTAL) [N/y/?] n
> [...]
> make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
> make[1]: Entering directory `/home/uwe/coreboot/payloads/libpayload'
>  CC      build/arch/i386/head.S.o
>  CC      build/arch/i386/main.o
> [...]
>  CC      build/curses/colors.o
>  AR      build/lib/libpayload.a
>  CP      build/lib/i386/head.o
>  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/lib
>  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/include
>  INSTALL /home/uwe/coreboot/payloads/tint-0.03b/./libpayloadbin/libpayload/bin
> make[1]: Leaving directory `/home/uwe/coreboot/payloads/libpayload'
>  LPCC      tint.o
> basename: missing operand
> Try `basename --help' for more information.
>  LPCC      engine.o
> basename: missing operand
> Try `basename --help' for more information.
>  LPCC      io.o
> basename: missing operand
> Try `basename --help' for more information.
> io.c: In function ‘io_init’:
> io.c:102: warning: array subscript is above array bounds
> io.c:103: warning: array subscript is above array bounds
>  LPCC      utils.o
> basename: missing operand
> Try `basename --help' for more information.
>  LPCC      tint.elf
> basename: missing operand
> Try `basename --help' for more information.
> make: only-keep-debug: Command not found
> make: [tint.elf] Error 127 (ignored)
> make: strip-debug: Command not found
> make: [tint.elf] Error 127 (ignored)
> /bin/sh: add-gnu-debuglink=tint.debug: not found
> make: [tint.elf] Error 127 (ignored)

$CC should get set xcompile. What does your .xcompile have? I always
use xgcc so there could be a problem there.

Marc
Uwe Hermann - 2010-09-21 00:24:27
On Mon, Sep 20, 2010 at 05:23:14PM -0600, Marc Jones wrote:
> $CC should get set xcompile. What does your .xcompile have? I always
> use xgcc so there could be a problem there.

I see one .xcompile in the coreboot/payloads/tint-0.03b directory after
a build attempt, which is an empty file. I use the stock gcc from Debian.

$ gcc --version
gcc (Debian 4.4.4-12) 4.4.5 20100902 (prerelease)

Something is going wrong with the invokation of xcompile.sh then? I
assume .xcompile should have some contents.


Uwe.
Marc Jones - 2010-09-21 18:15:28
On Mon, Sep 20, 2010 at 6:24 PM, Uwe Hermann <uwe@hermann-uwe.de> wrote:
> On Mon, Sep 20, 2010 at 05:23:14PM -0600, Marc Jones wrote:
>> $CC should get set xcompile. What does your .xcompile have? I always
>> use xgcc so there could be a problem there.
>
> I see one .xcompile in the coreboot/payloads/tint-0.03b directory after
> a build attempt, which is an empty file. I use the stock gcc from Debian.
>
> $ gcc --version
> gcc (Debian 4.4.4-12) 4.4.5 20100902 (prerelease)
>
> Something is going wrong with the invokation of xcompile.sh then? I
> assume .xcompile should have some contents.

Yes, You should have something in .xcompile xgcc path or hostcc.

Marc

Patch

diff -rupN tintorig/Makefile tint/Makefile
--- tintorig/Makefile	2005-07-17 05:30:54.000000000 -0600
+++ tint/Makefile	2010-08-23 18:06:24.671875000 -0600
@@ -28,6 +28,65 @@ 
 #  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 #  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
+$(if $(wildcard .xcompile),,$(eval $(shell bash ./xcompile.sh &> .xcompile)))
+include .xcompile
+
+LIBCONFIG_PATH := ../libpayload
+LIBPAYLOAD_DIR := ./libpayloadbin
+LPCC := $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc
+LPAS := $(LIBPAYLOAD_DIR)/libpayload/bin/lpas
+HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a)
+LIB_CONFIG ?= defconfig 
+
+# CFLAGS := -Wall -Werror -Os
+CFLAGS := -Wall -g -Os
+TARGET := tint
+OBJS := $(TARGET).o engine.o io.o utils.o
+
+# Make is silent per default, but 'make V=1' will show all compiler calls.
+ifneq ($(V),1)
+Q := @
+endif
+
+all: $(TARGET).elf
+#	printf" CC   $(CC)\n"
+	
+$(TARGET).elf: $(OBJS) libpayload
+	$(Q)printf "  LPCC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(LPCC) -o $@ $(OBJS)
+	$(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug
+	$(Q)$(OBJCOPY) --strip-debug $@
+	$(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@
+	
+%.o: %.c libpayload
+	$(Q)printf "  LPCC      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+
+%.S.o: %.S libpayload
+	$(Q)printf "  LPAS      $(subst $(shell pwd)/,,$(@))\n"
+	$(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $<
+
+ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
+libpayload:
+	$(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
+else
+libpayload:
+	$(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
+	$(Q)make -C $(LIBCONFIG_PATH) distclean
+	$(Q)make -C $(LIBCONFIG_PATH) $(LIB_CONFIG)
+	$(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install
+endif
+
+clean:
+	$(Q)rm -f $(TARGET).elf $(TARGET).debug *.o 
+	$(Q)rm .xcompile
+
+distclean: clean
+	$(Q)rm -rf $(LIBPAYLOAD_DIR)
+
+# Original tint targets
+ifdef $(UNUSED)
+
 #CROSS = arm-linux-
 
 bindir = $(DESTDIR)/usr/games
@@ -110,3 +169,4 @@  clean:
 distclean: clean
 	$(MAKE) -C debian clean
 
+endif
diff -rupN tintorig/config.h tint/config.h
--- tintorig/config.h	2001-12-07 16:03:24.000000000 -0700
+++ tint/config.h	2010-01-27 13:59:18.000000000 -0700
@@ -29,7 +29,16 @@ 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <libpayload.h>
+#include <curses.h>
+#define random(x) rand(x)
+#define srandom(x) srand(x)
+#define curs_set(x)
+
+
 /* Score file */
+#if 0
 const char scorefile[] = SCOREFILE;
+#endif
 
 #endif	/* #ifndef CONFIG_H */
diff -rupN tintorig/engine.c tint/engine.c
--- tintorig/engine.c	2005-07-17 05:26:22.000000000 -0600
+++ tint/engine.c	2010-01-27 13:59:18.000000000 -0700
@@ -27,8 +27,12 @@ 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
+#if 0
 #include <stdlib.h>
 #include <string.h>
+#endif
 
 #include "typedefs.h"
 #include "utils.h"
diff -rupN tintorig/io.c tint/io.c
--- tintorig/io.c	2001-12-07 08:48:20.000000000 -0700
+++ tint/io.c	2010-01-27 13:59:18.000000000 -0700
@@ -27,9 +27,13 @@ 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
+#if 0
 #include <stdarg.h>		/* va_list(), va_start(), va_end() */
 #include <sys/time.h>	/* gettimeofday() */
 #include <unistd.h>		/* gettimeofday() */
+#endif
 
 #include <curses.h>
 
@@ -70,7 +74,11 @@  static int in_timeleft;
 /* Initialize screen */
 void io_init ()
 {
+   curses_enable_serial(0);
+   curses_enable_vga(1);
    initscr ();
+   halfdelay(1);
+   timeout(1);
    start_color ();
    curs_set (CURSOR_INVISIBLE);
    out_attr = A_NORMAL;
@@ -176,11 +184,17 @@  void out_beep ()
 /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
 int in_getch ()
 {
+#if 0
    struct timeval starttv,endtv;
+#endif
    int ch;
+#if 0
    timeout (in_timeleft / 1000);
    gettimeofday (&starttv,NULL);
+#endif
    ch = getch ();
+   mdelay(150);
+#if 0
    gettimeofday (&endtv,NULL);
    /* Timeout? */
    if (ch == ERR)
@@ -198,6 +212,7 @@  int in_getch ()
 		in_timeleft -= endtv.tv_usec;
 		if (in_timeleft <= 0) in_timeleft = in_timetotal;
 	 }
+#endif
    return ch;
 }
 
diff -rupN tintorig/tint.c tint/tint.c
--- tintorig/tint.c	2005-07-17 05:26:43.000000000 -0600
+++ tint/tint.c	2010-08-23 18:13:53.281250000 -0600
@@ -1,4 +1,3 @@ 
-
 /*
  * Copyright (c) Abraham vd Merwe <abz@blio.net>
  * All rights reserved.
@@ -27,6 +26,7 @@ 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#if 0
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
@@ -34,6 +34,7 @@ 
 #include <pwd.h>
 #include <sys/types.h>
 #include <unistd.h>
+#endif
 
 #include "typedefs.h"
 #include "utils.h"
@@ -321,6 +322,7 @@  typedef struct
    time_t timestamp;
 } score_t;
 
+#if 0
 static void getname (char *name)
 {
    struct passwd *pw = getpwuid (geteuid ());
@@ -337,7 +339,9 @@  static void getname (char *name)
 		name[NAMELEN - 1] = '\0';
 	 }
 }
+#endif
 
+#if 0
 static void err1 ()
 {
    fprintf (stderr,"Error creating %s\n",scorefile);
@@ -349,10 +353,11 @@  static void err2 ()
    fprintf (stderr,"Error writing to %s\n",scorefile);
    exit (EXIT_FAILURE);
 }
+#endif
 
 void showplayerstats (engine_t *engine)
 {
-   fprintf (stderr,
+   printf (
 			"\n\t   PLAYER STATISTICS\n\n\t"
 			"Score       %11d\n\t"
 			"Efficiency  %11d\n\t"
@@ -360,6 +365,7 @@  void showplayerstats (engine_t *engine)
 			GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
 }
 
+#if 0
 static void createscores (int score)
 {
    FILE *handle;
@@ -394,7 +400,9 @@  static void createscores (int score)
    fprintf (stderr,"%s",scoretitle);
    fprintf (stderr,"\t  1* %7d        %s\n\n",score,scores[0].name);
 }
+#endif
 
+#if 0
 static int cmpscores (const void *a,const void *b)
 {
    int result;
@@ -412,7 +420,9 @@  static int cmpscores (const void *a,cons
    /* timestamps is equal */
    return 0;
 }
+#endif
 
+#if 0
 static void savescores (int score)
 {
    FILE *handle;
@@ -490,11 +500,13 @@  static void savescores (int score)
 	 }
    fprintf (stderr,"\n");
 }
+#endif
 
           /***************************************************************************/
           /***************************************************************************/
           /***************************************************************************/
 
+#if 0
 static void showhelp ()
 {
    fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n");
@@ -504,9 +516,11 @@  static void showhelp ()
    fprintf (stderr,"  -d           Draw vertical dotted lines\n");
    exit (EXIT_FAILURE);
 }
+#endif
 
 static void parse_options (int argc,char *argv[])
 {
+#if 0
    int i = 1;
    while (i < argc)
 	 {
@@ -536,10 +550,12 @@  static void parse_options (int argc,char
 		  }
 		i++;
 	 }
+#endif
 }
 
 static void choose_level ()
 {
+#if 0
    char buf[NAMELEN];
 
    do
@@ -549,6 +565,8 @@  static void choose_level ()
 		buf[strlen (buf) - 1] = '\0';
 	 }
    while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
+#endif
+	level = 1;
 }
 
           /***************************************************************************/
@@ -663,8 +681,15 @@  int main (int argc,char *argv[])
    if (ch != 'q')
 	 {
 		showplayerstats (&engine);
+#if 0
 		savescores (GETSCORE (engine.score));
+#endif
 	 }
+   printf("Bye.\n");
+   refresh();
+   for(;;); //halt();
+#if 0
    exit (EXIT_SUCCESS);
+#endif
 }
 
diff -rupN tintorig/utils.c tint/utils.c
--- tintorig/utils.c	2001-12-07 08:49:19.000000000 -0700
+++ tint/utils.c	2010-01-27 13:59:18.000000000 -0700
@@ -27,9 +27,13 @@ 
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include "config.h"
+
+#if 0
 #include <stdlib.h>
 #include <time.h>
 #include <limits.h>
+#endif
 
 #include "typedefs.h"
 
@@ -41,8 +45,11 @@  void rand_init ()
 #ifdef USE_RAND
    srand (time (NULL));
 #else
+#if 0
    srandom (time (NULL));
 #endif
+   srandom (123);
+#endif
 }
 
 /*
@@ -61,6 +68,7 @@  int rand_value (int range)
  * Convert an str to long. Returns TRUE if successful,
  * FALSE otherwise.
  */
+#if 0
 bool str2int (int *i,const char *str)
 {
    char *endptr;
@@ -69,3 +77,4 @@  bool str2int (int *i,const char *str)
    return TRUE;
 }
 
+#endif
diff -rupN tintorig/xcompile.sh tint/xcompile.sh
--- tintorig/xcompile.sh	1969-12-31 17:00:00.000000000 -0700
+++ tint/xcompile.sh	2010-03-10 15:34:51.421875000 -0700
@@ -0,0 +1,76 @@ 
+#!/bin/bash
+
+CONFIG=defconfig
+SCRIPT_DIR=`dirname "$0"`
+
+for make in make gmake gnumake; do
+	if [ "`$make --version 2>/dev/null | grep -c GNU`" -gt 0 ]; then
+		MAKE=$make
+		break
+	fi
+done
+
+GCCPREFIX=invalid
+for gccprefixes in `pwd`/$SCRIPT_DIR/../../util/crossgcc/xgcc/bin/i386-elf- i386-elf- ""; do
+	TMP=`mktemp /tmp/temp.XXXX`
+	echo "mov %eax, %eax" > ${TMP}.s
+	printf "\x7fELF" > ${TMP}.compare
+	if which ${gccprefixes}as 2>/dev/null >/dev/null; then
+		printf ""
+	else
+		continue
+	fi
+	if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}.s; then
+		dd bs=4 count=1 if=${TMP}.o > ${TMP}.test 2>/dev/null
+		if cmp ${TMP}.test ${TMP}.compare; then
+			GCCPREFIX=$gccprefixes
+			rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test
+			break
+		fi
+	fi
+	rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test
+done
+
+if [ "$GCCPREFIX" = "invalid" ]; then
+	echo no suitable gcc found
+	exit 1
+fi
+
+#MAKEFLAGS=" \
+#	AS=\"${GCCPREFIX}as --32\"		\
+#	CC=\"${GCCPREFIX}gcc -m32\"		\
+#	AR=\"${GCCPREFIX}ar\"			\
+#	LD=\"${GCCPREFIX}ld -b elf32-i386\"	\
+#	STRIP=\"${GCCPREFIX}strip\"		\
+#	NM=\"${GCCPREFIX}nm\"			\
+#	HOSTCC=gcc				\
+#	-j					\
+#"
+
+cat << afteroptions
+export AS:=${GCCPREFIX}as --32
+export CC:=${GCCPREFIX}gcc -m32
+export CPP:=${GCCPREFIX}cpp
+export AR:=${GCCPREFIX}ar
+export LD:=${GCCPREFIX}ld -b elf32-i386
+export STRIP:=${GCCPREFIX}strip
+export NM:=${GCCPREFIX}nm
+export OBJCOPY:=${GCCPREFIX}objcopy
+export OBJDUMP:=${GCCPREFIX}objdump
+export HOSTCC:=gcc
+afteroptions
+
+# Should we let the payload build libpayload or do it for them?
+#test -d ./build || (
+#	BUILDDIR=$PWD
+#	cd ../libpayload
+#	$MAKE distclean
+#	cp configs/$CONFIG .config
+#	$MAKE oldconfig
+#	eval $MAKE $MAKEFLAGS
+#	eval $MAKE $MAKEFLAGS DESTDIR=$BUILDDIR/build install 
+#	cd ..
+#)
+
+# eval $MAKE -C $SCRIPT_DIR $MAKEFLAGS
+