slitaz-tools annotate tinyutils/bootfloppybox @ rev 548

Remove all obsolete stuff/ folder
author Christophe Lincoln <pankso@slitaz.org>
date Fri Feb 25 01:43:27 2011 +0100 (2011-02-25)
parents ca6804d9b56b
children 0f5e3af5a51d
rev   line source
pascal@130 1 #! /bin/sh
pascal@130 2 #
pascal@130 3 # Gtkdialog box for the mount command. Part of SliTaz tools.
pascal@130 4 #
pascal@496 5 VERSION=20100701
pascal@130 6
pascal@130 7 # Check if user is root.
pascal@130 8 check_root()
pascal@130 9 {
pascal@130 10 if test $(id -u) != 0 ; then
pascal@130 11 echo -e "
pascal@130 12 You must be root to run `basename $0`. Please type 'su' and
pascal@130 13 root password to become super-user.\n"
pascal@130 14 exit 0
pascal@130 15 fi
pascal@130 16 }
pascal@130 17
paul@477 18 # This function is used after each screen to continue or abort install.
pascal@213 19 check_retval()
pascal@213 20 {
pascal@213 21 case $retval in
pascal@213 22 1)
pascal@214 23 rm -f /tmp/floppybox.grub.menu
pascal@213 24 echo -e "\nVoluntary exit.\n" && exit 0 ;;
pascal@213 25 255)
pascal@214 26 rm -f /tmp/floppybox.grub.menu
pascal@213 27 echo -e "ESC pressed.\n" && exit 0 ;;
pascal@213 28 esac
pascal@213 29 }
pascal@213 30
pascal@496 31 # Trigger floppy driver to update /sys/devices/platform/
pascal@496 32 dd if=/dev/fd0 bs=1k count=1 > /dev/null 2>&1
pascal@496 33
pascal@474 34 # check or list floppy devices.
pascal@474 35 list_floppy()
pascal@474 36 {
pascal@474 37 local list
pascal@474 38 list=""
pascal@496 39 for i in /sys/devices/platform/floppy.*/block/*; do
pascal@474 40 [ -d $i ] || continue
pascal@496 41 list="$list $(basename $i)"
pascal@474 42 done
pascal@474 43 [ -n "$1" ] || echo $list
pascal@474 44 [ -n "$list" ]
pascal@474 45 }
pascal@474 46
pascal@474 47 # dialog to select the floppy device
pascal@213 48 select_floppy()
pascal@213 49 {
pascal@264 50 DEVICE="$DIALOG --title \" Floppy device \" --backtitle \"Boot Floppy Creation\" --clear --extra-button --extra-label \"Format\" --colors --radiolist \"
pascal@264 51 Select boot device
pascal@264 52 \" 18 70 50"
pascal@264 53 on=on
pascal@474 54 for i in $(list_floppy); do
pascal@474 55 DEVICE="$DEVICE /dev/$i 'Floppy in $i' $on"
pascal@264 56 on=off
pascal@264 57 done
pascal@474 58 DEVICE="$DEVICE floppy \"floppy image file boot.fd\" $on"
pascal@474 59 DEVICE="$DEVICE cdrom \"cdrom image file boot.iso\" off 2>&1 1>&3"
pascal@213 60 exec 3>&1
pascal@264 61 DEVICE=`eval $DEVICE`
pascal@213 62 retval=$?
pascal@213 63 exec 3>&-
pascal@213 64 check_retval
pascal@213 65 if [ "$retval" = "3" ]; then
pascal@264 66 case "$DEVICE" in
pascal@264 67 /dev/*) fdformat -n $DEVICE;;
pascal@264 68 esac
pascal@213 69 fi
pascal@213 70 }
pascal@213 71
pascal@474 72 # Build menu for grub or grub4dos
pascal@274 73 mkmenu()
pascal@274 74 {
pascal@274 75 if [ "$1" = "grub4dos" ]; then
pascal@274 76 SAVEDEFAULT="save default"
pascal@274 77 cat > /tmp/floppybox.grub.menu <<EOT
pascal@274 78 # grub4dos menu
pascal@274 79 default /default
pascal@274 80 EOT
pascal@274 81 else
pascal@274 82 SAVEDEFAULT="savedefault"
pascal@274 83 cat > /tmp/floppybox.grub.menu <<EOT
pascal@274 84 # grub menu
pascal@274 85 default saved
pascal@274 86 EOT
pascal@274 87 fi
pascal@274 88 cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 89 timeout 8
pascal@274 90 color yellow/brown light-green/black
pascal@274 91
pascal@274 92 EOT
pascal@274 93 entry=0
pascal@274 94 [ -f /boot/gpxe ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 95 title gPXE (Boot from the Web, PXE/iSCSI/AoE support)
pascal@274 96 kernel /boot/gpxe $(dd if=/boot/gpxe bs=1 skip=519 count=255 2>/dev/null | strings)
pascal@274 97
pascal@274 98 EOT
pascal@274 99 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
pascal@274 100 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 101 title Smart Boot Manager (text - boot floppy, hard disk or CD/DVD)
pascal@274 102 kernel /boot/memdisk floppy c=80 h=2 s=18
pascal@274 103 initrd /boot/btmgr.gz
pascal@274 104
pascal@274 105 EOT
pascal@382 106 http://mirror.slitaz.org/boot/plpbt.bin
pascal@382 107 [ -f /usr/share/boot/plpbt.bin ] \
pascal@274 108 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 109 title Plop Boot Manager (graphic - boot floppy, hard disk, CD/DVD or USB)
pascal@382 110 kernel /boot/plpbt.bin
pascal@274 111
pascal@274 112 EOT
pascal@274 113 [ -f /usr/share/boot/etherboot ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 114 title Etherboot (LAN boot, PXE or NBI)
pascal@274 115 kernel /boot/etherboot
pascal@274 116
pascal@274 117 EOT
pascal@274 118 [ -f /usr/share/boot/memtest.lzma -a -f /usr/share/boot/memdisk.lzma ] \
pascal@274 119 && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 120 title Memtest86+ (Test system memory)
pascal@274 121 kernel /boot/memdisk floppy c=80 h=2 s=18
pascal@274 122 initrd /boot/memtest.gz
pascal@274 123
pascal@274 124 EOT
pascal@274 125 [ "$1" = "grub4dos" ] && entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 126 title Windows (scan ntldr)
pascal@274 127 fallback $(($entry -3 + 1))
pascal@274 128 find --set-root /ntldr
pascal@274 129 chainloader /ntldr
pascal@274 130 $SAVEDEFAULT --wait=2
pascal@274 131
pascal@274 132 title Windows (scan cmldr)
pascal@274 133 fallback $(($entry -3 + 2))
pascal@274 134 find --set-root /cmldr
pascal@274 135 chainloader /cmldr
pascal@274 136 $SAVEDEFAULT --wait=2
pascal@274 137
pascal@274 138 title Windows (scan io.sys)
pascal@274 139 fallback $(($entry -3 + 3))
pascal@274 140 find --set-root /io.sys
pascal@274 141 chainloader /io.sys
pascal@274 142 $SAVEDEFAULT --wait=2
pascal@274 143
pascal@274 144 EOT
pascal@274 145 entry=$(($entry + 3)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 146 title Windows (example on /dev/hda1)
pascal@274 147 rootnoverify (hd0,0)
pascal@274 148 chainloader +1
pascal@274 149 $SAVEDEFAULT
pascal@274 150
pascal@274 151 title Slitaz Frugal (example on /dev/hda1)
pascal@274 152 root (hd0,0)
pascal@274 153 kernel /boot/bzImage rw root=/dev/null vga=normal
pascal@274 154 initrd /boot/rootfs.gz
pascal@274 155 $SAVEDEFAULT
pascal@274 156
pascal@274 157 title Slitaz Installed (example on /dev/hda2)
pascal@274 158 root (hd0,1)
pascal@274 159 kernel /boot/bzImage ro root=/dev/hda2 vga=normal
pascal@274 160 $SAVEDEFAULT
pascal@274 161
pascal@274 162 EOT
pascal@274 163 [ "$1" = "grub4dos" ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 164 title Slitaz cdrom image (example on /dev/hda1, DEFRAGMENTED)
pascal@274 165 map (hd0,0)/boot/slitaz-cooking.iso (hd1)
pascal@274 166 map --hook
pascal@274 167 kernel (hd1)/boot/bzImage rw root=/dev/null vga=normal
pascal@274 168 initrd (hd1)/boot/rootfs.gz
pascal@274 169 $SAVEDEFAULT
pascal@274 170
pascal@274 171 EOT
pascal@274 172 false && [ -f /usr/share/boot/grub.exe.lzma ] && entry=$(($entry + 1)) && cat >> /tmp/floppybox.grub.menu <<EOT
pascal@274 173 title Grub4Dos
pascal@274 174 kernel /boot/grub/grub.exe --config-file="configfile (fd0)/boot/grub/menu4dos.lst"
pascal@274 175
pascal@274 176 EOT
pascal@274 177 }
pascal@274 178
pascal@474 179 # Install grub or grub4dos on floppy
pascal@264 180 install_grub()
pascal@264 181 {
pascal@274 182 LOOP=""
pascal@274 183 GRUB_DEV=${DEVICE#/dev/}
pascal@274 184 GRUB_DEV=${GRUB_DEV%% *}
pascal@264 185 case "$DEVICE" in
pascal@274 186 floppy*)
pascal@274 187 LOOP="-o loop"
pascal@274 188 GRUB_DEV=fd0
pascal@274 189 DEVICE=boot.fd
pascal@274 190 dd if=/dev/zero of=$DEVICE bs=18k count=80;;
pascal@274 191 esac
pascal@274 192 grep -qs "^# $2 menu" /tmp/floppybox.grub.menu || mkmenu $2
pascal@274 193 case "$DEVICE" in
pascal@274 194 /dev/*|boot.fd)
pascal@274 195 yes y | mke2fs $DEVICE
pascal@213 196 mkdir /media/floppy
pascal@274 197 mount $LOOP $DEVICE /media/floppy
pascal@274 198 if [ "$2" = "grub4dos" ]; then
pascal@274 199 mkdir -p /media/floppy/boot
pascal@274 200 unlzma -c /usr/share/boot/grldr.lzma > /media/floppy/grldr
pascal@274 201 cp $1/boot/* /media/floppy/boot 2> /dev/null
pascal@274 202 cp /tmp/floppybox.grub.menu /media/floppy/menu.lst
pascal@274 203 umount -d /media/floppy
pascal@274 204 bootlace --floppy --sectors-per-track=18 --heads=2 \
pascal@274 205 --chs --ext2 $DEVICE
pascal@274 206 else
pascal@274 207 mkdir -p /media/floppy/boot/grub
pascal@274 208 cp /usr/lib/grub/i386-pc/stage? /media/floppy/boot/grub
pascal@274 209 cp -a $1/boot /media/floppy
pascal@274 210 cp /tmp/floppybox.grub.menu /media/floppy/boot/grub/menu.lst
pascal@274 211 grub-set-default --root-directory=/media/floppy 0
pascal@274 212 echo "($GRUB_DEV) $(losetup | grep $DEVICE | cut -d: -f1)" > $1/device.map
pascal@274 213 [ -n "$LOOP" ] && LOOP="--device-map=$1/device.map"
pascal@274 214 grub $LOOP --batch <<EOT
pascal@274 215 root ($GRUB_DEV)
pascal@274 216 setup ($GRUB_DEV)
pascal@214 217 quit
pascal@214 218 EOT
pascal@274 219 umount -d /media/floppy
pascal@274 220 fi ;;
pascal@264 221 cdrom*)
pascal@266 222 mkdir -p $1/boot/grub 2> /dev/null
pascal@274 223 cp /tmp/floppybox.grub.menu $1/boot/grub/menu.lst
pascal@274 224 if [ "$2" = "grub4dos" ]; then
pascal@274 225 unlzma -c /usr/share/boot/grldr.lzma > $1/boot/grub/grldr
pascal@274 226 genisoimage -R -o boot.iso -b boot/grub/grldr \
pascal@274 227 -c boot/boot.cat -no-emul-boot -boot-load-seg 0x1000 \
pascal@274 228 -hide boot/boot.cat -input-charset iso8859-1 $1
pascal@274 229 else
pascal@274 230 cp /usr/lib/grub/i386-pc/stage2_eltorito $1/boot/grub
pascal@274 231 genisoimage -R -o boot.iso -b boot/grub/stage2_eltorito \
pascal@274 232 -c boot/boot.cat -no-emul-boot -boot-load-size 4 \
pascal@274 233 -hide boot/boot.cat -input-charset iso8859-1 \
pascal@274 234 -boot-info-table $1
pascal@274 235 fi ;;
pascal@264 236 esac
pascal@264 237 }
pascal@264 238
pascal@474 239 # Build /init for floppies from iso image
pascal@474 240 buildinit()
pascal@474 241 {
pascal@474 242 mv $1/init $1/init.org
pascal@474 243 cat > $1/init <<EOTEOT
pascal@474 244 #!/bin/sh
pascal@474 245
pascal@474 246 mount -t proc proc /proc
pascal@474 247 total=\$(grep MemTotal /proc/meminfo | sed 's/[^0-9]//g')
pascal@474 248 # the floppy driver may not be included in kernel
pascal@474 249 insmod /lib/modules/*/kernel/drivers/block/floppy.ko.gz 2> /dev/null
pascal@474 250 # loram may put floppy.ko.gz module in /lib
pascal@474 251 insmod /lib/floppy.ko.gz 2> /dev/null
pascal@474 252 umount /proc
pascal@474 253 while read name min num count file md5; do
pascal@474 254 [ -e \$file ] && continue
pascal@474 255 [ \$total -lt \$min ] && break
pascal@474 256 while [ \$count -ne 0 ]; do
pascal@474 257 tmp="\$(dd if=/dev/fd0 count=1 2> /dev/null | md5sum)"
pascal@474 258 echo -n "Insert floppy \$num for \$name and press Enter or Q to skip"
pascal@474 259 while true; do
pascal@474 260 echo -n ":"
pascal@474 261 read -t 10 answer < /dev/tty0
pascal@474 262 case "\$answer" in
pascal@474 263 Q*|q*|A*|a*) break 3;;
pascal@474 264 esac
pascal@474 265 dd if=/dev/fd0 count=1 > /tmp/bs.\$\$ 2> /dev/null
pascal@474 266 [ -s /tmp/bs.\$\$ ] || continue
pascal@474 267 [ "\$(md5sum < /tmp/bs.\$\$)" != "\$tmp" ] || continue
pascal@474 268 rm -f /tmp/bs.\$\$
pascal@474 269 break
pascal@474 270 done
pascal@474 271 dd if=/dev/fd0 of=/tmp/rootfs.\$num 2> /dev/null || continue
pascal@474 272 cat /tmp/rootfs.\$num >> /tmp/rootfs
pascal@474 273 rm -f /tmp/rootfs.\$num
pascal@474 274 num=\$((\$num+1))
pascal@474 275 count=\$((\$count-1))
pascal@474 276 done
pascal@474 277 echo "\$md5 /tmp/rootfs" | md5sum -c || break
pascal@474 278 cpio -idmu < /tmp/rootfs > /dev/null 2>&1 ||
pascal@474 279 ( zcat /tmp/rootfs 2> /dev/null || unlzma -c /tmp/rootfs ) | cpio -idmu
pascal@474 280 rm -f /tmp/rootfs*
pascal@474 281 done <<EOT
pascal@474 282 $(while read line; do echo $line; done)
pascal@474 283 EOT
pascal@474 284 mv -f /init.org /init || sh
pascal@474 285 exec /init
pascal@474 286 EOTEOT
pascal@474 287 chmod +x $1/init
pascal@474 288 }
pascal@474 289
pascal@405 290 # write a 32 bits data
pascal@405 291 # usage: storelong offset data32 file
pascal@405 292 storelong()
pascal@405 293 {
pascal@405 294 printf "00000 %02X %02X %02X %02X \n" \
pascal@405 295 $(( $2 & 255 )) $(( ($2>>8) & 255 )) \
pascal@405 296 $(( ($2>>16) & 255 )) $(( ($2>>24) & 255 )) | \
pascal@405 297 hexdump -R | dd bs=1 conv=notrunc of=$3 seek=$(( $1 )) 2> /dev/null
pascal@405 298 }
pascal@405 299
pascal@405 300 # read a 32 bits data
pascal@405 301 # usage: getlong offset file
pascal@405 302 getlong()
pascal@405 303 {
pascal@405 304 dd if=$2 bs=1 skip=$(( $1 )) count=4 2> /dev/null | \
pascal@405 305 hexdump -e '"" 1/4 "%d" "\n"'
pascal@405 306 }
pascal@405 307
pascal@474 308 # output floppy images set
pascal@474 309 floppysetcat()
pascal@405 310 {
pascal@405 311 KERNEL="$1"
pascal@405 312 INITRD="$2"
pascal@405 313 shift 2
pascal@405 314 CMDLINE="$@"
pascal@405 315
pascal@405 316 # bzImage offsets
pascal@405 317 SetupSzOfs=497
pascal@405 318 SyssizeOfs=500
pascal@405 319 CodeAdrOfs=0x214
pascal@405 320 RamfsAdrOfs=0x218
pascal@405 321 RamfsLenOfs=0x21C
pascal@405 322 ArgPtrOfs=0x228
pascal@405 323
pascal@405 324 # boot+setup address
pascal@405 325 SetupBase=0x90000
pascal@405 326
pascal@405 327 stacktop=0x9E00
pascal@405 328
pascal@405 329 bs=/tmp/bs$$
pascal@405 330
pascal@405 331 # Get and patch boot sector
pascal@405 332 dd if=$KERNEL bs=512 count=1 of=$bs 2> /dev/null
pascal@405 333 uudecode <<EOT | dd of=$bs conv=notrunc 2> /dev/null
pascal@405 334 begin-base64 644 -
pascal@474 335 /L+6nWgAkAcGF4n8McC5HQDzq1sfD6mg8X1ABlfFd3ixBvOlZWaPR3gGH8ZF
pascal@490 336 +D/6l1hB6DQBvgACA3QO6HYBWwseKAJ0LFNH6AoBXuhmAbAgzRCwCM0QTuhl
pascal@490 337 ATwIdAOIBK05NigCdPDoPgE8CnXgiHz+ieb/TBD/TBi/9AGBTRz/gMdFMACc
pascal@490 338 sBCxBUi0k4lEHLABiUQUmGaY0+BIZgMFZtPoaAAQB7+AACn4nHMCAccx21BW
pascal@490 339 6J4AXrkAgLSH/kQczRVYnXfcoRoCvxwCsQk4RBxyuJPNE+oAACCQsEYoyL7b
pascal@490 340 AejSAF3rI4D5E3IEOMF3a4D+AnIEOOZ3bGCB/QAGdCoGUlFTlrQCULEGtQTB
pascal@490 341 xQSwDyHoBJAnFEAn6IwA/s117LAgzRDitOiWAJjNE2FSUCjIdwKwAZg5+HIC
pascal@490 342 ifhQtALNE5VeWFpyoJVBjuGAxwJPdFFOdfSM4ZU4wXVFiMj+xrEBOOZ1O4j0
pascal@490 343 /sW2AID9UHIwOi7wAXIqtQBgvt4B/kQMU+gxAFvoOAB1FlKYzRO4AQLNE1rQ
pascal@490 344 1Dpk/nXqRgjkdeVh64sWB7AxLAO0DrsHAM0QPA1088OwDejv/6wIwHX4w79s
pascal@474 345 BLFbZQINuA0BZToNdArNFnT0mM0Wju9Hw1g6AEluc2VydCBkaXNrIDEuBw0A
pascal@408 346 AA==
pascal@405 347 ====
pascal@405 348 EOT
pascal@405 349
pascal@405 350 # Get setup
pascal@405 351 setupsz=$(getlong $SetupSzOfs $bs)
pascal@405 352 setupszb=$(( $setupsz & 255 ))
pascal@405 353 dd if=$KERNEL bs=512 skip=1 count=$setupszb 2> /dev/null >> $bs
pascal@405 354
pascal@405 355 # Store cmdline after setup
pascal@405 356 if [ -n "$CMDLINE" ]; then
pascal@405 357 echo -n "$CMDLINE" | dd bs=512 count=1 conv=sync 2> /dev/null >> $bs
pascal@405 358 storelong ArgPtrOfs $(( $SetupBase + $stacktop )) $bs
pascal@405 359 fi
pascal@405 360
pascal@405 361 # Compute initramfs size
pascal@405 362 initrdlen=0
pascal@405 363 padding=0
pascal@405 364 for i in $( echo $INITRD | sed 's/,/ /' ); do
pascal@405 365 [ -s "$i" ] || continue
pascal@405 366 initrdlen=$(( $initrdlen + $padding ))
pascal@405 367 padding=$(stat -c %s $i)
pascal@405 368 initrdlen=$(( $initrdlen + $padding ))
pascal@405 369 padding=$(( 4096 - ($padding & 4095) ))
pascal@405 370 [ $padding -eq 4096 ] && padding=0
pascal@405 371 done
pascal@405 372 Ksize=$(( $(getlong $SyssizeOfs $bs)*16 ))
pascal@405 373 Kpad=$(( (($Ksize+4095)/4096)*4096 - Ksize ))
pascal@405 374 if [ $initrdlen -ne 0 ]; then
pascal@405 375 Kbase=$(getlong $CodeAdrOfs $bs)
pascal@405 376 storelong $RamfsAdrOfs \
pascal@405 377 $(( (0x1000000 - $initrdlen) & 0xFFFF0000 )) $bs
pascal@405 378 storelong $RamfsLenOfs $initrdlen $bs
pascal@405 379 fi
pascal@405 380
pascal@405 381 # Output boot sector + setup + cmdline
pascal@405 382 dd if=$bs 2> /dev/null
pascal@405 383
pascal@405 384 # Output kernel code
pascal@405 385 dd if=$KERNEL bs=512 skip=$(( $setupszb + 1 )) 2> /dev/null
pascal@405 386
pascal@405 387 # Pad to next sector
pascal@405 388 Kpad=$(( 512 - ($(stat -c %s $KERNEL) & 511) ))
pascal@405 389 [ $Kpad -eq 512 ] || dd if=/dev/zero bs=1 count=$Kpad 2> /dev/null
pascal@405 390
pascal@405 391 # Output initramfs
pascal@405 392 padding=0
pascal@405 393 for i in $( echo $INITRD | sed 's/,/ /' ); do
pascal@405 394 [ -s "$i" ] || continue
pascal@405 395 [ $padding -ne 0 ] && dd if=/dev/zero bs=1 count=$padding
pascal@405 396 dd if=$i 2> /dev/null
pascal@405 397 padding=$(( 4096 - ($(stat -c %s $i) & 4095) ))
pascal@405 398 [ $padding -eq 4096 ] && padding=0
pascal@405 399 done
pascal@405 400
pascal@405 401 # Cleanup
pascal@405 402 rm -f $bs
pascal@405 403 }
pascal@405 404
pascal@474 405 # Create boot floppy set from kernel, initrd & cmdline
pascal@474 406 floppyset()
pascal@474 407 {
pascal@490 408 floppysetcat "$@" | split -b 1440k /dev/stdin floppy$$
pascal@474 409 i=1
pascal@474 410 ls floppy$$* | while read file ; do
pascal@476 411 output=$(printf "fd%03d.img" $i)
pascal@474 412 cat $file /dev/zero | dd bs=1k count=1440 of=$output conv=sync 2> /dev/null
pascal@474 413 rm -f $file
pascal@474 414 i=$(( $i + 1 ))
pascal@474 415 done
pascal@474 416 }
pascal@474 417
pascal@474 418 # Create boot floppy set from a SliTaz ISO image
pascal@474 419 floppysetfromiso()
pascal@474 420 {
pascal@474 421 mkdir /tmp/iso$$
pascal@474 422 mount -o loop,ro $1 /tmp/iso$$
pascal@480 423 rootfs="$(ls /tmp/iso$$/boot/rootfs*z 2> /dev/null | tail -1)"
pascal@474 424 bzimage=/tmp/iso$$/boot/bzImage
pascal@474 425 if [ -z "$rootfs" -o ! -s $bzimage ]; then
pascal@474 426 umount -d /tmp/iso$$
pascal@474 427 rm -rf /tmp/iso$$
pascal@474 428 echo "Not a SliTaz ISO image !"
pascal@474 429 return 1
pascal@474 430 fi
pascal@474 431 mkdir -p /tmp/rootfs$$/fs
pascal@474 432 n=1
pascal@480 433 for i in $(ls /tmp/iso$$/boot/rootfs*z | sort -r); do
pascal@474 434 mkdir /tmp/rootfs$$/$n
pascal@474 435 ln -s $i /tmp/rootfs$$/$n
pascal@474 436 n=$(($n + 1))
pascal@474 437 done
pascal@474 438 echo "Unpack rootfs..."
pascal@474 439 ( zcat $rootfs 2> /dev/null | unlzma -c $rootfs ) | \
pascal@474 440 ( cd /tmp/rootfs$$/fs ; cpio -idm > /dev/null )
pascal@474 441 if [ $(unlzma -c $rootfs 2> /dev/null| wc -c) -gt $(stat -c %s $rootfs) ]; then
pascal@474 442 if [ $(du -ck $rootfs $bzimage | awk 'END { print $1 }') -gt 15296 ]; then
pascal@474 443 # The rootfs.gz file is too big, extract a minimum bootfs with busybox stuff
pascal@474 444 echo "Extract bootfs..."
pascal@474 445 mv /tmp/rootfs$$/fs /tmp/rootfs$$/fs0
pascal@474 446 for i in lib bin sbin usr/bin usr/sbin ; do
pascal@474 447 mkdir -p /tmp/rootfs$$/fs/$i
pascal@474 448 done
pascal@474 449 cd /tmp/rootfs$$/fs0
pascal@474 450 dir=$(echo lib/modules/*/kernel/drivers/block)
pascal@479 451 [ -d $dir ] && mkdir -p ../fs/$dir
pascal@474 452 [ -f $dir/floppy.ko.gz ] && mv $dir/floppy.ko.gz ../fs/$dir
pascal@474 453 for i in dev init mnt proc sys tmp ; do
pascal@474 454 mv $i ../fs
pascal@474 455 done
pascal@479 456 mv lib/ld-* ../fs/lib
pascal@479 457 LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so bin/busybox | \
pascal@479 458 awk '/\/lib\/lib/ { print $3 }' | while read lib ; do
pascal@479 459 while [ -L .$lib ]; do
pascal@479 460 local target
pascal@479 461 target="$(readlink ".$lib")"
pascal@479 462 case "$target" in
pascal@479 463 /*) ;;
pascal@479 464 *) target="$(dirname $lib)/$target" ;;
pascal@479 465 esac
pascal@479 466 mv ".$lib" ../fs/lib
pascal@479 467 lib="$target"
pascal@479 468 done
pascal@479 469 mv ".$lib" ../fs/lib
pascal@479 470 done
pascal@474 471 for i in $(bin/busybox | awk '{ if (s) printf "%s",$0 }
pascal@474 472 /Currently/ { s=1 }' | sed 's/,//g'); do
pascal@474 473 for j in bin sbin usr/bin usr/sbin ; do
pascal@474 474 [ -e $j/$i ] && mv $j/$i ../fs/$j/$i
pascal@474 475 done
pascal@474 476 done
pascal@474 477 mv bin/busybox ../fs/bin
pascal@479 478 [ -e ../fs/bin/cpio ] || mv bin/cpio ../fs/bin
pascal@474 479 rm -f ../1/*
pascal@474 480 find | cpio -o -H newc | lzma e ../1/rootfs.gz -si
pascal@474 481 cd - > /dev/null
pascal@474 482 rm -rf /tmp/rootfs$$/fs0
pascal@474 483 else
paul@477 484 # The rootfs.gz file fits in 15MB, no need to split it.
pascal@474 485 rm -rf /tmp/rootfs$$/1
pascal@474 486 fi
pascal@474 487 else
pascal@474 488 # This is a loram rootfs.gz, extract loram bootstrap
pascal@474 489 echo "Split loram rootfs..."
pascal@488 490 offset=$(awk '/07070100/ { o+=index($0,"07070100"); print o/4 ; exit } { o+=1+length() }' < $rootfs)
pascal@488 491 dd if=$rootfs skip=$(($offset / 1024)) bs=4k count=1 2> /dev/null | \
pascal@488 492 dd skip=$(($offset % 1024)) bs=4 of=/tmp/rootfs$$/1/root 2> /dev/null
pascal@488 493 dd if=$rootfs skip=$((1 + ($offset / 1024) )) bs=4k \
pascal@488 494 >> /tmp/rootfs$$/1/root 2> /dev/null
pascal@488 495 rm -f /tmp/rootfs$$/1/rootfs*
pascal@474 496 fi
pascal@474 497 # Create extra rootfs floppies
pascal@474 498 for i in /tmp/rootfs$$/[1-9]*/root* ; do
pascal@474 499 [ -f $i ] || continue
pascal@474 500 echo "Create floppies for rootfs $(basename $(dirname $i) )..."
pascal@474 501 case "$(dd if=$i bs=1 count=4 2> /dev/null)" in
pascal@474 502 0707) cat $i ;;
pascal@474 503 *) zcat $i 2> /dev/null || unlzma -c $i ;;
pascal@474 504 esac | cpio -t > $(dirname $i)/files.list
pascal@474 505 sed -i '/ blocks$/d' $(dirname $i)/files.list
pascal@474 506 x=$(readlink $i)
pascal@474 507 [ -n "$x" ] || x=$i
pascal@474 508 pad=$(( $(stat -c %s $x ) % 1474560 ))
pascal@474 509 [ $pad -ne 0 ] && pad=$(( 1474560 - $pad ))
pascal@474 510 dd if=/dev/zero bs=1 count=$pad 2> /dev/null | cat $i - | \
pascal@474 511 split -b 1440k /dev/stdin $(dirname $i)/floppy
pascal@474 512 done
pascal@479 513 selection="$(grep -s append /tmp/iso$$/boot/isolinux/common.cfg | sed 's/.*append //')"
pascal@474 514 [ -n "$selection" ] || selection="0 slitaz"
pascal@474 515 set -- $selection
pascal@474 516 selection=""
pascal@474 517 while [ -n "$2" ]; do
pascal@474 518 [ ! -d /tmp/rootfs$$/1 -a -z "$4" ] && break
pascal@474 519 case "$1" in
pascal@474 520 *G) selection="$2 $(( ${1%G} * 1024 * 1024 )) $selection" ;;
pascal@474 521 *M) selection="$2 $(( ${1%M} * 1024 )) $selection" ;;
pascal@474 522 *) selection="$2 $1 $selection" ;;
pascal@474 523 esac
pascal@474 524 shift 2
pascal@474 525 done
pascal@474 526 echo "Create /init ..."
pascal@474 527 base=100
pascal@474 528 set -- $selection
pascal@474 529 for i in /tmp/rootfs$$/[1-9]* ; do
pascal@474 530 [ -d $i ] || continue
pascal@474 531 while read file; do
pascal@474 532 [ -e $i/../fs/$file ] && continue
pascal@474 533 [ $(grep -- "$file" $i/../*/files.list | wc -l) -eq 1 ] &&
pascal@474 534 break
pascal@474 535 done < $i/files.list
pascal@474 536 printf "%s %s %03d %d %s %s\n" \
pascal@474 537 $1 $2 $base $(ls $i/floppy* | wc -l) $file \
pascal@474 538 $(cat $i/floppy* | md5sum - | awk '{print $1}')
pascal@474 539 base=$(($base + 100))
pascal@474 540 shift 2
pascal@474 541 done | buildinit /tmp/rootfs$$/fs
pascal@474 542 cmdline="$(grep append /tmp/iso$$/boot/isolinux/isolinux.cfg | tail -n 1 | sed 's/.*gz //')"
pascal@474 543 ( cd /tmp/rootfs$$/fs ; find | cpio -o -H newc ) | lzma e /tmp/rootfs$$/rootfs -si
pascal@474 544 echo "Create first stage boot floppies..."
pascal@490 545 floppyset $bzimage /tmp/rootfs$$/rootfs "$cmdline"
pascal@474 546 base=100
pascal@474 547 for i in /tmp/rootfs$$/[1-9]* ; do
pascal@474 548 [ -d $i ] || continue
pascal@474 549 j=0
pascal@474 550 for f in $i/floppy* ; do
pascal@476 551 mv $f $(printf "fd%03d.img" $(( $base + $j )) )
pascal@474 552 j=$(($j + 1))
pascal@474 553 done
pascal@474 554 base=$(($base + 100))
pascal@474 555 done
pascal@474 556 rm -rf /tmp/rootfs$$
pascal@474 557 umount -d /tmp/iso$$
pascal@474 558 rm -rf /tmp/iso$$
pascal@474 559 }
pascal@474 560
pascal@474 561 # Show new boot floppy set
pascal@474 562 dialogwritefloppyset()
pascal@474 563 {
pascal@474 564 if ! list_floppy check; then
pascal@476 565 du -h fd???.img
pascal@474 566 return
pascal@474 567 fi
pascal@474 568 while true; do
pascal@474 569 exec 3>&1
pascal@474 570 IMAGE=`$DIALOG --title " Write floppy image " \
pascal@474 571 --backtitle "Boot floppy set creation on $DEVICE" --clear \
pascal@474 572 --colors --radiolist "
pascal@474 573 Insert a blank floppy in drive and
paul@477 574 select the floppy image you want to write.
pascal@474 575 " 18 46 46 \
pascal@476 576 $(on="on"; for i in fd???.img; do echo "$i $(du -h $i | cut -f1) $on "; on="off"; done) 2>&1 1>&3`
pascal@474 577 retval=$?
pascal@474 578 exec 3>&-
pascal@474 579 check_retval
pascal@474 580 dd if=$IMAGE of=$DEVICE
pascal@474 581 done
pascal@474 582 }
pascal@474 583
pascal@474 584 dialognofloppyset()
pascal@474 585 {
pascal@474 586 cat << EOT
paul@477 587 The boot loader can't load the kernel and the initramfs in the first 16MB
paul@477 588 of RAM. The total size exceeds 15MB. No floppy image is created.
pascal@474 589 EOT
pascal@474 590 }
pascal@474 591
pascal@474 592 # Check for iso 9660 image
pascal@474 593 isiso()
pascal@474 594 {
pascal@474 595 mkdir /tmp/iso$$
pascal@474 596 mount -o loop,ro $1 /tmp/iso$$ 2> /dev/null
pascal@474 597 status=$?
pascal@474 598 umount -d /tmp/iso$$ 2> /dev/null
pascal@474 599 rm -rf /tmp/iso$$
pascal@474 600 return $status
pascal@474 601 }
pascal@474 602
pascal@474 603 dialogfloppyset()
pascal@474 604 {
pascal@474 605 : ${DIALOG=dialog}
pascal@474 606 while true; do
pascal@474 607 exec 3>&1
pascal@474 608 KERNEL=`$DIALOG --title " Select a Linux kernel or a SliTaz iso " \
pascal@474 609 --backtitle "Boot floppy set creation on $DEVICE" --clear \
pascal@474 610 --colors --fselect "$PWD" 10 70 \
pascal@474 611 2>&1 1>&3`
pascal@474 612 retval=$?
pascal@474 613 exec 3>&-
pascal@474 614 check_retval
pascal@474 615 [ -f $KERNEL ] && break
pascal@474 616 done
pascal@474 617 if isiso $KERNEL ; then
pascal@474 618 bootfloppybox call mkisofloppies $KERNEL
pascal@474 619 dialogwritefloppyset
pascal@474 620 return
pascal@474 621 fi
pascal@474 622 exec 3>&1
pascal@474 623 INITRD=`$DIALOG --title " Select an Initramfs " \
pascal@474 624 --backtitle "Boot floppy set creation on $DEVICE" --clear \
pascal@474 625 --colors --fselect "$PWD" 10 70 \
pascal@474 626 2>&1 1>&3`
pascal@474 627 retval=$?
pascal@474 628 exec 3>&-
pascal@474 629 check_retval
pascal@474 630 [ -f "$INITRD" ] || INITRD=""
pascal@474 631 exec 3>&1
pascal@474 632 CMDLINE=`$DIALOG --title " Enter boot command line " \
pascal@474 633 --backtitle "Boot floppy set creation on $DEVICE" --clear \
pascal@474 634 --colors --inputbox "Kernel command line" 10 70 "rw root=/dev/null autologin" \
pascal@474 635 2>&1 1>&3`
pascal@474 636 retval=$?
pascal@474 637 exec 3>&-
pascal@474 638 check_retval
pascal@490 639 bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE" &&
pascal@474 640 dialogwritefloppyset ||
pascal@474 641 dialognofloppyset
pascal@474 642 }
pascal@474 643
pascal@474 644 #
pascal@474 645 # Create floppy image set
pascal@474 646 #
pascal@474 647 export IMAGE_SET='
pascal@474 648 <window title="Image set generator" icon-name="gtk-floppy">
pascal@474 649 <vbox>
pascal@474 650 <text use-markup="true">
pascal@474 651 <label>
pascal@474 652 "
pascal@474 653 <b>Create a boot floppy set</b>
pascal@474 654 "
pascal@474 655 </label>
pascal@474 656 </text>
paul@477 657 <notebook labels="Slitaz only|Any Linux">
pascal@474 658 <frame Slitaz only (no size limit)>
pascal@474 659 <vbox>
pascal@474 660 <text wrap="false" width-chars="44" use-markup="true">
pascal@474 661 <label>
pascal@474 662 "
paul@477 663 Slitaz uses a floppy boot flavor as a first
paul@477 664 stage boot to break the tiny loader 15MB limit.
pascal@474 665 "
pascal@474 666 </label>
pascal@474 667 </text>
pascal@474 668 <hbox>
pascal@474 669 <text use-markup="true">
pascal@474 670 <label>"<b>Slitaz ISO : </b>"</label>
pascal@474 671 </text>
pascal@474 672 <entry accept="filename">
pascal@474 673 <label>Select a Slitaz ISO image</label>
pascal@474 674 <variable>ISO</variable>
pascal@474 675 </entry>
pascal@474 676 <button>
pascal@474 677 <input file stock="gtk-open"></input>
pascal@474 678 <action type="fileselect">ISO</action>
pascal@474 679 </button>
pascal@474 680 </hbox>
pascal@474 681 <hbox>
pascal@474 682 <text use-markup="true">
pascal@474 683 <label>"<b>Output directory : </b>"</label>
pascal@474 684 </text>
pascal@474 685 <entry accept="directory">
pascal@474 686 <label>Select output directory</label>
pascal@474 687 <variable>FILE_DIRECTORY</variable>
pascal@474 688 <default>/tmp</default>
pascal@474 689 </entry>
pascal@474 690 <button>
pascal@474 691 <input file stock="gtk-open"></input>
pascal@474 692 <action type="fileselect">FILE_DIRECTORY</action>
pascal@474 693 </button>
pascal@474 694 </hbox>
pascal@474 695 <hbox>
pascal@474 696 <button>
pascal@474 697 <input file icon="forward"></input>
pascal@474 698 <label>Create image set from ISO boot</label>
pascal@476 699 <action>cd $FILE_DIRECTORY; bootfloppybox call mkisofloppiesxterm $ISO</action>
pascal@474 700 <action type="closewindow">IMAGE_SET</action>
pascal@474 701 </button>
pascal@474 702 </hbox>
pascal@474 703 </vbox>
pascal@474 704 </frame>
paul@477 705 <frame Any Linux distribution (max total size 14-15MB)>
pascal@474 706 <vbox>
pascal@474 707 <text wrap="false" width-chars="44" use-markup="true">
pascal@474 708 <label>
pascal@474 709 "
pascal@474 710 The total size of the kernel and the initramfs must be
paul@477 711 lower than 14-15MB due to the tiny boot loader design.
pascal@474 712 "
pascal@474 713 </label>
pascal@474 714 </text>
pascal@474 715 <hbox>
pascal@474 716 <text use-markup="true">
pascal@474 717 <label>"<b>Kernel : </b>"</label>
pascal@474 718 </text>
pascal@474 719 <entry accept="filename">
pascal@474 720 <label>Select a linux kernel</label>
pascal@474 721 <variable>KERNEL</variable>
pascal@474 722 </entry>
pascal@474 723 <button>
pascal@474 724 <input file stock="gtk-open"></input>
pascal@474 725 <action type="fileselect">KERNEL</action>
pascal@474 726 </button>
pascal@474 727 </hbox>
pascal@474 728 <hbox>
pascal@474 729 <text use-markup="true">
pascal@474 730 <label>"<b>Initramfs : </b>"</label>
pascal@474 731 </text>
pascal@474 732 <entry accept="filename">
pascal@474 733 <label>Select an initramfs/initrd file</label>
pascal@474 734 <variable>INITRD</variable>
pascal@474 735 </entry>
pascal@474 736 <button>
pascal@474 737 <input file stock="gtk-open"></input>
pascal@474 738 <action type="fileselect">INITRD</action>
pascal@474 739 </button>
pascal@474 740 </hbox>
pascal@474 741 <hbox>
pascal@474 742 <text use-markup="true">
pascal@474 743 <label>"<b>Cmdline : </b>"</label>
pascal@474 744 </text>
pascal@474 745 <entry>
pascal@474 746 <label>Enter kernel arguments</label>
pascal@474 747 <variable>CMDLINE</variable>
pascal@474 748 <default>rw root=/dev/null autologin</default>
pascal@474 749 </entry>
pascal@474 750 </hbox>
pascal@474 751 <hbox>
pascal@474 752 <text use-markup="true">
pascal@474 753 <label>"<b>Output directory : </b>"</label>
pascal@474 754 </text>
pascal@474 755 <entry accept="directory">
pascal@474 756 <label>Select output directory</label>
pascal@474 757 <variable>OUTPUT_DIRECTORY</variable>
pascal@474 758 <default>/tmp</default>
pascal@474 759 </entry>
pascal@474 760 <button>
pascal@474 761 <input file stock="gtk-open"></input>
pascal@474 762 <action type="fileselect">OUTPUT_DIRECTORY</action>
pascal@474 763 </button>
pascal@474 764 </hbox>
pascal@474 765 <hbox>
pascal@474 766 <button>
pascal@474 767 <input file icon="forward"></input>
pascal@474 768 <label>Create image set</label>
pascal@490 769 <action>cd $OUTPUT_DIRECTORY; bootfloppybox call mkfloppies "$KERNEL" "$INITRD" "$CMDLINE"</action>
pascal@474 770 <action type="closewindow">IMAGE_SET</action>
pascal@474 771 </button>
pascal@474 772 </hbox>
pascal@474 773 </vbox>
pascal@474 774 </frame>
pascal@474 775 </notebook>
pascal@474 776 <hbox>
pascal@474 777 <button>
pascal@474 778 <input file icon="gtk-close"></input>
pascal@474 779 <action type="closewindow">IMAGE_SET</action>
pascal@474 780 </button>
pascal@474 781 </hbox>
pascal@474 782 </vbox>
pascal@474 783 </window>
pascal@474 784 '
pascal@474 785
pascal@474 786 #
pascal@474 787 # Read/write floppy images
pascal@474 788 #
pascal@474 789 export FLOPPY_IMAGE='
pascal@474 790 <window title="Floppy image manager" icon-name="gtk-floppy">
pascal@474 791 <vbox>
pascal@474 792 <frame Floppy disk drive>
pascal@474 793 <hbox>
pascal@474 794 <text use-markup="true">
pascal@474 795 <label>"<b>Device : </b>"</label>
pascal@474 796 </text>
pascal@474 797 <combobox>
pascal@474 798 <variable>DEVICE</variable>'
pascal@474 799 FLOPPY_DEV=""
pascal@474 800 for i in $(list_floppy); do
pascal@474 801 FLOPPY_DEV="$FLOPPY_DEV
pascal@474 802 <item>/dev/$i</item>"
pascal@474 803 done
pascal@474 804 FLOPPY_IMAGE="$FLOPPY_IMAGE$FLOPPY_DEV
pascal@474 805 </combobox>
pascal@474 806 <button>
pascal@474 807 <label>Format floppy</label>
pascal@474 808 <input file icon=\"media-floppy\"></input>
pascal@474 809 <action>fdformat -n $DEVICE</action>
pascal@474 810 </button>
pascal@474 811 </hbox>
pascal@474 812 </frame>
pascal@474 813 <frame Floppy image file>
pascal@474 814 <hbox>
pascal@474 815 <text use-markup=\"true\">
pascal@474 816 <label>\"<b>File : </b>\"</label>
pascal@474 817 </text>
pascal@474 818 <entry accept=\"filename\">
pascal@474 819 <label>Select a floppy image</label>
pascal@474 820 <variable>IMAGE</variable>
pascal@474 821 </entry>
pascal@474 822 <button>
pascal@474 823 <input file stock=\"gtk-open\"></input>
pascal@474 824 <action type=\"fileselect\">IMAGE</action>
pascal@474 825 </button>
pascal@474 826 </hbox>
pascal@474 827 </frame>
pascal@474 828 <hbox>
pascal@474 829 <button>
pascal@474 830 <input file icon=\"reload\"></input>
pascal@474 831 <label>Create image set</label>
pascal@474 832 <action type=\"launch\">IMAGE_SET</action>
pascal@474 833 </button>
pascal@474 834 <button>
pascal@474 835 <input file icon=\"go-jump\"></input>
pascal@474 836 <label>Write image to floppy</label>
pascal@474 837 <action>dd if=\$IMAGE of=\$DEVICE</action>
pascal@474 838 </button>
pascal@474 839 <button>
pascal@474 840 <input file icon=\"undo\"></input>
pascal@474 841 <label>Get floppy image</label>
pascal@474 842 <action>dd if=\$DEVICE of=\$IMAGE</action>
pascal@474 843 </button>
pascal@474 844 <button>
pascal@474 845 <input file icon=\"gtk-close\"></input>
pascal@474 846 <action type=\"closewindow\">FLOPPY_IMAGE</action>
pascal@474 847 </button>
pascal@474 848 </hbox>
pascal@474 849 </vbox>
pascal@474 850 </window>
pascal@474 851 "
pascal@474 852
pascal@474 853 gtkdialogshowfloppyset()
pascal@474 854 {
pascal@474 855 #
pascal@474 856 # Show floppy image set
pascal@474 857 #
pascal@474 858 IMAGE_SHOW='
pascal@474 859 <window title="Image set" icon-name="gtk-floppy">
pascal@474 860 <vbox>
pascal@474 861 <text use-markup="true">
pascal@474 862 <label>
pascal@474 863 "
pascal@474 864 <b>Boot floppy images</b>
pascal@474 865 "
pascal@474 866 </label>
pascal@474 867 </text>
pascal@474 868 <tree>
pascal@474 869 <width>50</width><height>140</height>
pascal@474 870 <label>Size|File</label>
pascal@476 871 <input>du -h fd???.img | sed "s/\t/|/" </input>
pascal@474 872 </tree>
pascal@474 873 <hbox>
pascal@474 874 '
pascal@474 875 [ 0$1 -gt $((15 * 1024 * 1024)) ] && IMAGE_SHOW="$IMAGE_SHOW
pascal@474 876 <frame WARNING>
pascal@474 877 <text>
pascal@474 878 <label>
paul@477 879 \"This floppy set breaks the 15MB limit ($1 bytes).
paul@512 880 It may not be able to complete the boot process.\"
pascal@474 881 </label>
pascal@474 882 </text>
pascal@474 883 </frame>
pascal@474 884 </hbox>
pascal@474 885 <hbox>
pascal@474 886 "
pascal@474 887 list_floppy check && IMAGE_SHOW="$IMAGE_SHOW
pascal@474 888 <button>
pascal@474 889 <input file icon=\"media-floppy\"></input>
pascal@474 890 <label>Manage images</label>
pascal@474 891 <action type=\"launch\">FLOPPY_IMAGE</action>
pascal@474 892 </button>
pascal@474 893 "
pascal@474 894 IMAGE_SHOW="$IMAGE_SHOW
pascal@474 895 <button>
pascal@474 896 <input file icon=\"gtk-close\"></input>
pascal@474 897 <action type=\"closewindow\">IMAGE_SET</action>
pascal@474 898 </button>
pascal@474 899 </hbox>
pascal@474 900 </vbox>
pascal@474 901 </window>
pascal@474 902 "
pascal@474 903 export IMAGE_SHOW
pascal@474 904 gtkdialog --program=IMAGE_SHOW
pascal@474 905 }
pascal@474 906
pascal@264 907 while true; do
pascal@264 908
pascal@264 909 if [ "$1" == "call" ]; then
pascal@264 910 case "$2" in
pascal@274 911 mkmenu) mkmenu $3;;
pascal@474 912 mkisofloppiesxterm)
pascal@474 913 shift 2
pascal@474 914 xterm -geometry 80x16 -title "Build boot floppies from ISO" \
pascal@474 915 -e "$0 call mkisofloppies $@ ; echo -e \"----\nENTER to continue...\" && read close"
pascal@474 916 gtkdialogshowfloppyset
pascal@474 917 ;;
pascal@474 918 mkisofloppies)
pascal@474 919 shift 2
pascal@474 920 floppysetfromiso $@
pascal@474 921 ;;
pascal@405 922 mkfloppies)
pascal@405 923 shift 2
pascal@490 924 floppyset "$@"
pascal@476 925 sz=$(cat fd???.img | wc -c)
pascal@474 926 if [ -n "$XAUTHORITY" ]; then
pascal@474 927 gtkdialogshowfloppyset $sz
pascal@474 928 else
pascal@474 929 if [ $sz -gt $((15 * 1024 * 1024)) ]; then
pascal@474 930 cat <<EOT
paul@477 931 This floppy set breaks the 15MB limit ($sz bytes).
paul@512 932 It may not be able to complete the boot process.
pascal@474 933 EOT
pascal@474 934 fi
pascal@474 935 fi
pascal@474 936 ;;
pascal@264 937 install)
pascal@264 938 DIR=/tmp/mkbootfloppy$$
pascal@264 939 mkdir -p $DIR
pascal@264 940 DEVICE=$4
pascal@264 941 file=$5
pascal@264 942 case "$3" in
pascal@474 943 dialog*)
pascal@474 944 shift 2
pascal@474 945 $@
pascal@474 946 ;;
pascal@274 947 grub*)
pascal@264 948 mkdir -p $DIR/boot/grub
pascal@274 949 [ -f /usr/share/boot/btmgr -a -f /usr/share/boot/memdisk.lzma ] \
pascal@264 950 && cat /usr/share/boot/btmgr /dev/zero | \
pascal@264 951 dd bs=18k count=80 | gzip -9 > \
pascal@264 952 $DIR/boot/btmgr.gz \
pascal@264 953 && unlzma -c /usr/share/boot/memdisk.lzma > \
pascal@264 954 $DIR/boot/memdisk
pascal@382 955 [ -f /usr/share/boot/plpbt.bin ] \
pascal@382 956 && cp /usr/share/boot/plpbt.bin $DIR/boot
pascal@274 957 [ -f /usr/share/boot/etherboot ] \
pascal@264 958 && cp /usr/share/boot/etherboot $DIR/boot
pascal@264 959 [ -f /boot/gpxe ]\
pascal@264 960 && cp /boot/gpxe $DIR/boot
pascal@274 961 [ -f /usr/share/boot/memtest.lzma -a \
pascal@274 962 -f /usr/share/boot/memdisk.lzma ] \
pascal@274 963 && unlzma -c /usr/share/boot/memtest.lzma | \
pascal@274 964 cat - /dev/zero | dd bs=18k count=80 | \
pascal@274 965 gzip -9 > $DIR/boot/memtest.gz \
pascal@274 966 && unlzma -c /usr/share/boot/memdisk.lzma > \
pascal@274 967 $DIR/boot/memdisk
pascal@274 968 install_grub $DIR $3
pascal@264 969 ;;
pascal@264 970 *)
pascal@264 971 case "$file" in
pascal@264 972 *.lzma) action="unlzma -c";;
pascal@264 973 *.gz) action="zcat";;
pascal@264 974 *) action="cat";;
pascal@264 975 esac
pascal@264 976 case "$DEVICE" in
pascal@264 977 /dev/*) $action $file > $DEVICE;;
pascal@274 978 flopp*) $action $file | cat - /dev/zero | \
pascal@274 979 dd bs=18k count=80 > boot.fd;;
pascal@264 980 cdrom*)
pascal@264 981 mkdir -p $DIR/boot/grub
pascal@264 982 case "$3" in
pascal@382 983 btmgr|memtest)
pascal@264 984 $action $file | cat - /dev/zero | \
pascal@264 985 dd bs=18k count=80 | \
pascal@264 986 gzip -9 > $DIR/boot/$3.gz
pascal@264 987 unlzma -c /usr/share/boot/memdisk.lzma \
pascal@264 988 > $DIR/boot/memdisk
pascal@274 989 cat > /tmp/floppybox.grub.menu << EOT
pascal@274 990 # grub menu
pascal@264 991 timeout 0
pascal@264 992 title $3
pascal@264 993 kernel /boot/memdisk floppy c=80 h=2 s=18
pascal@264 994 initrd /boot/$3.gz
pascal@264 995 EOT
pascal@264 996 ;;
pascal@264 997 *) $action $file > $DIR/boot/$3
pascal@274 998 cat > /tmp/floppybox.grub.menu << EOT
pascal@274 999 # grub menu
pascal@264 1000 timeout 0
pascal@264 1001 title $3
pascal@264 1002 kernel /boot/$3
pascal@264 1003 EOT
pascal@264 1004 ;;
pascal@264 1005 esac
pascal@274 1006 install_grub $DIR grub
pascal@264 1007 ;;
pascal@264 1008 esac
pascal@264 1009 ;;
pascal@264 1010 esac
pascal@264 1011 rm -rf $DIR
pascal@264 1012 ;;
pascal@220 1013 get-plop)
pascal@382 1014 mkdir -p /tmp/get-plop$$
pascal@382 1015 PLOP_URL=http://mirror.slitaz.org/boot/plpbt.bin
pascal@382 1016 wget -O - $PLOP_URL > /tmp/get-plop$$/plpbt.bin
pascal@382 1017 VERSION="$(strings /tmp/get-plop$$/plpbt.bin \
pascal@382 1018 | grep 'Boot Manager v' | sed 's/.* v\([0-9\.]*\) .*/\1/')"
pascal@382 1019 mkdir -p $(dirname /tmp/get-plop$$/plop-$VERSION/fs/$3)
pascal@382 1020 mv /tmp/get-plop$$/plpbt.bin \
pascal@382 1021 /tmp/get-plop$$/plop-$VERSION/fs/$3
pascal@285 1022 if [ -s /tmp/get-plop$$/plop-$VERSION/fs/$3 ]; then
pascal@285 1023 cat > /tmp/get-plop$$/plop-$VERSION/receipt <<EOT
pascal@220 1024 PACKAGE="plop"
pascal@285 1025 VERSION="$VERSION"
pascal@220 1026 CATEGORY="non-free"
pascal@220 1027 SHORT_DESC="Plop boot manager."
pascal@220 1028 WEB_SITE="http://www.plop.at/en/bootmanager.html"
pascal@220 1029 EOT
pascal@285 1030 ( cd /tmp/get-plop$$ ; tazpkg pack plop-$VERSION )
pascal@285 1031 tazpkg install /tmp/get-plop$$/plop-$VERSION.tazpkg
pascal@264 1032 fi
pascal@220 1033 rm -rf /tmp/get-plop$$
pascal@220 1034 ;;
pascal@214 1035 *) echo "Invalid command $0 $@" 1>&2
pascal@214 1036 exit 1;;
pascal@214 1037 esac
pascal@214 1038 exit 0
pascal@214 1039 fi
pascal@214 1040
pascal@213 1041 if [ -z "$XAUTHORITY" ]; then
pascal@213 1042
pascal@213 1043 : ${DIALOG=dialog}
pascal@213 1044
pascal@213 1045 DEVICE=/dev/fd0
pascal@474 1046 list_floppy check || DEVICE="floppy"
pascal@213 1047 while true; do
pascal@213 1048 exec 3>&1
pascal@213 1049 ID_SOURCE=`$DIALOG --title " Choose a boot floppy " \
pascal@213 1050 --backtitle "Boot Floppy Creation on $DEVICE" --clear \
pascal@213 1051 --extra-button --extra-label "Change floppy" \
pascal@213 1052 --colors --radiolist "
paul@317 1053 Create a floppy or a cdrom to boot a LiveCD in a PXE network...
pascal@264 1054 May need a floppy disk in drive. Erase the whole floppy disk.
pascal@213 1055 " 18 70 50\
pascal@474 1056 FloppySet "Boot Slitaz with floppies only." on \
pascal@474 1057 SmartBtmgr "Boot any partition or ATAPI CD-ROM." off \
pascal@382 1058 Plop "Boot USB harddisk floppy or CD/DVD." off \
pascal@220 1059 Etherboot "Replacement for proprietary PXE ROMs." off \
pascal@223 1060 gPXE "Boot from http://boot.slitaz.org/" off \
pascal@220 1061 Memtest86+ "Memory failures detection tool." off \
paul@333 1062 Grub4DOS "Enhanced grub version supporting NTFS." off \
pascal@474 1063 Grub "Boot loader with command shell." off \
pascal@474 1064 2>&1 1>&3`
pascal@213 1065 retval=$?
pascal@213 1066 exec 3>&-
pascal@213 1067 check_retval
pascal@213 1068 if [ "$retval" = "3" ]; then
pascal@213 1069 select_floppy
pascal@213 1070 continue;
pascal@213 1071 fi
pascal@213 1072 while read key file pkg; do
pascal@213 1073 [ "$key" = "$ID_SOURCE" ] || continue
pascal@213 1074 if [ ! -f "$file" ]; then
pascal@213 1075 $DIALOG --title " Install package " --colors \
pascal@213 1076 --backtitle "Boot Floppy Creation" --clear \
pascal@213 1077 --yes-label "Install" \
pascal@213 1078 --no-label "Quit" \
pascal@213 1079 --yesno "The package $pkg is not yet installed. Install it ?" 18 70
pascal@213 1080 retval=$?
pascal@220 1081 if [ "$pkg" = "plop" ]; then
pascal@220 1082 bootfloppybox call get-plop $file
pascal@220 1083 else
pascal@264 1084 tazpkg get-install $pkg
pascal@220 1085 fi
pascal@213 1086 fi
pascal@264 1087 bootfloppybox call install "$pkg" "$DEVICE" "$file"
pascal@213 1088 exit 0
pascal@213 1089 done <<EOT
pascal@474 1090 FloppySet /bin/dd dialogfloppyset
pascal@213 1091 SmartBtmgr /usr/share/boot/btmgr btmgr
pascal@382 1092 Plop /usr/share/boot/plpbt.bin plop
pascal@213 1093 Etherboot /usr/share/boot/etherboot etherboot
pascal@222 1094 gPXE /boot/gpxe gpxe
pascal@213 1095 Memtest86+ /usr/share/boot/memtest.lzma memtest
pascal@274 1096 Grub4DOS /usr/share/boot/grldr.lzma grub4dos
pascal@213 1097 Grub /usr/sbin/grub grub
pascal@213 1098 EOT
pascal@213 1099 done
pascal@213 1100 fi
pascal@264 1101 #
pascal@264 1102 # Describe gPXE arguments.
pascal@264 1103 #
pascal@264 1104 export HELP='
pascal@264 1105 <window title="gPXE forced url" icon-name="gtk-floppy">
pascal@264 1106 <vbox>
pascal@474 1107 <text use-markup="true">
pascal@264 1108 <label>"
pascal@264 1109 <b>Web boot parameters</b>"
pascal@264 1110 </label>
pascal@264 1111 </text>
pascal@264 1112 <frame>
pascal@264 1113 <text wrap="true" width-chars="58" use-markup="true">
pascal@264 1114 <label>
paul@333 1115 "Without parameters (i.e. with an empty Boot URL) gPXE will perform a normal PXE boot: IP configuration with DHCP and download the DHCP bootfile with TFTP.
pascal@264 1116
paul@317 1117 You can override the DHCP bootfile with a Boot URL such as <i>tftp://192.168.0.1/pxe/pxeloader</i>, <i>http://mirror.slitaz.org/pxe/pxelinux.0</i>, or <i>x-tftm://192.168.0.201//lts/vmlinuz.ltsp</i>.
pascal@264 1118
paul@333 1119 You can override IP configuration too (useful without a DHCP server), example: <i>ip=192.168.0.10/24 gw=192.168.0.1 dns=192.168.0.1 nodhcp url=http://mirror.slitaz.org/pxe/pxelinux.0</i>
pascal@264 1120
paul@317 1121 The <i>nodhcp</i> keyword avoids dhcp timeouts and the <i>url=</i> keyword is optional when the url is the only one argument.
pascal@337 1122
paul@350 1123 Comma separated URL lists are supported. The PXE client will try to load the first URL. If the load fails, it will try the next URL, and so on.
pascal@264 1124 "
pascal@264 1125 </label>
pascal@264 1126 </text>
pascal@264 1127 </frame>
pascal@264 1128 </vbox>
pascal@264 1129 </window>
pascal@264 1130 '
pascal@264 1131 #
pascal@130 1132 # Write bootfloppy image to floppy device.
pascal@130 1133 #
pascal@130 1134 BOOT_DIALOG='
pascal@139 1135 <window title="bootfloppybox" icon-name="gtk-floppy">
pascal@130 1136 <vbox>
pascal@130 1137
pascal@130 1138 <text use-markup="true">
pascal@130 1139 <label>
pascal@130 1140 "
pascal@130 1141 <b>SliTaz - Bootfloppybox</b>"
pascal@130 1142 </label>
pascal@130 1143 </text>
pascal@134 1144 <text wrap="false" width-chars="44" use-markup="true">
pascal@130 1145 <label>
pascal@130 1146 "
paul@333 1147 Create a floppy or a cdrom to boot a LiveCD in a PXE network or the WEB...
pascal@264 1148 May need a floppy disk in drive. Erase the whole floppy disk.
pascal@130 1149 "
pascal@130 1150 </label>
pascal@130 1151 </text>
pascal@130 1152
pascal@130 1153 <frame Floppy disk drive>
pascal@130 1154 <hbox>
pascal@130 1155 <text use-markup="true">
pascal@132 1156 <label>"<b>Device : </b>"</label>
pascal@130 1157 </text>
pascal@264 1158 <combobox>
pascal@264 1159 <variable>DEVICE</variable>'
pascal@474 1160 FLOPPY_DEV=""
pascal@474 1161 for i in $(list_floppy); do
pascal@474 1162 FLOPPY_DEV="$FLOPPY_DEV
pascal@474 1163 <item>/dev/$i</item>"
pascal@264 1164 done
pascal@474 1165 BOOT_DIALOG="$BOOT_DIALOG$FLOPPY_DEV
pascal@474 1166 <item>floppy image (boot.fd)</item>
paul@333 1167 <item>cdrom image (boot.iso)</item>
pascal@474 1168 </combobox>"
pascal@474 1169 if [ -n "$FLOPPY_DEV" ]; then
pascal@474 1170 tmp='
pascal@132 1171 <button>
pascal@132 1172 <label>Format floppy</label>
pascal@330 1173 <input file icon="media-floppy"></input>
pascal@264 1174 <action>case "$DEVICE" in /dev/*) fdformat -n $DEVICE;; esac</action>
pascal@474 1175 </button>'
pascal@474 1176 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@474 1177 fi
pascal@474 1178 tmp='
pascal@130 1179 </hbox>
pascal@130 1180 </frame>
pascal@474 1181 <notebook labels="Set|LiveCD|USB|PXE Network|WEB Network|Memory Test|Windows|Expert">
pascal@474 1182 <frame Boot floppy set (many floppies)>
pascal@474 1183 <vbox>
pascal@474 1184 <hbox>
pascal@474 1185 <text wrap="true" width-chars="58" use-markup="true">
pascal@474 1186 <label>
pascal@474 1187 "
paul@477 1188 Only people without a CD-ROM, USB and Network should use a floppy set.
pascal@474 1189 The images are built from an ISO boot or from a Linux kernel, an initramfs
paul@477 1190 and a boot command line. Non Slitaz boot floppy sets are limited to 15MB.
pascal@474 1191 "
pascal@474 1192 </label>
pascal@474 1193 </text>
pascal@474 1194 </hbox>
pascal@474 1195 <hbox>
pascal@474 1196 <button>
pascal@474 1197 <label>Create image set</label>
pascal@474 1198 <input file icon="forward"></input>
pascal@474 1199 <action type="launch">IMAGE_SET</action>
pascal@474 1200 </button>
pascal@474 1201 </hbox>
pascal@474 1202 </vbox>
pascal@474 1203 </frame>
pascal@130 1204 '
pascal@264 1205 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@130 1206 while read name file pkg desc; do
pascal@474 1207 tmp="<frame $name (single floppy)>
pascal@130 1208 <hbox>
pascal@474 1209 <text wrap=\"true\" width-chars=\"58\" use-markup=\"true\">
pascal@130 1210 <label>
pascal@130 1211 \"
pascal@130 1212 $(echo -e $desc)
pascal@130 1213 \"
pascal@130 1214 </label>
pascal@130 1215 </text>
pascal@130 1216 </hbox>
pascal@264 1217 <hbox>
pascal@130 1218 "
pascal@130 1219 if [ -f $file ]; then
pascal@274 1220 if [ "$pkg" = "grub" -o "$pkg" = "grub4dos" ]; then
pascal@135 1221 tmp="$tmp
pascal@135 1222 <button>
pascal@200 1223 <label>Grub menu</label>
pascal@200 1224 <input file icon=\"accessories-text-editor\"></input>
pascal@274 1225 <action>bootfloppybox call mkmenu $pkg</action>
pascal@214 1226 <action type=\"lauch\">leafpad /tmp/floppybox.grub.menu</action>
pascal@200 1227 </button>
pascal@135 1228 "
pascal@267 1229 elif [ "$pkg" = "etherboot" ]; then
pascal@267 1230 tmp="$tmp
pascal@267 1231 <button>
pascal@267 1232 <input file icon=\"browser\"></input>
pascal@267 1233 <label>Wiki</label>
pascal@498 1234 <action>browser http://doc.slitaz.org/en:guides:pxe &</action>
pascal@267 1235 </button>
pascal@267 1236 "
pascal@233 1237 elif [ "$pkg" = "gpxe" ]; then
pascal@233 1238 tmp="$tmp
pascal@233 1239 <text wrap=\"true\" use-markup=\"true\">
pascal@233 1240 <label> \"<b>Boot URL:</b>\" </label>
pascal@233 1241 </text>
pascal@233 1242 <entry>
pascal@233 1243 <default>$(dd if=$file bs=1 skip=519 count=255 2>/dev/null | strings)</default>
pascal@233 1244 <variable>URL</variable>
pascal@233 1245 </entry>
pascal@264 1246 </hbox>
pascal@264 1247 <hbox>
pascal@267 1248 <button>
pascal@267 1249 <input file icon=\"browser\"></input>
pascal@267 1250 <label>Wiki</label>
pascal@498 1251 <action>browser http://doc.slitaz.org/en:guides:pxe &</action>
pascal@267 1252 </button>
pascal@264 1253 <button help>
pascal@264 1254 <action type=\"launch\">HELP</action>
pascal@264 1255 </button>
pascal@233 1256 <button>
pascal@233 1257 <label>Update</label>
pascal@233 1258 <input file icon=\"reload\"></input>
pascal@233 1259 <action>echo -n \"\$URL\" | cat - /dev/zero | dd conv=notrunc bs=1 count=255 seek=519 of=$file 2>/dev/null</action>
pascal@233 1260 </button>
pascal@264 1261 "
pascal@264 1262 fi
pascal@267 1263 receipt=/var/lib/tazpkg/installed/$pkg/receipt
pascal@267 1264 if [ -f $receipt ]; then
pascal@267 1265 . $receipt
pascal@267 1266 tmp="$tmp
pascal@267 1267 <button>
pascal@267 1268 <input file icon=\"browser\"></input>
pascal@267 1269 <label>Web</label>
pascal@496 1270 <action>browser $WEB_SITE &</action>
pascal@267 1271 </button>
pascal@267 1272 "
pascal@267 1273 fi
pascal@264 1274 tmp="$tmp
pascal@233 1275 <button>
pascal@233 1276 <label>Write floppy</label>
pascal@233 1277 <input file icon=\"forward\"></input>
pascal@264 1278 <action>bootfloppybox call install \"$pkg\" \"\$DEVICE\" \"$file\"</action>
pascal@233 1279 </button>
pascal@233 1280 </hbox>
pascal@233 1281 </frame>
pascal@233 1282 "
pascal@130 1283 else
pascal@264 1284 tmp2="tazpkg get-install $pkg --forced"
pascal@220 1285 [ "$pkg" = "plop" ] && tmp2="bootfloppybox call get-plop $file"
pascal@130 1286 tmp="$tmp
pascal@157 1287 <text wrap=\"true\" width-chars=\"34\" use-markup=\"true\">
pascal@130 1288 <label>
pascal@130 1289 \"<i>The package <b>$pkg</b> is not yet installed</i>\"
pascal@130 1290 </label>
pascal@130 1291 </text>
pascal@157 1292 <button>
pascal@157 1293 <input file icon=\"go-jump\"></input>
pascal@157 1294 <label>Install</label>
pascal@264 1295 <action>[ -f /var/lib/tazpkg/packages.list ] || tazpkg recharge</action>
pascal@264 1296 <action>xterm -fa MiscFixed -fs 11 -bg gray93 -fg black -geometry 80x17 -title \"$pkg install\" -e \"$tmp2 ; sleep 2\"</action>
pascal@221 1297 <action type=\"exit\">restart</action>
pascal@157 1298 </button>
pascal@130 1299 </hbox>
pascal@130 1300 </frame>
pascal@130 1301 "
pascal@130 1302 fi
pascal@130 1303 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@130 1304 done <<EOT
pascal@474 1305 SmartBtmgr /usr/share/boot/btmgr btmgr This OS independent Smart Boot Manager can boot \\\\nany partition or ATAPI CD-ROM.
pascal@474 1306 Plop /usr/share/boot/plpbt.bin plop This non free Boot Manager can boot a floppy disk, hardisk, USB or \\\\nCD/DVD. Hit Ctrl-ESC for text mode.
pascal@474 1307 Etherboot /usr/share/boot/etherboot etherboot This network bootloader provides a replacement \\\\nfor proprietary PXE or NBI ROMs.
pascal@233 1308 gPXE /boot/gpxe gpxe PXE / iSCSI / AoE network bootloader.
pascal@130 1309 Memtest86+ /usr/share/boot/memtest.lzma memtest Memory failures detection tool.
paul@333 1310 Grub4DOS /usr/share/boot/grldr.lzma grub4dos Enhanced grub version supporting NTFS.
paul@333 1311 Grub /usr/sbin/grub grub General purpose boot loader with command shell.
pascal@130 1312 EOT
pascal@130 1313 tmp='
pascal@134 1314 </notebook>
pascal@130 1315 <hbox>
pascal@474 1316 '
pascal@474 1317 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@474 1318 if [ -e /dev/cdrom ]; then
pascal@474 1319 tmp='
pascal@130 1320 <button>
pascal@330 1321 <input file icon="media-cdrom"></input>
pascal@330 1322 <label>Burn cdrom image</label>
pascal@330 1323 <action>burnbox</action>
pascal@330 1324 </button>
pascal@474 1325 '
pascal@474 1326 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@474 1327 fi
pascal@474 1328 if list_floppy check; then
pascal@474 1329 tmp='
pascal@330 1330 <button>
pascal@330 1331 <input file icon="media-floppy"></input>
pascal@330 1332 <label>Manage floppy image</label>
pascal@330 1333 <action type="launch">FLOPPY_IMAGE</action>
pascal@330 1334 </button>
pascal@474 1335 '
pascal@474 1336 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@474 1337 fi
pascal@474 1338 tmp='
pascal@330 1339 <button>
pascal@130 1340 <input file icon="exit"></input>
pascal@130 1341 <label>Exit</label>
pascal@130 1342 <action type="exit">Exit</action>
pascal@130 1343 </button>
pascal@130 1344 </hbox>
pascal@130 1345
pascal@130 1346 </vbox>
pascal@130 1347 </window>
pascal@130 1348 '
pascal@130 1349 BOOT_DIALOG="$BOOT_DIALOG$tmp"
pascal@130 1350 export BOOT_DIALOG
pascal@130 1351
pascal@130 1352 # Only root can create floppy.
pascal@130 1353 check_root
pascal@221 1354 gtkdialog --program=BOOT_DIALOG | grep -q 'EXIT="restart"' && continue
pascal@214 1355 rm -f /tmp/floppybox.grub.menu
pascal@130 1356 exit 0
pascal@221 1357 done