Added support knoppix 5.0.1
authorPravin Shinde <pravin@black-perl.(none)>
Fri, 19 Jun 2009 14:26:29 +0000 (16:26 +0200)
committerPravin Shinde <pravin@black-perl.(none)>
Fri, 19 Jun 2009 14:26:29 +0000 (16:26 +0200)
37 files changed:
pxeknife/knoppix/5.0.1/README.txt [new file with mode: 0755]
pxeknife/knoppix/5.0.1/busybox [new file with mode: 0755]
pxeknife/knoppix/5.0.1/generate_minirt.sh [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/server/fusermount [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/server/httpfs [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/chmod [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/cp [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/ifconfig [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/ln [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/ls [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/mkdir [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/ping [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/ps [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/reboot [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/rm [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/udhcpc [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/udhcpc.sh [new file with mode: 0755]
pxeknife/knoppix/5.0.1/httpfs/static/wget [new file with mode: 0755]
pxeknife/knoppix/5.0.1/linux [new file with mode: 0755]
pxeknife/knoppix/5.0.1/linuxrc [new file with mode: 0755]
pxeknife/knoppix/5.0.1/minirt.gz_orig [new file with mode: 0755]
pxeknife/knoppix/5.0.1/modules/8139too.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/8390.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/af_packet.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/cloop.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/crc32c.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/e100.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/e1000.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/loop.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/mii.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/ne2k-pci.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/pcnet32.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/r8169.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/sis900.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/modules/via-rhine.ko [new file with mode: 0644]
pxeknife/knoppix/5.0.1/mount_http_iso.sh [new file with mode: 0755]
pxeknife/knoppix/knoppix.conf

diff --git a/pxeknife/knoppix/5.0.1/README.txt b/pxeknife/knoppix/5.0.1/README.txt
new file mode 100755 (executable)
index 0000000..ae37b7e
--- /dev/null
@@ -0,0 +1,3 @@
+You need to execute "generate_minirt24.sh" for generating minirt24.sh
+This script takes the vanila minirt24.sh_orig and does all needed changes,
+which are needed to make it able of booting over HTTP.
diff --git a/pxeknife/knoppix/5.0.1/busybox b/pxeknife/knoppix/5.0.1/busybox
new file mode 100755 (executable)
index 0000000..49c4bdb
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/busybox differ
diff --git a/pxeknife/knoppix/5.0.1/generate_minirt.sh b/pxeknife/knoppix/5.0.1/generate_minirt.sh
new file mode 100755 (executable)
index 0000000..243edc2
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/bash
+
+#cleanup the old mess
+echo "Removing the old files"
+rm -rf minitrt.gz minirt mpoint
+
+# create a copy of image to modify
+cp minirt.gz_orig minirt.gz
+gunzip minirt.gz
+e2fsck -f -y minirt
+resize2fs minirt 6m
+
+echo "Mounting the filesystem"
+mkdir mpoint
+mount minirt -o loop mpoint/
+
+echo "coping the needed files..."
+cp modules/* mpoint/modules/
+cp httpfs/static/udhcpc mpoint/static/
+cp httpfs/static/udhcpc.sh mpoint/static/
+cp busybox mpoint/static/
+
+cp httpfs/server/httpfs mpoint/static/
+cp httpfs/server/fusermount mpoint/static/
+cp linuxrc mpoint/
+cp mount_http_iso.sh mpoint/
+chmod 0777 mpoint/linuxrc 
+chmod 0777 mpoint/mount_http_iso.sh 
+#mknod mpoint/dev/fuse c 10 229
+
+echo "creating environment, creating links..."
+cd mpoint/static
+chmod 0777 *
+ln -s busybox halt
+ln -s busybox poweroff
+ln -s busybox route
+ln -s busybox ifconfig
+ln -s busybox ls
+ln -s busybox ln
+ln -s busybox chmod
+ln -s busybox reboot 
+ln -s busybox mkdir
+ln -s busybox cp
+ln -s busybox ps 
+ln -s busybox nc 
+ln -s busybox rm
+ln -s busybox wget
+ln -s busybox ping
+ln -s busybox dmesg 
+ln -s busybox dd 
+ln -s busybox mount
+ln -s busybox umount
+
+cd ..
+cd ..
+
+echo "un-mounting the filesystem"
+umount mpoint
+rmdir mpoint
+
+echo "Compressing the filesystem"
+gzip -9 minirt
+
+echo "Done, you can use minirt.gz"
+
+
diff --git a/pxeknife/knoppix/5.0.1/httpfs/server/fusermount b/pxeknife/knoppix/5.0.1/httpfs/server/fusermount
new file mode 100755 (executable)
index 0000000..c37325c
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/server/fusermount differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/server/httpfs b/pxeknife/knoppix/5.0.1/httpfs/server/httpfs
new file mode 100755 (executable)
index 0000000..df1b078
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/server/httpfs differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/chmod b/pxeknife/knoppix/5.0.1/httpfs/static/chmod
new file mode 100755 (executable)
index 0000000..b04de73
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/chmod differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/cp b/pxeknife/knoppix/5.0.1/httpfs/static/cp
new file mode 100755 (executable)
index 0000000..5140cd1
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/cp differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/ifconfig b/pxeknife/knoppix/5.0.1/httpfs/static/ifconfig
new file mode 100755 (executable)
index 0000000..7d3dfd6
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/ifconfig differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/ln b/pxeknife/knoppix/5.0.1/httpfs/static/ln
new file mode 100755 (executable)
index 0000000..d1585a1
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/ln differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/ls b/pxeknife/knoppix/5.0.1/httpfs/static/ls
new file mode 100755 (executable)
index 0000000..e465e66
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/ls differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/mkdir b/pxeknife/knoppix/5.0.1/httpfs/static/mkdir
new file mode 100755 (executable)
index 0000000..30c7172
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/mkdir differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/ping b/pxeknife/knoppix/5.0.1/httpfs/static/ping
new file mode 100755 (executable)
index 0000000..c759eac
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/ping differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/ps b/pxeknife/knoppix/5.0.1/httpfs/static/ps
new file mode 100755 (executable)
index 0000000..d1cd8c6
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/ps differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/reboot b/pxeknife/knoppix/5.0.1/httpfs/static/reboot
new file mode 100755 (executable)
index 0000000..20068b2
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/reboot differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/rm b/pxeknife/knoppix/5.0.1/httpfs/static/rm
new file mode 100755 (executable)
index 0000000..19982f0
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/rm differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/udhcpc b/pxeknife/knoppix/5.0.1/httpfs/static/udhcpc
new file mode 100755 (executable)
index 0000000..2d408a5
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/udhcpc differ
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/udhcpc.sh b/pxeknife/knoppix/5.0.1/httpfs/static/udhcpc.sh
new file mode 100755 (executable)
index 0000000..9a8437a
--- /dev/null
@@ -0,0 +1,18 @@
+#!/static/sh
+
+case "$1" in
+       renew|bound)
+               ifconfig $interface $ip up
+
+               if [ -n "$router" ] ; then
+                       for i in $router ; do
+                               route add -net 0.0.0.0 netmask 0.0.0.0 gw $i dev $interface
+                       done
+               fi
+               ;;
+       * )
+               ifconfig $interface 0.0.0.0
+               ;;
+esac
+
+exit 0
diff --git a/pxeknife/knoppix/5.0.1/httpfs/static/wget b/pxeknife/knoppix/5.0.1/httpfs/static/wget
new file mode 100755 (executable)
index 0000000..52b893c
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/httpfs/static/wget differ
diff --git a/pxeknife/knoppix/5.0.1/linux b/pxeknife/knoppix/5.0.1/linux
new file mode 100755 (executable)
index 0000000..ba10bdb
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/linux differ
diff --git a/pxeknife/knoppix/5.0.1/linuxrc b/pxeknife/knoppix/5.0.1/linuxrc
new file mode 100755 (executable)
index 0000000..0b1f7c6
--- /dev/null
@@ -0,0 +1,924 @@
+#!/static/sh
+#
+# KNOPPIX General Startup Script
+# (C) Klaus Knopper <knoppix@knopper.net>
+# License: GPL V2.
+#
+# This script needs some of the builtin ash commands (if, test, ...)
+# mount/umount, insmod/rmmod are also a builtin in ash-knoppix.
+#
+
+# Just informational: This is a CD or DVD edition
+MEDIUM="CD"
+
+# hardcoded configurable options
+# Default maximum size of dynamic ramdisk in kilobytes
+RAMSIZE=1000000
+# End of options
+
+# Don't allow interrupt signals
+trap "" 1 2 3 11 15
+
+MODULE_DIRS="/cdrom/KNOPPIX/modules /cdrom2/KNOPPIX/modules /modules"
+
+# "Safe" SCSI modules in the right order for autoprobe
+# Warning: The sym53c8xx.ko and g_NCR* cause a kernel Oops if no such adapter
+# is present.
+#
+# NB: It looks like that ncr53c8xx.ko is more stable than 53c7,8xx.ko for
+# a ncr53c810 controller (at least on my installation box it's more
+# immune to SCSI timeouts)
+# Removed 53c7,8xx -> crashes if no device attached.
+# Removed AM53C974 -> crashes tmscsim if adapter found
+# Added initio.ko on request (untested)
+#SCSI_MODULES="aic7xxx.ko aic7xxx_old.ko BusLogic.ko \
+#ncr53c8xx.ko NCR53c406a.ko \
+#initio.ko mptscsih.ko \
+#advansys.ko aha1740.ko aha1542.ko aha152x.ko \
+#atp870u.ko dtc.ko eata.ko fdomain.ko gdth.ko \
+#megaraid.ko pas16.ko pci2220i.ko pci2000.ko psi240i.ko \
+#qlogicfas.ko qlogicfc.ko qlogicisp.ko \
+#seagate.ko t128.ko tmscsim.ko u14-34f.ko ultrastor.ko wd7000.ko \
+#a100u2w.ko 3w-xxxx.ko"
+# Obsoleted by /proc/pci lookups
+
+# Misc functions
+
+
+# Dynamic program loader
+# /KNOPPIX is already mounted when this is used.
+DYNLOADER="/KNOPPIX/lib/ld-linux.so.2"
+
+# Builin filesystems
+BUILTIN_FS="iso9660 ext2 reiserfs vfat ntfs"
+
+mountit(){
+# Usage: mountit src dst "options"
+# Uses builtin mount of ash.knoppix
+for fs in $BUILTIN_FS; do
+ if test -b $1; then
+  options="$3"
+  case "$fs" in
+   vfat)
+    # We REALLY need this for Knoppix on DOS-filesystems
+    shortname="shortname=winnt"
+    [ -n "$options" ] && options="$options,$shortname" || options="-o $shortname"
+    ;;
+   ntfs)
+    ntfsopts="force,silent,umask=0,no_def_opts,allow_other,streams_interface=windows"
+    [ -n "$options" ] && ntfsopts="$options,$ntfsopts" || ntfsopts="-o $ntfsopts"
+    test -x /static/ntfs-3g && /static/ntfs-3g $1 $2 $ntfsopts >/dev/null 2>&1 && return 0
+    ;;
+  esac
+  mount -t $fs $options $1 $2 >/dev/null 2>&1 && return 0
+ fi
+done
+return 1
+}
+
+FOUND_SCSI=""
+FOUND_KNOPPIX=""
+INTERACTIVE=""
+HTTPFS=""
+
+# Clean input/output
+exec >/dev/console </dev/console 2>&1
+
+# Reset fb color mode
+RESET="\e]R"
+# ANSI COLORS
+# Erase to end of line
+CRE="\r\e[K"
+# Clear and reset Screen
+CLEAR="\ec"
+# Normal color
+NORMAL="\e[0;39m"
+# RED: Failure or error message
+RED="\e[1;31m"
+# GREEN: Success message
+GREEN="\e[1;32m"
+# YELLOW: Descriptions
+YELLOW="\e[1;33m"
+# BLUE: System mesages
+BLUE="\e[1;34m"
+# MAGENTA: Found devices or drivers
+MAGENTA="\e[1;35m"
+# CYAN: Questions
+CYAN="\e[1;36m"
+# BOLD WHITE: Hint
+WHITE="\e[1;37m"
+
+# Clear screen with colormode reset
+# echo "$CLEAR$RESET"
+# echo "$CLEAR"
+# Just go to the top of the screen
+# echo -n "\e[H\e[J"
+echo ""
+# Be verbose
+echo "${WHITE}Welcome to the ${CYAN}K${MAGENTA}N${YELLOW}O${WHITE}P${RED}P${GREEN}I${BLUE}X${WHITE} live GNU/Linux on ${MEDIUM}"'!'"${NORMAL}"
+echo ""
+echo ""
+
+# We only need the builtin commands and /static at this point
+PATH=/static
+export PATH
+
+umask 022
+
+# Mount /proc and /dev/pts
+mount -t proc /proc /proc
+
+# Disable kernel messages while probing modules in autodetect mode
+echo "0" > /proc/sys/kernel/printk
+
+# Kernel 2.6
+mount -t sysfs /sys /sys >/dev/null 2>&1
+
+# Read boot command line with builtin cat command (shell read function fails in Kernel 2.4.19-rc1)
+CMDLINE="$(cat /proc/cmdline)"
+
+# Check if we are in interactive startup mode
+case "$CMDLINE" in *BOOT_IMAGE=expert\ *) INTERACTIVE="yes"; :>/interactive; ;; esac
+case "$CMDLINE" in *modules-disk*) INTERACTIVE="yes"; ;; esac
+case "$CMDLINE" in *BOOT_IMAGE=debug\ *|*\ debug*) DEBUG="yes"; ;; esac
+# Does the user want to skip scsi detection?
+NOSCSI=""
+case "$CMDLINE" in *noscsi*|*nobootscsi*) NOSCSI="yes"; ;; esac
+case "$CMDLINE" in *nousb*|*nobootusb*) NOUSB="yes"; ;; esac
+case "$CMDLINE" in *nofirewire*|*nobootfirewire*) NOFIREWIRE="yes"; ;; esac
+NOCD=""
+case "$CMDLINE" in *fromhd*) NOCD="yes"; ;; esac
+case "$CMDLINE" in *fromdvd*) FROMDVD="yes"; ;; esac
+case "$CMDLINE" in *idecd*|*atapicd*) IDECD="yes"; ;; esac
+case "$CMDLINE" in *noideraid*) NOIDERAID="yes"; ;; esac
+USB2="ehci-hcd"
+case "$CMDLINE" in *nousb2*) USB2=""; ;; esac
+
+KNOPPIX_DIR="KNOPPIX"
+KNOPPIX_NAME="KNOPPIX"
+case "$CMDLINE" in *knoppix_dir=*) KNOPPIX_DIR="$knoppix_dir"; ;; esac
+case "$CMDLINE" in *knoppix_name=*) KNOPPIX_NAME="$knoppix_name"; ;; esac
+
+case "$CMDLINE" in *httpfs=*) HTTPFS="$httpfs"; ;; esac
+
+# Print kernel info
+read a b KERNEL relax >/dev/null 2>&1 </proc/version
+echo "${GREEN}Running Linux Kernel ${YELLOW}$KERNEL${GREEN}.${NORMAL}"
+
+# Get total ramsize, and available real ram in kB. We need this later.
+# Note that FREEMEM is incorrect, we should add MemCached,
+# but the difference should be minimal at this point.
+TOTALMEM=64000
+FREEMEM=32000
+while read info amount kb; do
+ case "$info" in 
+   MemTotal:)   test "$amount" -gt "0" >/dev/null 2>&1 && TOTALMEM="$amount";;
+   MemFree:)    test "$amount" -gt "0" >/dev/null 2>&1 && FREEMEM="$amount";;
+ esac
+done </proc/meminfo
+
+# Print meminfo.
+echo "${CRE}${BLUE}Total Memory available: ${YELLOW}${TOTALMEM}kB${BLUE}, Memory free: ${YELLOW}${FREEMEM}kB${BLUE}.${NORMAL}"
+
+# New in Knoppix 5.1: cloop preload cache
+# Default values
+case "$MEDIUM" in
+ *[Cc][Dd]*) CLOOP_PRELOAD="preload=64" ;;
+ *[Dd][Vv][Dd]*) CLOOP_PRELOAD="preload=128" ;;
+ *) CLOOP_PRELOAD="preload=32" ;;
+esac
+
+# cloop improves seek performance when caching the directory index
+# (first few MB) of each cloop file.
+# Default values depending on ramsize, override with cloop_preload=numblocks at boot.
+if test "$TOTALMEM" -lt 128000; then
+ # up to 128MB: No preload.
+ CLOOP_PRELOAD=""
+elif test "$TOTALMEM" -lt 256000; then
+ # less than 256MB: About 4MB preload w/ blocksize 128k
+ CLOOP_PRELOAD="preload=32"
+elif test "$TOTALMEM" -lt 512000; then
+ # less than 512MB: About 8MB preload w/ blocksize 128k
+ CLOOP_PRELOAD="preload=64"
+elif test "$TOTALMEM" -lt 1024000; then
+ # less than 1GB: About 16MB preload w/ blocksize 128k
+ CLOOP_PRELOAD="preload=128"
+else
+ # 1GB Ram or more
+ # About 32MB w/ blocksize 128k
+ CLOOP_PRELOAD="preload=256"
+fi
+
+case "$CMDLINE" in *\ nocache*|*\ nocloop_preload*|*\ nopreload*) CLOOP_PRELOAD="" ;; esac
+
+[ -n "$cloop_preload" ] && CLOOP_PRELOAD="preload=$cloop_preload"
+
+# Run a shell if in debug mode
+stage=1
+rundebugshell(){
+if [ -n "$DEBUG" ]; then
+echo "${CRE}${BLUE}Starting intermediate Shell stage $stage as requested by \"debug\" option.${NORMAL}"
+echo "${CRE}${BLUE}Type \"exit\" to continue with normal bootup.${NORMAL}"
+[ -x /static/ash ] && /static/ash || /bin/bash
+fi
+}
+
+# Mount module disk
+mountmodules(){
+TYPE="$1"; shift
+echo -n "${CRE}${CYAN}Please insert ${TYPE} modules disk and hit Return. ${NORMAL}"
+read a
+echo -n "${CRE}${BLUE}Mounting ${TYPE} modules disk... ${NORMAL}"
+# We always mount over /modules (because it's there ;-)
+if mountit /dev/fd0 /modules "-o ro"; then
+echo "${GREEN}OK.${NORMAL}"
+return 0
+fi
+echo "${RED}NOT FOUND.${NORMAL}"
+return 1
+}
+
+# Unmount module disk
+umountmodules(){
+TYPE="$1"; shift
+echo -n "${CRE}${BLUE}Unmounting ${TYPE} modules disk... ${NORMAL}"
+umount /modules 2>/dev/null
+echo "${GREEN}DONE.${NORMAL}"
+}
+
+# Ask user for modules
+askmodules(){
+TYPE="$1"; shift
+echo "${BLUE}${TYPE} modules available:${WHITE}"
+c=""; for m in "$@"; do
+if test -r "/modules/$m"; then
+test -z "$c"  && { echo -n "   $m"; c="1"; } || { echo "               $m"; c=""; }
+fi
+done
+[ -n "$c" ] && echo ""
+echo "${CYAN}Load ${TYPE} Modules?${NORMAL}"
+echo "${CYAN}[Enter full filename(s) (space-separated), Return for autoprobe, ${WHITE}n${CYAN} for none] ${NORMAL}"
+echo -n "${CYAN}insmod module(s)> ${NORMAL}"
+read MODULES
+case "$MODULES" in n|N) MODULES=""; ;; y|"")  MODULES="$*"; ;; esac
+}
+
+# Try to load the given module with optional parameters
+# module can be a full path or a module.ko name
+# (in which case $MODULE_DIRS is searched).
+# loadmodule module options...
+loadmodule() {
+ MODULE="$1"; shift
+ INSMOD=""
+ # Find insmod in CURRENT file system configuration
+ for p in $MODULE_DIRS /static; do
+  checkfor="$p/insmod"
+  if test -x "$checkfor"; then
+   INSMOD="$checkfor"; break
+  fi
+ done
+ # At last resort, try builtin insmod
+ test -z "$INSMOD" && INSMOD="insmod" # builtin insmod
+ LOAD=""
+ for p in $MODULE_DIRS; do
+  for ext in "" ".ko" ".o"; do
+   checkfor="$p/$MODULE$ext"
+   if test -r "$checkfor"; then
+    LOAD="$checkfor"
+    break 2
+   fi
+  done
+ done
+ test -n "$LOAD" || return 1
+ # Fork a new process to avoid crashing our main shell
+ echo "$INSMOD -f $LOAD" "$@" | /static/ash
+ return $?
+}
+
+# Load many modules at once
+# loadmodules TYPE(comment) module ...
+loadmodules(){
+ TYPE="$1"; shift
+ test -n "$INTERACTIVE" && echo "6" > /proc/sys/kernel/printk
+ for m in "$@"; do
+  echo -n "${CRE}${BLUE}Probing ${TYPE}... ${MAGENTA}$m${NORMAL}"
+  if loadmodule "$m" >/dev/null 2>&1; then
+   case "$TYPE" in scsi|SCSI) FOUND_SCSI="yes"; ;; esac
+  fi
+ done
+ test -n "$INTERACTIVE" && echo "0" > /proc/sys/kernel/printk
+ echo -n "${CRE}"
+}
+
+unloadmodule() {
+ MODULE="$1"
+ RMMOD=""
+ # Find rmmod in CURRENT file system configuration
+ for p in $MODULE_DIRS /static; do
+  checkfor="$p/rmmod"
+  if test -x "$checkfor"; then
+   RMMOD="$checkfor"; break
+  fi
+ done
+ # At last resort, try builtin rmmod
+ test -z "$RMMOD" && RMMOD="rmmod" # builtin rmmod
+ # For a new process to avoid crashing our main shell
+ echo "$RMMOD" "$MODULE" | /static/ash
+ return $?
+}
+
+# Check for SCSI, use modules on bootfloppy first
+ISA_SCSI="aha1740.ko aha1542.ko aha152x.ko pas16.ko psi240i.ko qlogicfas.ko qlogicfc.ko seagate.ko t128.ko u14-34f.ko wd7000.ko"
+SCSI_PROBE="$ISA_SCSI"
+# Trying to do kind of /proc/pci hardware detection
+# SCSI detection using /sys/devices
+for d in /sys/devices/*/*; do
+ if test -r "$d"/class -a -r "$d"/vendor -a -r "$d"/device; then
+  read CLASS  < "$d"/class 2>/dev/null
+  case "$CLASS" in 0x0100*) 
+   read VENDOR < "$d"/vendor 2>/dev/null
+   read DEVICE < "$d"/device 2>/dev/null
+   case "$VENDOR:$DEVICE" in
+    *1000:*00[0-2]?) SCSI_PROBE="$SCSI_PROBE sym53c8xx.ko" ;;
+    *1000:*040?|*1000:*196?|*101e:*196?|*1028:*000[ef]|*1028:*0013) SCSI_PROBE="$SCSI_PROBE megaraid_mbox.ko" ;;
+    *1000:*04[1-9]?|*1028:*0015) SCSI_PROBE="$SCSI_PROBE megaraid_sas.ko" ;;
+    *1001:*9100|*1101:*) SCSI_PROBE="$SCSI_PROBE initio.ko" ;;
+    *9004:*|*9005:*00??) SCSI_PROBE="$SCSI_PROBE aic7xxx.ko" ;;
+    *1011:*|*1028:*000[1-9a]|*9005:*02[08]?) SCSI_PROBE="$SCSI_PROBE aacraid.ko" ;;
+    *1014:*002e|*1014:*01bd|*9005:*0250) SCSI_PROBE="$SCSI_PROBE ips.ko" ;;
+    *1014:*0[1-2]8?|*1069:*|*9005:*0503) SCSI_PROBE="$SCSI_PROBE ipr.ko" ;;
+    *1022:*) SCSI_PROBE="$SCSI_PROBE tmscsim.ko" ;;
+    *1044:*) SCSI_PROBE="$SCSI_PROBE dpt_i2o.ko" ;;
+    *1077:*1???) SCSI_PROBE="$SCSI_PROBE qla1280.ko" ;;
+    *1077:*21??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2100.ko" ;;
+    *1077:*22??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2200.ko" ;;
+    *1077:*23[0-1]?) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2300.ko" ;;
+    *1077:*232?) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla2322.ko" ;;
+    *1077:*24??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko" ;;
+    *1077:*63??) SCSI_PROBE="$SCSI_PROBE qla2xxx.ko qla6312.ko" ;;
+    *10df:*) SCSI_PROBE="$SCSI_PROBE lpfc.ko" ;;
+    *10fc:*|*1145:*) SCSI_PROBE="$SCSI_PROBE nsp32.ko" ;;
+    *1101:*) SCSI_PROBE="$SCSI_PROBE a100u2w.ko" ;;
+    *1119:*|*8086:*) SCSI_PROBE="$SCSI_PROBE gdth.ko" ;;
+    *1191:*) SCSI_PROBE="$SCSI_PROBE atp870u.ko" ;;
+    *134a:*) SCSI_PROBE="$SCSI_PROBE dmx3191d.ko" ;;
+    *1de1:*) SCSI_PROBE="$SCSI_PROBE dc395x.ko" ;;
+    *9005:*8???) SCSI_PROBE="$SCSI_PROBE aic79xx.ko" ;;
+    *104b:*) SCSI_PROBE="$SCSI_PROBE BusLogic.ko" ;;
+    *1[0d]e1:*) SCSI_PROBE="$SCSI_PROBE dc395x.ko" ;;
+    *1000:*00[34]?) SCSI_PROBE="$SCSI_PROBE mptscsih.ko" ;;
+    *10cd:*) SCSI_PROBE="$SCSI_PROBE advansys.ko" ;;
+    *1191:*) SCSI_PROBE="$SCSI_PROBE atp870u.ko" ;;
+    *134a:*) SCSI_PROBE="$SCSI_PROBE dtc.ko" ;;
+    *1d44:*) SCSI_PROBE="$SCSI_PROBE eata.ko" ;;
+    *1036:*) SCSI_PROBE="$SCSI_PROBE fdomain.ko" ;;
+    *1256:*4201) SCSI_PROBE="$SCSI_PROBE pci2220i.ko" ;;
+    *1256:*5201) SCSI_PROBE="$SCSI_PROBE pci2000.ko" ;;
+    *1022:*) SCSI_PROBE="$SCSI_PROBE tmscsim.ko" ;;
+    *6356:*) SCSI_PROBE="$SCSI_PROBE ultrastor.ko" ;;
+    *13c1:*) SCSI_PROBE="$SCSI_PROBE 3w-xxxx.ko" ;;
+   esac
+   ;;
+  esac
+ fi
+done
+
+# Load fuse, we may need it to access ntfs filesystems
+loadmodule fuse >/dev/null 2>&1
+
+if test -n "$INTERACTIVE"; then
+ # Let the user select interactively
+ askmodules SCSI $(cd /modules; echo *.ko)
+else
+ # these are the autoprobe-safe modules
+ MODULES="$SCSI_PROBE"
+fi
+test -z "$NOSCSI" && test -n "$MODULES" && loadmodules SCSI $MODULES
+# End of SCSI check
+
+# Check for IDE-Raid devices
+if test -z "$NOIDERAID"; then
+ ( { loadmodule ataraid.ko && loadmodule silraid.ko; } || loadmodule medley.ko || loadmodule pdcraid.ko ) >/dev/null 2>&1
+fi
+# End of IDE-Raid check
+
+# Check for USB, use modules on bootfloppy first
+if test -z "$NOUSB"; then
+ echo -n "${CRE}${BLUE}Checking for USB...${NORMAL}"
+ if loadmodule usbcore.ko >/dev/null 2>&1; then
+  FOUNDUSB=""
+  for i in $USB2 uhci-hcd ohci-hcd; do
+   loadmodule $i >/dev/null 2>&1 && FOUNDUSB="yes"
+  done
+  if test -n "$FOUNDUSB"; then
+   loadmodule libusual.ko >/dev/null 2>&1
+   loadmodule ff-memless.ko >/dev/null 2>&1
+   loadmodule usbhid.ko >/dev/null 2>&1
+   loadmodule ub.ko >/dev/null 2>&1 || loadmodule usb-storage.ko >/dev/null 2>&1
+  else
+   # For an unknown reason, unloading usbcore hangs sometimes
+   # rmmod usbcore >/dev/null 2>&1
+   true
+  fi
+ fi
+ echo -n "${CRE}"
+fi
+# End of USB check
+
+# Check for Firewire, use modules on bootfloppy first
+if test -z "$NOFIREWIRE"; then
+ echo -n "${CRE}${BLUE}Checking for Firewire...${NORMAL}"
+ if loadmodule ieee1394.ko >/dev/null 2>&1; then
+  FOUNDFIREWIRE=""
+  for i in ohci1394.ko; do
+   echo -n "${CRE}${BLUE}Loading $i...${NORMAL}"
+   loadmodule "$i" >/dev/null 2>&1 && FOUNDFIREWIRE="yes"
+  done
+  if test -n "$FOUNDFIREWIRE"; then
+   echo -n "${CRE}${BLUE}Loading sbp2.ko...${NORMAL}"
+   loadmodule sbp2.ko serialize_io=1 >/dev/null 2>&1
+  else
+   # For an unknown reason, unloading ieee1394 hangs sometimes
+   # echo -n "${CRE}${BLUE}Unloading ieee1394...${NORMAL}"
+   # rmmod ieee1394 >/dev/null 2>&1
+   true
+  fi
+ fi
+ echo -n "${CRE}"
+fi
+# End of FIREWIRE check
+
+# Unfortunately, hotpluggable devices tend to need some time in order to register
+if test -n "$FOUNDUSB" -o -n "$FOUNDFIREWIRE"; then
+ echo -n "${CRE}${BLUE}Scanning for USB/Firewire devices... ${NORMAL}"
+ if test -n "$FOUNDFIREWIRE"; then
+  # Wait for driver to register
+  sleep 2
+  # Kernel 2.6 does this automatically
+  case "$(cat /proc/version 2>/dev/null)" in *version\ 2.6.*) ;; *) for host in 0 1 2 3 4 5 6 7; do for channel in 0 1; do for id in 0 1 2 3 4 5 6 7; do echo "scsi add-single-device $host $channel $id 0" >/proc/scsi/scsi 2>/dev/null; done; done; done ;; esac
+ fi
+ sleep 6
+ echo "${BLUE}Done.${NORMAL}"
+fi
+
+# Check for misc modules in expert mode
+if test -n "$INTERACTIVE"; then
+ another=""; answer=""
+ while test "$answer" != "n" -a "$answer" != "N"; do
+  echo -n "${CYAN}Do you want to load additional modules from$another floppy disk? [${WHITE}Y${CYAN}/n] ${NORMAL}"
+  another=" another"
+  read answer
+  case "$answer" in n*|N*) break; ;; esac
+  if mountmodules new; then
+   askmodules new $(cd /modules; echo *.ko)
+   test -n "$MODULES" && loadmodules new $MODULES
+   umountmodules current
+  fi
+ done
+fi
+# All interactively requested modules should be loaded now.
+
+# Give USB-Storage devices some more time to register
+if test -d /proc/scsi/usb-storage; then
+ echo -n "${CRE}${BLUE}Allowing slow USB-devices some more time to register...${NORMAL}"
+ ash -c "sleep 6"
+ echo "${BLUE}Ok.${NORMAL}"
+fi
+
+# Check for ide-scsi supported CD-Roms et al.
+test -r /proc/scsi/scsi && FOUND_SCSI="yes"
+
+# Disable kernel messages again
+echo "0" > /proc/sys/kernel/printk
+
+# We now enable DMA right here, for faster reading/writing from/to IDE devices
+# in FROMHD or TORAM mode
+case "$CMDLINE" in *\ nodma*) ;; *)
+ for d in $(cd /proc/ide 2>/dev/null && echo hd[a-z]); do
+ if test -d /proc/ide/$d; then
+  MODEL="$(cat /proc/ide/$d/model 2>/dev/null)"
+  test -z "$MODEL" && MODEL="[GENERIC IDE DEVICE]"
+  echo "${BLUE}Enabling DMA acceleration for: ${MAGENTA}$d     ${YELLOW}[${MODEL}]${NORMAL}"
+  echo "using_dma:1" >/proc/ide/$d/settings
+ fi
+ done
+ ;;
+esac
+
+#mounting iso image over HTTP.
+/mount_http_iso.sh $HTTPFS
+
+# test if knoppix is there
+
+if test -r /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME; then
+ echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$HTTPFS${GREEN}...${NORMAL}"
+ FOUND_KNOPPIX="HTTPFS"
+ break
+fi
+
+stage=1
+rundebugshell
+
+# Now that the right SCSI driver is (hopefully) loaded, try to find CDROM
+DEVICES="/dev/hd?"
+test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
+test -n "$FOUNDUSB$FOUNDFIREWIRE" -a -z "$NOCD" && DEVICES="/dev/sr? $DEVICES"
+# New: Also try parallel port CD-Roms [for Mike].
+DEVICES="$DEVICES /dev/pcd?"
+# New: also check HD partitions for a KNOPPIX/KNOPPIX image
+test -n "$FOUND_SCSI" -a -z "$NOSCSI" && DEVICES="$DEVICES /dev/sd? /dev/sd?[1-9] /dev/sd?[1-9][0-9]"
+DEVICES="$DEVICES /dev/ub?[1-9] /dev/ub?[1-9][0-9] /dev/ub? /dev/hd?[1-9] /dev/hd?[1-9][0-9]"
+case "$CMDLINE" in *fromhd=/dev/*) DEVICES="$fromhd"; ;; esac
+for i in $DEVICES; do
+ echo -n "${CRE}${BLUE}Looking for ${MEDIUM} in: ${MAGENTA}$i${NORMAL}   "
+ if mountit $i /cdrom "-o ro" >/dev/null 2>&1; then
+  if test -r /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME; then
+   echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$i${GREEN}...${NORMAL}"
+   FOUND_KNOPPIX="$i"
+   break
+  fi
+  umount /cdrom
+ fi
+done
+
+# Harddisk-installed script part version has been removed
+# (KNOPPIX can be booted directly from HD now).
+
+mount_knoppix()
+{
+ if test -n "$FOUND_KNOPPIX" -a -r "$1/$KNOPPIX_DIR/$KNOPPIX_NAME"; then
+  # Recheck for modules dir.
+  # If /cdrom/boot/modules is gone, try /cdrom/KNOPPIX/modules
+  # DEBUG
+  # echo "6" > /proc/sys/kernel/printk
+  loadmodule cloop.ko file="$1/$KNOPPIX_DIR/$KNOPPIX_NAME" $CLOOP_PRELOAD || \
+    loadmodule cloop.ko file="$1/$KNOPPIX_DIR/$KNOPPIX_NAME"
+  mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX=""
+  # Allow multi-image KNOPPIX mounts
+  if [ -n "$FOUND_KNOPPIX" -a -x "$DYNLOADER" -a -x /KNOPPIX/sbin/losetup ]; then
+   echo ""
+   echo -n "${CRE} ${GREEN}Found primary KNOPPIX compressed image at ${MAGENTA}$1/$KNOPPIX_DIR/$KNOPPIX_NAME${GREEN}.${NORMAL}"
+   for c in 1 2 3 4 5 6 7; do
+    if test -r "$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c"; then
+     if "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/sbin/losetup "/dev/cloop$c" "$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c"; then
+      if "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/mkdir -m 755 -p "/KNOPPIX$c"; then
+       if mountit "/dev/cloop$c" "/KNOPPIX$c" "-o ro"; then
+        echo ""
+        echo -n "${CRE} ${GREEN}Found additional KNOPPIX compressed image at ${MAGENTA}$1/$KNOPPIX_DIR/$KNOPPIX_NAME$c${GREEN}.${NORMAL}"
+       else
+        "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/rmdir "/KNOPPIX$c" 2>/dev/null
+       fi
+      else
+       "$DYNLOADER" --library-path /KNOPPIX/lib /KNOPPIX/bin/losetup -d "/dev/cloop$c" 2>/dev/null
+      fi
+     fi
+    fi
+   done
+   /KNOPPIX/bin/ln -snf /KNOPPIX/sbin /sbin && hash -r
+  fi
+ fi
+}
+
+remount_knoppix()
+{
+ if test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME; then
+  umount /KNOPPIX
+  for c in 0 1 2 3 4 5 6 7; do
+   umount "/$KNOPPIX_NAME$c" >/dev/null 2>&1
+  done
+  unloadmodule cloop # release CD
+  umount $SOURCE  # unmount CD
+  [ -n "$SOURCE2" ] && umount $SOURCE2  # umount possible loop-device
+  mount_knoppix $TARGET
+ else
+  echo "${CRE}${RED}Warning: Changing to $TARGET failed.${NORMAL}"
+  return 1
+ fi
+ return 0
+}
+
+boot_from()
+{
+ # preparations
+ /bin/mkdir $TARGET
+ SOURCE_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/bootfrom=/s/.*=//p' | /usr/bin/tail -1)
+ LOOP_DEV=$(echo $SOURCE_DEV | /usr/bin/gawk -F/ '{ print $1 "/" $2 "/" $3 }')
+ ISO_PATH=$(echo $SOURCE_DEV | /bin/sed "s|$LOOP_DEV||g" )
+ case "$ISO_PATH" in /*.[iI][sS][oO]) ;; *) ISO_PATH="" ;; esac
+ LOOP_SOURCE=""
+
+ # load filesystems
+ for i in reiserfs jbd ext3 ntfs fuse; do
+  /KNOPPIX/sbin/modprobe $i >/dev/null 2>&1
+ done
+ FS="reiserfs ext3 ntfs"
+ if [ -n "$ISO_PATH" ]; then
+  LOOP_SOURCE="$TARGET.loop"
+  LOOP_SOURCE2="$LOOP_SOURCE"
+  TARGET_DEV="$LOOP_SOURCE$ISO_PATH"
+  /bin/mkdir $LOOP_SOURCE
+  /KNOPPIX/sbin/modprobe loop
+  # Try out own mount first.
+  mountit $LOOP_DEV $LOOP_SOURCE "-o ro"
+  if [ "$?" != "0" ]; then
+   for i in $FS; do 
+    case "$i" in ntfs) PLAIN="-i" ;; *) PLAIN="" ;; esac
+    /bin/mount $PLAIN -o ro -t $i $LOOP_DEV $LOOP_SOURCE >/dev/null 2>&1 && break
+   done
+  fi
+  test "$?" = "0" || LOOP_SOURCE=""
+  /bin/mount -n -o loop $LOOP_SOURCE2$ISO_PATH $TARGET >/dev/null 2>&1
+ else
+  TARGET_DEV="$SOURCE_DEV"
+  mountit $SOURCE_DEV $TARGET "-o ro"
+  if [ "$?" != "0" ]; then
+   for i in $FS; do 
+    case "$i" in ntfs) PLAIN="-i" ;; *) PLAIN="" ;; esac
+    /bin/mount $PLAIN -n -o ro -t $i $SOURCE_DEV $TARGET >/dev/null 2>&1
+   done
+  fi
+ fi
+ if [ "$?" != "0" ]; then
+  [ -n "$LOOP_SOURCE" ] && { /bin/umount $LOOP_SOURCE || umount $LOOP_SOURCE; } >/dev/null 2>&1
+  echo -n "${CRE}${RED}Accessing KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV${RED} is not mountable.${NORMAL}"
+  sleep 2
+  return 1
+ fi
+ if test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME ; then
+  echo -n "${CRE}${GREEN}Accessing KNOPPIX ${MEDIUM} at ${MAGENTA}$TARGET_DEV${GREEN}...${NORMAL}"
+ else
+  echo -n "${CRE}${RED}Accessing KNOPPIX ${MEDIUM} failed. Could not find $KNOPPIX_DIR/$KNOPPIX_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}"
+  [ -n "$LOOP_SOURCE" ] && { /bin/umount -l $LOOP_SOURCE || umount $LOOP_SOURCE; } >/dev/null 2>&1
+  umount $TARGET
+  sleep 2
+  return 1
+ fi
+ # remount the CD 
+ remount_knoppix
+}
+
+copy_to()
+{
+ # preparations
+ /bin/mkdir $TARGET
+ COPY="$SOURCE/$KNOPPIX_DIR"
+ # look if we copy to hd or to ram
+ SIZE="$(/usr/bin/du -s $COPY | /usr/bin/gawk '{print int($1*1.1)}')"
+ test -n "$SIZE" || SIZE="800000"
+ case "$1" in 
+  ram)
+   TARGET_DEV="/dev/shm"
+   TARGET_DEV_DESC="ramdisk"
+   FOUNDSPACE="$(/usr/bin/gawk '/MemTotal/{print $2}' /proc/meminfo)"
+   /bin/mount -n -t tmpfs -o size=${SIZE}k $TARGET_DEV $TARGET
+  ;;
+  hd)
+   TARGET_DEV=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1)
+   TARGET_DEV_DESC="$TARGET_DEV"
+
+   # load filesystems
+   for i in reiserfs jbd ext3 ntfs fuse; do
+    /KNOPPIX/sbin/modprobe $i >/dev/null 2>&1
+   done
+   FS="ext3 ext2 reiserfs vfat ntfs fuse"
+   /KNOPPIX/bin/cp -au /KNOPPIX/dev/fuse /dev/ >/dev/null 2>&1
+   MOUNTED=""
+   for filesystem in $FS; do
+    if /KNOPPIX/bin/mount -o rw -t "$filesystem" "$TARGET_DEV" "$TARGET" >/dev/null 2>&1; then
+     MOUNTED="true"
+     break
+    fi
+   done
+   if test -z "$MOUNTED"; then
+    echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV_DESC${RED} is not mountable.${NORMAL}"
+    sleep 2
+    return 1
+   fi
+   # check for enough free space
+   USED_SPACE=0
+   test -r $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME && USED_SPACE=$(/usr/bin/du -s $TARGET/$KNOPPIX_DIR/$KNOPPIX_NAME | /usr/bin/gawk '{ print $1 }')
+   FOUNDSPACE="$(/bin/df -k $TARGET | /usr/bin/tail -1 | /usr/bin/gawk '{ print $4+int('$USED_SPACE') }')"
+  ;;
+  *)
+   return 1
+  ;;
+ esac
+ # sanity check
+ if [ $FOUNDSPACE -lt $SIZE ]; then
+  echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${RED}. Found: ${MAGENTA}${FOUNDSPACE}k${RED} Need: ${MAGENTA}${SIZE}k${RED} ${NORMAL}"
+  sleep 2
+  umount $TARGET
+  return 1
+ fi
+ # do the real copy
+ echo "${CRE}${GREEN}Copying KNOPPIX ${MEDIUM} to ${MAGENTA}$TARGET_DEV_DESC${GREEN}... Please be patient. ${NORMAL}"
+ if [ -z "$COPY_COMMAND" -a -x /usr/bin/rsync ]; then 
+  # first cp the small files
+  /usr/bin/rsync -a --exclude="$KNOPPIX_DIR/$KNOPPIX_NAME*" $COPY $TARGET # Copy Knoppix to $TARGET
+  # then the big files with nice progress meter
+  /usr/bin/rsync -a --progress --include="$KNOPPIX_DIR/$KNOPPIX_NAME*" --include="$KNOPPIX_DIR/" --exclude="*" $COPY $TARGET
+ else
+  "$COPY_COMMAND" $COPY $TARGET
+ fi
+ if [ "$?" -ne "0" ]; then
+  echo -n "${CRE}${RED}Copying KNOPPIX ${MEDIUM} failed. ${MAGENTA}$TARGET_DEV_DESC${RED} possibly has not enough space left.${NORMAL}"
+  sleep 2
+  return 1
+ fi
+ # remount r/o
+ case "$filesystem" in
+  ntfs) umount "$TARGET" ; sleep 2 ; { mountit "$TARGET_DEV" "$TARGET" "-o ro" || /KNOPPIX/bin/mount -i -t ntfs -o ro "$TARGET_DEV" "$TARGET"; } ;;
+     *) /KNOPPIX/bin/mount -n -o remount,ro "$TARGET" ;;
+ esac
+ remount_knoppix
+}
+
+mount_knoppix /cdrom
+
+COPYTO=""
+BOOTFROM=""
+DO_REMOUNT=""
+REAL_TARGET=""
+UNIONFS=""
+
+case "$CMDLINE" in *toram*) DO_REMOUNT="yes"; COPYTO="ram"; ;; esac
+case "$CMDLINE" in *tohd=*) DO_REMOUNT="yes"; COPYTO="hd"; ;; esac
+case "$CMDLINE" in *bootfrom=*) DO_REMOUNT="yes"; BOOTFROM="yes" ;; esac
+# Remount later after copying/isoloading/driverloading?
+# pre-test if everything succeeded
+if  test -n "$DO_REMOUNT" -a -n "$FOUND_KNOPPIX"; then
+ # copy library cache 
+ cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache 
+ echo "" 
+
+ SOURCE="/cdrom"
+ TARGET="/cdrom2"
+ # first copy_to, then boot_from
+ if [ -n "$COPYTO" ]; then
+  copy_to $COPYTO && REAL_TARGET="$TARGET"
+ fi
+ if [ -n "$BOOTFROM" ]; then
+  boot_from
+  if [ "$?" -eq "0" ]; then
+   # set new source / target paths
+   REAL_TARGET="$TARGET"
+   SOURCE2="$LOOP_SOURCE"
+   SOURCE="/cdrom2"
+   TARGET="/cdrom3"
+  fi
+ fi
+fi
+# Final test if everything succeeded.
+if test -n "$FOUND_KNOPPIX"; then
+ # copy library cache
+ cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache
+ echo ""
+ UNIONFS=""
+ loadmodule aufs.ko 2>/dev/null && UNIONFS="yes"
+ # Enable kernel messages
+ echo "6" > /proc/sys/kernel/printk
+ # Set paths
+ echo -n "${CRE}${BLUE}Setting paths...${NORMAL}"
+ PATH="/sbin:/bin:/usr/sbin:/usr/bin:/usr/X11R6/bin:."
+ export PATH
+ # Make space: We don't need the modules anymore from here.
+ /KNOPPIX/bin/rm -rf /modules
+ # Debian weirdness
+ /KNOPPIX/bin/cp -a /KNOPPIX/etc/alternatives /etc/ 2>/dev/null
+ # Replace /sbin
+ /KNOPPIX/bin/rm -f /sbin
+ /KNOPPIX/bin/ln -sf /KNOPPIX/sbin /sbin
+ # From here, we should have all essential commands available.
+ hash -r
+ # Did we remount the source media ? 
+ if  test -n "$REAL_TARGET"; then
+  /bin/mount -n --move $REAL_TARGET /cdrom # move it back and go on to normal boot 
+ fi
+ # Clean up /
+ /KNOPPIX/bin/rm -rf /modules /static
+ # New in Kernel 2.4.x: tmpfs with variable ramdisk size.
+ # We check for available memory anyways and limit the ramdisks
+ # to a reasonable size.
+ # Be verbose
+ # Now we need to use a little intuition for finding a ramdisk size
+ # that keeps us from running out of space, but still doesn't crash the
+ # machine due to lack of Ram
+ # Minimum size of additional ram partitions
+ MINSIZE=20000
+ # At least this much memory minus 30% should remain when home and var are full.
+ MINLEFT=16000
+ # Maximum ramdisk size
+ MAXSIZE="$(expr $TOTALMEM - $MINLEFT)"
+ # Default ramdisk size for ramdisk
+ RAMSIZE="$(expr $TOTALMEM / 5)"
+ # Create additional dynamic ramdisk.
+ test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
+ mkdir -p /ramdisk
+ # tmpfs/varsize version, can use swap
+ RAMSIZE=$(expr $RAMSIZE \* 4)
+ echo -n "${CRE}${BLUE}Creating ${YELLOW}/ramdisk${BLUE} (dynamic size=${RAMSIZE}k) on ${MAGENTA}shared memory${BLUE}...${NORMAL}"
+ # We need /bin/mount here for the -o size= option
+ /bin/mount -t tmpfs -o "size=${RAMSIZE}k,mode=755" /ramdisk /ramdisk 
+ mkdir -p /ramdisk/tmp /ramdisk/home/knoppix
+ chmod 1777 /ramdisk/tmp
+ chown knoppix.knoppix /ramdisk/home/knoppix
+ ln -snf /ramdisk/home /home
+ mv /tmp /tmp.old && ln -s /ramdisk/tmp /tmp && rm -rf /tmp.old
+ echo "${BLUE}Done.${NORMAL}"
+ stage=2
+ rundebugshell
+ echo -n "${CRE}${BLUE}Creating unified filesystem and symlinks on ramdisk...${NORMAL}"
+ mkdir -p /UNIONFS
+ UNION="/ramdisk"
+ # Add all KNOPPIX images to the union
+ for c in "" 1 2 3 4 5 6 7; do
+  [ -d "/KNOPPIX$c" ] && UNION="$UNION:/KNOPPIX$c"
+ done
+ # Do the actual mount
+ if test -n "$UNIONFS" && /bin/mount -t aufs -o "br:$UNION" /UNIONFS /UNIONFS; then
+  # We now have aufs, copy some data from the initial ramdisk first
+  cp -a /etc/fstab /etc/auto.mnt /etc/filesystems /etc/mtab /UNIONFS/etc/
+  # /dev is a special case, it is now normally handled via udev
+  UNIONDEV=""
+  case "$CMDLINE" in *noudev*) UNIONDEV="dev"; ;; esac
+  for i in bin boot etc $UNIONDEV sbin var lib opt root usr; do # Move directories to union
+   if test -d /$i; then
+    mv /$i /$i.old && \
+    /KNOPPIX/lib/ld-linux.so.2 --library-path /KNOPPIX/lib /KNOPPIX/bin/ln -snf /UNIONFS/$i /$i && \
+    rm -rf /$i.old
+   else
+    ln -snf /UNIONFS/$i /$i
+   fi
+  done
+  for i in $(cd /UNIONFS; echo *); do # Create links for new stuff on /UNIONFS
+   test "$i" = "home" -o "$i" = "tmp" && continue
+   test -L "/$i" || test -d "/$i" || test -f "/$i" || ln -snf "/UNIONFS/$i" /$i
+  done
+ else
+  echo -n "${CRE}${RED}ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!${NORMAL}"
+  /KNOPPIX/sbin/halt -f -n
+ fi
+ echo ""
+ echo "${GREEN}>> Read-only ${MEDIUM} system successfully merged with read-write /ramdisk.${NORMAL}"
+ chown knoppix.knoppix /home/knoppix
+ # CUPS wants writable files. :-/
+ cp -a /KNOPPIX/etc/cups/*.conf /etc/cups/ 2>/dev/null
+ # resolv.conf must be writable as well
+ cp -a /KNOPPIX/etc/dhcpc/resolv.conf /etc/dhcpc/ 2>/dev/null
+ # Create empty utmp and wtmp
+ :> /var/run/utmp
+ :> /var/run/wtmp
+ # Make SURE that these are files, not links!
+ rm -rf /etc/ftpusers /etc/passwd /etc/shadow /etc/gshadow /etc/group \
+        /etc/ppp /etc/isdn /etc/ssh /etc/ioctl.save \
+        /etc/inittab /etc/network /etc/sudoers \
+        /etc/init /etc/localtime /etc/dhcpc /etc/pnm2ppa.conf 2>/dev/null
+ cp -a /KNOPPIX/etc/ftpusers /KNOPPIX/etc/passwd /KNOPPIX/etc/shadow /etc/gshadow /KNOPPIX/etc/group \
+       /KNOPPIX/etc/ppp /KNOPPIX/etc/isdn /KNOPPIX/etc/ssh \
+       /KNOPPIX/etc/inittab /KNOPPIX/etc/network /KNOPPIX/etc/sudoers \
+       /KNOPPIX/sbin/init /KNOPPIX/etc/dhcpc /etc/ 2>/dev/null
+ # Extremely important, init crashes on shutdown if this is only a link
+ :> /etc/ioctl.save
+ :> /etc/pnm2ppa.conf
+ # Must exist for samba to work
+ [ -d /var/lib/samba ] && :> /var/lib/samba/unexpected.tdb
+ # Kernel 2.6.9 bug?
+ chmod 1777 /tmp /var/tmp
+ # Diet libc bug workaround
+ /bin/cp -f /KNOPPIX/etc/localtime /etc/localtime
+ echo "${BLUE}Done.${NORMAL}"
+ # Mount devpts, should be done much later
+ # mount -t devpts /dev/pts /dev/pts 2>/dev/null
+ # Clean up /etc/mtab (and - just in case - make a nice entry for looped ISO)
+ /bin/egrep " /KNOPPIX[0-9]* | /cdrom " /proc/mounts | sed 's|/dev/loop0 /cdrom \(.*\) 0 0|'$LOOP_SOURCE$ISO_PATH' /cdrom/ \1,loop=/dev/loop0 0 0|g' >> /etc/mtab
+ # Now tell kernel where the real modprobe lives
+ echo "/sbin/modprobe" > /proc/sys/kernel/modprobe
+ # Change root device from /dev/fd0 to /dev/ram0
+ echo "0x100" > /proc/sys/kernel/real-root-dev
+ stage=3
+ rundebugshell
+ # Give control to the init process.
+ echo "${CRE}${BLUE}Starting init process.${NORMAL}"
+ rm -f /linuxrc
+ exit 0
+else
+ echo "${CRE}${RED}Can't find KNOPPIX filesystem, sorry.${NORMAL}"
+ echo "${RED}Dropping you to a (very limited) shell.${NORMAL}"
+ echo "${RED}Press reset button to quit.${NORMAL}"
+ echo ""
+ echo "Additional builtin commands avaliable:"
+ echo "        cat        mount     umount"
+ echo "        insmod     rmmod     lsmod"
+ echo ""
+ PS1="knoppix# "
+ export PS1
+ echo "6" > /proc/sys/kernel/printk
+ # Allow signals
+ trap 1 2 3 11 15
+ exec /static/ash
+fi
diff --git a/pxeknife/knoppix/5.0.1/minirt.gz_orig b/pxeknife/knoppix/5.0.1/minirt.gz_orig
new file mode 100755 (executable)
index 0000000..e04a668
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/minirt.gz_orig differ
diff --git a/pxeknife/knoppix/5.0.1/modules/8139too.ko b/pxeknife/knoppix/5.0.1/modules/8139too.ko
new file mode 100644 (file)
index 0000000..4faa5be
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/8139too.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/8390.ko b/pxeknife/knoppix/5.0.1/modules/8390.ko
new file mode 100644 (file)
index 0000000..6cc9706
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/8390.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/af_packet.ko b/pxeknife/knoppix/5.0.1/modules/af_packet.ko
new file mode 100644 (file)
index 0000000..e2fae30
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/af_packet.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/cloop.ko b/pxeknife/knoppix/5.0.1/modules/cloop.ko
new file mode 100644 (file)
index 0000000..aaf68f8
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/cloop.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/crc32c.ko b/pxeknife/knoppix/5.0.1/modules/crc32c.ko
new file mode 100644 (file)
index 0000000..8509069
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/crc32c.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/e100.ko b/pxeknife/knoppix/5.0.1/modules/e100.ko
new file mode 100644 (file)
index 0000000..1fe64ee
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/e100.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/e1000.ko b/pxeknife/knoppix/5.0.1/modules/e1000.ko
new file mode 100644 (file)
index 0000000..6d259e4
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/e1000.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/loop.ko b/pxeknife/knoppix/5.0.1/modules/loop.ko
new file mode 100644 (file)
index 0000000..4d17d1e
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/loop.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/mii.ko b/pxeknife/knoppix/5.0.1/modules/mii.ko
new file mode 100644 (file)
index 0000000..3dd3192
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/mii.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/ne2k-pci.ko b/pxeknife/knoppix/5.0.1/modules/ne2k-pci.ko
new file mode 100644 (file)
index 0000000..4c7df2f
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/ne2k-pci.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/pcnet32.ko b/pxeknife/knoppix/5.0.1/modules/pcnet32.ko
new file mode 100644 (file)
index 0000000..4fef799
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/pcnet32.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/r8169.ko b/pxeknife/knoppix/5.0.1/modules/r8169.ko
new file mode 100644 (file)
index 0000000..b931db9
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/r8169.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/sis900.ko b/pxeknife/knoppix/5.0.1/modules/sis900.ko
new file mode 100644 (file)
index 0000000..0e14934
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/sis900.ko differ
diff --git a/pxeknife/knoppix/5.0.1/modules/via-rhine.ko b/pxeknife/knoppix/5.0.1/modules/via-rhine.ko
new file mode 100644 (file)
index 0000000..b349f74
Binary files /dev/null and b/pxeknife/knoppix/5.0.1/modules/via-rhine.ko differ
diff --git a/pxeknife/knoppix/5.0.1/mount_http_iso.sh b/pxeknife/knoppix/5.0.1/mount_http_iso.sh
new file mode 100755 (executable)
index 0000000..66cc867
--- /dev/null
@@ -0,0 +1,41 @@
+#!/static/sh
+
+# objectives: 
+# Enable networking.
+# Setup networking.
+# Find the location from which we need to get the ISO.
+# Mount the ISO.
+
+echo "HTTP Boot: inserting network modules"
+insmod /modules/crc32c.ko >/dev/null 2>&1  
+insmod /modules/8390.ko  >/dev/null 2>&1 
+insmod /modules/mii.ko  >/dev/null 2>&1 
+insmod /modules/ne2k-pci.ko  >/dev/null 2>&1 
+insmod /modules/pcnet32.ko  >/dev/null 2>&1 
+insmod /modules/r8169.ko  >/dev/null 2>&1 
+insmod /modules/e100.ko  >/dev/null 2>&1 
+insmod /modules/e1000.ko  >/dev/null 2>&1 
+insmod /modules/sis900.ko  >/dev/null 2>&1 
+insmod /modules/via-rhine.ko  >/dev/null 2>&1 
+insmod /modules/8139too.ko  >/dev/null 2>&1 
+insmod /modules/af_packet.ko >/dev/null 2>&1 
+insmod /modules/loop.ko >/dev/null 2>&1 
+
+ifconfig lo 127.0.0.1 up
+ifconfig eth0 up
+udhcpc -s /static/udhcpc.sh  >/dev/null 2>&1 
+
+ISO_PATH=$1
+echo "The location of dsl.iso is $ISO_PATH"
+echo "mounting CDROM"
+mkdir /iso
+httpfs $ISO_PATH /iso
+busybox mount -t iso9660 /iso/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso /cdrom -o loop -o ro
+
+
+# test if knoppix is there
+if test -f /cdrom/$KNOPPIX_DIR/$KNOPPIX_NAME
+then
+echo -n "successfully mounted the Image"
+fi
+
index 7076acb..0b11aba 100755 (executable)
@@ -4,10 +4,21 @@ LABEL rootmenu
        kernel menu.c32
        append pxeknife/pxeknife.conf
 
-label knoppix502
-       MENU LABEL Knoppix 5.0.1 - DVD
-       kernel pxeknife/knoppix/5.0.1/vmlinuz
-       append nfsdir=yankee:/export/proj/mirrors/knoppix/5.0.1-dvd-en/ nodhcp lang=us ramdisk_size=100000 init=/etc/init apm=power-off nomce vga=791 initrd=pxeknife/knoppix/5.0.1/miniroot.gz quiet BOOT_IMAGE=knoppix
+label knoppix502-rom
+       MENU LABEL Knoppix 5.0.1 - from rom (for US)
+       kernel pxeknife/knoppix/5.0.1/linux httpfs=http://140.211.167.171/share/pravin/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso
+       append nodhcp lang=us ramdisk_size=100000 init=/etc/init apm=power-off nomce vga=791 initrd=pxeknife/knoppix/5.0.1/minirt.gz quiet BOOT_IMAGE=knoppix
+
+label knoppix502-alien
+       MENU LABEL Knoppix 5.0.1 - from alien 
+       kernel pxeknife/knoppix/5.0.1/linux httpfs=http://145.116.233.189/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso
+       append nodhcp lang=us ramdisk_size=100000 init=/etc/init apm=power-off nomce vga=791 initrd=pxeknife/knoppix/5.0.1/minirt.gz quiet BOOT_IMAGE=knoppix
+
+label knoppix502-laptop
+       MENU LABEL Knoppix 5.0.1 - laptop
+       kernel pxeknife/knoppix/5.0.1/linux httpfs=http://192.168.0.2/KNOPPIX_V5.1.1CD-2007-01-04-EN.iso
+       append nodhcp lang=us ramdisk_size=100000 init=/etc/init apm=power-off nomce vga=791 initrd=pxeknife/knoppix/5.0.1/minirt.gz quiet BOOT_IMAGE=knoppix
+
 label knoppix-txt502
        MENU LABEL Knoppix 5.0.1 - DVD - Text
        kernel pxeknife/knoppix/5.0.1/vmlinuz