# HG changeset patch
# User Pascal Bellard
# Date 1368116168 -7200
# Node ID e6e4be1b259123f54abfbad28da83e6e99d418c9
# Parent 28c1b40cf593b5d90a834dd8c045d73863576bb4
mirror/floppies: updates from web site, add loram for 1.0 & 2.0
diff -r 28c1b40cf593 -r e6e4be1b2591 mirror/floppies/4.0/description.html
--- a/mirror/floppies/4.0/description.html Wed May 01 10:50:21 2013 +0200
+++ b/mirror/floppies/4.0/description.html Thu May 09 18:16:08 2013 +0200
@@ -3,7 +3,7 @@
-
- base needs 48Mb of RAM and 7 floppies: fd001.img to fd006.img.
+ base needs 48Mb of RAM and 6 floppies: fd001.img to fd006.img.
base provides the minimum slitaz distribution subset in text mode.
-
diff -r 28c1b40cf593 -r e6e4be1b2591 mirror/floppies/builder/bootloader
--- a/mirror/floppies/builder/bootloader Wed May 01 10:50:21 2013 +0200
+++ b/mirror/floppies/builder/bootloader Thu May 09 18:16:08 2013 +0200
@@ -9,187 +9,274 @@
usage()
{
cat < /dev/null; }
+
+patch()
{
- echo $(( $2 + 0x10000 )) | \
- awk '{ printf "\\\\x%02X\\\\x%02X",$1%256,($1/256)%256 }' | \
- xargs echo -en | \
- dd bs=2 conv=notrunc of=$3 seek=$(( $1 / 2 )) 2> /dev/null
- [ -n "$DEBUG" ] && printf "store16(%04X) = %04X\n" $1 $2 1>&2
+ echo -en $(echo ":$2" | sed 's/:/\\x/g') | \
+ ddq bs=1 conv=notrunc of=$3 seek=$((0x$1))
+ [ -n "$DEBUG" ] && echo "patch $1 $2 $4" 1>&2
}
-# write a 32 bits data
-# usage: storelong offset data32 file
-storelong()
+# usage: store bits offset data file
+store()
{
- echo $2 | awk '{ printf "\\\\x%02X\\\\x%02X\\\\x%02X\\\\x%02X",
- $1%256,($1/256)%256,($1/256/256)%256,($1/256/256/256)%256 }' | \
- xargs echo -en | \
- dd bs=4 conv=notrunc of=$3 seek=$(( $1 / 4 )) 2> /dev/null
- [ -n "$DEBUG" ] && printf "storelong(%04X) = %08X\n" $1 $2 1>&2
+ 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))
+ [ -n "$DEBUG" ] && printf "store%d(%03X) = %0$(($1/4))X %s\n" $1 $2 $3 "$5" 1>&2
}
-# read a 32 bits data
# usage: getlong offset file
getlong()
{
- dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
- hexdump -e '"" 1/4 "%d" "\n"'
+ ddq if=$2 bs=1 skip=$(($1)) count=4 | hexdump -e '"" 1/4 "%d" "\n"'
+}
+
+error()
+{
+ echo $@ 1>&2
+ rm -f $bs
+ exit 1
}
floppyset()
{
# bzImage offsets
- CylinderCount=496
SetupSzOfs=497
FlagsOfs=498
- SyssizeOfs=500
VideoModeOfs=506
RootDevOfs=508
- CodeAdrOfs=0x214
+ Magic=0x202
RamfsAdrOfs=0x218
RamfsLenOfs=0x21C
- ArgPtrOfs=0x228
# boot+setup address
SetupBase=0x90000
- stacktop=0x9E00
-
bs=/tmp/bs$$
# Get and patch boot sector
- # See http://hg.slitaz.org/wok/raw-file/711d076b277c/linux/stuff/linux-header-2.6.34.u
- dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
- uudecode < /dev/null
+ # See http://hg.slitaz.org/wok/raw-file/66e38bd6a132/linux/stuff/linux-header.u
+ [ -n "$DEBUG" ] && echo "Read bootsector..." 1>&2
+ ddq if=$KERNEL bs=512 count=1 of=$bs
+
+ [ $(( $(getlong 0x1FE $bs) & 0xFFFF )) -eq 43605 ] ||
+ error "Not bootable"
+
+ uudecode <&2
+ ddq if=$KERNEL bs=512 skip=1 count=$setupsz >> $bs
- # Get setup
- setupsz=$(getlong $SetupSzOfs $bs)
- setupszb=$(( $setupsz & 255 ))
- dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
+ Version=$(( $(getlong 0x206 $bs) & 0xFFFF ))
+ [ $(getlong $Magic $bs) -ne 1400005704 ] && Version=0
+ feature=""
+ while read prot kern info ; do
+ [ $Version -lt $((0x$prot)) ] && continue
+ feature="features $prot starting from kernel $kern "
+ done <&2
+
+ # Old kernels need bootsector patches to disable rescent features
+ while read minversion maxversion offset bytes rem; do
+ [ $Version -gt $(( 0x$maxversion )) ] && continue
+ [ $Version -lt $(( 0x$minversion )) ] && continue
+ patch $offset $bytes $bs "$rem"
+ done < /dev/null)
+ store 16 $RootDevOfs $RDEV $bs RDEV
- if [ -n "$TRACKS" ]; then
- [ -n "$DEBUG" ] && echo -n "--tracks " 1>&2
- n=$(getlong $CylinderCount $bs)
- store16 $CylinderCount $(( ($n & -256) + $TRACKS )) $bs
- fi
- if [ -n "$FLAGS" ]; then
- [ -n "$DEBUG" ] && echo -n "--flags " 1>&2
- store16 $FlagsOfs $FLAGS $bs
- fi
- if [ -n "$VIDEO" ]; then
- [ -n "$DEBUG" ] && echo -n "--video " 1>&2
- store16 $VideoModeOfs $VIDEO $bs
- fi
- if [ -n "$RDEV" ]; then
- if [ "$(dirname $RDEV)" == "/dev" -a -b $RDEV ]; then
- [ -n "$DEBUG" ] && echo -n "--rdev " 1>&2
- RDEV=$(stat -c '0x%02t%02T' $RDEV 2> /dev/null)
- store16 $RootDevOfs $RDEV $bs
+ [ $FORMAT -lt 1440 ] && store 8 0xEF 16 $bs 1.2M
+ [ $FORMAT -lt 1200 ] && store 8 0xEF 10 $bs 720K
+ [ $FORMAT -lt 720 ] && store 8 0x171 40 $bs 360K
+ [ $FORMAT -lt 360 ] && store 8 0xEF 9 $bs 320K
+ [ $FORMAT -lt 320 ] && store 8 0xF8 2 $bs 160K
+
+ # Info text after setup
+ if [ -s "$INFOFILE" ]; then
+ patch 048 9a:00:00:00:90 $bs lcall displayinfo
+ uudecode >$bs.infotext <>$bs.infotext
+ if [ $Version -lt 514 ]; then
+ store 16 0x050 0x0022 $bs.infotext
fi
+ ddq if=/dev/zero bs=512 count=1 >>$bs.infotext
+ n=$(($(stat -c %s $bs.infotext)/512))
+ ddq if=$bs.infotext count=$n bs=512 >> $bs
+ rm -f $bs.infotext
+ store 8 0x1F1 $(($setupsz+$n)) $bs update setup size
+ store 8 0x04A $((2+2*$setupsz)) $bs update displayinfo call
fi
- # Store cmdline after setup
+ # Store cmdline after setup for kernels >= 0.99
if [ -n "$CMDLINE" ]; then
- [ -n "$DEBUG" ] && echo -n "--cmdline '$CMDLINE' " 1>&2
- echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
- storelong $ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
+ echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> $bs
+ CmdlineOfs=0x9E00 # Should be in 0x8000 .. 0xA000
+ ArgPtrOfs=0x228
+ ArgPtrVal=$(( $SetupBase + $CmdlineOfs ))
+ if [ $Version -lt 514 ]; then
+ ArgPtrOfs=0x0020
+ ArgPtrVal=$(( 0xA33F + ($CmdlineOfs << 16) ))
+ fi
+ store 32 $ArgPtrOfs $ArgPtrVal $bs "Cmdline '$CMDLINE'"
fi
- # Compute initramfs size
+ # Compute initramfs size (protocol >= 2.00)
+ [ $Version -lt 512 ] && INITRD=""
initrdlen=0
+INITRDPAD=4
+INITRDALIGN=0x1000
for i in $( echo $INITRD | sed 's/,/ /' ); do
[ -s "$i" ] || continue
- [ -n "$DEBUG" ] && echo "--initrd $i " 1>&2
- initrdlen=$(( ($initrdlen + $(stat -c %s $i) + 3) & -4 ))
+ while [ -L "$i" ]; do i="$(readlink $i)"; done
+ size=$(( ($(stat -c %s "$i") + $INITRDPAD - 1) & -$INITRDPAD ))
+ [ -n "$DEBUG" ] && echo "initrd $i $size " 1>&2
+ initrdlen=$(( $initrdlen + $size ))
+ [ -n "$ADRSRD" ] || ADRSRD=$(( (($MEM * 0x100000) - $initrdlen) & -$INITRDALIGN ))
+ store 32 $RamfsAdrOfs $(( $ADRSRD )) $bs initrd adrs
+ store 32 $RamfsLenOfs $initrdlen $bs initrdlen
done
- if [ $initrdlen -ne 0 ]; then
- [ -n "$DEBUG" ] && echo "initrdlen = $initrdlen " 1>&2
- storelong $RamfsAdrOfs \
- $(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
- storelong $RamfsLenOfs $initrdlen $bs
- fi
+
+ [ -n "$NOSYSSIZEFIX" ] || store 32 0x1F4 \
+ $(( ($(stat -c %s $KERNEL)+15)/16 - ($setupsz+1)*32)) $bs fix system size
# Output boot sector + setup + cmdline
- dd if=$bs 2> /dev/null
+ ddq if=$bs
# Output kernel code
- dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
-
- # Pad to next sector
- Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
- [ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
+ syssz=$(( ($(getlong 0x1F4 $bs)+31)/32 ))
+ cat $KERNEL /dev/zero | ddq bs=512 skip=$(( $setupsz+1 )) count=$syssz conv=sync
# Output initramfs
- padding=0
for i in $( echo $INITRD | sed 's/,/ /' ); do
[ -s "$i" ] || continue
- [ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding 2> /dev/null
- dd if=$i 2> /dev/null
- padding=$(( 4 - ($(stat -c %s $i) & 3) ))
- [ $padding -eq 4 ] && padding=0
+ ddq if=$i
+ padding=$(( $INITRDPAD - ($(stat -c %s $i) % $INITRDPAD) ))
+ [ $padding -eq $INITRDPAD ] || ddq if=/dev/zero bs=1 count=$padding
done
# Cleanup
@@ -199,14 +286,14 @@
if [ "$FORMAT" == "0" ]; then # unsplitted
floppyset > $PREFIX
PAD=$(( 512 - ($(stat -c %s $PREFIX) % 512) ))
- [ $PAD -ne 512 ] && dd if=/dev/zero bs=1 count=$PAD >> $PREFIX 2> /dev/null
+ [ $PAD -ne 512 ] && ddq if=/dev/zero bs=1 count=$PAD >> $PREFIX
exit
fi
floppyset | split -b ${FORMAT}k /dev/stdin floppy$$
i=1
-ls floppy$$* | while read file ; do
+ls floppy$$* 2> /dev/null | while read file ; do
output=$PREFIX$(printf "%03d" $i)
- cat $file /dev/zero | dd bs=1k count=$FORMAT conv=sync of=$output 2> /dev/null
+ cat $file /dev/zero | ddq bs=1k count=$FORMAT conv=sync of=$output
echo $output
rm -f $file
i=$(( $i + 1 ))
diff -r 28c1b40cf593 -r e6e4be1b2591 mirror/floppies/builder/index.html
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/mirror/floppies/builder/index.html Thu May 09 18:16:08 2013 +0200
@@ -0,0 +1,1 @@
+index.php
\ No newline at end of file
diff -r 28c1b40cf593 -r e6e4be1b2591 mirror/floppies/builder/index.php
--- a/mirror/floppies/builder/index.php Wed May 01 10:50:21 2013 +0200
+++ b/mirror/floppies/builder/index.php Thu May 09 18:16:08 2013 +0200
@@ -12,6 +12,7 @@
+