[coreboot-gerrit] Change in coreboot[master]: Upgrade tint from 0.03b to 0.04+nmu1 with extra improvements

Mike Banon (Code Review) gerrit at coreboot.org
Tue Jul 18 23:06:27 CEST 2017


Mike Banon has uploaded this change for review. ( https://review.coreboot.org/20637


Change subject: Upgrade tint from 0.03b to 0.04+nmu1 with extra improvements
......................................................................

Upgrade tint from 0.03b to 0.04+nmu1 with extra improvements

1) Update tint from 0.03b to 0.04+nmu1 to fix 2 buffer overflows
2) Improve the security by checking SHA-256 of downloaded archive
3) Make it possible to reboot from this payload by pressing q key
4) Manually reduced a size of libpayload_tint.patch in half
5) Fix to show "Paused - Press any key to continue" message

This patch is a significantly improved version of
https://review.coreboot.org/#/c/17507/

Change-Id: I16f4a4a9804fef3da67ae1888dd56fa184ffba9d
Signed-off-by: Mike Banon <mikebdp2 at gmail.com>
---
M payloads/external/tint/Makefile
M payloads/external/tint/libpayload_tint.patch
2 files changed, 196 insertions(+), 642 deletions(-)



  git pull ssh://review.coreboot.org:29418/coreboot refs/changes/37/20637/1

diff --git a/payloads/external/tint/Makefile b/payloads/external/tint/Makefile
index 0fba6e7..e4477df 100644
--- a/payloads/external/tint/Makefile
+++ b/payloads/external/tint/Makefile
@@ -1,5 +1,8 @@
-project_url=http://snapshot.debian.org/archive/debian-archive/20110127T084257Z/debian/pool/main/t/tint/tint_0.03b.tar.gz
-archive_name=tint_0.03b.tar.gz
+project_url=http://http.debian.net/debian/pool/main/t/tint/tint_0.04+nmu1.tar.gz
+archive_name=tint_0.04+nmu1.tar.gz
+correct_sha256=c1ebbf652e6bec8fa8bfb5ebc94620dd8dc474b0bb647f61b93e2948837aeb9d
+
+THIS_FILE := $(lastword $(MAKEFILE_LIST))
 
 unexport KCONFIG_AUTOHEADER
 unexport KCONFIG_AUTOCONFIG
@@ -14,15 +17,59 @@
 	echo "    MAKE       TINT     "
 	$(MAKE) -C tint
 
-patch: download
+patch: download extract
 	cd tint; \
-	if [ -e debian ]; then patch -l -p1 < ../libpayload_tint.patch; fi
+	if [ -e debian ]; then \
+		rm -rf debian typedefs.h Makefile; \
+    		touch Makefile; \
+    		patch -l -p1 < ../libpayload_tint.patch; \
+  	fi
 
-download:
-	test -d tint || { wget $(project_url); \
-		tar -xvf $(archive_name); \
-		rm $(archive_name); \
-		mv tint-0.03b tint; }
+download: get check
+
+get:
+	if [ ! -d tint ]; then \
+		if [ ! -f $(archive_name) ]; then \
+			wget $(project_url); \
+		fi; \
+	fi
+
+determine_sum = \
+	sum=; \
+	for x in sha256sum sha256 'shasum -a 256' 'openssl dgst -sha256'; do \
+		if type "$${x%% *}" >/dev/null 2>/dev/null; then sum=$$x; break; fi; \
+	done; \
+	if [ -z "$$sum" ]; then \
+		echo "TINT payload: unable to find a SHA-256 utility!" 1>&2 ; \
+		exit 2;\
+	fi
+
+check:
+	if [ -f $(archive_name) ]; then \
+		$(determine_sum); \
+		archive_sha256=$$($$sum $(archive_name)); \
+		echo $$archive_sha256; \
+		echo $(correct_sha256); \
+		if ! [ $$(echo $$archive_sha256 | grep -c $(correct_sha256)) -eq 0 ]; then \
+			echo "TINT payload: good SHA-256 of downloaded archive" 1>&2 ; \
+			exit 0;\
+		else \
+			echo "TINT payload: BAD SHA-256 of downloaded archive!" 1>&2 ; \
+			exit 1;\
+		fi; \
+	fi
+
+extract: check
+	if [ ! -d tint ]; then \
+		if [ -f $(archive_name) ]; then \
+			tar -xvf $(archive_name); \
+			rm $(archive_name); \
+			mv tint-0.04+nmu1 tint; \
+		else \
+			echo "TINT payload: archive with sources is not found!" 1>&2 ; \
+			exit 1;\
+		fi; \
+	fi
 
 clean:
 	test -d tint && $(MAKE) -C tint clean || exit 0
@@ -30,4 +77,4 @@
 distclean:
 	rm -rf tint
 
-.PHONY: download patch tint clean distclean
+.PHONY: download get check extract patch tint clean distclean
diff --git a/payloads/external/tint/libpayload_tint.patch b/payloads/external/tint/libpayload_tint.patch
index b5592dd..781269a 100644
--- a/payloads/external/tint/libpayload_tint.patch
+++ b/payloads/external/tint/libpayload_tint.patch
@@ -1,6 +1,6 @@
-diff -rupN tint-0.03b/config.h tint/config.h
---- tint-0.03b/config.h	2001-12-08 00:03:24.000000000 +0100
-+++ tint/config.h	2016-05-27 14:47:15.797402090 +0200
+diff -rupN tint-0.04+nmu1/config.h tint/config.h
+--- tint-0.04+nmu1/config.h	2001-12-08 00:03:24.000000000 +0100
++++ tint/config.h	2017-07-18 23:00:00.000000000 +0200
 @@ -29,7 +29,16 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */
@@ -18,439 +18,9 @@
 +#endif
  
  #endif	/* #ifndef CONFIG_H */
-diff -rupN tint-0.03b/debian/changelog tint/debian/changelog
---- tint-0.03b/debian/changelog	2005-07-17 13:32:20.000000000 +0200
-+++ tint/debian/changelog	1970-01-01 01:00:00.000000000 +0100
-@@ -1,53 +0,0 @@
--tint (0.03b) unstable; urgency=low
--
--  * Added breaks at end of switch statements to keep gcc 3+ happy
--    (Closes: #316022)
--  * Added missing includes to engine.c
--  * Fixed spelling mistake in NOTES
--  * Updated debian policy version
--
-- -- Abraham van der Merwe <abz at debian.org>  Sun, 17 Jul 2005 13:32:17 +0200
--
--tint (0.03a) unstable; urgency=low
--
--  * Applied patch with some minor tweaks from Marcello Mamino which
--    adds a dotted background.
--  * Applied patches from Robert Lemmen which add support for user logins as
--    default name and an interactive mode for specifying the start level.
--  * Show player statistics.
--
-- -- Abraham van der Merwe <abz at debian.org>  Mon, 16 Jun 2003 23:07:37 +0200
--
--tint (0.02d) unstable; urgency=low
--
--  * Install man page in correct directory (Closes: #128923)
--  * Created a postinst program that checks for old score files
--    before installing the default score file (Closes: #136466)
--  * Added a menu control file (Closes: #128924)
--
-- -- Abraham van der Merwe <abz at debian.org>  Wed, 19 Dec 2001 18:03:34 +0200
--
--tint (0.02c) unstable; urgency=low
--
--  * Removed common-sense suggests from control file *g* (Closes: #123204)
--
-- -- Abraham van der Merwe <abz at debian.org>  Wed, 19 Dec 2001 18:03:34 +0200
--
--tint (0.02b) unstable; urgency=low
--
--  * Changed the name from tclassic to tint (as in TINT Is Not Tetris(tm))
--  * Added a build dependancy on libncurses5-dev (Closes: #124241)
--  * Changed the location for the score file to /var/games (Closes: #124236)
--  * Made score file sgid games (Closes: #123595)
--
-- -- Abraham van der Merwe <abz at debian.org>  Wed, 19 Dec 2001 18:03:34 +0200
--
--tclassic (0.02a) unstable; urgency=low
--
--  * Initial Release. (Closes: #122839)
--
-- -- Abraham van der Merwe <abz at debian.org>  Fri,  7 Dec 2001 17:59:25 +0200
--
--Local variables:
--mode: debian-changelog
--End:
-diff -rupN tint-0.03b/debian/control tint/debian/control
---- tint-0.03b/debian/control	2005-07-17 13:31:13.000000000 +0200
-+++ tint/debian/control	1970-01-01 01:00:00.000000000 +0100
-@@ -1,19 +0,0 @@
--Source: tint
--Section: games
--Priority: optional
--Maintainer: Abraham van der Merwe <abz at debian.org>
--Build-Depends: debhelper (>> 3.0.0), libncurses5-dev
--Standards-Version: 3.6.1
--
--Package: tint
--Architecture: any
--Depends: ${shlibs:Depends}
--Replaces: tclassic
--Conflicts: tclassic
--Description: TINT Is Not Tetris(tm) ...at least the name isn't
-- As the title suggests, this is a clone of the original tetris game
-- written by Alexey Pajitnov, Dmitry Pavlovsky, and Vadim Gerasimov.
-- .
-- I've tried to keep the game as close to the original as possible, but
-- there is a few differences. Nevertheless, it's probably the closest to
-- the original that you'll ever find in the UNIX world...
-diff -rupN tint-0.03b/debian/copyright tint/debian/copyright
---- tint-0.03b/debian/copyright	2001-12-19 17:08:42.000000000 +0100
-+++ tint/debian/copyright	1970-01-01 01:00:00.000000000 +0100
-@@ -1,39 +0,0 @@
--This is the Debian GNU/Linux prepackaged version of tint. These
--files were written and packaged by Abraham van der Merwe <abz at debian.org>
--
--The games is released under a derivative of the BSD license. For more
--information see http://www.opensource.org/licenses/bsd-license.html
--
--The original source can be found at: http://oasis.frogfoot.net
--
--Copyright:
--
--  Copyright (c) Abraham vd Merwe <abz at blio.net>
--  All rights reserved.
--
--  Redistribution and use in source and binary forms, with or without
--  modification, are permitted provided that the following conditions
--  are met:
--
--  1. Redistributions of source code must retain the above copyright
--     notice, this list of conditions and the following disclaimer.
--
--  2. Redistributions in binary form must reproduce the above copyright
--     notice, this list of conditions and the following disclaimer in the
--     documentation and/or other materials provided with the distribution.
--
--  3. Neither the name of the author nor the names of other contributors
--     may be used to endorse or promote products derived from this software
--     without specific prior written permission.
--
--  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
--  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
--  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
--  ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
--  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
--  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
--  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
--  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
--  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.
--
-diff -rupN tint-0.03b/debian/.depends tint/debian/.depends
---- tint-0.03b/debian/.depends	2002-03-16 17:26:42.000000000 +0100
-+++ tint/debian/.depends	1970-01-01 01:00:00.000000000 +0100
-@@ -1 +0,0 @@
--tint.postinst.o: tint.postinst.c
-diff -rupN tint-0.03b/debian/dirs tint/debian/dirs
---- tint-0.03b/debian/dirs	2002-03-16 17:58:42.000000000 +0100
-+++ tint/debian/dirs	1970-01-01 01:00:00.000000000 +0100
-@@ -1,2 +0,0 @@
--usr/games
--usr/share/man/man6
-diff -rupN tint-0.03b/debian/docs tint/debian/docs
---- tint-0.03b/debian/docs	2001-12-07 17:25:17.000000000 +0100
-+++ tint/debian/docs	1970-01-01 01:00:00.000000000 +0100
-@@ -1,2 +0,0 @@
--NOTES
--CREDITS
-diff -rupN tint-0.03b/debian/Makefile tint/debian/Makefile
---- tint-0.03b/debian/Makefile	2002-03-16 18:41:18.000000000 +0100
-+++ tint/debian/Makefile	1970-01-01 01:00:00.000000000 +0100
-@@ -1,28 +0,0 @@
--
--# -*- sh -*-
--
--# Written by Abraham van der Merwe <abz at blio.net>
--# Last updated: 2002-03-26
--
--CC = gcc
--CFLAGS = -Wall -Os -pipe
--LDFLAGS = -s
--
--STRIP = strip
--STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
--
--OBJ =
--SRC = $(OBJ:%.o=%.c)
--PRG =
--
--all: #$(PRG)
--
--$(PRG): $(OBJ)
--	$(CC) $(CPPFLAGS) $(CFLAGS) $^ -o $@ $(LDFLAGS) $(LDLIBS)
--
--clean:
--	rm -rf tint
--	rm -f *~ $(OBJ) $(PRG) *.substvars *.debhelper
--
--.PHONY: all clean
--
-diff -rupN tint-0.03b/debian/menu tint/debian/menu
---- tint-0.03b/debian/menu	2002-03-16 18:31:13.000000000 +0100
-+++ tint/debian/menu	1970-01-01 01:00:00.000000000 +0100
-@@ -1,4 +0,0 @@
--?package(tint):needs="text" section="Games/Tetris-like" \
--	title="TINT Is Not Tetris(tm)" \
--	command="sh -c '/usr/games/tint -l 5;echo;echo PRESS ENTER;read line'" \
--	hints="Text"
-diff -rupN tint-0.03b/debian/postinst tint/debian/postinst
---- tint-0.03b/debian/postinst	2002-03-16 18:44:34.000000000 +0100
-+++ tint/debian/postinst	1970-01-01 01:00:00.000000000 +0100
-@@ -1,13 +0,0 @@
--#!/bin/sh -e
--
--scorefile="/var/games/tint.scores"
--
--if [ ! -e $scorefile ]
--then
--	touch $scorefile
--	chmod 0664 $scorefile
--	chown root:games $scorefile
--fi
--
--#DEBHELPER#
--
-diff -rupN tint-0.03b/debian/postinst.c tint/debian/postinst.c
---- tint-0.03b/debian/postinst.c	2002-03-16 18:15:32.000000000 +0100
-+++ tint/debian/postinst.c	1970-01-01 01:00:00.000000000 +0100
-@@ -1,143 +0,0 @@
--
--/*
-- * Hacked up postinst program to install the default score file. We have to do it this
-- * way, since the old score file is overwritten if the score file already exists in the
-- * package - abz
-- */
--
--#include <sys/types.h>
--#include <sys/stat.h>
--#include <unistd.h>
--#include <fcntl.h>
--#include <pwd.h>
--#include <grp.h>
--#include <inttypes.h>
--#include <stdlib.h>
--#include <stdio.h>
--#include <string.h>
--
--/* location of score file */
--static const char filename[] = "/var/games/tint.scores";
--
--/* user name of default score file */
--static const char user[] = "root";
--
--/* group name of default score file */
--static const char group[] = "games";
--
--/* contents of default score file */
--static const uint8_t contents[] =
--{
--   0x54, 0x69, 0x6e, 0x74, 0x20, 0x30, 0x2e, 0x30,
--   0x32, 0x62, 0x20, 0x28, 0x63, 0x29, 0x20, 0x41,
--   0x62, 0x72, 0x61, 0x68, 0x61, 0x6d, 0x20, 0x76,
--   0x64, 0x20, 0x4d, 0x65, 0x72, 0x77, 0x65, 0x20,
--   0x2d, 0x20, 0x53, 0x63, 0x6f, 0x72, 0x65, 0x73,
--   0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
--   0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
--   0x74, 0x00, 0x10, 0x5f, 0x00, 0x00, 0xb7, 0xc8,
--   0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00, 0x80, 0x3a,
--   0x00, 0x00, 0x94, 0xc5, 0x20, 0x3c, 0x52, 0x69,
--   0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65,
--   0x6c, 0x62, 0x72, 0x65, 0x63, 0x68, 0x74, 0x00,
--   0x66, 0x21, 0x00, 0x00, 0x31, 0xc9, 0x20, 0x3c,
--   0x52, 0x69, 0x61, 0x61, 0x6e, 0x20, 0x45, 0x6e,
--   0x67, 0x65, 0x6c, 0x62, 0x72, 0x65, 0x63, 0x68,
--   0x74, 0x00, 0xdc, 0x1a, 0x00, 0x00, 0x79, 0xc6,
--   0x20, 0x3c, 0x52, 0x69, 0x61, 0x61, 0x6e, 0x20,
--   0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62, 0x72, 0x65,
--   0x63, 0x68, 0x74, 0x00, 0x2f, 0x16, 0x00, 0x00,
--   0xf9, 0xc5, 0x20, 0x3c, 0x52, 0x69, 0x61, 0x61,
--   0x6e, 0x20, 0x45, 0x6e, 0x67, 0x65, 0x6c, 0x62,
--   0x72, 0x65, 0x63, 0x68, 0x74, 0x00, 0x8b, 0x11,
--   0x00, 0x00, 0x82, 0xc7, 0x20, 0x3c, 0x41, 0x62,
--   0x7a, 0x00, 0x23, 0x10, 0x00, 0x00, 0xa9, 0xc9,
--   0x20, 0x3c, 0x44, 0x6f, 0x70, 0x70, 0x65, 0x6c,
--   0x67, 0x61, 0x6e, 0x67, 0x65, 0x72, 0x00, 0x13,
--   0x0b, 0x00, 0x00, 0x21, 0xc7, 0x20, 0x3c, 0x4a,
--   0x6f, 0x68, 0x61, 0x6e, 0x6e, 0x20, 0x42, 0x6f,
--   0x74, 0x68, 0x61, 0x00, 0x5a, 0x09, 0x00, 0x00,
--   0xef, 0xc6, 0x20, 0x3c, 0x41, 0x62, 0x7a, 0x00,
--   0xd7, 0x07, 0x00, 0x00, 0xad, 0xc6, 0x20, 0x3c
--};
--
--static void debhelper_stuff()
--{
--   /* dh_installdocs */
--   system ("if [ -d /usr/doc -a ! -e /usr/doc/tint -a -d /usr/share/doc/tint ]; then\n"
--		   "	ln -sf ../share/doc/tint /usr/doc/tint\n"
--		   "fi\n");
--
--   /* dh_installmenu */
--   system ("if [ -x /usr/bin/update-menus ]; then update-menus ; fi");
--}
--
--int main (int argc,char *argv[])
--{
--   struct stat sb;
--
--   /* we only do something if we're called as <program> configure ... */
--   if (argc < 2 || strcmp (argv[1],"configure")) exit (EXIT_SUCCESS);
--
--   /* if the score file doesn't exist, create it */
--   if (stat (filename,&sb) < 0)
--	 {
--		int fd,result;
--		struct passwd *u;
--		struct group *g;
--		uid_t uid;
--		gid_t gid;
--
--		/* get uid */
--		if ((u = getpwnam (user)) == NULL)
--		  {
--			 fprintf (stderr,"Couldn't obtain uid for %s: %m\n",user);
--			 exit (EXIT_FAILURE);
--		  }
--		uid = u->pw_uid;
--
--		/* get gid */
--		if ((g = getgrnam (group)) == NULL)
--		  {
--			 fprintf (stderr,"Couldn't obtain gid for %s: %m\n",group);
--			 exit (EXIT_FAILURE);
--		  }
--		gid = g->gr_gid;
--
--		/* create default score file */
--		if ((fd = creat (filename,0664)) < 0)
--		  {
--			 fprintf (stderr,"Couldn't create score file %s: %m\n",filename);
--			 exit (EXIT_FAILURE);
--		  }
--		result = write (fd,contents,sizeof (contents));
--		if (result < 0)
--		  {
--			 fprintf (stderr,"Unable to write to %s: %m\n",filename);
--			 close (fd);
--			 unlink (filename);
--			 exit (EXIT_FAILURE);
--		  }
--		if (result < sizeof (contents))
--		  {
--			 fprintf (stderr,"Short write count. %d/%d bytes written to %s\n",result,sizeof (contents),filename);
--			 close (fd);
--			 unlink (filename);
--			 exit (EXIT_FAILURE);
--		  }
--		close (fd);
--
--		/* change ownership of score file */
--		if (chown (filename,uid,gid) < 0)
--		  {
--			 fprintf (stderr,"Couldn't change ownership of %s to %s:%s: %m\n",filename,user,group);
--			 unlink (filename);
--			 exit (EXIT_FAILURE);
--		  }
--	 }
--
--   debhelper_stuff ();
--
--   exit (EXIT_SUCCESS);
--}
--
-diff -rupN tint-0.03b/debian/rules tint/debian/rules
---- tint-0.03b/debian/rules	2002-03-16 18:00:11.000000000 +0100
-+++ tint/debian/rules	1970-01-01 01:00:00.000000000 +0100
-@@ -1,82 +0,0 @@
--#!/usr/bin/make -f
--
--# -*- sh -*-
--
--# Uncomment this to turn on verbose mode.
--export DH_VERBOSE=1
--
--# This is the debhelper compatability version to use.
--export DH_COMPAT=3
--
--configure: configure-stamp
--configure-stamp:
--	dh_testdir
--	# Add here commands to configure the package.
--
--
--	touch configure-stamp
--
--build: configure-stamp build-stamp
--build-stamp:
--	dh_testdir
--
--	# Add here commands to compile the package.
--	$(MAKE)
--
--	touch build-stamp
--
--clean:
--	dh_testdir
--	dh_testroot
--	rm -f build-stamp configure-stamp
--
--	# Add here commands to clean up after the build process.
--	-$(MAKE) clean
--
--	dh_clean
--
--install: build
--	dh_testdir
--	dh_testroot
--	dh_clean -k
--	dh_installdirs
--
--	# Add here commands to install the package into debian/tint.
--	$(MAKE) install DESTDIR=$(CURDIR)/debian/tint
--
--# Build architecture-independent files here.
--binary-indep: build install
--# We have nothing to do by default.
--
--# Build architecture-dependent files here.
--binary-arch: build install
--	dh_testdir
--	dh_testroot
--#	dh_installdebconf
--	dh_installdocs
--#	dh_installexamples
--	dh_installmenu
--#	dh_installlogrotate
--#	dh_installemacsen
--#	dh_installpam
--#	dh_installmime
--#	dh_installinit
--#	dh_installcron
--	dh_installman
--#	dh_installinfo
--#	dh_undocumented
--	dh_installchangelogs
--	dh_link
--	dh_strip
--	dh_compress
--#	dh_fixperms --exclude /usr/games/tint
--#	dh_makeshlibs
--	dh_installdeb
--#	dh_perl
--	dh_shlibdeps
--	dh_gencontrol
--	dh_md5sums
--	dh_builddeb
--
--binary: binary-indep binary-arch
--.PHONY: build clean binary-indep binary-arch binary install configure
-diff -rupN tint-0.03b/engine.c tint/engine.c
---- tint-0.03b/engine.c	2005-07-17 13:26:22.000000000 +0200
-+++ tint/engine.c	2016-05-27 19:05:21.681035752 +0200
+diff -rupN tint-0.04+nmu1/engine.c tint/engine.c
+--- tint-0.04+nmu1/engine.c	2005-07-17 13:26:22.000000000 +0200
++++ tint/engine.c	2017-07-18 23:00:00.000000000 +0200
 @@ -27,10 +27,13 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */
@@ -466,9 +36,9 @@
  #include "utils.h"
  #include "io.h"
  #include "engine.h"
-diff -rupN tint-0.03b/engine.h tint/engine.h
---- tint-0.03b/engine.h	2001-12-07 16:48:08.000000000 +0100
-+++ tint/engine.h	2016-05-27 19:04:32.456828081 +0200
+diff -rupN tint-0.04+nmu1/engine.h tint/engine.h
+--- tint-0.04+nmu1/engine.h	2001-12-07 16:48:08.000000000 +0100
++++ tint/engine.h	2017-07-18 23:00:00.000000000 +0200
 @@ -29,7 +29,7 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */
@@ -478,9 +48,9 @@
 
  /*
   * Macros
-diff -rupN tint-0.03b/io.c tint/io.c
---- tint-0.03b/io.c	2001-12-07 16:48:20.000000000 +0100
-+++ tint/io.c	2016-05-27 14:47:15.798402053 +0200
+diff -rupN tint-0.04+nmu1/io.c tint/io.c
+--- tint-0.04+nmu1/io.c	2010-06-23 15:05:12.000000000 +0100
++++ tint/io.c	2017-07-18 23:00:00.000000000 +0200
 @@ -27,9 +27,13 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */
@@ -493,9 +63,9 @@
  #include <unistd.h>		/* gettimeofday() */
 +#endif
  
- #include <curses.h>
+ #include "io.h"
  
-@@ -70,7 +74,11 @@ static int in_timeleft;
+@@ -68,7 +72,11 @@ static int in_timeleft;
  /* Initialize screen */
  void io_init ()
  {
@@ -507,7 +77,7 @@
     start_color ();
     curs_set (CURSOR_INVISIBLE);
     out_attr = A_NORMAL;
-@@ -176,11 +184,17 @@ void out_beep ()
+@@ -177,11 +185,17 @@ void out_beep ()
  /* Read a character. Please note that you MUST call in_timeout() before in_getch() */
  int in_getch ()
  {
@@ -525,7 +95,7 @@
     gettimeofday (&endtv,NULL);
     /* Timeout? */
     if (ch == ERR)
-@@ -198,6 +212,7 @@ int in_getch ()
+@@ -199,6 +213,7 @@ int in_getch ()
  		in_timeleft -= endtv.tv_usec;
  		if (in_timeleft <= 0) in_timeleft = in_timetotal;
  	 }
@@ -533,26 +103,55 @@
     return ch;
  }
  
-diff -rupN tint-0.03b/Makefile tint/Makefile
---- tint-0.03b/Makefile	2005-07-17 13:30:54.000000000 +0200
-+++ tint/Makefile	2016-05-27 21:04:02.374391088 +0200
-@@ -28,85 +28,79 @@
- #  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.
-
--#CROSS = arm-linux-
+diff -rupN tint-0.04+nmu1/io.h tint/io.h
+--- tint-0.04+nmu1/io.h	2010-06-23 14:55:03.000000000 +0100
++++ tint/io.h	2017-07-18 23:00:00.000000000 +0200
+@@ -29,9 +29,8 @@
+  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+  */
 -
--bindir = $(DESTDIR)/usr/games
--mandir = $(DESTDIR)/usr/share/man
--localstatedir = $(DESTDIR)/var/games
++
+ #include <curses.h>
+-#include <wchar.h>
 -
--ifeq ($(CC),)
--CC = gcc
--else
--ifeq ($(CC),colorgcc)
--	ifneq ($(CROSS),)
--	CC = gcc
--	endif
++
+ /*
+  * Colors
+  */
+diff -rupN tint-0.04+nmu1/Makefile tint/Makefile
+--- tint-0.04+nmu1/Makefile	2010-06-23 15:06:11.000000000 +0200
++++ tint/Makefile	2017-07-18 23:00:00.000000000 +0200
+@@ -1,0 +1,106 @@
++
++# -*- sh -*-
++
++#  Copyright (c) Abraham vd Merwe <abz at blio.net>
++#  All rights reserved.
++#
++#  Redistribution and use in source and binary forms, with or without
++#  modification, are permitted provided that the following conditions
++#  are met:
++#  1. Redistributions of source code must retain the above copyright
++#     notice, this list of conditions and the following disclaimer.
++#
++#  2. Redistributions in binary form must reproduce the above copyright
++#     notice, this list of conditions and the following disclaimer in the
++#     documentation and/or other materials provided with the distribution.
++#  3. Neither the name of the author nor the names of other contributors
++#     may be used to endorse or promote products derived from this software
++#     without specific prior written permission.
++#
++#  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
++#  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
++#  THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
++#  ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
++#  FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
++#  DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
++#  SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
++#  CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
++#  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.
++
 +# in addition to the dependency below, create the file if it doesn't exist
 +# to silence warnings about a file that would be generated anyway.
 +$(if $(wildcard .xcompile),,$(eval $(shell ../../../../util/xcompile/xcompile $(XGCCPATH) > .xcompile || rm -f .xcompile)))
@@ -589,32 +188,8 @@
 +# Make is silent per default, but 'make V=1' will show all compiler calls.
 +ifneq ($(V),1)
 +Q := @
- endif
--endif
--
--CFLAGS = -Wall -Os -pipe
--CPPFLAGS = -DSCOREFILE=\"$(localstatedir)/$(PRG).scores\" #-DUSE_RAND
--LDFLAGS = -s
--LDLIBS = -lncurses
--
--STRIP = strip
--STRIPFLAGS = --strip-all --remove-section=.note --remove-section=.comment
--
--INSTALL = install
--
--OBJ = engine.o utils.o io.o tint.o
--SRC = $(OBJ:%.o=%.c)
--PRG = tint
--
--       ########### NOTHING TO EDIT BELOW THIS ###########
--
--.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
--
--all: do-it-all postinst
-
--ifeq (.depends,$(wildcard .depends))
--include .depends
--do-it-all: with-depends
++endif
++
 +all: $(TARGET).elf
 +#	printf" CC   $(CC)\n"
 +
@@ -636,63 +211,26 @@
 +ifneq ($(strip $(HAVE_LIBPAYLOAD)),)
 +libpayload:
 +	$(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n"
- else
--do-it-all: without-depends
--endif
--
--without-depends: depend with-depends
--
--depend:
--	rm -f .depends
--	set -e; for F in $(SRC); do $(CC) -MM $(CFLAGS) $(CPPFLAGS) $$F >> .depends; done
--
--with-depends: $(PRG)
--
--$(PRG): $(OBJ)
--	$(CROSS)$(CC) $(LDFLAGS) $^ -o $@ $(LDLIBS)
--	$(CROSS)$(STRIP) $(STRIPFLAGS) $@
--
--ifneq ($(DESTDIR),)
--install: $(PRG)
--	$(INSTALL) -d $(bindir) $(mandir) $(localstatedir)
--	$(INSTALL) -s -g games -o root -m 2755 $(PRG) $(bindir)
--	$(INSTALL) -g games -o root -m 0644 $(PRG).6 $(mandir)/man6
--#	cp tint.scores $(localstatedir)/$(PRG).scores
--#	chown root.games $(localstatedir)/$(PRG).scores
--#	chmod 0664 $(localstatedir)/$(PRG).scores
--
--uninstall:
--	rm -f $(bindir)/$(PRG) $(mandir)/man6/$(PRG).6 $(localstatedir)/$(PRG).scores
++else
 +libpayload:
 +	$(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n"
 +	$(Q)make -C $(LIBCONFIG_PATH) distclean
 +	$(Q)make -C $(LIBCONFIG_PATH) defconfig KBUILD_DEFCONFIG=$(LIB_CONFIG)
 +	$(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(tint_obj) install
- endif
-
--postinst:
--	$(MAKE) -C debian
--
--debian:
--	dpkg-buildpackage -rfakeroot -k2B555AEE
--
- clean:
--	rm -f .depends *~ $(OBJ) $(PRG) {configure,build}-stamp gmon.out a.out
--	rm -rf debian/$(PRG)
--	rm -f debian/*.{debhelper,substvars} debian/files debian/*~
++endif
++
++clean:
 +	$(Q)rm -f $(TARGET).elf $(TARGET).debug *.o
 +	$(Q)rm .xcompile
-
- distclean: clean
--	$(MAKE) -C debian clean
++
++distclean: clean
 +	$(Q)rm -rf $(tint_obj)
-
++
 +
 +.PHONY: all clean do-it-all depend with-depends without-depends debian postinst
-Binary files tint-0.03b/.Makefile.swp and tint/.Makefile.swp differ
-diff -rupN tint-0.03b/tint.c tint/tint.c
---- tint-0.03b/tint.c	2005-07-17 13:26:43.000000000 +0200
-+++ tint/tint.c	2016-05-27 18:59:53.838346317 +0200
+diff -rupN tint-0.04+nmu1/tint.c tint/tint.c
+--- tint-0.04+nmu1/tint.c	2010-08-08 19:42:50.000000000 +0200
++++ tint/tint.c	2017-07-18 23:00:00.000000000 +0200
 @@ -1,4 +1,3 @@
 -
  /*
@@ -716,7 +254,14 @@
  #include "utils.h"
  #include "io.h"
  #include "config.h"
-@@ -321,6 +321,7 @@ typedef struct
+@@ -306,4 +306,4 @@
+ /* Header for scorefile */
+-#define SCORE_HEADER	"Tint 0.02b (c) Abraham vd Merwe - Scores"
++#define SCORE_HEADER	"Tint 0.04+nmu1 (c) Abraham vd Merwe - Scores"
+-
++
+ /* Header for score title */
+@@ -322,6 +322,7 @@ typedef struct
     time_t timestamp;
  } score_t;
  
@@ -724,7 +269,7 @@
  static void getname (char *name)
  {
     struct passwd *pw = getpwuid (geteuid ());
-@@ -337,7 +338,9 @@ static void getname (char *name)
+@@ -338,7 +339,9 @@ static void getname (char *name)
  		name[NAMELEN - 1] = '\0';
  	 }
  }
@@ -734,7 +279,7 @@
  static void err1 ()
  {
     fprintf (stderr,"Error creating %s\n",scorefile);
-@@ -349,10 +352,11 @@ static void err2 ()
+@@ -350,10 +353,11 @@ static void err2 ()
     fprintf (stderr,"Error writing to %s\n",scorefile);
     exit (EXIT_FAILURE);
  }
@@ -747,7 +292,7 @@
  			"\n\t   PLAYER STATISTICS\n\n\t"
  			"Score       %11d\n\t"
  			"Efficiency  %11d\n\t"
-@@ -360,6 +364,7 @@ void showplayerstats (engine_t *engine)
+@@ -361,6 +365,7 @@ void showplayerstats (engine_t *engine)
  			GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ());
  }
  
@@ -755,7 +300,7 @@
  static void createscores (int score)
  {
     FILE *handle;
-@@ -394,7 +399,9 @@ static void createscores (int score)
+@@ -395,7 +400,9 @@ static void createscores (int score)
     fprintf (stderr,"%s",scoretitle);
     fprintf (stderr,"\t  1* %7d        %s\n\n",score,scores[0].name);
  }
@@ -765,7 +310,7 @@
  static int cmpscores (const void *a,const void *b)
  {
     int result;
-@@ -412,7 +419,9 @@ static int cmpscores (const void *a,cons
+@@ -413,7 +420,9 @@ static int cmpscores (const void *a,cons
     /* timestamps is equal */
     return 0;
  }
@@ -775,7 +320,7 @@
  static void savescores (int score)
  {
     FILE *handle;
-@@ -490,11 +499,13 @@ static void savescores (int score)
+@@ -491,11 +500,13 @@ static void savescores (int score)
  	 }
     fprintf (stderr,"\n");
  }
@@ -788,9 +333,9 @@
 +#if 0
  static void showhelp ()
  {
-    fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n");
-@@ -504,9 +515,11 @@ static void showhelp ()
-    fprintf (stderr,"  -d           Draw vertical dotted lines\n");
+    fprintf (stderr,"USAGE: tint [-h] [-l level] [-n] [-d] [-b char]\n");
+@@ -506,9 +517,11 @@ static void showhelp ()
+    fprintf (stderr,"  -b <char>    Use this character to draw blocks instead of spaces\n");
     exit (EXIT_FAILURE);
  }
 +#endif
@@ -801,7 +346,7 @@
     int i = 1;
     while (i < argc)
  	 {
-@@ -536,10 +549,12 @@ static void parse_options (int argc,char
+@@ -544,10 +557,12 @@ static void parse_options (int argc,char
  		  }
  		i++;
  	 }
@@ -814,7 +359,7 @@
     char buf[NAMELEN];
  
     do
-@@ -549,6 +564,8 @@ static void choose_level ()
+@@ -557,6 +572,8 @@ static void choose_level ()
  		buf[strlen (buf) - 1] = '\0';
  	 }
     while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL);
@@ -823,7 +368,7 @@
  }
  
            /***************************************************************************/
-@@ -561,6 +578,8 @@ int main (int argc,char *argv[])
+@@ -569,6 +586,8 @@ int main (int argc,char *argv[])
     int ch;
     engine_t engine;
     /* Initialize */
@@ -832,97 +377,59 @@
     rand_init ();							/* must be called before engine_init () */
     engine_init (&engine,score_function);	/* must be called before using engine.curshape */
     finished = shownext = FALSE;
-@@ -663,8 +682,15 @@
+@@ -632,13 +651,15 @@ int main (int argc,char *argv[])
+ 				  /* pause */
+ 				case 'p':
+ 				  out_setcolor (COLOR_WHITE,COLOR_BLACK);
+-				  out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
++				  out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
+ 				  out_printf ("Paused - Press any key to continue");
++				  refresh ();
+ 				  while ((ch = in_getch ()) == ERR) ;	/* Wait for a key to be pressed */
+ 				  in_flush ();							/* Clear keyboard buffer */
+-				  out_gotoxy ((out_width () - 34) / 2,out_height () - 2);
++				  out_gotoxy ((out_width () - 34) / 2,out_height () / 2);
+ 				  out_printf ("                                  ");
++				  refresh ();
+ 				  break;
+ 				  /* unknown keypress */
+ 				default:
+ 				  out_beep ();
+@@ -673,11 +694,31 @@ int main (int argc,char *argv[])
+    /* Restore console settings and exit */
+    io_close ();
++#if 0
+    /* Don't bother the player if he want's to quit */
     if (ch != 'q')
  	 {
++#endif
  		showplayerstats (&engine);
 +#if 0
  		savescores (GETSCORE (engine.score));
-+#endif
  	 }
-+   printf("Bye.\n");
++#endif
++   printf("Press 'q' to reboot...\n");
 +   refresh();
-+   for(;;); //halt();
++   for (;;) {
++   	in_flush ();
++   	while ((ch = in_getch ()) == ERR) ;   /* Wait for a key to be pressed */
++   	if (ch == 'q') { /* reboot */
++   		outb(0x6, 0xcf9);
++   		for(;;); //halt();
++   	}
++   	else {
++   		in_flush ();
++   	}
++   }
++
 +#if 0
     exit (EXIT_SUCCESS);
 +#endif
  }
  
-diff -rupN tint-0.03b/typedefs.h tint/typedefs.h
---- tint-0.03b/typedefs.h	2001-12-07 16:49:06.000000000 +0100
-+++ tint/typedefs.h	1970-01-01 01:00:00.000000000 +0100
-@@ -1,68 +0,0 @@
--#ifndef TYPEDEFS_H
--#define TYPEDEFS_H
--
--/*
-- * Copyright (c) Abraham vd Merwe <abz at blio.net>
-- * All rights reserved.
-- *
-- * Redistribution and use in source and binary forms, with or without
-- * modification, are permitted provided that the following conditions
-- * are met:
-- * 1. Redistributions of source code must retain the above copyright
-- *	  notice, this list of conditions and the following disclaimer.
-- * 2. Redistributions in binary form must reproduce the above copyright
-- *	  notice, this list of conditions and the following disclaimer in the
-- *	  documentation and/or other materials provided with the distribution.
-- * 3. Neither the name of the author nor the names of other contributors
-- *	  may be used to endorse or promote products derived from this software
-- *	  without specific prior written permission.
-- *
-- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
-- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
-- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
-- * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
-- * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-- * 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.
-- */
--
--/*
-- * Boolean definitions
-- */
--
--#ifndef bool
--#define bool int
--#endif
--
--#if !defined(false) || (false != 0)
--#define false	0
--#endif
--
--#if !defined(true) || (true != 0)
--#define true	1
--#endif
--
--#if !defined(FALSE) || (FALSE != false)
--#define FALSE	false
--#endif
--
--#if !defined(TRUE) || (TRUE != true)
--#define TRUE	true
--#endif
--
--/*
-- * Error flags
-- */
--
--#if !defined(ERR) || (ERR != -1)
--#define ERR		-1
--#endif
--
--#if !defined(OK) || (OK != 0)
--#define OK		0
--#endif
--
--#endif	/* #ifndef TYPEDEFS_H */
-diff -rupN tint-0.03b/utils.c tint/utils.c
---- tint-0.03b/utils.c	2001-12-07 16:49:19.000000000 +0100
-+++ tint/utils.c	2016-05-27 19:05:40.313351887 +0200
+diff -rupN tint-0.04+nmu1/utils.c tint/utils.c
+--- tint-0.04+nmu1/utils.c	2001-12-07 16:49:19.000000000 +0100
++++ tint/utils.c	2017-07-18 23:00:00.000000000 +0200
 @@ -27,11 +27,13 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */
@@ -964,9 +471,9 @@
  }
  
 +#endif
-diff -rupN tint-0.03b/utils.h tint/utils.h
---- tint-0.03b/utils.h	2001-12-07 16:49:35.000000000 +0100
-+++ tint/utils.h	2016-05-27 19:00:34.120754123 +0200
+diff -rupN tint-0.04+nmu1/utils.h tint/utils.h
+--- tint-0.04+nmu1/utils.h	2001-12-07 16:49:35.000000000 +0100
++++ tint/utils.h	2017-07-18 23:00:00.000000000 +0200
 @@ -29,7 +29,7 @@
   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
   */

-- 
To view, visit https://review.coreboot.org/20637
To unsubscribe, visit https://review.coreboot.org/settings

Gerrit-Project: coreboot
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I16f4a4a9804fef3da67ae1888dd56fa184ffba9d
Gerrit-Change-Number: 20637
Gerrit-PatchSet: 1
Gerrit-Owner: Mike Banon <mikebdp2 at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.coreboot.org/pipermail/coreboot-gerrit/attachments/20170718/0fed351b/attachment-0001.html>


More information about the coreboot-gerrit mailing list