# HG changeset patch # User Pascal Bellard # Date 1437637458 -7200 # Node ID df58e6c974a371acf0f26f85d82cf7e436010bac # Parent 7184ec55b1aa9da8e38c9b25a4b802e3876590eb linld: add tobzimage diff -r 7184ec55b1aa -r df58e6c974a3 hfsprescue/receipt --- a/hfsprescue/receipt Mon Jul 20 08:25:22 2015 +0200 +++ b/hfsprescue/receipt Thu Jul 23 09:44:18 2015 +0200 @@ -1,17 +1,16 @@ # SliTaz package receipt. PACKAGE="hfsprescue" -VERSION="0.3" +VERSION="1.1" CATEGORY="base-system" SHORT_DESC="HFS+ recovery tool." MAINTAINER="pascal.bellard@slitaz.org" LICENSE="GPL2" TARBALL="$PACKAGE-$VERSION.tar.gz" WEB_SITE="http://www.plop.at/en/hfsprescue.html" -WGET_URL="http://download.plop.at/files/$PACKAGE/$TARBALL" +WGET_URL="http://download.plop.at/$PACKAGE/$TARBALL" DEPENDS="gcc-lib-base" -BUILD_DEPENDS="" # Rules to configure and make the package. compile_rules() @@ -29,4 +28,3 @@ mkdir -p $fs/usr cp -a $install/usr/bin $fs/usr } - diff -r 7184ec55b1aa -r df58e6c974a3 linld/receipt --- a/linld/receipt Mon Jul 20 08:25:22 2015 +0200 +++ b/linld/receipt Thu Jul 23 09:44:18 2015 +0200 @@ -31,9 +31,9 @@ # Rules to gen a SliTaz package suitable for Tazpkg. genpkg_rules() { - mkdir -p $fs/usr/share/boot + mkdir -p $fs/usr/share/boot $fs/usr/bin cp $src/LINLD$(echo $VERSION | sed 's/[^0-9]//')/LINLD.COM \ $fs/usr/share/boot/linld.com cp $stuff/linld.txt $fs/usr/share/boot/ + cp $stuff/tobzimage $fs/usr/bin } - diff -r 7184ec55b1aa -r df58e6c974a3 linld/stuff/load.u --- a/linld/stuff/load.u Mon Jul 20 08:25:22 2015 +0200 +++ b/linld/stuff/load.u Thu Jul 23 09:44:18 2015 +0200 @@ -6,7 +6,8 @@ die("No boot signature (55,AA). It's not a kernel"); - if(first1k->header != HdrS) + if(first1k->header != HdrS) // starting linux 1.3.73 - die("No 'HdrS' signature (kernel is too old)"); +- die("No 'HdrS' signature (kernel is too old)"); ++ die("No 'HdrS' signature (kernel is too old, try /usr/bin/tobzimage)"); - if(first1k->version < 0x202) - die("Loader protocol version is less than 2.02 (kernel is too old)"); if(!(first1k->loadflags & 0x01)) diff -r 7184ec55b1aa -r df58e6c974a3 linld/stuff/tobzimage --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linld/stuff/tobzimage Thu Jul 23 09:44:18 2015 +0200 @@ -0,0 +1,71 @@ +#!/bin/sh + +[ -s "$1" -a "$2" ] || { + cat << EOT +Usage: $0 zImage-to-read bzImage-to-create [version-string] +EOT + exit 1 +} + +ddq() +{ + dd "$@" 2> /dev/null +} + +get() +{ + echo $( od -v -j $(($1)) -N ${4:-${3:-2}} -t u${3:-2} -w${3:-2} \ + -An $2 2>/dev/null ) +} + +store() +{ + n=$3; for i in $(seq 8 8 $1); do + printf '\\\\x%02X' $(($n & 255)) + n=$(($n >> 8)) + done | xargs echo -en | ddq bs=1 conv=notrunc of=$4 seek=$(($2)) +} + +create_bzImage() +{ + ddq bs=512 count=1 of=$1 + # from http://hg.slitaz.org/wok/file/7184ec55b1aa/linux/stuff/linux-header.u + uudecode <> $1 +begin-base64 644 - +H4sIACpPrlUCA3ut4pFSFMzAxAACAg0MDIwMQEKAARXM+cOXxZAgx76vhsnw +P1v40qX7GZg6n+7kZMhiePRnB+PkmQGBQYELxJiA1EYOkFh36JfOZzsZGra0 +nxX97yLy30Wm4Z1A+ZvON/sYWAxP/vP92JX78fTnpYnnqzxzE9NTFQz0DBlG +wQAAAJkasY8AAgAA +==== +EOT + if [ "$2" ]; then + s="$2" + [ -s "$2" ] && s="$(cat "$2")" + echo -e "\n$2" | tr '\n' '\r' | cat - /dev/zero | \ + dd conv=notrunc of=$1 bs=1 seek=640 count=383 + fi + setupsz=$(get 497 $1 1) + [ $setupsz -eq 0 ] && setupsz=4 + ddq bs=512 count=$setupsz >> $1 + store 8 497 $(($setupsz+1)) $1 + ddq >> $1 +} + +create_bzImage $2 "$3" < $1 diff -r 7184ec55b1aa -r df58e6c974a3 linld/stuff/tobzimage.S --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/linld/stuff/tobzimage.S Thu Jul 23 09:44:18 2015 +0200 @@ -0,0 +1,78 @@ + .code16 + .org 0 + + jmp start + .ascii "HdrS" + .word 0x200 # version + .long 0 # realmode_swtch + .word 0x1000 # start_sys_seg + .word kernel_version + .byte 0 # type of loader + .byte 1 # loadflags + .word 0x8000 # setup_move_size + .long 0x100000 # code32_start + .long 0 # ramdisk_image + .long 0 # ramdisk_size + .long 0 # bootsect_kludge + .word 0 # heap_end_ptr 2.01+, patched by bootloader +start: + pushf + cld + pushw %cs + pushw $0 + pushaw + pushw %ds + popw %es + movw $mover+0x200, %si + xorw %di, %di + pushw %es + pushw %di + movsw + movsw + movw $0x200, %di + movw %sp, %bp + movw $9, %cx +z1: + pushw $0 + loop z1 + movw $0x9301, %ax + cwd # %dx = -1 + pushw %ax + pushw %cx + pushw %dx + pushw %cx + movb 0x216, %al + pushw %ax + pushw %cx + pushw %dx + movb $8, %cl +z2: + pushw $0 + loop z2 + movw -12(%di), %dx +mvlp: + movw %sp, %si + movw $0x8000, %cx + movb $0x87, %ah + int $0x15 + incw 20(%si) + incw 28(%si) + subb $0x10, %dh + ja mvlp + movw %bp, %sp + movw $0x400, %si + xorw %cx, %cx + decb -15(%di) + movb -15(%di), %ch + lret +mover: + rep + movsw + popaw + iret +moverend: +kernel_version: + .asciz "zImage" + .org 512 +oldsetup: +