wok rev 24043

memtest: add 386 support
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Apr 30 16:47:13 2021 +0000 (2021-04-30)
parents a00792a1ec20
children 0a67bf248823
files memtest/receipt memtest/stuff/memtest86+-5.01-386.patch memtest/stuff/memtest86+-5.01-O0.patch memtest/stuff/memtest86+-5.01-array-size.patch memtest/stuff/memtest86+-5.01-io.patch memtest/stuff/memtest86+-5.01-scp.patch rsync/receipt tinc/receipt
line diff
     1.1 --- a/memtest/receipt	Thu Apr 15 15:26:18 2021 +0100
     1.2 +++ b/memtest/receipt	Fri Apr 30 16:47:13 2021 +0000
     1.3 @@ -16,9 +16,9 @@
     1.4  # Rules to configure and make the package.
     1.5  compile_rules()
     1.6  {
     1.7 -	sed -i '/scp memtest.bin/d' Makefile
     1.8 -	for i in array-size io setup ; do
     1.9 -		patch -p1 < $stuff/$SOURCE-$VERSION-$i.patch
    1.10 +	ls $stuff/memtest*-$VERSION-*.patch &&
    1.11 +	for i in $stuff/memtest*-$VERSION-*.patch ; do
    1.12 +		patch -p1 < $i
    1.13  	done
    1.14  	make
    1.15  	cp $stuff/*.S $stuff/pack .
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/memtest/stuff/memtest86+-5.01-386.patch	Fri Apr 30 16:47:13 2021 +0000
     2.3 @@ -0,0 +1,105 @@
     2.4 +--- memtest86+-5.01/cpuid.c
     2.5 ++++ memtest86+-5.01/cpuid.c
     2.6 +@@ -14,6 +14,15 @@
     2.7 + 	unsigned int *v, dummy[3];
     2.8 + 	char *p, *q;
     2.9 + 
    2.10 ++	switch (has_cpuid(AC_BIT|CPUID_BIT)) {
    2.11 ++        case 0:
    2.12 ++	    cpu_id.vers.bits.family = 3;
    2.13 ++	    return;
    2.14 ++        case AC_BIT:
    2.15 ++	    cpu_id.vers.bits.family = 4;
    2.16 ++	    return;
    2.17 ++	}
    2.18 ++	    
    2.19 + 	/* Get max std cpuid & vendor ID */
    2.20 + 	cpuid(0x0, &cpu_id.max_cpuid, &cpu_id.vend_id.uint32_array[0],
    2.21 + 	    &cpu_id.vend_id.uint32_array[2], &cpu_id.vend_id.uint32_array[1]);
    2.22 +--- memtest86+-5.01/cpuid.h
    2.23 ++++ memtest86+-5.01/cpuid.h
    2.24 +@@ -11,6 +11,26 @@
    2.25 + 
    2.26 + extern struct cpu_ident cpu_id;
    2.27 + 
    2.28 ++#define AC_BIT		(1<<18)
    2.29 ++#define CPUID_BIT	(1<<21)
    2.30 ++static inline int has_cpuid(int bits)
    2.31 ++{
    2.32 ++	int eax, edx;
    2.33 ++	asm __volatile__(
    2.34 ++		"pushfl\n\t"
    2.35 ++		"popl %0\n\t"
    2.36 ++		"movl %0,%1\n\t"
    2.37 ++		"xorl %2,%0\n\t"
    2.38 ++		"pushl %0\n\t"
    2.39 ++		"popfl\n\t"
    2.40 ++		"pushfl\n\t"
    2.41 ++		"popl %0\n\t"
    2.42 ++		"pushl %1\n\t"
    2.43 ++		"popfl\n\t"
    2.44 ++		"xorl %1,%0":"=a" (eax),"=d" (edx):"c" (bits));
    2.45 ++	return eax;
    2.46 ++}
    2.47 ++
    2.48 + static inline void __cpuid(unsigned int *eax, unsigned int *ebx,
    2.49 +                                 unsigned int *ecx, unsigned int *edx)
    2.50 + {
    2.51 +--- memtest86+-5.01/init.c
    2.52 ++++ memtest86+-5.01/init.c
    2.53 +@@ -77,6 +77,7 @@
    2.54 + 	cprint(19, 15, "==> Press F2 to force Multi-Threading (SMP) <==");				
    2.55 + 	}
    2.56 + 
    2.57 ++	if (cpu_id.fid.bits.rdtsc) {
    2.58 + 	/* save the starting time */
    2.59 + 	asm __volatile__(
    2.60 + 		"rdtsc":"=a" (sl),"=d" (sh));
    2.61 +@@ -122,6 +123,7 @@
    2.62 + 		}				
    2.63 + 			
    2.64 + 	}
    2.65 ++	}
    2.66 + 	
    2.67 + 	cprint(18, 18, "                                          ");
    2.68 + 	cprint(19, 15, "                                                ");
    2.69 +@@ -321,7 +323,9 @@
    2.70 + 		beep(1000);
    2.71 + 	
    2.72 + 	/* Record the start time */
    2.73 ++	if (cpu_id.fid.bits.rdtsc) {
    2.74 +   asm __volatile__ ("rdtsc":"=a" (v->startl),"=d" (v->starth));
    2.75 ++  	}
    2.76 +   v->snapl = v->startl;
    2.77 +   v->snaph = v->starth;
    2.78 + 	if (l1_cache == 0) { l1_cache = 64; }
    2.79 +@@ -998,10 +1002,18 @@
    2.80 + 	default:
    2.81 + 		/* Make a guess at the family */
    2.82 + 		switch(cpu_id.vers.bits.family) {
    2.83 ++		case 3:
    2.84 ++			cprint(0, COL_MID, "386");
    2.85 ++			break;
    2.86 ++		case 4:
    2.87 ++			cprint(0, COL_MID, "486");
    2.88 ++			break;
    2.89 + 		case 5:
    2.90 + 			cprint(0, COL_MID, "586");
    2.91 ++			break;
    2.92 + 		case 6:
    2.93 + 			cprint(0, COL_MID, "686");
    2.94 ++			break;
    2.95 + 		default:
    2.96 + 			cprint(0, COL_MID, "Unidentified Processor");
    2.97 + 		}
    2.98 +--- memtest86+-5.01/test.c
    2.99 ++++ memtest86+-5.01/test.c
   2.100 +@@ -1501,6 +1501,8 @@
   2.101 + {
   2.102 + 	ulong sh, sl, l, h, t, ip=0;
   2.103 + 
   2.104 ++	if (cpu_id.fid.bits.rdtsc == 0) return;
   2.105 ++	
   2.106 + 	/* save the starting time */
   2.107 + 	asm __volatile__(
   2.108 + 		"rdtsc":"=a" (sl),"=d" (sh));
     3.1 --- a/memtest/stuff/memtest86+-5.01-O0.patch	Thu Apr 15 15:26:18 2021 +0100
     3.2 +++ b/memtest/stuff/memtest86+-5.01-O0.patch	Fri Apr 30 16:47:13 2021 +0000
     3.3 @@ -1,4 +1,4 @@
     3.4 ---- memtest86+-5.01/Makefile~	2014-01-08 01:30:11.355900076 +0000
     3.5 +--- memtest86+-5.01/Makefile	2014-01-08 01:30:11.355900076 +0000
     3.6  +++ memtest86+-5.01/Makefile	2014-01-08 01:31:19.387555469 +0000
     3.7  @@ -12,7 +12,7 @@
     3.8   AS=as -32
     4.1 --- a/memtest/stuff/memtest86+-5.01-array-size.patch	Thu Apr 15 15:26:18 2021 +0100
     4.2 +++ b/memtest/stuff/memtest86+-5.01-array-size.patch	Fri Apr 30 16:47:13 2021 +0000
     4.3 @@ -1,4 +1,4 @@
     4.4 ---- memtest86+-5.01/controller.c~	2013-08-10 02:01:58.000000000 +0000
     4.5 +--- memtest86+-5.01/controller.c	2013-08-10 02:01:58.000000000 +0000
     4.6  +++ memtest86+-5.01/controller.c	2013-12-12 20:58:12.873555378 +0000
     4.7  @@ -292,7 +292,7 @@
     4.8   
     5.1 --- a/memtest/stuff/memtest86+-5.01-io.patch	Thu Apr 15 15:26:18 2021 +0100
     5.2 +++ b/memtest/stuff/memtest86+-5.01-io.patch	Fri Apr 30 16:47:13 2021 +0000
     5.3 @@ -1,4 +1,4 @@
     5.4 ---- memtest86+-5.01/io.h~	2013-08-10 02:01:58.000000000 +0000
     5.5 +--- memtest86+-5.01/io.h	2013-08-10 02:01:58.000000000 +0000
     5.6  +++ memtest86+-5.01/io.h	2014-01-08 01:29:12.404465515 +0000
     5.7  @@ -31,7 +31,7 @@
     5.8    */
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/memtest/stuff/memtest86+-5.01-scp.patch	Fri Apr 30 16:47:13 2021 +0000
     6.3 @@ -0,0 +1,10 @@
     6.4 +--- memtest86+-5.01/Makefile
     6.5 ++++ memtest86+-5.01/Makefile
     6.6 +@@ -21,7 +21,6 @@
     6.7 +       
     6.8 + 
     6.9 + all: clean memtest.bin memtest 
    6.10 +-		 scp memtest.bin root@192.168.0.12:/srv/tftp/mt86plus
    6.11 + 
    6.12 + # Link it statically once so I know I don't have undefined
    6.13 + # symbols and then link it dynamically so I have full
     7.1 --- a/rsync/receipt	Thu Apr 15 15:26:18 2021 +0100
     7.2 +++ b/rsync/receipt	Fri Apr 30 16:47:13 2021 +0000
     7.3 @@ -20,6 +20,12 @@
     7.4  # TazPanel
     7.5  TAZPANEL_DAEMON="man::rsync|help::rsync|edit|options|web::$WEB_SITE"
     7.6  
     7.7 +current_version()
     7.8 +{
     7.9 +	wget -O - $WEB_SITE 2>/dev/null | \
    7.10 +	sed "/$PACKAGE-/!d;/tar/!d;s|.tar.*||;s|.*-||;q"
    7.11 +}
    7.12 +
    7.13  # Rules to configure and make the package.
    7.14  compile_rules()
    7.15  {
     8.1 --- a/tinc/receipt	Thu Apr 15 15:26:18 2021 +0100
     8.2 +++ b/tinc/receipt	Fri Apr 30 16:47:13 2021 +0000
     8.3 @@ -44,3 +44,11 @@
     8.4  	cp -a $install/usr/sbin	$fs/usr
     8.5  	cp -a $stuff/*		$fs
     8.6  }
     8.7 +
     8.8 +post_install()
     8.9 +{
    8.10 +	grep -q'^tinc\b' $1/etc/services || cat >> $1/etc/services <<EOT
    8.11 +tinc		655/tcp		TINC
    8.12 +tinc		655/udp		TINC
    8.13 +EOT
    8.14 +}