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