wok-tiny rev 104

Add ipxe, memtest
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sun Feb 07 14:42:58 2016 +0100 (2016-02-07)
parents 981558572b0f
children a41610cab1ff
files hardware-ibm-6272/receipt ipxe/receipt linux/receipt linux/stuff/bundle linux/stuff/bundle.S memtest/receipt
line diff
     1.1 --- a/hardware-ibm-6272/receipt	Wed Jan 06 13:13:00 2016 +0100
     1.2 +++ b/hardware-ibm-6272/receipt	Sun Feb 07 14:42:58 2016 +0100
     1.3 @@ -48,7 +48,7 @@
     1.4  		*\ $i\ *)	list="$list $i"
     1.5  		esac
     1.6  	done
     1.7 -	sed -i "s/ IRQ_CS89X0_LIST/${list:-15 12 11 10}/" $1/etc/init.d/pnp.sh
     1.8 +	sed -i "s/ IRQ_CS89X0_LIST/${list:- 15 12 11 10}/" $1/etc/init.d/pnp.sh
     1.9  	sed -i 's/cs89x0[^ "]* //' $1/etc/rcS.conf
    1.10  	sed -i '/rm -f .sbin.*pnp/d' $1/etc/init.d/pnp.sh
    1.11  	[ "$CS89X0_WIPEPNP" == "on" ] &&
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/ipxe/receipt	Sun Feb 07 14:42:58 2016 +0100
     2.3 @@ -0,0 +1,19 @@
     2.4 +# SliTaz package receipt.
     2.5 +
     2.6 +PACKAGE="ipxe"
     2.7 +VERSION="1.0.0-20160119"
     2.8 +CATEGORY="system-tools"
     2.9 +SHORT_DESC="Open source network boot firmware."
    2.10 +MAINTAINER="pascal.bellard@slitaz.org"
    2.11 +LICENSE="GPL2"
    2.12 +WEB_SITE="http://ipxe.org/"
    2.13 +TARBALL="$PACKAGE-$VERSION"
    2.14 +WGET_URL="http://cook.slitaz.org/cooker.cgi?download=../wok/$PACKAGE/taz/$PACKAGE-$VERSION/fs/boot/ipxe"
    2.15 +TARGET="i486"
    2.16 +
    2.17 +# Rules to gen a SliTaz package suitable for Tazpkg.
    2.18 +genpkg_rules()
    2.19 +{
    2.20 +	mkdir -p $fs/boot
    2.21 +	cp $SOURCES_REPOSITORY/$TARBALL $fs/boot
    2.22 +}
     3.1 --- a/linux/receipt	Wed Jan 06 13:13:00 2016 +0100
     3.2 +++ b/linux/receipt	Sun Feb 07 14:42:58 2016 +0100
     3.3 @@ -14,6 +14,7 @@
     3.4  PATCH="https://www.selenic.com/tiny/2.6.14-tiny1.patch.bz2"
     3.5  AUTO_SELECTION="always"
     3.6  
     3.7 +DEPENDS="memtest ipxe"  # bundle may install a boot menu
     3.8  BUILD_DEPENDS="slitaz-toolchain perl git lzma wget gcc2 advancecomp"
     3.9  
    3.10  # Rules to configure and make the package.
    3.11 @@ -46,6 +47,10 @@
    3.12  	grep -q "CONFIG_MODULES=y" .config &&
    3.13  	make ARCH=i386 CC=gcc-2 HOSTCC=gcc-2 -j 4 modules &&
    3.14  	make ARCH=i386 INSTALL_MOD_PATH=$DESTDIR -j 1 modules_install || true
    3.15 +	cc -o bundle.o -Wa,-algms=bundle.lst -c $stuff/bundle.S
    3.16 +	objcopy -O binary bundle.o bundle.bin
    3.17 +	cp $stuff/bundle .
    3.18 +	./bundle
    3.19  }
    3.20  
    3.21  # Rules to gen a SliTaz package suitable for Tazpkg.
    3.22 @@ -57,7 +62,7 @@
    3.23  	cp -a $src/System.map $fs/boot/
    3.24  	cp -a $src/.config $fs/boot/config
    3.25  	cp -a $src/config-busybox $fs/boot
    3.26 -	cp -a $stuff/bundle $fs/boot
    3.27 +	cp -a $src/bundle.sh $fs/boot/bundle
    3.28  }
    3.29  
    3.30  # Pre and post install commands for Tazpkg.
     4.1 --- a/linux/stuff/bundle	Wed Jan 06 13:13:00 2016 +0100
     4.2 +++ b/linux/stuff/bundle	Sun Feb 07 14:42:58 2016 +0100
     4.3 @@ -23,10 +23,52 @@
     4.4  	echo $(( $(get 0x1F1 "$1" 1)*32 +($(get 0x1F4 "$1") +31 +${2:-1})&-${2:-1} ))
     4.5  }
     4.6  
     4.7 -if [ ! -s "$1" ]; then
     4.8 +#install-begin
     4.9 +	cp $0 $0.sh
    4.10 +	gzip -9 < bundle.bin | uuencode -m - | \
    4.11 +		sed -e '/^bundle.bin$/r/dev/stdin' -e '/^bundle.bin*/d' \
    4.12 +		    -e '/install-begin$/,/install-end$/d' -i $0.sh
    4.13 +	chmod +x $0.sh
    4.14 +	exit
    4.15 +#install-end
    4.16 +if [ ! -s "$1" -a -z "$4" ]; then
    4.17 +	p=$(basename "$0")
    4.18  	cat <<EOT
    4.19 -Usage: $0 kernel [initrd] [@]
    4.20 +Usage: $p kernel [initrd] [@]
    4.21 +or: $p menufile "menu title" file1 "menu entry 1" ...
    4.22  EOT
    4.23 +elif [ -n "$4" ]; then
    4.24 +	out="$1"
    4.25 +	uudecode <<EOT | gunzip > "$out"
    4.26 +bundle.bin
    4.27 +EOT
    4.28 +	pos=$(get 0x1F2 "$out")
    4.29 +	[ $(get $(($pos - 3)) "$out") -eq 24937 ] && crc=2 || crc=0
    4.30 +	echo -en "$2\0" | ddq bs=1 of="$out" seek=$pos conv=notrunc
    4.31 +	pos=$(($pos+${#2}+1))
    4.32 +	shift 2
    4.33 +	free=$((0x1F1 - 2 - $pos - $crc))
    4.34 +	p=1
    4.35 +	while [ -n "$2" -a $free -ge ${#2} ]; do
    4.36 +		s=$((($(stat -c "%s" "$1")+511)/512))
    4.37 +		x="$(printf '\\x%02x\\x%02x' $(($p % 256)) $(($p / 256)) )"
    4.38 +		echo -en "$x$2\0" | ddq bs=1 of="$out" seek=$pos conv=notrunc
    4.39 +		p=$(($p+$s))
    4.40 +		pos=$(($pos+2+${#2}+1))
    4.41 +		cat "$1" /dev/zero | ddq bs=512 count=$s >> "$out"
    4.42 +		if [ $crc -ne 0 ]; then
    4.43 +			x=$(cat "$1" /dev/zero | ddq bs=512 count=$s | od -v \
    4.44 +			    -t u2 -w2 -An|awk '{i+=$0} END {print (i % 65536)}')
    4.45 +			x="$(printf '\\x%02x\\x%02x' $(($x % 256)) $(($x / 256)) )"
    4.46 +			echo -en "$x" | ddq bs=1 of="$out" seek=$pos conv=notrunc
    4.47 +			pos=$(($pos+2))
    4.48 +			x="$(printf '\\x%02x\\x%02x' $(($s % 256)) $(($s / 256)) )"
    4.49 +			echo -en "$x" | ddq bs=1 of="$out" seek=$pos conv=notrunc
    4.50 +			pos=$(($pos+2))
    4.51 +		fi
    4.52 +		shift 2
    4.53 +	done
    4.54 +	[ -n "$2" ] && echo "Warning: skip $@" 1>&2 && exit 1
    4.55  elif [ -s "$2" ]; then
    4.56  	base_initrd=$((0x00300000))
    4.57  	size_initrd=$(stat -c %s "$2")
    4.58 @@ -39,14 +81,43 @@
    4.59  	ddq bs=16 seek=$(end "$1" 32) of="$1" if="$2"
    4.60  	ls -l "$1"
    4.61  else
    4.62 -	base_initrd=$(get 0x218 "$1")
    4.63 -	size_initrd=$(get 0x21C "$1")
    4.64 -	[ $base_initrd -ne 0 ] &&
    4.65 -	printf "initrd @%X\n" $base_initrd &&
    4.66 -	ddq bs=1 skip=$(($(end "$1" 32) * 16)) count=$size_initrd \
    4.67 -		if="$1" of=initrd && ls -l initrd
    4.68 -	store 0x218 0 "$1"
    4.69 -	store 0x21C 0 "$1"
    4.70 -	ddq bs=16 count=0 seek=$(end "$1") of="$1"
    4.71 -	ls -l "$1"
    4.72 +	if [ $(get 0x1F1 "$1" 1) -eq 0 ]; then
    4.73 +		menu=$(get 0x1F2 "$1")
    4.74 +		[ $(get $(($menu - 3)) "$1") -eq 24937 ] && skip=4 || skip=0
    4.75 +		ddq bs=1 skip=$menu count=$((0x1F3 - $menu)) if="$1" | \
    4.76 +		od -v -t u1 -w1 -An | awk -vx=$skip 'BEGIN { state=0 }
    4.77 +{
    4.78 +	if (--bytes == 0) state++
    4.79 +	if (state > 3) { state=1; bytes=2; sector=0; mul=1 }
    4.80 +	if (state == 0 || state == 2) {
    4.81 +		if ($1 == 0) {
    4.82 +			if (state == 2) {
    4.83 +				if (sector == 0) exit
    4.84 +				print sector " " s
    4.85 +			}
    4.86 +			s=""; state++; sector=0; mul=1
    4.87 +			bytes= (state == 3) ? x+1 : 3
    4.88 +		}
    4.89 +		else { c=sprintf("%c",$1); s=s c }
    4.90 +	}
    4.91 +	else { sector += $0*mul; mul *= 256 }
    4.92 +}' |		while read s name; do
    4.93 +			cnt=$(get $(($s*512 + 0x1F4)) "$1")
    4.94 +			cnt=$(($cnt+32*(1+$(get $(($s*512 + 0x1F1)) "$1" 1))))
    4.95 +			ddq bs=16 skip=$((32*$s)) count=$cnt if="$1" of="$name"
    4.96 +			ls -l "$name"
    4.97 +		done
    4.98 +	else
    4.99 +		base_initrd=$(get 0x218 "$1")
   4.100 +		size_initrd=$(get 0x21C "$1")
   4.101 +		[ $base_initrd -ne 0 ] &&
   4.102 +		printf "initrd @%X\n" $base_initrd &&
   4.103 +		ddq bs=1 skip=$(($(end "$1" 32) * 16)) count=$size_initrd \
   4.104 +			if="$1" of=initrd && ls -l initrd
   4.105 +		store 0x218 0 "$1"
   4.106 +		store 0x21C 0 "$1"
   4.107 +		ddq bs=16 count=0 seek=$(end "$1") of="$1"
   4.108 +		ls -l "$1"
   4.109 +	fi
   4.110  fi
   4.111 +true
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linux/stuff/bundle.S	Sun Feb 07 14:42:58 2016 +0100
     5.3 @@ -0,0 +1,277 @@
     5.4 +#define TIMEOUT		autostart after 5 seconds
     5.5 +#define CHECK_FILES	add 'Check media' entry
     5.6 +
     5.7 +	.arch	i8086
     5.8 +	.code16
     5.9 +	.org	0
    5.10 +start:
    5.11 +	// stack segment setup
    5.12 +	cld
    5.13 +	movw	$0x9000, %di
    5.14 +	pushw	%di
    5.15 +	popw	%ss
    5.16 +	movw	%di, %sp
    5.17 +
    5.18 +	// patch disk parameter table
    5.19 +	xorw	%ax, %ax
    5.20 +	movw	$0x78, %bx
    5.21 +	movw	%ax, %ds
    5.22 +	ldsw	(%bx), %si	
    5.23 +	pushw	%ss
    5.24 +	popw	%es
    5.25 +	movw	$64/2, %cx
    5.26 +	rep
    5.27 +	 stosw
    5.28 +	movb	$6, %cl
    5.29 +	pushw	%di
    5.30 +	rep
    5.31 +	 movsw
    5.32 +	movb	$63, %es:4-12(%di)
    5.33 +	movw	%cx, %ds
    5.34 +	popw	(%bx)
    5.35 +	movw	%es, 2(%bx)	
    5.36 +
    5.37 +	// data segments setup
    5.38 +	movw	$0x7C0, %ax
    5.39 +	pushw	%ax
    5.40 +	popw	%ds
    5.41 +	pushw	%ds
    5.42 +	popw	%es
    5.43 +
    5.44 +	// main loop
    5.45 +menustart:
    5.46 +	xorw	%bp, %bp
    5.47 +menudown:
    5.48 +	incw	%bp
    5.49 +menustartlp:
    5.50 +	movw	$3, %ax
    5.51 +	int	$0x10		// clear screen
    5.52 +	movb	$1, %ah
    5.53 +	movw	$0x1000, %cx
    5.54 +	int	$0x10		// clear cursor
    5.55 +	movw	$menu, %si
    5.56 +	call	puts
    5.57 +	call	putcr
    5.58 +	movw	%bp, %cx
    5.59 +menulp:
    5.60 +	movb	$' ', %bh
    5.61 +	lodsw
    5.62 +	loop	notcur
    5.63 +	xchgw	%ax, %di
    5.64 +	movb	$'>', %bh
    5.65 +notcur:
    5.66 +	movb	%bh, %al
    5.67 +	call	putcs
    5.68 +#ifdef CHECK_FILES
    5.69 +	lodsw		// CRC16
    5.70 +	lodsw		// sector count
    5.71 +#endif
    5.72 +	cmpw	%bx, (%si)
    5.73 +	jnc	menulp
    5.74 +#ifdef CHECK_FILES
    5.75 +	movw	$msgcrc, %si
    5.76 +	movb	$' ', %al
    5.77 +	loop	notcrc
    5.78 +	movb	$'>', %al
    5.79 +notcrc:
    5.80 +	call	putcs
    5.81 +#endif
    5.82 +menustartz:
    5.83 +#ifdef TIMEOUT
    5.84 +clock	= 0x46C
    5.85 +wait:
    5.86 +wait4key:
    5.87 +	pushw	%ds
    5.88 +	movw	$0, %ax
    5.89 +	movw	%ax, %ds
    5.90 +	movw	$clock, %si
    5.91 +#define DELAY 5
    5.92 +	movb	$257-(DELAY*182)/10, (%si)
    5.93 +waitkbd:
    5.94 +	movw	$0x10D, %ax		// test keyboard, timeout => CR
    5.95 +	cmpb	(%si), %ah
    5.96 +	je	waitdone
    5.97 +	int	$0x16
    5.98 +	jz	waitkbd
    5.99 +	cbw
   5.100 +	int	$0x16			// eat char
   5.101 +	movw	%si, wait4key+0x7C02	// disable timeout
   5.102 +waitdone:
   5.103 +	popw	%ds
   5.104 +#else
   5.105 +	xorb	%ax, %ax
   5.106 +	int	$0x16
   5.107 +#endif
   5.108 +	cmpb	$0x0D, %al	// CR ?
   5.109 +	je	doit
   5.110 +	cmpb	$0x48, %ah	// UP ?
   5.111 +	jne	isitdn
   5.112 +	decw	%bp
   5.113 +	jz	menudown
   5.114 +isitdn:
   5.115 +	incw	%cx
   5.116 +	cmpb	$0x50, %ah	// DN ?
   5.117 +	loope	menudown
   5.118 +	jmp	menustartlp
   5.119 +
   5.120 +	.macro	tochs		// %di -> %cx, %dx & %bp=sector max
   5.121 +	movw	$64, %cx
   5.122 +	movw	$0x200, %bx
   5.123 +sectlp:
   5.124 +	movw	$0x201,	%ax
   5.125 +	movb	%ch, %dh
   5.126 +	decw	%cx
   5.127 +	int	$0x13
   5.128 +	jc	sectlp
   5.129 +	movw	%cx, %bp
   5.130 +	movw	%di, %ax
   5.131 +	div	%cl		// 32 Mb & 255 tracks max
   5.132 +	movb	%ah, %cl	// sector
   5.133 +	incb	%cl
   5.134 +	shrb	$1, %al		// C = head, AL = cylinder
   5.135 +	adcb	%dh, %dh
   5.136 +	movb	%al, %ch
   5.137 +	.endm
   5.138 +
   5.139 +doit:
   5.140 +#ifdef CHECK_FILES
   5.141 +	jcxz	docrc
   5.142 +	call	getsectors
   5.143 +#else
   5.144 +	tochs		// %di -> %cx, %dx & %bp=sector max
   5.145 +#endif
   5.146 +	pushw	%cx
   5.147 +	movw	$0x201,	%ax
   5.148 +	int	$0x13
   5.149 +	popw	%cx
   5.150 +	jc	menustart
   5.151 +
   5.152 +	// scan boot code
   5.153 +	movw	%bx, %di
   5.154 +scanboot:
   5.155 +	incw	%di
   5.156 +	cmpw	$0x5897, -3(%di)	// xchgw %ax, %di; popw	%ax
   5.157 +	jne	scanboot
   5.158 +	cmpw	$0xE841, -1(%di)	// incw %cx ; call ...
   5.159 +	jne	scanboot
   5.160 +	pushw	%ds
   5.161 +	pushw	%di
   5.162 +	movb	0x1F1(%bx), %al		// setup size
   5.163 +	pushw	%ss
   5.164 +	popw	%ds
   5.165 +	pushw	%ss
   5.166 +	popw	%es
   5.167 +	xorw	%di, %di
   5.168 +	xchgw	%ax, %di		// ax = limits = 0
   5.169 +	xorw	%bx, %bx		// to %es:%bx = 9000:0000
   5.170 +	incw	%di			// Add bootsector, Clear Z
   5.171 +	lret				// Read from %dx, %cx
   5.172 +
   5.173 +#ifdef CHECK_FILES
   5.174 +docrc:
   5.175 +	movw	$menu, %si
   5.176 +skiptitle:
   5.177 +	lodsb
   5.178 +	orb	%al, %al
   5.179 +	jnz	skiptitle
   5.180 +nextchk:
   5.181 +	lodsw			// sector offset
   5.182 +	xchgw	%ax, %di
   5.183 +	movw	%di, %cx
   5.184 +	movw	$1, %bp
   5.185 +	jcxz	menustartz
   5.186 +	call	puts		// menu entry
   5.187 +	call	getsectors
   5.188 +	lodsw
   5.189 +	xchgw	%ax, %di	// crc
   5.190 +	movw	$0x201,	%ax
   5.191 +	int	$0x13
   5.192 +	lodsw			// sector count
   5.193 +	pushw	%si
   5.194 +	jc	chkfail
   5.195 +	xchgw	%ax, %si
   5.196 +chksector:
   5.197 +	subw	(%bx), %di
   5.198 +	incw	%bx
   5.199 +	incw	%bx
   5.200 +	cmpb	$4, %bh
   5.201 +	jne	chksector
   5.202 +	movb	$2, %bh
   5.203 +	decw	%si
   5.204 +	je	chkend
   5.205 +	movw	%bp, %ax
   5.206 +	incw	%cx
   5.207 +	cmpb	%al, %cl
   5.208 +	jle	rdit
   5.209 +	movb	$1, %cl
   5.210 +	xorb	%cl, %dh
   5.211 +	jne	rdit
   5.212 +	incb	%ch
   5.213 +rdit:
   5.214 +	movw	$0x201, %ax
   5.215 +	int	$0x13
   5.216 +	jnc	chksector
   5.217 +chkend:
   5.218 +	movw	$msgok, %si
   5.219 +	orw	%di, %di
   5.220 +	je	chkok
   5.221 +chkfail:
   5.222 +	movw	$msgko, %si
   5.223 +chkok:
   5.224 +	call	puts
   5.225 +	popw	%si
   5.226 +	jmp	nextchk
   5.227 +
   5.228 +getsectors:
   5.229 +	tochs		// %di -> %cx, %dx & %bp=sector max
   5.230 +return:
   5.231 +	ret
   5.232 +#endif
   5.233 +
   5.234 +putcr:
   5.235 +	movb	$10, %al
   5.236 +putlf:
   5.237 +	xorb	$10^13, %al
   5.238 +putcs:
   5.239 +	movw	$7, %bx
   5.240 +	movb	$0xE, %ah
   5.241 +	int	$0x10
   5.242 +	cmpb	$13, %al
   5.243 +	jz	putlf
   5.244 +	jc	return
   5.245 +puts:
   5.246 +	lodsb
   5.247 +	orb	%al, %al
   5.248 +	jnz	putcs
   5.249 +	jmp	putcr
   5.250 +#ifndef CHECK_FILES
   5.251 +return:
   5.252 +	ret
   5.253 +#endif
   5.254 +
   5.255 +#ifdef CHECK_FILES
   5.256 +msgok:
   5.257 +	.asciz	" OK"
   5.258 +msgko:
   5.259 +	.asciz	" Broken"
   5.260 +msgcrc:	
   5.261 +	.asciz	"Check media"		// used to detect CHECK_FILES
   5.262 +#endif
   5.263 +menu:
   5.264 +
   5.265 +	.org	0x1F1
   5.266 +setupsz:
   5.267 +	.byte	0
   5.268 +rootflags:
   5.269 +	.word	menu
   5.270 +syssz:
   5.271 +	.long	0	// updated by bundle
   5.272 +ramsize:
   5.273 +	.ascii	"SliTaz"
   5.274 +//	.word	0
   5.275 +//vidmode:
   5.276 +//	.word	0
   5.277 +//rootdev:
   5.278 +//	.word	0
   5.279 +bootflag:
   5.280 +	.word	0xAA55
     6.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     6.2 +++ b/memtest/receipt	Sun Feb 07 14:42:58 2016 +0100
     6.3 @@ -0,0 +1,19 @@
     6.4 +# SliTaz package receipt.
     6.5 +
     6.6 +PACKAGE="memtest"
     6.7 +VERSION="5.01"
     6.8 +CATEGORY="base-system"
     6.9 +SHORT_DESC="Memory failures detection tool."
    6.10 +MAINTAINER="pascal.bellard@slitaz.org"
    6.11 +LICENSE="GPL2"
    6.12 +WEB_SITE="http://www.memtest.org/"
    6.13 +TARBALL="$PACKAGE-$VERSION"
    6.14 +WGET_URL="http://cook.slitaz.org/cooker.cgi?download=../wok/memtest/taz/memtest-$VERSION/fs/boot/memtest"
    6.15 +TARGET="i486"
    6.16 +
    6.17 +# Rules to gen a SliTaz package suitable for Tazpkg.
    6.18 +genpkg_rules()
    6.19 +{
    6.20 +	mkdir -p $fs/boot
    6.21 +	cp $SOURCES_REPOSITORY/$TARBALL $fs/boot
    6.22 +}