Parte 3

#!/bin/sh

# This is a function to unload the USB mouse/keyboard modules:
usb_kbd_down() {
modprobe -r keybdev mousedev usbmouse hid usbkbd input uhci usb-uhci usb-ohci uhci-hcd ohci-hcd ehci-hcd 2> /dev/null
umount usbfs 2> /dev/null
modprobe -r usbcore 2> /dev/null
}

# This is a function to attempt to enable a USB keyboard.
# If this causes problems for you, use "nousb" as a kernel
# command line option at boot time.
usb_kbd_up() {
# If nousb was given at boot, skip.
if ! cat /proc/cmdline | grep nousb 1> /dev/null 2> /dev/null ; then
# If there aren't even any modules for this kernel, skip.
if [ -d /lib/modules/`uname -r` ]; then
# If usbcore is already loaded, skip.
if ! grep usbcore /proc/modules 1> /dev/null 2> /dev/null ; then
modprobe -q usbcore >/dev/null 2>&1
# Try to mount usbfs:
if [ -d /proc/bus/usb -a ! -f /proc/bus/usb/devices ]; then
mount -t usbfs usbfs /proc/bus/usb
fi
# Try to load all the hub modules:
modprobe -q ehci-hcd >/dev/null 2>&1
modprobe -q ohci-hcd >/dev/null 2>&1
modprobe -q uhci-hcd >/dev/null 2>&1
modprobe -q usb-ohci >/dev/null 2>&1
# NOTE: this prefers "usb-uhci"; you may prefer "uhci".
modprobe -q usb-uhci >/dev/null 2>&1 || modprobe -q uhci >/dev/null 2>&1
# modprobe -q uhci >/dev/null 2>&1 || modprobe -q usb-uhci >/dev/null 2>&1
# Load input core:
modprobe -q input >/dev/null 2>&1
# Load USB keyboard:
modprobe -q usbkbd >/dev/null 2>&1
# Load Human Interface Device (HID) USB module:
modprobe -q hid >/dev/null 2>&1
# Load mouse (just in case (TM)) and keyboard USB input modules:
modprobe -q mousedev >/dev/null 2>&1
modprobe -q keybdev >/dev/null 2>&1
# Give these some time to register:
sleep 2
# Next, take a look to see if there are devices detected.
# If not, unload the modules.
if [ ! -r /proc/bus/usb/devices ]; then
usb_kbd_down
break
elif cat /proc/bus/usb/devices | grep -i Driver=usb_mouse 1> /dev/null 2> /dev/null ; then
# Looks like a mouse.
break
elif cat /proc/bus/usb/devices | grep -i Driver=hid 1> /dev/null 2> /dev/null ; then
# Probably a keyboard (but could be a game pad
break
elif [ -d /proc/bus/usb/devices/001 ]; then # we're REALLY not picky here...
break
else
# Nothing? Fine, we'll give up.
echo "No USB devices found. Unloading USB subsystem..."
usb_kbd_down
fi
fi
fi
fi
}

# remove /etc/mtab* so mount creates the /etc/mtab file
/bin/rm -f /etc/mtab* /etc/nologin

/bin/mount -av -t nonfs

#/sbin/swapon -a 2> /dev/null

if [ -x /sbin/ldconfig ]; then
/sbin/ldconfig -v
fi

## Detect serial console from kernel command line:
if cat /proc/cmdline | grep console=ttyS 1> /dev/null 2> /dev/null ; then
SERIAL_CONSOLE="true"
fi

# USB keyboard?
usb_kbd_up

# Replace some startup binaries with better versions:
( cd /bin
rm -f grep gzip tar gunzip zcat df
ln -sf df.bin df
ln -sf grep.bin grep
ln -sf gzip.bin gzip
ln -sf tar-1.13 tar
ln -sf gzip gunzip
ln -sf gzip zcat
)

# Make detected partitions:
/dev/makedevs.sh

if [ -x /etc/rc.d/rc.inet1 ]; then
/bin/sh /etc/rc.d/rc.inet1
fi

/sbin/syslogd 2> /dev/null
sleep 1
/sbin/klogd -c 3 1> /dev/null

/bin/setterm -blank 0

echo
echo "<OPZIONI PER CARICAMENTO MAPPA CARATTERI DELLA TASTIERA>"
echo
echo "Se non stai usando una tastiera Inglese, hai la possibilità di cambiarla"
echo "con quella del tuo paese. Per selezionare una mappa diversa di caratteri"
echo "per la tua tastiera digita 1 adesso.Scegli it.map se la tastiera e' italiana."
echo "Altrimenti premi solo enter per confermare la tastiera inglese"
echo -n "Digita 1 per selezionare la mappa di caratteri per la tua tastiera: "
read ONE
if [ "$ONE" = "1" ]; then
/usr/lib/setup/SeTkeymap
fi
clear


# If possible, figure out what kernel we just booted with:
#unset SLACK_KERNEL
#for ARG in `cat /proc/cmdline` ; do
# if [ "`echo $ARG | cut -f 1 -d =`" = "SLACK_KERNEL" ]; then
# IMAGE="`echo $ARG | cut -f 2 -d =`"
# SLACK_KERNEL=$IMAGE
# fi
#done
#export SLACK_KERNEL

alias ll='ls -al --color=auto'
insmod apm
insmod ntfs
insmod ide-scsi
insmod scsi_debug
clear
echo "Mini Linux login: enter per proseguire"
echo "Per espellere il cd digitare:"
echo "cdrecord -dev=ATAPI:0,0,0 -eject"
echo "I tre numeri 0,0,0 (bus,target,lun) potrebbero necessitare"
echo "di modifiche a seconda della configurazione del bus, masterizzatore ecc..."
echo "Esempio masterizzatore sul secondo bus:"
echo "senza emulazione scsi:cdrecord -dev=ATAPI:1,0,0 -eject"
echo "Esempio secondo masterizzatore sul primo bus"
echo "con emulazione scsi: cdrecord -dev=0,1,0 -eject"

minilinux che io ho inserito nel cd nella directory /bin...praticamente configura le periferiche usb, carica i moduli che a me interessano ed infine da qualche informazione utile e permette di settare la tastiera.

Bene ma noi dobbiamo ancora creare il cdrom...allora dicevamo che in /mnt2 c'è il nostro linux...
copiamo in /mnt2/boot l'immagine avviabile del floppy floppy.img
cp /floppy.img /mnt2/boot/ se non lo avevamo già fatto prima..

Poi entriamo in /mnt2 e diamo il comandone del secolo che creerà l'immagine iso del cd da scrivere utilizzando come avvio l'immagine di un floppy avviabile ( il nostro floppy.img)

cd /mnt2
mkisofs -v -R -J -V "Live CD" -b boot/floppy.img -c boot/catalogo.b -o livecd.iso /mnt2

Questo comando creera' il file catalogo.b utile a rendere il cd avviabile e lo inserirà nel file livecd.iso che conterra' tutta la directoty /mnt2 utilizzando come avvio l'immagine del floppy avviabile (floppy.img che badate bene deve trovarsi all'interno della directory contente il nostro linux.Io per comodità l'ho copiata in /boot (vedi sopra))
Di fatto questo comandone del secolo crea un file chiamato livecd.iso che sarà quello da scrivere nel cd...

Bene ora abbiamo livecd.iso...scriviamo adesso sul cd con
Controllate i parametri che potrebbero differire a seconda dei casi (i tre numerini 0,0,0 che rappresentano scsibus, masterizzatore (0 o 1) e lun (che non so cos'è ma che di solito è sempre 0).Se non avete caricato il modulo scsi dovrete dare ATAPI:0,0,0 al posto di 0,0,0 da solo)..(può essere utile dare

cdrecord -scanbus per capire come è configurato il nostro bus..

.quindi...

da /mnt2

cdrecord -v dev=0,0,0 -data livecd.iso

man cdrecord per le mille opzioni da usare con cdrecord