(--)
(-)
 
(11 intermediate revisions not shown)
Line 11: Line 11:
== The script ==
== The script ==
-
This is a simple script that can make a bootable USB-stick (or USD-HD) similar at Slackware installation DVD, that may contains also the packages to perform Slackware installation in computers without DVD reader.
+
<!--NewsZ-->This is a simple script that can make a bootable USB-stick (or USD-HD) similar at Slackware installation DVD, that may contains also the packages to perform Slackware installation in computers without DVD reader. Download the script<!--EndZ--> [[File:usbslackDVDboot.sh]]
-
'''usbslackDVDboot.sh'''
+
Rev.03 - 2013-03-13 some improvments. Notes:
 +
#The script copy the entire /dev structure of host system to avoid error below:
<source lang="bash">
<source lang="bash">
-
#!/bin/sh
+
#Uncomment below if you get errors type: Warning: '/proc/partitions' does not match '/dev' directory structure.
-
# usbslackDVD.sh - Make a bootable USB-stick (or USB-HD) from Slackware
+
cp -Rpdf /dev/* $USB_TEMP_MOUNTPOINT/$SLACK_INSTALL_PATH/dev/
-
# copyleft Fabio Zorba 2012
+
</source>
-
# rev.01 - 2012-10-09
+
#Slackware14 kernel needs LILO version 23.2 to boot
-
SLACK_INSTALL_PATH="SlackDVD"
+
{| class="collapsible collapsed wikitable"
-
USB_TEMP_MOUNTPOINT="../USB_SLACK_TEMP_MOUNTPOINT"
+
|-
 +
!'''usbslackDVDboot.sh''' this is the code:
 +
|-
 +
|{{:UsbslackDVDboot.sh source code}}
 +
|}
-
if [ $# -eq 2 ] ; then
+
Note: the script is not wide scale tested, but so far it has worked well on several PCs
-
ROOT_DEV=/dev/$1
+
== How to use ==
 +
To make a bootable USB-stick, you must mount Slackware DVD in your system before run the script. You must be sure that you known exactly the name of USB disk connected to your PC: the script can format the disk, so all data in target device will be lost.
-
echo "
+
However, you can make the bootable USB-stick without formatting, infact the script will install entire system in a folder named "SlackDVD". The script will not format the USB device if this is already mounted, but, in every case, the script will copy the right files and will install the boot manager Lilo.
-
---------------------------------------------------
+
-
You selected $BOOT_DEVICE device to install SLACK filesystem.
+
-
Warning ! All data in selected device may be LOST
+
=== Operating procedure ===
 +
*download the script ready to work (link above) or copy the code in a file named usbslackDVDboot.sh (you can choose a more simple name as "install.sh") and put it in a working directory, then open a terminal (konsole) in that point.
 +
*plug the USB-stick and get the name of usb device:
 +
<source lang="bash">
 +
$su -
 +
# fsisk -l
-
"
+
Disk /dev/sda: 251.0 GB, 251000193024 bytes
-
echo -n "type 'okay' to proceed : "
+
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
-
  read NNN
+
  Device Boot      Start        End      Blocks  Id System
-
 
+
/dev/sdc1              63     7438094     3719016   83  Linux
-
if [ "a$NNN" = "aokay" ] ; then
+
/dev/sdc2   *     7438095     7855784      208845   b W95 FAT32
-
 
+
-
  #-------- 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
+
-
 
+
-
  #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"
+
-
  exit
+
-
  fi
+
-
 
+
-
  USB_MOUNTPOINT=`mount | grep $BOOT_DEVICE | cut -d" " -f3`
+
-
 
+
-
  if [ ! -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,dev,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
+
-
 
+
-
  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
+
</source>
-
# Append any additional kernel parameters:
+
in this example the usb device is /dev/sdc1, already formatted with ext2 ... in this case you can also mount also the device, or to be sure that is umounted, so the script will begin formatting it.
-
boot = $ROOT_DEV
+
*now you can run the script:
 +
<source lang="bash">
 +
./usbslackDVDboot.sh sdc 1
 +
</source>
 +
then follow the program instructions, have fun!
-
prompt
+
=== Run script inside the Linux Slackware DVD installer ===
-
compact
+
When using the Slackware installer to create the usb-stick you have to make additional operations, in particular install "lilo", because it is not present in the system by default. Here is an example:
-
lba32
+
<source lang="bash">
-
vga = normal
+
mkdir /slackcdrom
-
timeout = 50
+
mount /dev/sr0 /slackcdrom
-
 
+
installpkg /slackcdrom/slackware/a/lilo-*.txz
-
# 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
+
</source>
</source>
 +
and, of course, copy the script usbslackDVDboot.sh in the home directory, /root for example
-
Note: the script is not wide scale tested, but so far it has worked well on several PCs
+
[[User:Zoros|Zoros]] 00:45, 10 October 2012 (CEST)
-
 
+
-
== How to use ==
+
-
[[Category:Slackware mods]]
+
[[Category:Slackware mods]] [[Category:Highlight news]]

Latest revision as of 11:49, 17 March 2013

Contents

Make a Slackware bootable USB-stick

Notice:

the procedures described in this tutorial are to be considered "as is", without any warranty. There is no relationship between the original distro Slackware (great distro!) and the ideas contained in this article.

Preamble

I think that the usbboot.img idea, as system to make a bootable USB-stick, has to be overcome, It is slow as boot time and uses a proprietary FAT filesystem. The only reason whereby Slackware team mantains this system in use is, perhaps, because the windows users cannot run bash scripts in their own system.

But to run a simple bash script is sufficient any Linux system, also the mini-system inside the Slackware DVD, so, also windows users that have at least a PC with DVD reader can run an external script.

The script

This is a simple script that can make a bootable USB-stick (or USD-HD) similar at Slackware installation DVD, that may contains also the packages to perform Slackware installation in computers without DVD reader. Download the script File:UsbslackDVDboot.sh

Rev.03 - 2013-03-13 some improvments. Notes:

  1. The script copy the entire /dev structure of host system to avoid error below:
#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/
  1. Slackware14 kernel needs LILO version 23.2 to boot

Note: the script is not wide scale tested, but so far it has worked well on several PCs

How to use

To make a bootable USB-stick, you must mount Slackware DVD in your system before run the script. You must be sure that you known exactly the name of USB disk connected to your PC: the script can format the disk, so all data in target device will be lost.

However, you can make the bootable USB-stick without formatting, infact the script will install entire system in a folder named "SlackDVD". The script will not format the USB device if this is already mounted, but, in every case, the script will copy the right files and will install the boot manager Lilo.

Operating procedure

$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 this example the usb device is /dev/sdc1, already formatted with ext2 ... in this case you can also mount also the device, or to be sure that is umounted, so the script will begin formatting it.

./usbslackDVDboot.sh sdc 1

then follow the program instructions, have fun!

Run script inside the Linux Slackware DVD installer

When using the Slackware installer to create the usb-stick you have to make additional operations, in particular install "lilo", because it is not present in the system by default. Here is an example:

mkdir /slackcdrom
mount /dev/sr0 /slackcdrom
installpkg /slackcdrom/slackware/a/lilo-*.txz

and, of course, copy the script usbslackDVDboot.sh in the home directory, /root for example

Zoros 00:45, 10 October 2012 (CEST)

Retrieved from "http://www.zoros.org/wiki/index.php?title=How_to_make_a_Slackware_bootable_usb-stick_starting_from_Slackware_installation_DVD,_or_any_Linux_system"