![]() |
![]() |
![]() |
![]() |
![]() |
Contents |
Da notare:
le procedure descritte in questo tutorial sono da considerare "as is", così come sono, e senza garanzie. Non c'è relazione tra l'originale distro Slackware (grande distro!) e le idee contenute in questo articolo.
Io penso che l'idea della usbboot.img, come sistema per farsi una pennina USB avviabile, sia superata. E' lenta al boot e usa un filesystem FAT proprietario. Forse l'unica ragione per cui il team di Slackware mantiene ancora questo sistema è perché gli utenti windows non possono far girare uno script bash nel proprio sistema.
Ma per far girare un semplice script bash sarebbe sufficiente un qualsiasi sistema Linux, anche il mini sistema interno al DVD di Slackware, così anche gli utenti windows che possiedono almeno un PC con lettore DVD potrebbero eseguire uno script esterno.
Ecco un semplice script che può creare una pennina USB bootabile simile al DVD di installazione Slackware, che potrebbe contenere anche i pacchetti per eseguire l'installazione di Slackware anche in computer senza lettore DVD. Scarica lo script File:UsbslackDVDboot.sh
Rev.03 - 13-03-2013, alcuni miglioramanti. Note:
#Uncomment below if you get errors type: Warning: '/proc/partitions' does not match '/dev' directory structure. cp -Rpdf /dev/* $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev/
usbslackDVDboot.sh, ecco il codice: |
---|
#!/bin/sh # usbslackDVD.sh - Make a bootable USB-stick (or USB-HD) from Slackware # copyleft Fabio Zorba 2012-2013 # rev.03 - 2013-03-13 # Note: Slackware14 kernel needs LILO version 23.2 to boot SLACK_INSTALL_PATH="SlackDVD" USB_TEMP_MOUNTPOINT="../USB_SLACK_TEMP_MOUNTPOINT" if [ $# -eq 2 ] ; then ROOT_DEV=/dev/$1 #-------- check device --------- case "$1" in sda) BOOT_DEVICE="/dev/sda$2" ;; sdb) BOOT_DEVICE="/dev/sdb$2" ;; sdc) BOOT_DEVICE="/dev/sdc$2" ;; sdd) BOOT_DEVICE="/dev/sdd$2" ;; sde) BOOT_DEVICE="/dev/sde$2" ;; sdf) BOOT_DEVICE="/dev/sdf$2" ;; sdg) BOOT_DEVICE="/dev/sdg$2" ;; sdh) BOOT_DEVICE="/dev/sdh$2" ;; *) BOOT_DEVICE="not_in_list" ;; esac if [ "a$BOOT_DEVICE" = "anot_in_list" ] ; then echo "Error device $ROOT_DEV, valid names are: sda,sdb,sdc,sdd,sde,sdf,sdh ... exit" exit fi echo " --------------------------------------------------- You selected $BOOT_DEVICE device to install SLACK filesystem. Warning ! All data in selected device may be LOST " echo -n "type 'okay' to proceed : " read NNN if [ "a$NNN" = "aokay" ] ; then EXIST_DEVICE=`ls $BOOT_DEVICE` if [ "a$EXIST_DEVICE" == "a" ] ; then echo "Error device $BOOT_DEVICE not exists ... exit" exit fi #Check if Slackware DVD is present in system DVD_MOUNTPOINT=`mount | grep iso9660 | cut -d" " -f3` if [ ! -d $DVD_MOUNTPOINT/slackware ] ; then echo " Error Slackware DVD not found or not mounted ... exit try to mount by hand: mount /dev/sr0 /mnt/cdrom or mount /dev/hda /mnt/cdrom " exit fi USB_MOUNTPOINT=`mount | grep $BOOT_DEVICE | cut -d" " -f3` if [ "a$USB_MOUNTPOINT" == "a" ] || [ ! -d $USB_MOUNTPOINT ] ; then echo "Format the partition $BOOT_DEVICE ? [ENTER=no]" echo -n "... or type 'okay' to proceed with formatting: " read NNN if [ "a$NNN" = "aokay" ] ; then mkfs.ext2 $BOOT_DEVICE fi mkdir $USB_TEMP_MOUNTPOINT mount $BOOT_DEVICE $USB_TEMP_MOUNTPOINT IS_USB_MOUNTED=`mount | grep $USB_TEMP_MOUNTPOINT` if [ "a$IS_USB_MOUNTED" = "a" ] ; then echo "Error: $ROOT_DEV device not mounted in $USB_TEMP_MOUNTPOINT ... exit" exit fi else echo "$BOOT_DEVICE already mounted in $USB_MOUNTPOINT, I will install inside this one ..." USB_TEMP_MOUNTPOINT=$USB_MOUNTPOINT fi echo "Make usb-disk devices" mkdir -p $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH mkdir -p $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/boot mkdir -p $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev mkdir -p $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/etc echo "Copying files ..." cp -f $DVD_MOUNTPOINT/kernels/hugesmp.s/bzImage $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/boot cp -f $DVD_MOUNTPOINT/isolinux/initrd.img $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/boot #Add Slackware packages to root of partition echo "Copy Slackware packages to $BOOT_DEVICE ? [ENTER=no]" echo -n "type 'yes' to begin copying files: " read NNN if [ "a$NNN" = "ayes" ] ; then echo "Copying Slackware packages ..." cp -Rf $DVD_MOUNTPOINT/slackware $USB_TEMP_MOUNTPOINT/ fi #Make usb devices in /dev because Lilo needs them START=0 MINOR=0 for DISK in "a" "b" "c" "d" "e" "f" "g" "h" do MINOR=$START for i in 0 1 2 3 4 5 6 do if [ $i -eq 0 ] ; then mknod $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev/sd$DISK b 8 $MINOR else mknod $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev/sd$DISK$i b 8 $MINOR fi let MINOR=$MINOR+1 done let START=$START+16 done #Uncomment below if you get errors type: #Warning: '/proc/partitions' does not match '/dev' directory structure. cp -Rpdf /dev/* $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev/ echo "LILO will be installed to $ROOT_DEV by default ..." echo echo -n "You may select another device [enter=default] : " read ELSE_ROOT_DEV if [ "a$ELSE_ROOT_DEV" != "a" ] ; then ROOT_DEV=$ELSE_ROOT_DEV fi echo echo "flushing disk cache before install Lilo ... please wait ..." echo " # LILO configuration file # generated by Zoros # # Start LILO global section # Append any additional kernel parameters: boot = $ROOT_DEV prompt compact lba32 vga = normal timeout = 50 # Linux bootable partition config begins image = /boot/bzImage initrd=/boot/initrd.img label = SlackDVD read-write # Linux bootable partition config ends " > $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/etc/lilo.conf lilo -P ignore -r $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH if [ "a$USB_MOUNTPOINT" == "a" ] ; then umount $USB_TEMP_MOUNTPOINT rmdir $USB_TEMP_MOUNTPOINT fi fi else echo " This script make a bootable USB-Stick (or HD) from Slackware DVD ... Pay attention: all data in selected device may be lost. Usage: $0 device [sdb,sdb,sdc...] n.partition [1,2,3...] " fi
|
Nota: lo script non è testato su larga scala, ma finora ha lavorato bene in diversi PC
Per costruire la pennina USB, devi montare il DVD di Slackware prima di eseguire lo script. Devi essere sicuro di conoscere esattamente il nome del dispositivo USB connesso al tuo PC: lo script può formattare il disco, così tutti i dati nel dispositivo di destinazione andrebbero persi.
Comunque, ti puoi fare la pennina USB senza formattare, infatti lo script installerà l'intero sistema in una cartella chiamata "SlackDVD". Lo script non formatterà il dispositivo USB se questo è già montato, ma, in ogni caso, copierà i giusti file e installerà il boot manager Lilo.
$su - # fsisk -l Disk /dev/sda: 251.0 GB, 251000193024 bytes 255 heads, 63 sectors/track, 30515 cylinders, total 490234752 sectors ... Disk /dev/sdb: 500.1 GB, 500107862016 bytes 255 heads, 63 sectors/track, 60801 cylinders, total 976773168 sectors ... Disk /dev/sdc: 4022 MB, 4022337024 bytes 255 heads, 63 sectors/track, 489 cylinders, total 7856127 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x516cb889 Device Boot Start End Blocks Id System /dev/sdc1 63 7438094 3719016 83 Linux /dev/sdc2 * 7438095 7855784 208845 b W95 FAT32 #
in questo esempio il dispositivo usb è /dev/sdc1, già formattato ext2 ... nel caso puoi anche montare il dispositivo, oppure essere sicuro che è smontato, così lo script lo formatterà.
./usbslackDVDboot.sh sdc 1
poi segui le istruzioni del programma, buon divertimento!
Se intendi usare l'installer di Slackware per creare il disco usb devi fare alcune operazioni aggiuntive, in particolare installare "lilo", poiché non è presente nel sistema per default. Ecco un esempio:
mkdir /slackcdrom mount /dev/sr0 /slackcdrom installpkg /slackcdrom/slackware/a/lilo-*.txz
e, ovviamente, copiare lo script usbslackDVDboot.sh nella home directory, per esempio /root
Zoros 17:51, 10 October 2012 (CEST)