source:
trunk/payloads/external/tint/libpayload_tint.patch
| Last change on this file was 5816, checked in by mjones, 3 years ago | |
|---|---|
| File size: 10.4 KB | |
-
Makefile
Patch tint 0.03b to be usable as coreboot payload, linked against the libpayload library. Signed-off-by: Uwe Hermann <uwe@hermann-uwe.de> Add default libpayload build, xcompile, and lpgcc setup to tint. Signed-off-by: Marc Jones <marc.jones@gmail.com> diff -rupN tintorig/Makefile tint/Makefile
old new 28 28 # OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 29 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 30 31 $(if $(wildcard .xcompile),,$(eval $(shell bash ./xcompile.sh &> .xcompile))) 32 include .xcompile 33 34 LIBCONFIG_PATH := ../libpayload 35 LIBPAYLOAD_DIR := ./libpayloadbin 36 LPCC := $(LIBPAYLOAD_DIR)/libpayload/bin/lpgcc 37 LPAS := $(LIBPAYLOAD_DIR)/libpayload/bin/lpas 38 HAVE_LIBPAYLOAD := $(wildcard $(LIBPAYLOAD_DIR)/libpayload/lib/libpayload.a) 39 LIB_CONFIG ?= defconfig 40 41 # CFLAGS := -Wall -Werror -Os 42 CFLAGS := -Wall -g -Os 43 TARGET := tint 44 OBJS := $(TARGET).o engine.o io.o utils.o 45 46 # Make is silent per default, but 'make V=1' will show all compiler calls. 47 ifneq ($(V),1) 48 Q := @ 49 endif 50 51 all: $(TARGET).elf 52 # printf" CC $(CC)\n" 53 54 $(TARGET).elf: $(OBJS) libpayload 55 $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n" 56 $(Q)$(LPCC) -o $@ $(OBJS) 57 $(Q)$(OBJCOPY) --only-keep-debug $@ tint.debug 58 $(Q)$(OBJCOPY) --strip-debug $@ 59 $(Q)$(OBJCOPY) --add-gnu-debuglink=tint.debug $@ 60 61 %.o: %.c libpayload 62 $(Q)printf " LPCC $(subst $(shell pwd)/,,$(@))\n" 63 $(Q)$(LPCC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $< 64 65 %.S.o: %.S libpayload 66 $(Q)printf " LPAS $(subst $(shell pwd)/,,$(@))\n" 67 $(Q)$(LPAS) $(ASFLAGS) --32 -o $@ $< 68 69 ifneq ($(strip $(HAVE_LIBPAYLOAD)),) 70 libpayload: 71 $(Q)printf "Found Libpayload $(LIBPAYLOAD_DIR).\n" 72 else 73 libpayload: 74 $(Q)printf "Building libpayload @ $(LIBCONFIG_PATH).\n" 75 $(Q)make -C $(LIBCONFIG_PATH) distclean 76 $(Q)make -C $(LIBCONFIG_PATH) $(LIB_CONFIG) 77 $(Q)make -C $(LIBCONFIG_PATH) DESTDIR=$(shell pwd)/$(LIBPAYLOAD_DIR) install 78 endif 79 80 clean: 81 $(Q)rm -f $(TARGET).elf $(TARGET).debug *.o 82 $(Q)rm .xcompile 83 84 distclean: clean 85 $(Q)rm -rf $(LIBPAYLOAD_DIR) 86 87 # Original tint targets 88 ifdef $(UNUSED) 89 31 90 #CROSS = arm-linux- 32 91 33 92 bindir = $(DESTDIR)/usr/games … … clean: 110 169 distclean: clean 111 170 $(MAKE) -C debian clean 112 171 172 endif -
config.h
diff -rupN tintorig/config.h tint/config.h
old new 29 29 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 30 */ 31 31 32 #include <libpayload.h> 33 #include <curses.h> 34 #define random(x) rand(x) 35 #define srandom(x) srand(x) 36 #define curs_set(x) 37 38 32 39 /* Score file */ 40 #if 0 33 41 const char scorefile[] = SCOREFILE; 42 #endif 34 43 35 44 #endif /* #ifndef CONFIG_H */ -
engine.c
diff -rupN tintorig/engine.c tint/engine.c
old new 27 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 */ 29 29 30 #include "config.h" 31 32 #if 0 30 33 #include <stdlib.h> 31 34 #include <string.h> 35 #endif 32 36 33 37 #include "typedefs.h" 34 38 #include "utils.h" -
io.c
diff -rupN tintorig/io.c tint/io.c
old new 27 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 */ 29 29 30 #include "config.h" 31 32 #if 0 30 33 #include <stdarg.h> /* va_list(), va_start(), va_end() */ 31 34 #include <sys/time.h> /* gettimeofday() */ 32 35 #include <unistd.h> /* gettimeofday() */ 36 #endif 33 37 34 38 #include <curses.h> 35 39 … … static int in_timeleft; 70 74 /* Initialize screen */ 71 75 void io_init () 72 76 { 77 curses_enable_serial(0); 78 curses_enable_vga(1); 73 79 initscr (); 80 halfdelay(1); 81 timeout(1); 74 82 start_color (); 75 83 curs_set (CURSOR_INVISIBLE); 76 84 out_attr = A_NORMAL; … … void out_beep () 176 184 /* Read a character. Please note that you MUST call in_timeout() before in_getch() */ 177 185 int in_getch () 178 186 { 187 #if 0 179 188 struct timeval starttv,endtv; 189 #endif 180 190 int ch; 191 #if 0 181 192 timeout (in_timeleft / 1000); 182 193 gettimeofday (&starttv,NULL); 194 #endif 183 195 ch = getch (); 196 mdelay(150); 197 #if 0 184 198 gettimeofday (&endtv,NULL); 185 199 /* Timeout? */ 186 200 if (ch == ERR) … … int in_getch () 198 212 in_timeleft -= endtv.tv_usec; 199 213 if (in_timeleft <= 0) in_timeleft = in_timetotal; 200 214 } 215 #endif 201 216 return ch; 202 217 } 203 218 -
tint.c
diff -rupN tintorig/tint.c tint/tint.c
old new 1 2 1 /* 3 2 * Copyright (c) Abraham vd Merwe <abz@blio.net> 4 3 * All rights reserved. … … 27 26 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 27 */ 29 28 29 #if 0 30 30 #include <stdlib.h> 31 31 #include <stdio.h> 32 32 #include <string.h> … … 34 34 #include <pwd.h> 35 35 #include <sys/types.h> 36 36 #include <unistd.h> 37 #endif 37 38 38 39 #include "typedefs.h" 39 40 #include "utils.h" … … typedef struct 321 322 time_t timestamp; 322 323 } score_t; 323 324 325 #if 0 324 326 static void getname (char *name) 325 327 { 326 328 struct passwd *pw = getpwuid (geteuid ()); … … static void getname (char *name) 337 339 name[NAMELEN - 1] = '\0'; 338 340 } 339 341 } 342 #endif 340 343 344 #if 0 341 345 static void err1 () 342 346 { 343 347 fprintf (stderr,"Error creating %s\n",scorefile); … … static void err2 () 349 353 fprintf (stderr,"Error writing to %s\n",scorefile); 350 354 exit (EXIT_FAILURE); 351 355 } 356 #endif 352 357 353 358 void showplayerstats (engine_t *engine) 354 359 { 355 fprintf (stderr,360 printf ( 356 361 "\n\t PLAYER STATISTICS\n\n\t" 357 362 "Score %11d\n\t" 358 363 "Efficiency %11d\n\t" … … void showplayerstats (engine_t *engine) 360 365 GETSCORE (engine->score),engine->status.efficiency,GETSCORE (engine->score) / getsum ()); 361 366 } 362 367 368 #if 0 363 369 static void createscores (int score) 364 370 { 365 371 FILE *handle; … … static void createscores (int score) 394 400 fprintf (stderr,"%s",scoretitle); 395 401 fprintf (stderr,"\t 1* %7d %s\n\n",score,scores[0].name); 396 402 } 403 #endif 397 404 405 #if 0 398 406 static int cmpscores (const void *a,const void *b) 399 407 { 400 408 int result; … … static int cmpscores (const void *a,cons 412 420 /* timestamps is equal */ 413 421 return 0; 414 422 } 423 #endif 415 424 425 #if 0 416 426 static void savescores (int score) 417 427 { 418 428 FILE *handle; … … static void savescores (int score) 490 500 } 491 501 fprintf (stderr,"\n"); 492 502 } 503 #endif 493 504 494 505 /***************************************************************************/ 495 506 /***************************************************************************/ 496 507 /***************************************************************************/ 497 508 509 #if 0 498 510 static void showhelp () 499 511 { 500 512 fprintf (stderr,"USAGE: tint [-h] [-l level] [-n]\n"); … … static void showhelp () 504 516 fprintf (stderr," -d Draw vertical dotted lines\n"); 505 517 exit (EXIT_FAILURE); 506 518 } 519 #endif 507 520 508 521 static void parse_options (int argc,char *argv[]) 509 522 { 523 #if 0 510 524 int i = 1; 511 525 while (i < argc) 512 526 { … … static void parse_options (int argc,char 536 550 } 537 551 i++; 538 552 } 553 #endif 539 554 } 540 555 541 556 static void choose_level () 542 557 { 558 #if 0 543 559 char buf[NAMELEN]; 544 560 545 561 do … … static void choose_level () 549 565 buf[strlen (buf) - 1] = '\0'; 550 566 } 551 567 while (!str2int (&level,buf) || level < MINLEVEL || level > MAXLEVEL); 568 #endif 569 level = 1; 552 570 } 553 571 554 572 /***************************************************************************/ … … int main (int argc,char *argv[]) 663 681 if (ch != 'q') 664 682 { 665 683 showplayerstats (&engine); 684 #if 0 666 685 savescores (GETSCORE (engine.score)); 686 #endif 667 687 } 688 printf("Bye.\n"); 689 refresh(); 690 for(;;); //halt(); 691 #if 0 668 692 exit (EXIT_SUCCESS); 693 #endif 669 694 } 670 695 -
utils.c
diff -rupN tintorig/utils.c tint/utils.c
old new 27 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 28 */ 29 29 30 #include "config.h" 31 32 #if 0 30 33 #include <stdlib.h> 31 34 #include <time.h> 32 35 #include <limits.h> 36 #endif 33 37 34 38 #include "typedefs.h" 35 39 … … void rand_init () 41 45 #ifdef USE_RAND 42 46 srand (time (NULL)); 43 47 #else 48 #if 0 44 49 srandom (time (NULL)); 45 50 #endif 51 srandom (123); 52 #endif 46 53 } 47 54 48 55 /* … … int rand_value (int range) 61 68 * Convert an str to long. Returns TRUE if successful, 62 69 * FALSE otherwise. 63 70 */ 71 #if 0 64 72 bool str2int (int *i,const char *str) 65 73 { 66 74 char *endptr; … … bool str2int (int *i,const char *str) 69 77 return TRUE; 70 78 } 71 79 80 #endif -
xcompile.sh
diff -rupN tintorig/xcompile.sh tint/xcompile.sh
old new 1 #!/bin/bash 2 3 CONFIG=defconfig 4 SCRIPT_DIR=`dirname "$0"` 5 6 for make in make gmake gnumake; do 7 if [ "`$make --version 2>/dev/null | grep -c GNU`" -gt 0 ]; then 8 MAKE=$make 9 break 10 fi 11 done 12 13 GCCPREFIX=invalid 14 for gccprefixes in `pwd`/$SCRIPT_DIR/../../util/crossgcc/xgcc/bin/i386-elf- i386-elf- ""; do 15 TMP=`mktemp /tmp/temp.XXXX` 16 echo "mov %eax, %eax" > ${TMP}.s 17 printf "\x7fELF" > ${TMP}.compare 18 if which ${gccprefixes}as 2>/dev/null >/dev/null; then 19 printf "" 20 else 21 continue 22 fi 23 if ${gccprefixes}as --32 -o ${TMP}.o ${TMP}.s; then 24 dd bs=4 count=1 if=${TMP}.o > ${TMP}.test 2>/dev/null 25 if cmp ${TMP}.test ${TMP}.compare; then 26 GCCPREFIX=$gccprefixes 27 rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test 28 break 29 fi 30 fi 31 rm -f $TMP ${TMP}.s ${TMP}.o ${TMP}.compare ${TMP}.test 32 done 33 34 if [ "$GCCPREFIX" = "invalid" ]; then 35 echo no suitable gcc found 36 exit 1 37 fi 38 39 #MAKEFLAGS=" \ 40 # AS=\"${GCCPREFIX}as --32\" \ 41 # CC=\"${GCCPREFIX}gcc -m32\" \ 42 # AR=\"${GCCPREFIX}ar\" \ 43 # LD=\"${GCCPREFIX}ld -b elf32-i386\" \ 44 # STRIP=\"${GCCPREFIX}strip\" \ 45 # NM=\"${GCCPREFIX}nm\" \ 46 # HOSTCC=gcc \ 47 # -j \ 48 #" 49 50 cat << afteroptions 51 export AS:=${GCCPREFIX}as --32 52 export CC:=${GCCPREFIX}gcc -m32 53 export CPP:=${GCCPREFIX}cpp 54 export AR:=${GCCPREFIX}ar 55 export LD:=${GCCPREFIX}ld -b elf32-i386 56 export STRIP:=${GCCPREFIX}strip 57 export NM:=${GCCPREFIX}nm 58 export OBJCOPY:=${GCCPREFIX}objcopy 59 export OBJDUMP:=${GCCPREFIX}objdump 60 export HOSTCC:=gcc 61 afteroptions 62 63 # Should we let the payload build libpayload or do it for them? 64 #test -d ./build || ( 65 # BUILDDIR=$PWD 66 # cd ../libpayload 67 # $MAKE distclean 68 # cp configs/$CONFIG .config 69 # $MAKE oldconfig 70 # eval $MAKE $MAKEFLAGS 71 # eval $MAKE $MAKEFLAGS DESTDIR=$BUILDDIR/build install 72 # cd .. 73 #) 74 75 # eval $MAKE -C $SCRIPT_DIR $MAKEFLAGS 76
Note: See TracBrowser
for help on using the repository browser.
