slitaz-arm rev 199

tazbian, piboot: misc fixes
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Nov 18 10:50:30 2014 +0100 (2014-11-18)
parents c0c88b71a4b4
children f52ce3fe729d
files rpi/piboot rpi/tazbian
line diff
     1.1 --- a/rpi/piboot	Sun Nov 16 23:04:39 2014 +0100
     1.2 +++ b/rpi/piboot	Tue Nov 18 10:50:30 2014 +0100
     1.3 @@ -12,7 +12,7 @@
     1.4  
     1.5  # Check for depends ...
     1.6  LOG=/var/log/$(basename $0).log
     1.7 -mv -f $LOG $LOG.0 >/dev/null
     1.8 +mv -f $LOG $LOG.0 2>/dev/null
     1.9  while read file pkg ; do
    1.10  	[ "$(which $file)" ] && continue
    1.11  	echo "Can't find $file. Please install $pkg." >> $LOG
    1.12 @@ -122,7 +122,7 @@
    1.13  	[ "$webpath" ] || webpath=http://mirror.slitaz.org/pxe/arm/boot.php
    1.14  	for url in ${webpath//,/ }; do
    1.15  		wget -O /root/webboot.sh \
    1.16 -		  $url?mac=$(cat /sys/class/net/eth0/address) 2>&1 > /dev/null
    1.17 +		  "$url?mac=$(cat /sys/class/net/eth0/address)" 2>&1 > /dev/null
    1.18  		[ -s /root/webboot.sh ] || continue
    1.19  		. /root/webboot.sh
    1.20  		webprefix=$(dirname $url)
    1.21 @@ -139,7 +139,7 @@
    1.22  			echo "Can't find aria2." >> $LOG &&
    1.23  			exec /init
    1.24  
    1.25 -		wget -O /root/webboot.torrent $1
    1.26 +		wget -O /root/webboot.torrent "$1"
    1.27  		aria2c --enable-dht=false --disable-ipv6=true --seed-time=0 \
    1.28  			--file-allocation=none -j5 /root/webboot.torrent
    1.29  
    1.30 @@ -152,7 +152,7 @@
    1.31  		fi
    1.32  		rm -f /root/webboot.torrent ;;
    1.33  	*)
    1.34 -		wget -O - $1 >> $2
    1.35 +		wget -O - "$1" >> $2
    1.36  	esac
    1.37  }
    1.38  
    1.39 @@ -174,47 +174,49 @@
    1.40  
    1.41  # Get global variables
    1.42  
    1.43 -title=$(get title $mnt/menu.txt)
    1.44 -subtitle=$(get subtitle $mnt/menu.txt)
    1.45 +title="$(get title $mnt/menu.txt)"
    1.46 +subtitle="$(get subtitle $mnt/menu.txt)"
    1.47  
    1.48 -timeout=$(get timeout $mnt/menu.txt)
    1.49 -timeout=${timeout:-30}
    1.50 +timeout="$(get timeout $mnt/menu.txt)"
    1.51 +timeout="${timeout:-30}"
    1.52  
    1.53 -default=$(get default $mnt/menu.txt)
    1.54 +default="$(get default $mnt/menu.txt)"
    1.55  
    1.56  editbutton='--extra-button --extra-label "Edit"'
    1.57 -grep -qs ^noedit i$mnt/menu.txt && editbutton=
    1.58 +grep -qs ^noedit $mnt/menu.txt && editbutton=
    1.59  
    1.60  READONLY=
    1.61 -grep -qs ^readonly i$mnt/menu.txt && READONLY=ON
    1.62 +grep -qs ^readonly $mnt/menu.txt && READONLY=ON
    1.63  
    1.64  USING_WEBBOOT=
    1.65 -grep -qs ^nowebboot i$mnt/menu.txt && USING_WEBBOOT=1
    1.66 +grep -qs ^nowebboot $mnt/menu.txt && USING_WEBBOOT=1
    1.67  
    1.68 -kmap=$(get kmap $mnt/menu.txt)
    1.69 +kmap="$(get kmap $mnt/menu.txt)"
    1.70  [ "$kmap" ] && ! loadkeys $kmap && loadkmap < /usr/share/kmap/$kmap.kmap
    1.71  
    1.72 -edittitle=$(get edittitle $mnt/menu.txt)
    1.73 +edittitle="$(get edittitle $mnt/menu.txt)"
    1.74  
    1.75  # Get locale
    1.76  
    1.77 -msgsave=$(get msgsave $mnt/menu.txt)
    1.78 -msgedit=$(get msgedit $mnt/menu.txt)
    1.79 -msgdone=$(get msgdone $mnt/menu.txt)
    1.80 -msgboot=$(get msgboot $mnt/menu.txt)
    1.81 -msghalt=$(get msghalt $mnt/menu.txt)
    1.82 -msgselectkernel=$(get msgselectkernel $mnt/menu.txt)
    1.83 -msgselectinitrd=$(get msgselectinitrd $mnt/menu.txt)
    1.84 -msgeditcmdline=$(get msgeditcmdline $mnt/menu.txt)
    1.85 -msgkexec=$(get msgkexec $mnt/menu.txt)
    1.86 +msgsave="$(get msgsave $mnt/menu.txt)"
    1.87 +msgedit="$(get msgedit $mnt/menu.txt)"
    1.88 +msgdone="$(get msgdone $mnt/menu.txt)"
    1.89 +msgboot="$(get msgboot $mnt/menu.txt)"
    1.90 +msghalt="$(get msghalt $mnt/menu.txt)"
    1.91 +msgselectkernel="$(get msgselectkernel $mnt/menu.txt)"
    1.92 +msgselectinitrd="$(get msgselectinitrd $mnt/menu.txt)"
    1.93 +msgeditcmdline="$(get msgeditcmdline $mnt/menu.txt)"
    1.94 +msgkexec="$(get msgkexec $mnt/menu.txt)"
    1.95  
    1.96  # Get OS variables
    1.97  
    1.98  n=0
    1.99  for i in $mnt/*/ ; do
   1.100 -	grep -qs ^kernel $i/config.txt || continue
   1.101 +	KERNEL="$(get kernel $i/config.txt)"
   1.102 +	[ -z "$KERNEL" ] && [ -s $i/kernel.img ] && KERNEL="kernel.img"
   1.103 +	[ "$KERNEL" ] || continue
   1.104  	n=$(($n+1))
   1.105 -	eval KERNEL_$n="\$(get kernel \$i/config.txt)"
   1.106 +	eval KERNEL_$n="\$KERNEL"
   1.107  	eval INITRD_$n="\$(get initramfs \$i/config.txt)"
   1.108  	eval CMDLINE_$n="\$(cat \$i/cmdline.txt)"
   1.109  	eval SAVEDEFAULT_$n="\$(get savedefault \$i/config.txt)"
   1.110 @@ -319,9 +321,9 @@
   1.111  		cp /tmp/menu.txt $mnt/menu.txt
   1.112  	fi
   1.113  	[ "$INITRD" ] && INITRD="--initrd rootfs.gz"
   1.114 -	[ "$CMDLINE" ] && CMDLINE="--command-line \"$CMDLINE\""
   1.115  
   1.116 -	kexec -l $(basename $KERNEL) $INITRD $CMDLINE --atags
   1.117 +	kexec -l $(basename $KERNEL) $INITRD --command-line \
   1.118 +		"$(sed 's|  .*||' /proc/cmdline)  $CMDLINE" --atags
   1.119  	KEXEC="kexec -e" ;;
   1.120  
   1.121  esac
     2.1 --- a/rpi/tazbian	Sun Nov 16 23:04:39 2014 +0100
     2.2 +++ b/rpi/tazbian	Tue Nov 18 10:50:30 2014 +0100
     2.3 @@ -47,6 +47,7 @@
     2.4  wget http://hg.slitaz.org/slitaz-boot-scripts/raw-file/tip/init
     2.5  chmod +x piboot init
     2.6  mv piboot $BASE/sbin
     2.7 +sed -i 's|mnt /mnt|mnt "/mnt -o noatime"|' init
     2.8  mv init $BASE/sbin/pisubroot
     2.9  wget http://cook.slitaz.org/cross/arm/packages/packages.list
    2.10  while read file pkg extra ; do
    2.11 @@ -142,7 +143,7 @@
    2.12  if ! grep -qs raspbian etc/fstab ; then
    2.13  	sed -i 's/.*mmcblk0p[2-9].*/#&/' etc/fstab
    2.14  	cat >> etc/fstab <<EOM
    2.15 -\$RDEV	/mnt/raspbian	\$FSTYPE	defaults	0	0
    2.16 +\$RDEV	/mnt/raspbian	\$FSTYPE	noatime	0	0
    2.17  tmpfs	/mnt/raspbian/$DESTDIR	tmpfs	size=0	0	0
    2.18  EOM
    2.19  fi
    2.20 @@ -153,8 +154,8 @@
    2.21  for i in keyboard locale ; do
    2.22  	[ -s /etc/default/\$i ] && . /etc/default/\$i
    2.23  done
    2.24 -KMAP=
    2.25 -find /$DESTDIR/usr/share/kbd/keymaps | grep /\$XKBLAYOUT.map.gz\$ && KMAP=kmap=\$XKBLAYOUT
    2.26 +KMAP=\$(find /$DESTDIR/usr/share/kbd/keymaps | grep /\$XKBLAYOUT[.-] | head -n1)
    2.27 +[ "\$KMAP" ] && KMAP="kmap=\$(basename \$KMAP .map.gz)"
    2.28  cat > /boot/menu.txt <<EOM
    2.29  title=Raspberry PI boot menu
    2.30  subtitle=Select the OS with ARROW keys and hit RETURN
    2.31 @@ -170,15 +171,14 @@
    2.32  KERNEL=\$(sed '/^kernel/!d;s/.*=//' /boot/config.txt)
    2.33  cp /boot/config.txt /boot/cmdline.txt /boot/raspbian/
    2.34  mv /boot/\${KERNEL:-kernel.img} /boot/raspbian/
    2.35 -[ "\$KERNEL" ] || echo "kernel=kernel.img" >> /boot/raspbian/config.txt
    2.36  echo "entry=Raspbian \$(cat /etc/debian_version)" > /boot/raspbian/menu.txt
    2.37  sed -i '/^kernel/d;/^initramfs/d' /boot/config.txt
    2.38  echo "kernel=slitaz/kernel.img" >> /boot/config.txt
    2.39  echo "initramfs slitaz/rootfs-base.gz" >> /boot/config.txt
    2.40  echo "root=/dev/null rdinit=/sbin/piboot quiet" > /boot/cmdline.txt
    2.41 -echo "root=/dev/null rdinit=/sbin/pisubroot mount=\$RDEV subroot=$DESTDIR rootwait quiet" > /boot/slitaz/cmdline.txt
    2.42  L=
    2.43  [ -s /$DESTDIR/usr/share/i18n/locales/\${LANG%.*} ] && L=lang=\${LANG%.*} 
    2.44 +echo "root=/dev/null \$L \$KMAP rdinit=/sbin/pisubroot mount=\$RDEV subroot=$DESTDIR rootwait quiet" > /boot/slitaz/cmdline.txt
    2.45  echo "root=/dev/null \$L \$KMAP quiet" > /boot/slitaz-base/cmdline.txt
    2.46  cp /boot/slitaz-base/cmdline.txt /boot/slitaz-live/cmdline.txt
    2.47