Re: [debian-knoppix] [PATCH] new cheatcode "tohd/toram" ...
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Am Dienstag, 29. Juli 2003 23:04 schrieb Fabian Franz:
ok, attached is the new Patch, which does now boot the system after copying
... :-) (and not kernel-oops)
Many thx to Alex Thiessen (Lex), who did test toram and tohd for me :-).
cu
Fabian
PS: So Klaus, one could say it kind of stabilized ;-).
> Hi,
>
> I had some spare time today. (hm, not really, but anyway ...)
>
> Here is a new patch to linuxrc.
>
> As always boot-floppys for 06-06 are available at:
>
> http://debian.tu-bs.de/knoppix/HDRamPatch/boot.img
>
> Please test!!!
>
> Boot with:
>
> knoppix toram to copy whole knopix to ram, should work as before.
>
> knoppix fromhd to boot a poor man's install. (So cdroms are ignored, if you
> burn the boot.img to CD it will prefer hd before CD)
>
> knoppix tohd=hda5
>
> To copy KNOPPIX/ to the ext2/vfat-Partition /dev/hda5 !
>
> I had the problem, that I could copy knoppix to hd, but afterwards it
> kernel oopsed with FAT: BOGUS INTERFACE Could not find root-fs or so ... ,
> but when I tried then to boot with knoppix fromhd, everything did work ok.
>
> It also oopsed if printk was set to 0, when I tried to unload cloop ...
> Strange ... Very strange ...
>
> But could also be the PC, I was using. If you see some mistake I've made.
> I'll gladly correct it ;-).
>
> cu
>
> Fabian
>
> PS: If no one tests, this cannot be applied in original knoppix :-/. So do
> it! ;-)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.0 (GNU/Linux)
iD8DBQE/KXP5I0lSH7CXz7MRArvrAJ4iuuhJ6vngOebY3/8WXhECrfhmPACeKMwU
vGezxHOf3VbM3Y6iHBErqY4=
=KSVM
-----END PGP SIGNATURE-----
--- linuxrc.orig 2003-07-29 09:46:26.000000000 +0200
+++ linuxrc 2003-07-31 21:24:13.000000000 +0200
@@ -109,6 +109,8 @@
# Does the user want to skip scsi detection?
NOSCSI=""
case "$CMDLINE" in *noscsi*) NOSCSI="yes"; ;; esac
+NOCD=""
+case "$CMDLINE" in *fromhd*) NOCD="yes"; ;; esac
# Disable kernel messages while probing modules in autodetect mode
echo "0" > /proc/sys/kernel/printk
@@ -205,7 +207,7 @@
# Now that the right SCSI driver is (hopefully) loaded, try to find CDROM
DEVICES="/dev/hd?"
-test -n "$FOUND_SCSI" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
+test -n "$FOUND_SCSI" -a -z "$NOCD" && DEVICES="/dev/scd? /dev/scd?? $DEVICES"
# New: Also try parallel port CD-Roms [for Mike].
DEVICES="$DEVICES /dev/pcd?"
# New: also check HD partitions for a KNOPPIX/KNOPPIX image
@@ -236,6 +238,55 @@
mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX=""
fi
+COPYTORAM=""
+COPYTOHD=""
+COPYTO=""
+
+case "$CMDLINE" in *toram*) COPYTO="yes"; COPYTORAM="yes"; ;; esac
+case "$CMDLINE" in *tohd=*) COPYTO="yes"; COPYTOHD="yes"; ;; esac
+
+# Copy the whole cdrom to ram/hd ?
+if test -n "$COPYTO"
+then
+ # Pre-test if everything succeeded.
+ if test -n "$FOUND_KNOPPIX"
+ then
+ # copy library cache
+ cat /KNOPPIX/etc/ld.so.cache > /etc/ld.so.cache
+ echo ""
+
+ /bin/mkdir /cdrom2
+ if [ -n "$COPYTORAM" ]
+ then
+ # Hey, we could use some fancy dialog skript here :-))
+ echo -n "${CRE} ${GREEN}Copying KNOPPIX CDROM to ${MAGENTA}ramdisk${GREEN}... Please be patient. ${NORMAL}"
+ /bin/mount -t tmpfs -o size=800M /dev/shm /cdrom2
+ /bin/cp -a /cdrom/* /cdrom2 # Copy everything to /cdrom2; yes we need more things then only the KNOPPIX image, we don't want to produce problems we hadn't before, do we ?
+ else
+ COPYTOHD=$(echo $CMDLINE | /usr/bin/tr ' ' '\n' | /bin/sed -n '/tohd=/s/.*=//p' | /usr/bin/tail -1)
+ echo -n "${CRE} ${GREEN}Copying KNOPPIX CDROM to ${MAGENTA}/dev/$COPYTOHD${GREEN}... Please be patient. ${NORMAL}"
+ if mountit /dev/$COPYTOHD /cdrom2 >/dev/null 2>&1
+ then
+ /bin/cp -a /cdrom/KNOPPIX /cdrom2
+ #/bin/mount -o remount,ro /dev/$COPYTOHD /cdrom2
+ else
+ echo "${CRE} ${RED}Copying KNOPPIX CDROM failed. /dev/$COPYTOHD is not mountable. ${NORMAL}"
+ fi
+ fi
+ umount /KNOPPIX # unmount it
+ echo "6" > /proc/sys/kernel/printk # Debugging
+ rmmod cloop # release CD
+ echo "0" > /proc/sys/kernel/printk # Debugging
+ umount /cdrom # unmount CD
+ if test -f /cdrom2/KNOPPIX/KNOPPIX; then
+ insmod -f /modules/cloop.o file=/cdrom2/KNOPPIX/KNOPPIX
+ mountit /dev/cloop /KNOPPIX "-o ro" || FOUND_KNOPPIX="" # if everything else did suceeded so far, this will hopefully succeed too
+ else
+ FOUND_KNOPPIX=""
+ fi
+ fi
+fi
+
# Final test if everything succeeded.
if test -n "$FOUND_KNOPPIX"
then
@@ -257,6 +308,14 @@
# From here, we should have all essential commands available.
hash -r
+# Did we copy from ram/hd ?
+if test -n "$COPYTO";
+then
+ rmdir /cdrom
+ ln -s /cdrom2 /cdrom # make a symlink and go on to normal boot
+ /bin/mount -o remount,ro /dev/$COPYTOHD /cdrom2
+fi
+
# Clean up /
rm -rf /modules /static
Reply to: