tazlito rev 278

tazlito: update syslinux boot patchs for c32box
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri May 04 17:22:04 2012 +0200 (2012-05-04)
parents 773120012431
children ce45f609782c
files tazlito
line diff
     1.1 --- a/tazlito	Sat Apr 14 08:22:55 2012 +0200
     1.2 +++ b/tazlito	Fri May 04 17:22:04 2012 +0200
     1.3 @@ -618,7 +618,7 @@
     1.4       if (i % 2 == 0) printf " slitaz%d",i/2
     1.5       else printf " %s",$i
     1.6  }')"
     1.7 -	cat >> $1/common.cfg <<EOT
     1.8 +	[ -s $1/common.cfg ] && cat >> $1/common.cfg <<EOT
     1.9  
    1.10  label slitaz
    1.11  	kernel /boot/isolinux/ifmem.c32
    1.12 @@ -631,7 +631,11 @@
    1.13  	# Update vesamenu
    1.14  	if [ -s $1/isolinux.cfg ]; then
    1.15  		files="$files $1/isolinux.cfg"
    1.16 -		awk -v n=$(echo $2 | awk '{ print NF/2 }') -v "sel=$sel" '{
    1.17 +		awk -v n=$(echo $2 | awk '{ print NF/2 }') -v "sel=$sel" '
    1.18 +BEGIN {
    1.19 +	kernel="	COM32 c32box.c32"
    1.20 +}
    1.21 +{
    1.22  if (/ROWS/) print "MENU ROW " n+$3;
    1.23  else if (/TIMEOUTROW/) print "MENU TIMEOUTROW " n+$3;
    1.24  else if (/TABMSGROW/) print "MENU TABMSGROW " n+$3;
    1.25 @@ -641,8 +645,11 @@
    1.26  	if (x < 0) x=0;
    1.27  	print "MENU VSHIFT " x;
    1.28  }
    1.29 -else if (/bzImage/) kernel=$0;
    1.30  else if (/rootfs.gz/) {
    1.31 +	linux=""
    1.32 +	if (/bzImage/) {
    1.33 +		linux="linux /boot/bzImage "
    1.34 +	}
    1.35  	i=index($0,"rootfs.gz");
    1.36  	append=substr($0,i+9);
    1.37  	print	"	kernel /boot/isolinux/ifmem.c32"
    1.38 @@ -660,21 +667,18 @@
    1.39  		for (j = n - 1; j >= i; j--) {
    1.40  			initrd=initrd ",/boot/rootfs" j ".gz";
    1.41  		}
    1.42 -		printf "\tappend %s%s\n",initrd,append;
    1.43 +		printf "\tappend %s%s%s\n",linux,initrd,append;
    1.44  		print "";
    1.45  	}
    1.46  }
    1.47 +else if (/bzImage/) kernel=$0;
    1.48  else print;
    1.49  }' < $1/isolinux.cfg > $1/isolinux.cfg.$$
    1.50  		mv $1/isolinux.cfg.$$ $1/isolinux.cfg
    1.51  	fi
    1.52 +	[ -s $1/c32box.c32 ] && sed -i -e '/kernel.*ifmem/d' \
    1.53 +		-e 's/append \([0-9]\)/append ifmem \1/' $1/isolinux.cfg
    1.54  	cat > $1/noram.cfg <<EOT
    1.55 -display isolinux.msg
    1.56 -say Not enough RAM to boot slitaz. Give http://tiny.slitaz.org/ a try ?
    1.57 -default reboot
    1.58 -label reboot
    1.59 -	com32 reboot.c32
    1.60 -
    1.61  implicit 0
    1.62  prompt 1
    1.63  timeout 80
    1.64 @@ -684,11 +688,30 @@
    1.65  F4 display.txt
    1.66  F5 enhelp.txt
    1.67  F6 enopts.txt
    1.68 +
    1.69 +display isolinux.msg
    1.70 +say Not enough RAM to boot slitaz. Give http://tiny.slitaz.org/ a try ?
    1.71 +default reboot
    1.72 +label reboot
    1.73  EOT
    1.74 +	if [ -s $1/c32box.c32 ]; then
    1.75 +		cat >> $1/noram.cfg <<EOT
    1.76 +	COM32 c32box.c32
    1.77 +	append reboot
    1.78 +
    1.79 +label poweroff
    1.80 +	COM32 c32box.c32
    1.81 +	append poweroff
    1.82 +
    1.83 +EOT
    1.84 +	else
    1.85 +		echo "	com32 reboot.c32" >> $1/noram.cfg
    1.86 +	fi
    1.87  	# Restore real label names
    1.88 +	[ -s $1/common.cfg ] && files="$1/common.cfg $files"
    1.89  	echo $2 | awk '{ for (i=NF; i>1; i-=2) printf "%d/%s\n",i/2,$i }' | \
    1.90  	while read pat; do
    1.91 -		sed -i "s/slitaz$pat/" $1/common.cfg $files
    1.92 +		sed -i "s/slitaz$pat/" $files
    1.93  	done
    1.94  	status
    1.95  }
    1.96 @@ -1025,11 +1048,14 @@
    1.97  	local root=${1:-$TMP_DIR/loramiso}
    1.98  	if [ -f $root/boot/isolinux/noram.cfg ]; then
    1.99  		# We keep enough information to do unloram...
   1.100 +		[ -s $root/boot/isolinux/common.cfg ] &&
   1.101  		sed -i 's/label slitaz/label orgslitaz/' \
   1.102  			$root/boot/isolinux/common.cfg
   1.103 +		set -- $(grep 'append ifmem [0-9]' $root/boot/isolinux/isolinux.cfg)
   1.104 +		shift
   1.105  		sed -i '/ifmem/{NNNNNNNNd};/^LABEL/{N;/LABEL SliTaz [^L]/{NNNd}}' \
   1.106  			$root/boot/isolinux/isolinux.cfg
   1.107 -		set -- $(grep 'append [0-9]' $root/boot/isolinux/common.cfg)
   1.108 +		[ -n "$3" ] || set -- $(grep 'append [0-9]' $root/boot/isolinux/common.cfg)
   1.109  		sed -i "s/label $3\$/label slitaz/;s|=/boot/rootfs\(.*\).gz |=/boot/rootfs.gz |" \
   1.110  			$root/boot/isolinux/*.cfg
   1.111  	fi
   1.112 @@ -1081,13 +1107,14 @@
   1.113  # Reduce sizes with rootfs gains.
   1.114  update_metaiso_sizes()
   1.115  {
   1.116 -	for cfg in $(grep -l 'append [0-9]' $TMP_DIR/loramiso/boot/isolinux/*.cfg)
   1.117 +	for cfg in $(grep -El '(append|ifmem) [0-9]' $TMP_DIR/loramiso/boot/isolinux/*.cfg)
   1.118  	do
   1.119 -		local append="$(grep 'append [0-9]' $cfg)"
   1.120 +		local append="$(grep -E '(append|ifmem) [0-9]' $cfg)"
   1.121  		local sizes="$rootfs_sizes"
   1.122  		local new
   1.123  		set -- $append
   1.124  		shift
   1.125 +		[ "$1" == "ifmem" ] && shift
   1.126  		new=""
   1.127  		while [ -n "$2" ]; do
   1.128  			local s
   1.129 @@ -1103,7 +1130,8 @@
   1.130  			new="$new $s $2"
   1.131  			shift 2
   1.132  		done
   1.133 -		sed -i "/append [0-9]/s/append .*/append$new $1/" $cfg 
   1.134 +		sed -i -e "/append [0-9]/s/append .*/append$new $1/" -e \
   1.135 +			"/append ifmem [0-9]/s/append .*/append ifmem$new $1/" $cfg
   1.136  	done
   1.137  }
   1.138  
   1.139 @@ -2423,8 +2451,10 @@
   1.140  			echo "$1 is already a merged iso. Aborting."
   1.141  			cleanup_merge
   1.142  		fi
   1.143 -		if [ ! -f $TMP_DIR/iso/boot/isolinux/ifmem.c32 ]; then
   1.144 -			if [ ! -f /boot/isolinux/ifmem.c32 ]; then
   1.145 +		if [ ! -f $TMP_DIR/iso/boot/isolinux/ifmem.c32 -a
   1.146 +		     ! -f $TMP_DIR/iso/boot/isolinux/c32box.c32 ]; then
   1.147 +			if [ ! -f /boot/isolinux/ifmem.c32 -a
   1.148 +			     ! -f /boot/isolinux/c32box.c32 ]; then
   1.149  				cat <<EOT
   1.150  No file /boot/isolinux/ifmem.c32
   1.151  Please install syslinux package !
   1.152 @@ -2432,6 +2462,7 @@
   1.153  				rm -rf $TMP_DIR
   1.154  				exit 1
   1.155  			fi
   1.156 +			cp /boot/isolinux/c32box.c32 $TMP_DIR/iso/boot/isolinux 2> /dev/null ||
   1.157  			cp /boot/isolinux/ifmem.c32 $TMP_DIR/iso/boot/isolinux
   1.158  		fi
   1.159