wok rev 12826

linux: bootloader.sh may insert doc files in boot floppies
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue May 22 13:40:58 2012 +0200 (2012-05-22)
parents 082d59f85261
children 95ccd5458dbc
files linux/stuff/bootloader.sh
line diff
     1.1 --- a/linux/stuff/bootloader.sh	Tue May 22 13:16:18 2012 +0200
     1.2 +++ b/linux/stuff/bootloader.sh	Tue May 22 13:40:58 2012 +0200
     1.3 @@ -9,7 +9,7 @@
     1.4  usage()
     1.5  {
     1.6  cat <<EOT
     1.7 -Usage: $0 bzImage [--prefix image_prefix]
     1.8 +Usage: $0 bzImage [--prefix image_prefix] [--info file ]
     1.9         [--format 1200|1440|1680|1920|2880|... ] [--mem mb]
    1.10         [--rdev device] [--video mode] [--flags rootflags] [--tracks cnt]
    1.11         [--cmdline 'args'] [--dont-edit-cmdline] [--no-syssize-fix]
    1.12 @@ -36,10 +36,12 @@
    1.13  MEM="16"
    1.14  NOEDIT=""
    1.15  NOSYSSIZEFIX=""
    1.16 +INFOFILE=""
    1.17  DEBUG=""
    1.18  while [ -n "$1" ]; do
    1.19  	case "${1/--/-}" in
    1.20  	-c*) CMDLINE="$2"; shift;;
    1.21 +	-inf*) INFOFILE="$2"; shift;;
    1.22  	-i*) INITRD="$INITRD $2"; shift;;
    1.23  	-a*) ADRSRD="$2"; shift;;
    1.24  	-h*) HEAP="$2"; shift;;
    1.25 @@ -169,13 +171,13 @@
    1.26  	done <<EOT
    1.27  000 1FF 08D	B8:00:01			force zImage (movw \$0x100, %ax)
    1.28  000 1FF 0CB	EB:0B				skip initrd code 
    1.29 -000 201	01E	EB:1E:00:00:00:00		room for the cmdline magic
    1.30 -000 201	036	BE:00:00:E8:76:01:EB:0A:06:57:B1:06:F3:A5:EB:DE	code in cmdline magic moved
    1.31 +000 201 01E	EB:1E:00:00:00:00		room for the cmdline magic
    1.32 +000 201 036	BE:00:00:E8:76:01:EB:0A:06:57:B1:06:F3:A5:EB:DE	code in cmdline magic moved
    1.33  000 1FF 039	90:90:90			no kernel version
    1.34  000 201 04B	22:00				old cmdline ptr 1
    1.35  000 201 06D	22:00				old cmdline ptr 2
    1.36  000 203 1F6	00:00 				syssize32
    1.37 -200 FFF	210	FF				type_of_loader=FF
    1.38 +200 FFF 210	FF				type_of_loader=FF
    1.39  201 FFF 224	00:9B				heap_end_ptr
    1.40  EOT
    1.41  	if [ $Version -lt 514 ]; then
    1.42 @@ -203,6 +205,27 @@
    1.43  	[ -b "$RDEV" ] && RDEV=$(stat -c '0x%02t%02T' $RDEV 2> /dev/null)
    1.44  	store 16 $RootDevOfs $RDEV $bs RDEV
    1.45  	
    1.46 +	# Info text after setup
    1.47 +	if [ -s "$INFOFILE" ]; then
    1.48 +		patch	048	9a:00:00:00:90	$bs	lcall displayinfo
    1.49 +		uudecode >$bs.infotext <<EOT
    1.50 +begin-base64 644 -
    1.51 +MdsGYI7D6AAAXoHGSgCJ8MHoCUii8QGwDbQOuwcAzRCsPAx1I79sBLFbJgIN
    1.52 +uBsBJjoNdAnNFnT0mM0Wjsc8IHPjPBt0BuvPCMB1zWEHCx4oAss=
    1.53 +====
    1.54 +EOT
    1.55 +		cat "$INFOFILE" >>$bs.infotext
    1.56 +		if [ $Version -lt 514 ]; then
    1.57 +			store 16 0x050 0x0022 $bs.infotext 
    1.58 +		fi
    1.59 +		ddq if=/dev/zero bs=512 count=1 >>$bs.infotext
    1.60 +		n=$(($(stat -c %s $bs.infotext)/512))
    1.61 +		ddq if=$bs.infotext count=$n bs=512 >> $bs
    1.62 +		rm -f $bs.infotext
    1.63 +		store 8 0x1F1  $(($setupsz+$n))	 $bs	update setup size
    1.64 +		store 8 0x04A  $((2+2*$setupsz)) $bs	update displayinfo call
    1.65 +	fi
    1.66 +
    1.67  	# Store cmdline after setup
    1.68  	if [ -n "$CMDLINE" ]; then
    1.69  		echo -n "$CMDLINE" | ddq bs=512 count=1 conv=sync >> $bs
    1.70 @@ -240,7 +263,7 @@
    1.71  
    1.72  	# Output kernel code
    1.73  	syssz=$(( ($(getlong 0x1F4 $bs)+31)/32 ))
    1.74 -	cat $KERNEL /dev/zero | ddq bs=512 skip=$(( $setupsz+1 )) count=$syssz
    1.75 +	cat $KERNEL /dev/zero | ddq bs=512 skip=$(( $setupsz+1 )) count=$syssz conv=sync
    1.76  
    1.77  	# Output initramfs
    1.78  	for i in $( echo $INITRD | sed 's/,/ /' ); do