Move RAM check to linuxrc
[grml-live.git] / rewrite / linuxrc
1 #!/static/sh
2 # Filename: /linuxrc
3 # Purpose:  minirt for kernel 2.6 running on grml live-cd
4 # Authors:  (c) Klaus Knopper <knoppix@knopper.net>, (c) Michael Prokop <mika@grml.org>
5 # Latest change: Mon Apr 09 12:47:28 CEST 2007
6 #######################################################################################
7
8 # hardcoded configurable options
9 # Default maximum size of dynamic ramdisk in kilobytes
10 RAMSIZE=1000000
11 # End of options
12
13 # Don't allow interrupt signals
14 trap "" 1 2 3 15
15
16 # Misc functions
17 INSMOD="/static/insmod"
18 # [ -x /modules/insmod ] && INSMOD="/modules/insmod"
19
20 RMMOD="/static/rmmod"
21 # [ -x /modules/rmmod ] && RMMOD="/modules/rmmod"
22
23 # Builin filesystems
24 # BUILTIN_FS="iso9660 ext2 vfat"
25 BUILTIN_FS="iso9660 ext2 ext3 reiserfs vfat xfs jfs reiser4"
26
27 mountit(){
28 # Usage: mountit src dst "options"
29 for fs in $BUILTIN_FS; do
30  if test -b $1; then
31   options="$3"
32   case "$fs" in vfat)
33    # We REALLY need this for Knoppix on DOS-filesystems
34    shortname="shortname=winnt"
35    [ -n "$options" ] && options="$options,$shortname" || options="-o $shortname"
36   ;;
37   esac
38   mount -t $fs $options $1 $2 >/dev/null 2>&1 && return 0
39  fi
40 done
41 return 1
42 }
43
44 FOUND_SCSI=""
45 FOUND_GRML=""
46 INTERACTIVE=""
47
48 # Clean input/output
49 exec >/dev/console </dev/console 2>&1
50
51 # Mount /proc and /dev/pts
52 mount -t proc /proc /proc
53
54 # Disable kernel messages while probing modules in autodetect mode
55 echo "0" > /proc/sys/kernel/printk
56
57 mount -t devpts /dev/pts /dev/pts
58 # Kernel 2.6
59 mount -t sysfs /sys /sys >/dev/null 2>&1
60
61 # Read boot command line with builtin cat command (shell read function fails in Kernel 2.4.19-rc1)
62 CMDLINE="$(cat /proc/cmdline)"
63
64 # Simple shell grep
65 stringinfile(){
66   case "$(cat $2)" in *$1*) return 0;; esac
67   return 1
68 }
69
70 # same for strings
71 stringinstring(){
72   case "$2" in *$1*) return 0;; esac
73   return 1
74 }
75
76 # Reread boot command line; echo last parameter's argument or return false.
77 getbootparam(){
78   stringinstring " $1=" "$CMDLINE" || return 1
79   result="${CMDLINE##*$1=}"
80   result="${result%%[   ]*}"
81   echo "$result"
82   return 0
83 }
84
85 # Check boot commandline for specified option
86 checkbootparam(){
87   stringinstring " $1" "$CMDLINE"
88   return "$?"
89 }
90
91 if checkbootparam "nocolor" ; then
92   echo "Disabling colors in bootsequence as requested on commandline."
93   # Reset fb color mode
94   RESET="\e]R"
95   # ANSI COLORS
96   # Erase to end of line
97   CRE="\r\e[K"
98   # Clear and reset Screen
99   CLEAR="\ec"
100 else
101   # Reset fb color mode
102   RESET="\e]R"
103   # ANSI COLORS
104   # Erase to end of line
105   CRE="\r\e[K"
106   # Clear and reset Screen
107   CLEAR="\ec"
108   # Normal color
109   NORMAL="\e[0;39m"
110   # RED: Failure or error message
111   RED="\e[1;31m"
112   # GREEN: Success message
113   GREEN="\e[1;32m"
114   # YELLOW: Descriptions
115   YELLOW="\e[1;33m"
116   # BLUE: System mesages
117   BLUE="\e[1;34m"
118   # MAGENTA: Found devices or drivers
119   MAGENTA="\e[1;35m"
120   # CYAN: Questions
121   CYAN="\e[1;36m"
122   # BOLD WHITE: Hint
123   WHITE="\e[1;37m"
124 fi
125
126 # don't output anything if running with bootsplash feature
127 if checkbootparam "splash" ; then
128   echo ""
129   echo "${WHITE}Welcome to"
130   echo ""
131   echo "${RED}   ____ ____  __  __ _     "
132   echo "${RED}  / ___|  _ \|  \/  | |    "
133   echo "${RED} | |  _| |_) | |\/| | |    "
134   echo "${RED} | |_| |  _ <| |  | | |___ "
135   echo "${RED}  \____|_| \_\_|  |_|_____|"
136   echo ""
137   echo "${WHITE}grml.org - Linux for users of texttools and sysadmins."
138   echo "${NORMAL}"
139   exec >/dev/null </dev/null 2>&1
140 fi
141
142 # helper functions {{{
143 #log_success_msg () {
144 #  echo " * $@"
145 #}
146
147 log_failure_msg () {
148   echo " ${RED}*${NORMAL} $@"
149 }
150
151 #log_warning_msg () {
152 # echo " ${BLUE}*${NORMAL} $@"
153 #}
154
155 # int log_begin_message (char *message)
156 log_begin_msg () {
157   echo -n " ${GREEN}*${NORMAL} $@"
158 }
159
160 log_warn_msg () {
161   echo -n " ${YELLOW}*${NORMAL} $@"
162 }
163
164 # int log_end_message (int exitstatus)
165 SUCCESS=" ${BLUE}[ ${GREEN}ok ${BLUE}]${NORMAL}"
166 FAILED=" ${NORMAL}[${RED}fail${NORMAL}]"
167 # }}}
168
169 # Clear screen with colormode reset
170 # echo "$CLEAR$RESET"
171 # echo "$CLEAR"
172 # Just go to the top of the screen
173 # echo -n "\e[H\e[J"
174 DISTRI="$(getbootparam 'distri' 2>/dev/null)"
175 if [ -n "$DISTRI" ] ; then
176 SPLASH="
177 ${RED} $DISTRI
178
179 ${WHITE}based on grml.org.
180
181 ${NORMAL}"
182 else
183 SPLASH="
184 ${RED}   ____ ____  __  __ _
185 ${RED}  / ___|  _ \|  \/  | |
186 ${RED} | |  _| |_) | |\/| | |
187 ${RED} | |_| |  _ <| |  | | |___
188 ${RED}  \____|_| \_\_|  |_|_____|
189
190 ${WHITE}grml.org - Linux for users of texttools and sysadmins.
191
192 ${NORMAL}"
193 fi
194
195 echo ""
196 echo "${WHITE}Welcome to"
197 echo "$SPLASH"
198
199 # We need the builtin commands and /static only starting at this point
200 PATH=/static
201 export PATH
202
203 umask 022
204
205 case "$CMDLINE" in *debuglinuxrc*) set -x; echo "linuxrc debugging activated"; DEBUG="yes"; ;; esac
206 case "$CMDLINE" in *BOOT_IMAGE=expert\ *) INTERACTIVE="yes"; :>/interactive; ;; esac
207 case "$CMDLINE" in *BOOT_IMAGE=vmware\ *) VMWARE="yes"; ;; esac
208 case "$CMDLINE" in *modules-disk*) INTERACTIVE="yes"; ;; esac
209 case "$CMDLINE" in *BOOT_IMAGE=debug\ *|*\ debug\ *) DEBUG="yes"; ;; esac
210 case "$CMDLINE" in *secure*) SECURE=",nosuid"; ;; esac
211 # Does the user want to skip scsi detection?
212 NOSCSI=""
213 NOUSB=""
214 NOFIREWIRE=""
215 case "$CMDLINE" in *noscsi*|*nobootscsi*) NOSCSI="yes"; ;; esac
216 case "$CMDLINE" in *nousb\ *|*nobootusb*) NOUSB="yes"; ;; esac
217 case "$CMDLINE" in *nofirewire*|*nobootfirewire*) NOFIREWIRE="yes"; ;; esac
218 NOCD=""
219 case "$CMDLINE" in *fromhd*) NOCD="yes"; ;; esac
220 case "$CMDLINE" in *fromdvd*) FROMDVD="yes"; ;; esac
221 case "$CMDLINE" in *idecd*|*atapicd*) IDECD="yes"; ;; esac
222 case "$CMDLINE" in *noideraid*) NOIDERAID="yes"; ;; esac
223 USB2="ehci-hcd.ko"
224 case "$CMDLINE" in *nousb2*) USB2="" NOUSB2="yes"; ;; esac
225 case "$CMDLINE" in *\ usb*) USB="yes"; ;; esac
226
227 GRML_DIR="GRML"
228 GRML_NAME="GRML"
229 case "$CMDLINE" in *grml_dir=*) GRML_DIR="$grml_dir"; ;; esac
230 case "$CMDLINE" in *grml_name=*) GRML_NAME="$grml_name"; ;; esac
231
232 # NFS
233 for i in $cmdline; do case "$i" in nfsdir=*|NFSDIR=*) eval $i;; esac; done
234 [ -n "$nfsdir" ] && NFS="$nfsdir"
235
236 if [ -n "$DEBUG" ]; then
237    log_begin_msg "Bootoption debug detected. Printing kernel command line:"
238    echo ""
239    cat /proc/cmdline
240 fi
241
242 # check for available ram 
243 RAM=$(/static/awk '/MemTotal/{print $2}' /proc/meminfo)
244 log_begin_msg "${RAM} kB of RAM available"
245
246 case "$CMDLINE" in *small*) GRML_TYPE="small"; ;; esac
247
248 if [ "$GRML_TYPE" = "small" ]
249 then
250     if [[ $RAM -lt 25000 ]]
251     then 
252         log_end_msg "You need at least 32MB of RAM available for grml-small"
253         return 1
254     fi
255 else
256     if [[ $RAM -lt 58000 ]]
257     then
258         log_end_msg "You need at least 64Mb of RAM available for grml"
259         return 1
260     fi
261 fi
262
263 # Run a shell if in debug mode
264 # echo "${BLUE}Dropping you to a busybox shell for debugging.${NORMAL}"
265 stage=1
266 rundebugshell(){
267  if [ -n "$DEBUG" ]; then
268   log_begin_msg "Starting intermediate shell stage $stage as requested by \"debug\" option."
269   echo ""
270   echo "   ${GREEN}-${NORMAL} Just exit the shell to continue boot process...${NORMAL}"
271   if [ -x /static/sh ]; then
272     /static/sh
273   else
274     /bin/bash
275   fi
276  fi
277 }
278 rundebugshell
279
280 # Mount module disk
281 mountmodules(){
282 TYPE="$1"; shift
283 echo -n "${CRE}Please insert ${TYPE} modules disk and hit Return."
284 read a
285 echo -n "${CRE}Mounting ${TYPE} modules disk... "
286 # We always mount over /modules/scsi (because it's there ;-)
287 if mountit /dev/fd0 /modules/scsi "-o ro"; then
288 echo "${GREEN}OK.${NORMAL}"
289 return 0
290 fi
291 echo "${RED}NOT FOUND.${NORMAL}"
292 return 1
293 }
294
295 # Unmount module disk
296 umountmodules(){
297 TYPE="$1"; shift
298 echo -n "${CRE}Unmounting ${TYPE} modules disk... "
299 umount /modules/scsi 2>/dev/null
300 echo "${GREEN}DONE.${NORMAL}"
301 }
302
303 # Ask user for modules
304 askmodules(){
305  TYPE="$1"; shift
306  echo "${TYPE} modules available:${WHITE}"
307  c=""
308  for m in "$@"; do
309   if test -f "/modules/scsi/$m"; then
310    test -z "$c"  && { echo -n " $m"; c="1"; } || { echo "               $m"; c=""; }
311   fi
312  done
313  [ -n "$c" ] && echo ""
314  echo "Load ${TYPE} Modules?"
315  echo "[Enter full filename(s) (space-separated), Return for autoprobe, n for none] "
316  echo -n "insmod module(s)> "
317  read MODULES
318  case "$MODULES" in n|N) MODULES=""; ;; y|"")  MODULES="$*"; ;; esac
319 }
320
321 # Try to load the given modules (full path or current directory)
322 loadmodules(){
323  TYPE="$1"; shift
324  test -n "$INTERACTIVE" && echo "6" > /proc/sys/kernel/printk
325  echo ""
326  for i in "$@"; do
327   echo -n "   Probing ${TYPE}... ${WHITE}$i${NORMAL}: "
328    if test -f /modules/scsi/$i.ko && $INSMOD /modules/scsi/$i.ko >/dev/null 2>&1 && echo "  $SUCCESS" || echo " failed " ; then
329      case "$TYPE" in scsi|SCSI) FOUND_SCSI="yes"; ;; esac
330    fi
331  done
332  test -n "$INTERACTIVE" && echo "0" > /proc/sys/kernel/printk
333  echo -n "${CRE}"
334 }
335
336 # Check for SCSI, use modules on bootfloppy first
337 # Trying to do kind of /proc/pci hardware detection
338 if checkbootparam oldscsi ; then
339   PROCPCI="`cat /proc/pci 2>/dev/null`"
340   case "$PROCPCI" in *[Aa][Ii][Cc]-*|*[Aa][Hh][Aa]-*) SCSI_PROBE="$SCSI_PROBE aic7xxx" ;; esac
341   case "$PROCPCI" in *[Bb][Uu][Ss][Ll][Oo][Gg][Ii][Cc]*) SCSI_PROBE="$SCSI_PROBE BusLogic" ;; esac
342   case "$PROCPCI" in *[Tt][Rr][Mm]-[Ss]1040*|*[Dd][Cc]395*|*[Dd][Cc]315*) SCSI_PROBE="$SCSI_PROBE dc395x" ;; esac
343   case "$PROCPCI" in *53[Cc]8*) SCSI_PROBE="$SCSI_PROBE sym53c8xx" ;; esac
344   case "$PROCPCI" in *53[Cc]9*) SCSI_PROBE="$SCSI_PROBE NCR53C9x" ;; esac
345   case "$PROCPCI" in *53[Cc]406*) SCSI_PROBE="$SCSI_PROBE NCR53c406a" ;; esac
346   case "$PROCPCI" in *[Ii][Nn][Ii][Tt][Ii][Oo]\ *|*[Ii][Nn][Ii]-[Aa]100[Uu]2[Ww]*) SCSI_PROBE="$SCSI_PROBE initio" ;; esac
347   case "$PROCPCI" in *[Mm][Pp][Tt]*[Ss][Cc][Ss][Ii]*) SCSI_PROBE="$SCSI_PROBE mptbase mptscsih" ;; esac
348   case "$PROCPCI" in *[Aa][Dd][Vv][Aa][Nn][Cc][Ee][Dd]\ [Ss][Yy][Ss]*) SCSI_PROBE="$SCSI_PROBE advansys" ;; esac
349   case "$PROCPCI" in *[Aa][Tt][Pp]8*|*[Aa][Ee][Cc]6*) SCSI_PROBE="$SCSI_PROBE atp870u" ;; esac
350   case "$PROCPCI" in *[Dd][Tt][Cc]*) SCSI_PROBE="$SCSI_PROBE dtc" ;; esac
351   case "$PROCPCI" in *[Ee][Aa][Tt][Aa]*) SCSI_PROBE="$SCSI_PROBE eata" ;; esac
352   case "$PROCPCI" in *[Ff]*[Dd][Oo][Mm][Aa][Ii][Nn]*) SCSI_PROBE="$SCSI_PROBE fdomain" ;; esac
353   case "$PROCPCI" in *[Gg][Dd][Tt]\ *) SCSI_PROBE="$SCSI_PROBE gdth" ;; esac
354   case "$PROCPCI" in *[Mm][Ee][Gg][Aa][Rr][Aa][Ii][Dd]*) SCSI_PROBE="$SCSI_PROBE megaraid_mm megaraid_mbox" ;; esac
355   case "$PROCPCI" in *[Qq][Ll][Oo][Gg][Ii][Cc]*) SCSI_PROBE="$SCSI_PROBE qlogicfas408 qlogicfas qlogicfc" ;; esac
356   case "$PROCPCI" in *53[Cc]974*) SCSI_PROBE="$SCSI_PROBE tmscsim" ;; esac
357   case "$PROCPCI" in *[Uu][Ll][Tt][Rr][Aa][Ss][Tt][Oo][Rr]*) SCSI_PROBE="$SCSI_PROBE ultrastor" ;; esac
358   case "$PROCPCI" in *3[Ww][Aa][Rr][Ee]*) SCSI_PROBE="$SCSI_PROBE 3w-xxxx" ;; esac
359 fi
360
361 # New sysfs based SCSI detection (thanks, Jörg Schirottke)
362 sysfsscsi(){
363 SYS=$(for x in $(find /sys/devices/ -name modalias); do grep pci: $x 2>/dev/null; done|cut -f2 -d:)
364 while read id driver; do
365  for sysid in $SYS; do
366   case $sysid in $id)
367    if [ -z "$SCSI_PROBE" ]; then
368     SCSI_PROBE="$driver"
369    else
370     SCSI_PROBE="$SCSI_PROBE $driver"
371    fi
372    ;;
373   esac
374  done
375 done <<EOF
376 $(cat /modules/scsi/scsi-modules.txt)
377 EOF
378 }
379
380 if test -n "$INTERACTIVE"; then
381 # Let the user select interactively
382   askmodules SCSI $(cd /modules/scsi; echo *.ko)
383 else
384 # these are the autoprobe-safe modules
385   sysfsscsi
386   MODULES="$SCSI_PROBE"
387 fi
388
389 if test -z "$NOSCSI" ; then
390  log_begin_msg "Scanning for SCSI devices."
391  $INSMOD /modules/scsi/firmware_class.ko 1>/dev/null
392  test -n "$MODULES" && loadmodules SCSI $MODULES &&  echo -n "" || echo "           ${BLUE}[${NORMAL} none found ${BLUE}]${NORMAL} (try bootoption scsi=probe)"
393 else
394   log_warn_msg "Not scanning for SCSI devices as requested on commandline." && echo " $SUCCESS"
395 fi
396
397 if checkbootparam scsi ; then
398   MODULE="$(getbootparam 'scsi' 2>/dev/null)"
399   if test "$MODULE" = "probe" ; then
400     log_begin_msg "Bootoption scsi=probe found. Trying to autoprobe SCSI modules:"
401     echo ""
402     echo -n "   Trying to load scsi_debug: " ; $INSMOD /modules/scsi/scsi_debug.ko 1>/dev/null && echo "           $SUCCESS" || echo " [ failed ]"
403     for module in /modules/scsi/*.ko ; do
404       echo -n "   Probing ${WHITE}${module}${NORMAL}..."
405       $INSMOD ${module} >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
406     done
407   elif test "$MODULE" = "ask" ; then
408     askmodules SCSI $(cd /modules/scsi; echo *.ko)
409     test -z "$NOSCSI" && test -n "$MODULES" && loadmodules SCSI $MODULES
410   else
411     [ -n "$MODULE" ] || echo "   ${RED}Neither a specific module nor option probe nor option ask for SCSI module given. Skipping.${NORMAL}"
412     [ -n "$MODULE" ] && echo -n "   Trying to load module ${WHITE}${MODULE}${NORMAL}:" ; \
413       $INSMOD "/modules/scsi/${MODULE}.ko" 1>/dev/null && echo "  $SUCCESS" || echo " [ failed ]"
414   fi
415 fi
416 # End of SCSI check
417
418 if test -n "$VMWARE" ; then
419   log_begin_msg "Bootoption VMware detected. Trying to load SCSI modules:"
420   echo ""
421   for module in mptbase mptscsih mptspi BusLogic ; do
422     echo -n "   Trying to load ${WHITE}${module}${NORMAL}: "
423     $INSMOD /modules/scsi/${module}.ko >/dev/null 2>&1 && echo " $SUCCESS" || echo " [ failed ]"
424   done
425 fi
426
427 # Check for USB, use modules on bootfloppy first
428 if test -z "$NOUSB"; then
429   log_begin_msg "Checking for USB."
430   if test -f /modules/div/usbcore.ko; then
431     $INSMOD /modules/div/usbcore.ko >/dev/null 2>&1
432     FOUNDUSB=""
433     for i in $USB2 uhci-hcd.ko ohci-hcd.ko usbhid.ko ; do
434       test -f /modules/div/$i && $INSMOD /modules/div/$i >/dev/null 2>&1 && FOUNDUSB="yes"
435     done
436     if test -n "$FOUNDUSB"; then
437       test -f /modules/div/usb-storage.ko && $INSMOD /modules/div/usb-storage.ko >/dev/null 2>&1
438       echo "                   $SUCCESS"
439     else
440       echo "                   ${BLUE}[${NORMAL} not found ${BLUE}]${NORMAL}"
441       true
442     fi
443     if [ -n "$NOUSB2" ] ; then
444       echo "   Not loading usb2 module ehci-hcd as requested on commandline."
445       echo "   Notice: to skip loading of USB in initrd at all use bootoption nousb"
446     fi
447   fi
448 else
449   log_warn_msg "Not scanning for USB devices as requested on commandline." && echo " $SUCCESS"
450   echo "   Notice that bootoption nousb affects initrd only, it does *not*"
451   echo "   avoid loading of usb modules in userspace afterwards"
452   echo "   Boot using something like 'nousb blacklist=uhci-hcd' to avoid loading of usb modules at all"
453 fi
454 # End of USB check
455
456 # Check for Firewire, use modules on bootfloppy first
457 if test -z "$NOFIREWIRE" ; then
458   log_begin_msg "Checking for Firewire."
459   if test -f /modules/div/ieee1394.ko ; then
460     $INSMOD /modules/div/ieee1394.ko > /dev/null 2>&1
461     FOUNDFIREWIRE=""
462     test -f /modules/div/ohci1394.ko && $INSMOD /modules/div/ohci1394.ko > /dev/null 2>&1 && FOUNDFIREWIRE="yes"
463     if test -n "$FOUNDFIREWIRE" ; then
464       test -f /modules/div/sbp2.ko && $INSMOD /modules/div/sbp2.ko > /dev/null 2>&1
465       echo "              $SUCCESS"
466     else
467       echo "               ${BLUE}[${NORMAL} not found ${BLUE}]${NORMAL}"
468       true
469     fi
470   fi
471 else
472   log_warn_msg "Not scanning for firewire devices as requested on commandline." && echo " $SUCCESS"
473   echo "   Notice that bootoption nofirewire affects initrd only, it does *not*"
474   echo "   avoid loading of firewire modules in userspace afterwards"
475   echo "   Boot with something like 'nofirewire blacklist=ohci1394' to avoid loading of firewire modules at all"
476 fi
477 # End of FIREWIRE check
478
479 # Unfortunately, hotpluggable devices tend to need some time in order to register
480 if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then
481   log_begin_msg "Scanning for USB/Firewire devices."
482   sleep 4
483   if test -n "$USB"; then
484     sleep 10
485   fi
486  echo "  $SUCCESS"
487 fi
488
489 if checkbootparam scandelay ; then
490   DELAY="$(getbootparam 'scandelay' 2>/dev/null)"
491   [ -z $DELAY ] && DELAY='10'
492   log_begin_msg "Delaying bootsequence as requested for ${WHITE}${DELAY}${NORMAL} seconds."
493   sleep $DELAY && echo "  $SUCCESS"
494 fi
495
496 # boot via pcmcia
497 if checkbootparam bootpcmcia ; then
498   log_begin_msg "Bootoption bootpcmcia found. Trying to load ${WHITE}PCMCIA${NORMAL} modules..."
499   if $INSMOD /modules/div/pcmcia_core.ko 1>/dev/null ; then
500      $INSMOD /modules/div/firmware_class.ko 1>/dev/null && \
501      $INSMOD /modules/div/pcmcia.ko         1>/dev/null && \
502      $INSMOD /modules/div/rsrc_nonstatic.ko 1>/dev/null && \
503      $INSMOD /modules/div/yenta_socket.ko   1>/dev/null && echo " $SUCCESS"
504   else
505     echo " [ failed ]"
506   fi
507 fi
508
509 # Check for misc modules in expert mode
510 if test -n "$INTERACTIVE" ; then
511   another=""
512   answer=""
513   while test "$answer" != "n" -a "$answer" != "N" ; do
514     echo -n "${CYAN}Do you want to load additional modules from$another floppy disk? [${WHITE}Y${CYAN}/n] ${NORMAL}"
515     another=" another"
516     read answer
517     case "$answer" in n*|N*) break; ;; esac
518     if mountmodules new ; then
519        askmodules new $(cd /modules/scsi; echo *.ko)
520        test -n "$MODULES" && loadmodules new $MODULES
521        umountmodules current
522     fi
523   done
524 fi
525 # All interactively requested modules should be loaded now.
526
527 # Check for ide-scsi supported CD-Roms et al.
528 test -f /proc/scsi/scsi && FOUND_SCSI="yes"
529
530 # Disable kernel messages again
531 echo "0" > /proc/sys/kernel/printk
532
533 # We now enable DMA right here, for faster reading/writing from/to IDE devices
534 # in FROMHD or TORAM mode
535 case "$CMDLINE" in *\ nodma*) ;; *)
536  for d in $(cd /proc/ide 2>/dev/null && echo hd[a-z]); do
537   if test -d /proc/ide/$d; then
538     MODEL="$(cat /proc/ide/$d/model 2>/dev/null)"
539     test -z "$MODEL" && MODEL="[GENERIC IDE DEVICE]"
540     log_begin_msg "Enabling DMA acceleration for: ${MAGENTA}$d   ${YELLOW}[${MODEL}]${NORMAL}"
541     echo "using_dma:1" >/proc/ide/$d/settings && echo ""
542   fi
543  done
544  ;;
545 esac
546
547 stage=2
548 rundebugshell
549 if [ -n "$NFS" ]; then
550   tmp_="$(getbootparam nfsdir)"
551   log_begin_msg "Bootoption NFS found." ; echo "$SUCCESS"
552
553   /static/cdir
554
555   log_begin_msg "Trying to load network driver(s)." ; echo
556   modLoad()
557   {
558     for mod in $@ ; do
559       if [ -n "$DEBUG" ] ; then
560          echo "Debug: trying to load $mod:"
561          modprobe -v $mod
562       else
563          modprobe $mod 2>/dev/null
564       fi
565     done
566   }
567   # modules.alias and modules.dep are in place so USE IT :)!
568   find /sys/devices/ -name modalias |/static/xargs -r /static/grep -h pci: |while read i; do
569     modLoad "$i"
570   done
571   # loading additional modules
572   modLoad sunrpc lockd af_packet nfs
573
574   dhcp_iface_=$(getbootparam dhcp_iface)
575   if [ -z "$dhcp_iface_" ]; then
576         dhcp_iface_=`ifconfig -a | grep '^eth' | sed 's/ .*//'`
577   fi
578
579   # make sure we have a udhcpc executable, if it's not present
580   # assume that busybox provides one
581   if ! [ -x /static/udhcpc ] ; then
582      ln -s /static/busybox /static/udhcpc
583   fi
584
585   for INTERFACE in $dhcp_iface_ ; do
586       log_begin_msg "Requesting network configuration using udhcp for ${INTERFACE}:" ; echo
587       /static/timeout 10 /static/udhcpc --interface="${INTERFACE}" --foreground --quit --script=/static/udhcp-config.sh
588       # echo "press <enter> to start a system shell and configure your system"
589       # sh
590   done
591
592   # recreate dir layout + remove extra modules
593   /static/rdir
594
595   log_begin_msg "Looking for GRML in: ${MAGENTA}$NFS${NORMAL}" ; echo "$SUCCESS"
596   if mount -t nfs "$NFS" -o "async,ro,nolock" /cdrom #>/dev/null 2>&1
597     then
598     if test -f /cdrom/$GRML_DIR/$GRML_NAME
599       then
600       log_begin_msg "Accessing grml CDROM at ${MAGENTA}$NFS${NORMAL}" ; echo "$SUCCESS"
601       FOUND_GRML="$NFS"
602       break
603     fi
604   fi
605 fi
606
607 # Now that the right SCSI driver is (hopefully) loaded, try to find CD-ROM
608 grmlmount()
609 {
610   if test -z $NFS ; then
611     DEVICES="/dev/hd?"
612     test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
613     # New: Also try parallel port CD-ROMs
614     DEVICES="$DEVICES /dev/pcd?"
615     # New: also check HD partitions for a GRML/GRML image
616     # notice: use /dev/sd? for usb-sticks without partition(s)
617     test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd?[1-9] /dev/sd?[1-9][0-9] /dev/sd?"
618     DEVICES="$DEVICES /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
619     case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac
620     for i in $DEVICES ; do
621       log_begin_msg "${CRE} ${GREEN}*${NORMAL} Looking for CD-ROM in:    ${MAGENTA}$i${NORMAL}"
622       if mountit $i /cdrom "-o ro" >/dev/null 2>&1 ; then
623          echo "  $SUCCESS"
624          if test -f /cdrom/$GRML_DIR/$GRML_NAME ; then
625             log_begin_msg "Accessing grml CD-ROM at: ${MAGENTA}$i${NORMAL}" ; echo "  $SUCCESS"
626             FOUND_GRML="$i"
627             break
628          fi
629         umount /cdrom
630       fi
631     done
632   fi
633 }
634
635 # Rerun the grml-CDROM part 3 times at total
636 if ! grmlmount ; then
637    log_warning_msg "grml CD-ROM not yet found, sleeping for 5 seconds and trying again then."
638    sleep 5
639    if ! grmlmount ; then
640       log_warning_msg "grml CD-ROM still not yet found, sleeping for 5 more seconds and trying once more again."
641       sleep 5
642    fi
643 fi
644
645 # Harddisk-installed script part version has been removed
646 # (GRML can be booted directly from HD now).
647 mount_grml()
648 {
649   if test -n "$FOUND_GRML" -a -f $1/$GRML_DIR/$GRML_NAME; then
650     # echo "6" > /proc/sys/kernel/printk
651     mount -t squashfs $1/$GRML_DIR/$GRML_NAME /GRML -o loop,ro$SECURE || FOUND_GRML=""
652   fi
653 }
654
655 remount_grml()
656 {
657   if test -f $TARGET/$GRML_DIR/$GRML_NAME; then
658     umount /GRML # unmount it
659     umount $SOURCE  # unmount CD
660     [ -n "$SOURCE2" ] && umount $SOURCE2  # umount possible loop-device
661     mount_grml $TARGET
662   else
663     log_failure_msg "Warning: Changing to $TARGET failed."
664     return 1
665   fi
666
667   return 0
668 }
669
670 boot_from()
671 {
672   # preparations
673   /bin/mkdir $TARGET
674
675   SOURCE_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/bootfrom=/s/.*=//p' | /usr/bin/tail -1)
676
677   LOOP_DEV=$(echo $SOURCE_DEV | /usr/bin/gawk -F/ '{ print $1 "/" $2 "/" $3 }')
678   ISO_PATH=$(echo $SOURCE_DEV | /bin/sed "s|$LOOP_DEV||g" )
679   case "$ISO_PATH" in /*.[iI][sS][oO]) ;; *) ISO_PATH="" ;; esac
680   LOOP_SOURCE=""
681
682   # load filesystems
683   /GRML/sbin/modprobe fuse
684   /GRML/sbin/modprobe ntfs
685   $INSMOD /modules/div/ntfs.ko 1>/dev/null
686
687   if [ -n "$ISO_PATH" ]; then
688      LOOP_SOURCE="$TARGET.loop"
689      LOOP_SOURCE2="$LOOP_SOURCE"
690      TARGET_DEV="$LOOP_SOURCE$ISO_PATH"
691      /bin/mkdir $LOOP_SOURCE
692      /bin/mount -o ro $LOOP_DEV $LOOP_SOURCE || LOOP_SOURCE=""
693      /bin/mount -n -o loop $LOOP_SOURCE2$ISO_PATH $TARGET
694   else
695      TARGET_DEV="$SOURCE_DEV"
696     /bin/mount -n -o ro $SOURCE_DEV $TARGET
697   fi
698   if [ $? -ne 0 ]; then
699      [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
700      log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable."
701      sleep 2
702      return 1
703   fi
704
705   if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then
706     log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo "  $SUCCESS"
707   else
708     log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}"
709     [ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
710     umount $TARGET
711     sleep 2
712     return 1
713   fi
714   # remount the CD
715   remount_grml
716 }
717
718 copy_to()
719 {
720   # preparations
721   /bin/mkdir $TARGET
722   COPY="$SOURCE/$GRML_DIR"
723
724   # look if we copy to hd or to ram
725   SIZE="$(/usr/bin/du -s $COPY | /usr/bin/gawk '{print int($1*1.1)}')"
726   test -n "$SIZE" || SIZE="800000"
727
728   case "$1" in
729     ram)
730       TARGET_DEV="/dev/shm"
731       TARGET_DEV_DESC="ramdisk"
732       FOUNDSPACE="$(/usr/bin/gawk '/MemTotal/{print $2}' /proc/meminfo)"
733       /bin/mount -n -t tmpfs -o size=${SIZE}k $TARGET_DEV $TARGET
734     ;;
735     hd)
736       TARGET_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1)
737       TARGET_DEV_DESC="$TARGET_DEV"
738       # load filesystems
739       /GRML/sbin/modprobe fuse
740       /GRML/sbin/modprobe ntfs
741       FS="ext3 ext2 reiserfs reiser4 vfat ntfs"
742
743       MOUNTED=""
744       for i in $FS; do
745        if /GRML/bin/mount -o rw -t "$i" "$TARGET_DEV" "$TARGET"; then
746         MOUNTED="true"
747         break
748        fi
749       done
750       if test -z "$MOUNTED"; then
751         log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable."
752         sleep 2
753         return 1
754       fi
755       # check for enough free space
756       USED_SPACE=0
757       [ -f $TARGET/$GRML_DIR/$GRML_NAME ] && USED_SPACE=$(/usr/bin/du -s $TARGET/$GRML_DIR/$GRML_NAME | /usr/bin/gawk '{ print $1 }')
758       FOUNDSPACE="$(/bin/df -k $TARGET | /usr/bin/tail -1 | /usr/bin/gawk '{ print $4+int('$USED_SPACE') }')"
759    ;;
760    *)
761      return 1
762    ;;
763   esac
764
765   # sanity check
766
767   if [ $FOUNDSPACE -lt $SIZE ]
768   then
769     log_failure_msg "Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${NORMAL}. Found: ${MAGENTA}${FOUNDSPACE}k${NORMAL} Need: ${MAGENTA}${SIZE}k${NORMAL}"
770     sleep 2
771     umount $TARGET
772     return 1
773   fi
774
775   # do the real copy
776
777   log_begin_msg "Copying grml CD-ROM to ${TARGET_DEV_DESC}... Please be patient."
778   echo
779   if [ -z "$use_cp" -a -x /usr/bin/rsync ]
780   then
781     # first cp the small files
782     /usr/bin/rsync -a --exclude="$GRML_DIR/$GRML_NAME" $COPY $TARGET # Copy grml to $TARGET
783     # then the big file with nice progress meter
784     [ -f $TARGET/$GRML_DIR/$GRML_NAME ] && /bin/rm -f $TARGET/$GRML_DIR/$GRML_NAME
785     /usr/bin/rsync -a --progress --include="$GRML_DIR/$GRML_NAME" --include="$GRML_DIR/" --exclude="*" $COPY $TARGET # Copy grml to $TARGET
786     #/usr/bin/rsync -avP $COPY $TARGET # Copy grml to $TARGET
787     # make sure to support directories from http://grml.org/config/
788     for dir in scripts bootparams config debs ; do
789         if [ -d "/cdrom/$dir" ] ; then
790            log_begin_msg "Customization directory $dir found, copying to $TARGET"
791            cp -a /cdrom/$dir $TARGET/ && echo "$SUCCESS" || echo "$FAILED"
792         fi
793     done
794   else
795     /bin/cp -a -f $COPY $TARGET # Copy grml to $TARGET
796   fi
797   if [ $? -ne 0 ]
798   then
799     log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left."
800     sleep 2
801     return 1
802   fi
803   # remount r/o
804   /bin/mount -n -o remount,ro $TARGET 1>/dev/null 2>&1
805   remount_grml
806 }
807
808 mount_grml /cdrom
809
810 COPYTO=""
811 BOOTFROM=""
812 DO_REMOUNT=""
813 REAL_TARGET=""
814 UNIONFS=""
815
816 case "$CMDLINE" in *toram*) DO_REMOUNT="yes"; COPYTO="ram"; ;; esac
817 case "$CMDLINE" in *tohd=*) DO_REMOUNT="yes"; COPYTO="hd"; ;; esac
818 case "$CMDLINE" in *bootfrom=*) DO_REMOUNT="yes"; BOOTFROM="yes" ;; esac
819
820 # Remount later after copying/isoloading/driverloading?
821 # pre-test if everything succeeded
822 if  test -n "$DO_REMOUNT" -a -n "$FOUND_GRML" ; then
823   # copy library cache
824   cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
825   echo ""
826
827   SOURCE="/cdrom"
828   TARGET="/cdrom2"
829
830   # first copy_to, then boot_from
831   if [ -n "$COPYTO" ]; then
832      copy_to $COPYTO && REAL_TARGET="$TARGET"
833   fi
834   if [ -n "$BOOTFROM" ]; then
835      boot_from
836      if [ "$?" -eq "0" ]; then
837         # set new source / target paths
838         REAL_TARGET="$TARGET"
839         SOURCE2="$LOOP_SOURCE"
840         SOURCE="/cdrom2"
841         TARGET="/cdrom3"
842     fi
843   fi
844 fi
845
846 # Final test if everything succeeded.
847 if test -n "$FOUND_GRML" ; then
848 # copy library cache
849 cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
850
851 UNIONFS=""
852 if checkbootparam "unionfs" ; then
853    $INSMOD /modules/unionfs.ko 1>/dev/null
854    grep -q unionfs /proc/filesystems && UNIONFS=yes
855    unionfs='unionfs'
856    UNIONFS_FILETYPE='unionfs'
857    AUFS=''
858 else
859    $INSMOD /modules/aufs.ko 1>/dev/null
860    grep -q aufs /proc/filesystems && UNIONFS=yes
861    unionfs='unionfs (using aufs)'
862    UNIONFS_FILETYPE='aufs'
863    AUFS='yes'
864 fi
865
866 # Set paths
867 log_begin_msg "Setting paths"
868 PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:."
869 export PATH
870
871 # Make space: We don't need the modules anymore from here.
872 /GRML/bin/rm -rf /modules
873 # Debian weirdness
874 /GRML/bin/cp -a /GRML/etc/alternatives /etc/ 2>/dev/null
875
876 # Replace /sbin
877 /GRML/bin/rm -f /sbin
878 /GRML/bin/ln -sf /GRML/sbin /sbin
879
880 # From here, we should have all essential commands available.
881 hash -r
882
883 # Did we remount the source media?
884 if  test -n "$REAL_TARGET"; then
885   /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot
886 fi
887
888 # Clean up /etc/mtab (and - just in case - make a nice entry for looped ISO)
889 egrep " /GRML | /cdrom " /proc/mounts 2>/dev/null | sed 's|/dev/loop0 /cdrom \(.*\) 0 0|'$LOOP_SOURCE$ISO_PATH' /cdrom/ \1,loop=/dev/loop0 0 0|g' >> /etc/mtab
890
891 # Clean up /
892 /GRML/bin/rm -rf /modules /static
893 echo "                       $SUCCESS"
894
895 # New in Kernel 2.4.x: tempfs with variable ramdisk size.
896 # We check for available memory anyways and limit the ramdisks
897 # to a reasonable size.
898 FOUNDMEM="$(awk '/MemTotal/{print $2}' /proc/meminfo)"
899 TOTALMEM="$(awk 'BEGIN{m=0};/MemFree|Cached/{m+=$2};END{print m}' /proc/meminfo)"
900
901 # Be verbose
902 if [ -n "$FOUNDMEM" ] ; then
903    log_begin_msg "Total memory found: $FOUNDMEM kB" ; echo "       $SUCCESS"
904 else
905    log_failure_msg "Could not fetch memory information." ; echo "     $FAILED"
906 fi
907
908 # Now we need to use a little intuition for finding a ramdisk size
909 # that keeps us from running out of space, but still doesn't crash the
910 # machine due to lack of Ram
911
912 # Minimum size of additional ram partitions
913 MINSIZE=20000
914 # At least this much memory minus 30% should remain when home and var are full.
915 MINLEFT=16000
916 # Maximum ramdisk size
917 [ -n "$TOTALMEM" ] && MAXSIZE="$(/usr/bin/expr $TOTALMEM - $MINLEFT)"
918 # Default ramdisk size for ramdisk
919 [ -n "$TOTALMEM" ] && RAMSIZE="$(/usr/bin/expr $TOTALMEM / 5)"
920
921 # Create additional dynamic ramdisk.
922 test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
923 mkdir -p /ramdisk
924 # tmpfs/varsize version, can use swap
925 RAMSIZE=$(/usr/bin/expr $RAMSIZE \* 4)
926 log_begin_msg "Creating /ramdisk (dynamic size=${RAMSIZE}k) on shared memory"
927 # We need /bin/mount here for the -o size= option
928 /bin/mount -t tmpfs -o "size=${RAMSIZE}k" /ramdisk /ramdisk  && echo "$SUCCESS"
929 mkdir -p /ramdisk/tmp /ramdisk/home/grml && chmod 1777 /ramdisk/tmp && chown grml.grml /ramdisk/home/grml && ln -snf /ramdisk/home /home && /bin/mv /tmp /tmp.old && ln -s /ramdisk/tmp /tmp && rm -rf /tmp.old
930
931 stage=3
932 rundebugshell
933 # unionfs
934 log_begin_msg "Creating $unionfs and symlinks on ramdisk"
935 mkdir -p /UNIONFS
936 if test -n "$UNIONFS" && /bin/mount -t $UNIONFS_FILETYPE -o noatime${SECURE},dirs=/ramdisk=rw:/GRML=ro /UNIONFS /UNIONFS ; then
937  # check architecture
938  if [ -f /GRML/lib/ld-linux.so.2 ] ; then
939    LDLINUX=/GRML/lib/ld-linux.so.2
940    GRMLLIB=/GRML/lib
941  elif [ -f /GRML/lib64/ld-linux-x86-64.so.2 ] ; then
942    LDLINUX=/GRML/lib64/ld-linux-x86-64.so.2
943    EMUL='emul'
944    LIB64='lib64'
945    GRMLLIB=/GRML/lib64
946  fi
947  # We now have unionfs, copy some data from the initial ramdisk first
948  cp -a /etc/fstab /etc/auto.mnt /etc/filesystems /etc/mtab /UNIONFS/etc/
949  # disable resolvconf on the terminalserver client
950  if [ -n "$NFS" ] ; then
951     rm /UNIONFS/etc/resolv.conf
952     cp -a /etc/resolv.conf /UNIONFS/etc
953     echo REPORT_ABSENT_SYMLINK=no >> /UNIONFS/etc/default/resolvconf
954  fi
955  for i in bin boot etc sbin var opt root usr $EMUL $LIB64 lib ; do # Move directories to unionfs
956   if test -d /$i; then
957    /bin/mv /$i /$i.old && \
958    # /GRML/lib/ld-linux.so.2 --library-path /GRML/lib /GRML/bin/ln -snf /UNIONFS/$i /$i && \
959    $LDLINUX --library-path $GRMLLIB /GRML/bin/ln -snf /UNIONFS/$i /$i 1>/dev/null 2>/dev/null
960    rm -rf /$i.old
961   else
962    ln -snf /UNIONFS/$i /$i
963   fi
964  done
965  [ -n "$AUFS" ] && echo "    $SUCCESS" || echo "                 $SUCCESS"
966  log_begin_msg "Merging read-only system with read-writeable /ramdisk."
967  for i in $(cd /UNIONFS; echo *); do # Create links for new stuff on /UNIONFS
968    test "$i" = "home" -o "$i" = "tmp" && continue
969    test -L "/$i" || test -d "/$i" || test -f "/$i" || ln -snf "/UNIONFS/$i" /$i
970  done && echo "   $SUCCESS" || echo "   $FAILED"
971 else
972  echo ""
973  log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!"
974  echo "$FAILED"
975  sleep 2
976  echo "Can not continue booting, dropping you to a busybox shell."
977  stage=4
978  rundebugshell
979 fi
980
981 chown grml.grml /home/grml
982 # old:
983 # chmod 1777 /var/tmp
984 # new:
985 rm -rf /var/tmp/ ; mkdir /var/tmp ; chown root.root /var/tmp ; chmod 1777 /var/tmp
986
987 # Create empty utmp and wtmp
988 :> /var/run/utmp
989 :> /var/run/wtmp
990
991 # Make SURE that these are files, not links!
992 rm -rf /etc/ftpusers /etc/passwd /etc/shadow /etc/group \
993        /etc/ppp /etc/isdn /etc/ssh /etc/ioctl.save \
994        /etc/inittab /etc/network /etc/sudoers \
995        /etc/init /etc/localtime /etc/dhcpc /etc/pnm2ppa.conf 2>/dev/null
996 cp -a /GRML/etc/ftpusers /GRML/etc/passwd /GRML/etc/shadow /GRML/etc/group \
997       /GRML/etc/ppp /GRML/etc/isdn /GRML/etc/ssh \
998       /GRML/etc/inittab /GRML/etc/network /GRML/etc/sudoers \
999       /GRML/sbin/init /GRML/etc/dhcpc /etc/ 2>/dev/null
1000
1001 # Extremely important, init crashes on shutdown if this is only a link
1002 :> /etc/ioctl.save
1003 :> /etc/pnm2ppa.conf
1004 # Must exist for samba to work
1005 [ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
1006 # Diet libc bug workaround
1007 # cp -f /GRML/etc/localtime /etc/localtime
1008 # echo "${BLUE}Done.${NORMAL}"
1009
1010 # Now tell kernel where the real modprobe lives
1011 echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
1012
1013 # Change root device from /dev/fd0 to /dev/ram0
1014 echo "0x100" > /proc/sys/kernel/real-root-dev
1015
1016 /bin/umount /sys # (remount in grml-autoconfig)
1017
1018 stage=4
1019 rundebugshell
1020 # Give control to the init process.
1021 log_begin_msg "Starting init process. "
1022 [ -r /mountit ] && rm -f /mountit
1023 rm -f /linuxrc
1024 exit 0
1025
1026 else
1027  log_failure_msg "Error: Can't find grml filesystem, sorry."
1028  echo "
1029 Are you booting via USB or firewire?
1030 ====================================
1031 Try to boot with bootparam scandelay which delays the
1032 bootup sequence so modules should have enough time
1033 to initialize devices.
1034
1035 Usage examples on bootprompt of grml-iso:
1036
1037 grml scandelay       -> adds the default delay of 10 seconds
1038 grml scandelay=13    -> adds a delay of 13 seconds
1039
1040 Are you booting via SCSI?
1041 ====================================
1042 Use the bootparam scsi.
1043 Usage examples on bootprompt of grml-iso:
1044
1045 grml scsi=probe      -> autoprobing of scsi modules
1046 grml scsi=ask        -> list modules and prompt for module which should be loaded
1047 grml scsi=modulename -> loads specified module (without .ko extension)
1048 expert               -> activate expert mode, similar to scsi=ask
1049
1050 Are you getting SquashFS/zlib errors?
1051 =====================================
1052 Try to boot with \"grml nodma\"
1053
1054 Still problems?
1055 ===============
1056 Make sure the ISO itself is ok.
1057 Check the md5sum of downloaded ISO.
1058 Used a CD-RW? Make sure the medium is ok!
1059
1060 Please report any problems you notice to the grml-team!
1061 http://grml.org/contact/
1062 "
1063  echo "${RED}Now dropping you to the busybox shell.${NORMAL}"
1064  echo "${RED}Press reset button to quit.${NORMAL}"
1065  echo ""
1066  PS1="grml# "
1067  export PS1
1068  echo "6" > /proc/sys/kernel/printk
1069  # Allow signals
1070  trap 1 2 3 15
1071  exec /static/sh
1072 fi
1073 # EOF