# HG changeset patch # User Pascal Bellard # Date 1345356396 -7200 # Node ID 18d1dc85701e12d509eb460bb9be597ccdb5cbf4 # Parent 4cba4433d0b782aa377ec43440c6fc9c8a45bb45 memtest: compression (-76K) diff -r 4cba4433d0b7 -r 18d1dc85701e memtest/receipt --- a/memtest/receipt Fri Aug 17 15:30:50 2012 +0000 +++ b/memtest/receipt Sun Aug 19 08:06:36 2012 +0200 @@ -10,17 +10,24 @@ WEB_SITE="http://www.memtest.org/" WGET_URL="${WEB_SITE}download/$VERSION/$TARBALL" +BUILD_DEPENDS="lz4" + # Rules to configure and make the package. compile_rules() { cd $src make + cp $stuff/*.S $stuff/pack . + cc -o unpack.o -Wa,-a=unpack.lst -c unpack.S + objcopy -O binary unpack.o unpack.bin + ./pack --build unpack.bin + ./pack memtest.bin memtest.packed } # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/boot - cp $src/memtest.bin $fs/boot/memtest + mkdir -p $fs/boot + cp $src/memtest.packed $fs/boot/memtest } diff -r 4cba4433d0b7 -r 18d1dc85701e memtest/stuff/pack --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/memtest/stuff/pack Sun Aug 19 08:06:36 2012 +0200 @@ -0,0 +1,41 @@ +#!/bin/sh +if [ "$1" == "--build" ]; then + cat >> $0 <> 8)) + done | xargs echo -en | dd conv=notrunc bs=1 of=$2 seek=$3 +} + +setup="$(dd bs=1 count=1 if=$1 skip=497 | hexdump -e '"" 1/1 "%d" "\n"')" +syssize="$(dd bs=1 count=2 if=$1 skip=500 | hexdump -e '"" 1/2 "%d" "\n"')" + +compress() +{ + lz4demo -c1 stdin stdout + echo -en "\x00\x00\x00\x00" +} + +main() +{ + dd if=$1 bs=512 count=1 >$2 + uudecode | gunzip >>$2 + dd if=$1 bs=512 count=$setup skip=1 | compress >>$2 + dd if=$1 bs=16 count=$syssize skip=$((32*(1+$setup))) | compress >>$2 + size=$(stat -c %s $2) + store $((($size-512)/16)) $2 520 2 + store $((($size-2560)/16)) $2 500 2 + store 4 $2 497 1 +} + +main $1 $2 2>/dev/null <