wok-6.x rev 18228

linld: add tobzimage
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Jul 23 09:44:18 2015 +0200 (2015-07-23)
parents 7184ec55b1aa
children 19a9e131dc09
files hfsprescue/receipt linld/receipt linld/stuff/load.u linld/stuff/tobzimage linld/stuff/tobzimage.S
line diff
     1.1 --- a/hfsprescue/receipt	Mon Jul 20 08:25:22 2015 +0200
     1.2 +++ b/hfsprescue/receipt	Thu Jul 23 09:44:18 2015 +0200
     1.3 @@ -1,17 +1,16 @@
     1.4  # SliTaz package receipt.
     1.5  
     1.6  PACKAGE="hfsprescue"
     1.7 -VERSION="0.3"
     1.8 +VERSION="1.1"
     1.9  CATEGORY="base-system"
    1.10  SHORT_DESC="HFS+ recovery tool."
    1.11  MAINTAINER="pascal.bellard@slitaz.org"
    1.12  LICENSE="GPL2"
    1.13  TARBALL="$PACKAGE-$VERSION.tar.gz"
    1.14  WEB_SITE="http://www.plop.at/en/hfsprescue.html"
    1.15 -WGET_URL="http://download.plop.at/files/$PACKAGE/$TARBALL"
    1.16 +WGET_URL="http://download.plop.at/$PACKAGE/$TARBALL"
    1.17  
    1.18  DEPENDS="gcc-lib-base"
    1.19 -BUILD_DEPENDS=""
    1.20  
    1.21  # Rules to configure and make the package.
    1.22  compile_rules()
    1.23 @@ -29,4 +28,3 @@
    1.24  	mkdir -p $fs/usr
    1.25  	cp -a $install/usr/bin $fs/usr
    1.26  }
    1.27 -
     2.1 --- a/linld/receipt	Mon Jul 20 08:25:22 2015 +0200
     2.2 +++ b/linld/receipt	Thu Jul 23 09:44:18 2015 +0200
     2.3 @@ -31,9 +31,9 @@
     2.4  # Rules to gen a SliTaz package suitable for Tazpkg.
     2.5  genpkg_rules()
     2.6  {
     2.7 -	mkdir -p $fs/usr/share/boot
     2.8 +	mkdir -p $fs/usr/share/boot $fs/usr/bin
     2.9  	cp $src/LINLD$(echo $VERSION | sed 's/[^0-9]//')/LINLD.COM \
    2.10  		$fs/usr/share/boot/linld.com
    2.11  	cp $stuff/linld.txt $fs/usr/share/boot/
    2.12 +	cp $stuff/tobzimage $fs/usr/bin
    2.13  }
    2.14 -
     3.1 --- a/linld/stuff/load.u	Mon Jul 20 08:25:22 2015 +0200
     3.2 +++ b/linld/stuff/load.u	Thu Jul 23 09:44:18 2015 +0200
     3.3 @@ -6,7 +6,8 @@
     3.4           die("No boot signature (55,AA). It's not a kernel");
     3.5  -    if(first1k->header != HdrS)
     3.6  +    if(first1k->header != HdrS) // starting linux 1.3.73
     3.7 -         die("No 'HdrS' signature (kernel is too old)");
     3.8 +-        die("No 'HdrS' signature (kernel is too old)");
     3.9 ++        die("No 'HdrS' signature (kernel is too old, try /usr/bin/tobzimage)");
    3.10  -    if(first1k->version < 0x202)
    3.11  -        die("Loader protocol version is less than 2.02 (kernel is too old)");
    3.12       if(!(first1k->loadflags & 0x01))
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/linld/stuff/tobzimage	Thu Jul 23 09:44:18 2015 +0200
     4.3 @@ -0,0 +1,71 @@
     4.4 +#!/bin/sh
     4.5 +
     4.6 +[ -s "$1" -a "$2" ] || {
     4.7 +	cat << EOT
     4.8 +Usage: $0 zImage-to-read bzImage-to-create [version-string]
     4.9 +EOT
    4.10 +	exit 1
    4.11 +}
    4.12 +
    4.13 +ddq()
    4.14 +{
    4.15 +	dd "$@" 2> /dev/null
    4.16 +}
    4.17 +
    4.18 +get()
    4.19 +{
    4.20 +	echo $( od -v -j $(($1)) -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} \
    4.21 +		-An $2 2>/dev/null )
    4.22 +}
    4.23 +
    4.24 +store()
    4.25 +{
    4.26 +	n=$3; for i in $(seq 8 8 $1); do
    4.27 +		printf '\\\\x%02X' $(($n & 255))
    4.28 +		n=$(($n >> 8))
    4.29 +	done | xargs echo -en | ddq bs=1 conv=notrunc of=$4 seek=$(($2))
    4.30 +}
    4.31 +
    4.32 +create_bzImage()
    4.33 +{
    4.34 +	ddq bs=512 count=1 of=$1
    4.35 +	# from http://hg.slitaz.org/wok/file/7184ec55b1aa/linux/stuff/linux-header.u
    4.36 +	uudecode <<EOT | ddq of=$1 conv=notrunc
    4.37 +begin-base64 644 -
    4.38 +TVrrIEAAAAACAAAQ//8ACASeAABfAvD/TmV4dCEHDQA/owCeUuiwAZkfoPF9
    4.39 +QA+hxXd4XwZXsQbzpRYfZGaPR3jGRfg/+pdYQejIAL4AAoFMECCAxkQlm+hv
    4.40 +AVuJ5v9IEMdAFAiTgPMIdfOhFQJmix70AWZLZsHrBWZDvwAQOcd1AzWAFolE
    4.41 +G2a/gAAAAGYp+5xzAgHfUFZTMdtoAIAH6GEAW16MwbSHFgfNFVgFAAEQTB+/
    4.42 +gAedd8WITB/GRBwQx0QTgAa0h80Vl80T6gAAIJBaOMF3NGDNE/noeABhUlAo
    4.43 +yHcCsAE5+HICifhQtALNE1pYctyVAdGO6QDXANcp11p0UozplTjBddSIyLEB
    4.44 +MM51zP7FgP1QdcW1AGC+GABT6KoAW+g+AHUVUpjNE7gBAs0TWtDUOmT+depG
    4.45 +SHXm650x0ugAAAYftD+J+cHhCInrzSGSFh+wMRwDtA67BwDNEDwNdPPDv2wE
    4.46 +ZMYFprgNAWQ6JXQKzRZ09JjNFo7nR8PoVgCg0QJAvoAAigxG86SXgHz/P77g
    4.47 +AnQyDwHgJAF1K45fLEM5D3X7jVcEtD3NIXInleiM/4AGoAA9uwICOV8EcgXH
    4.48 +RyeeCR5qTMsDdA6wDeiH/6w8AH/4w16/xp1oAJAXifwWBzHAuTsA86pPW1bD
    4.49 +AA==
    4.50 +====
    4.51 +EOT
    4.52 +	# from tobzimage.S
    4.53 +	uudecode <<EOT | gunzip >> $1
    4.54 +begin-base64 644 -
    4.55 +H4sIACpPrlUCA3ut4pFSFMzAxAACAg0MDIwMQEKAARXM+cOXxZAgx76vhsnw
    4.56 +P1v40qX7GZg6n+7kZMhiePRnB+PkmQGBQYELxJiA1EYOkFh36JfOZzsZGra0
    4.57 +nxX97yLy30Wm4Z1A+ZvON/sYWAxP/vP92JX78fTnpYnnqzxzE9NTFQz0DBlG
    4.58 +wQAAAJkasY8AAgAA
    4.59 +====
    4.60 +EOT
    4.61 +	if [ "$2" ]; then
    4.62 +		s="$2"
    4.63 +		[ -s "$2" ] && s="$(cat "$2")"
    4.64 +		echo -e "\n$2" | tr '\n' '\r' | cat - /dev/zero | \
    4.65 +		dd conv=notrunc of=$1 bs=1 seek=640 count=383
    4.66 +	fi
    4.67 +	setupsz=$(get 497 $1 1)
    4.68 +	[ $setupsz -eq 0 ] && setupsz=4
    4.69 +	ddq bs=512 count=$setupsz >> $1
    4.70 +	store 8 497 $(($setupsz+1)) $1
    4.71 +	ddq >> $1
    4.72 +}
    4.73 +
    4.74 +create_bzImage $2 "$3" < $1
     5.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     5.2 +++ b/linld/stuff/tobzimage.S	Thu Jul 23 09:44:18 2015 +0200
     5.3 @@ -0,0 +1,78 @@
     5.4 +	.code16
     5.5 +	.org	0
     5.6 +
     5.7 +	jmp	start
     5.8 +	.ascii	"HdrS"
     5.9 +	.word	0x200		# version
    5.10 +	.long	0		# realmode_swtch
    5.11 +	.word	0x1000		# start_sys_seg
    5.12 +	.word	kernel_version
    5.13 +	.byte	0		# type of loader
    5.14 +	.byte	1		# loadflags
    5.15 +	.word	0x8000		# setup_move_size
    5.16 +	.long	0x100000	# code32_start
    5.17 + 	.long	0		# ramdisk_image
    5.18 +	.long	0		# ramdisk_size
    5.19 +	.long 	0		# bootsect_kludge
    5.20 +	.word	0		# heap_end_ptr	2.01+, patched by bootloader
    5.21 +start:
    5.22 +	pushf
    5.23 +	cld
    5.24 +	pushw	%cs
    5.25 +	pushw	$0
    5.26 +	pushaw
    5.27 +	pushw	%ds
    5.28 +	popw	%es
    5.29 +	movw	$mover+0x200, %si
    5.30 +	xorw	%di, %di
    5.31 +	pushw	%es
    5.32 +	pushw	%di
    5.33 +	movsw
    5.34 +	movsw
    5.35 +	movw	$0x200, %di
    5.36 +	movw	%sp, %bp
    5.37 +	movw	$9, %cx
    5.38 +z1:
    5.39 +	pushw	$0
    5.40 +	loop	z1
    5.41 +	movw	$0x9301, %ax
    5.42 +	cwd			# %dx = -1
    5.43 +	pushw	%ax
    5.44 +	pushw	%cx
    5.45 +	pushw	%dx
    5.46 +	pushw	%cx
    5.47 +	movb	0x216, %al
    5.48 +	pushw	%ax
    5.49 +	pushw	%cx
    5.50 +	pushw	%dx
    5.51 +	movb	$8, %cl
    5.52 +z2:
    5.53 +	pushw	$0
    5.54 +	loop	z2
    5.55 +	movw	-12(%di), %dx
    5.56 +mvlp:
    5.57 +	movw	%sp, %si
    5.58 +	movw	$0x8000, %cx
    5.59 +	movb	$0x87, %ah
    5.60 +	int	$0x15
    5.61 +	incw	20(%si)
    5.62 +	incw	28(%si)
    5.63 +	subb	$0x10, %dh
    5.64 +	ja	mvlp
    5.65 +	movw	%bp, %sp
    5.66 +	movw	$0x400, %si
    5.67 +	xorw	%cx, %cx
    5.68 +	decb	-15(%di)
    5.69 +	movb	-15(%di), %ch
    5.70 +	lret
    5.71 +mover:
    5.72 +	rep
    5.73 +	  movsw
    5.74 +	popaw
    5.75 +	iret
    5.76 +moverend:
    5.77 +kernel_version:
    5.78 +	.asciz	"zImage"
    5.79 +	.org	512
    5.80 +oldsetup:
    5.81 +