How to Slax into a pen drive


Results 1 to 3 of 3

Thread: How to Slax into a pen drive

  1. #1
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978

    How to put Slax into a pen drive

    To put a Live CD distro into a pen drive is very simple. I am using Slax as an example. The technique is generic. Also you can assemble several iso together in the same pen drive.

    The key steps are

    • Expand the iso by extracting the content into a temporary directory
    • Create a /boot/grub directory and copy stage1 and stage2 into it
    • Write a menu.lst for Grub (to substitute isolinux with Grub using information from isolinux.cfg)
    • copy the temporary directory content into a pen drive
    • setup up Grub in the MBR of pen drive


    When you download Slax and extract it temporarily into a directory, say /home/pen_iso, you will find there are only two folders

    /boot
    /slax

    Here I assume you have access to a Live CD like Ubuntu with which you can open a Slax iso file with "Archive Manager", highlight the two files and the click "extract" to /home/pen_iso.

    Grub always searches /boot/grub for two files, stage1 and stage2, for booting. You will find these two files in Ubuntu Live CD /usr/lib/grub/i386-pc. If in doubt do a search by command.
    Code:
    sudo su
    find / -name stage1
    So create the necessary directories and copy the two file across.
    Code:
    mkdir /home/pen_iso/boot/grub
    cp /usr/lib/grub/i386-pc/stage1 /home/pen_iso/boot/grub/
    cp /usr/lib/grub/i386-pc/stage2 /home/pen_iso/boot/grub/
    Now you shall use an editor to write a menu.lst and save it inside /home/pen_iso/boot/grub directory.
    Code:
    cd /home/pen_iso/boot/grub
    gedit menu.lst
    Writing a menu.lst sounds challenging but it is very easy for Slax, as shown below, because in a CD iso it is always booted by isolinux which has a configuration file /boot/isolinux/isolinux.cfg that you can copy. The content of Slax's isolinux.cfg is
    Code:
    PROMPT 0
    TIMEOUT 200
    DEFAULT /boot/vesamenu.c32
    
    LABEL xconf
    MENU LABEL Slax Graphics mode (KDE)
    KERNEL /boot/vmlinuz
    APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
    
    LABEL pchanges
    MENU LABEL Slax Graphics mode with Persistent Changes
    KERNEL /boot/vmlinuz
    APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw changes=/slax/slaxsave.dat autoexec=xconf;kdm
    
    LABEL copy2ram
    MENU LABEL Slax Graphics mode, Copy To RAM
    KERNEL /boot/vmlinuz
    APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw copy2ram autoexec=xconf;kdm
    
    LABEL startx
    MENU LABEL Slax Graphics VESA mode (1024x768)
    KERNEL /boot/vmlinuz
    APPEND vga=769 initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw autoexec=kdm
    
    LABEL slax
    MENU LABEL Slax Text mode
    KERNEL /boot/vmlinuz
    APPEND vga=normal initrd=/boot/initrd.gz ramdisk_size=6666 root=/dev/ram0 rw
    
    LABEL memtest86
    MENU LABEL Run Memtest utility
    KERNEL /boot/mt86p
    This bits that are of interest to you are marked in red.

    You basically copy the red bits and slightly re-arrange them to suit Grub's syntax, as follow
    Code:
    title Slax Graphics mode (KDE)
    kernel /boot/vmlinuz  vga=769 ramdisk_size=6666 root=/dev/ram0 rw autoexec=xconf;kdm
    initrd /boot/initrd.gz 
    
    
    You will note I have only changed the following

    (1) I used the first line as the "title". The word "title" must be spelled correctly because it is a command.
    (2) I combined the last two lines together and remove the word "APPEND".
    (3) I changed the "KERNEL" to the lower case
    (4) I moved the "initrd=/boot/initrd.gz " to a new line and replace the "=" with a space.

    Now I plug in a pen drive which is usually preformatted in fat16 or fat32. No need to do anything as long as it has sufficent space to hold the the content of /home/pen_iso. Assuming the pen drive is detected as sdb1 I shall create a mount point /mnt/sdb1, mount the device on it and copy the two folders across.
    Code:
    mkdir /mnt/sdb1
    mount /dev/sdb1 /mnt/sdb1
    cp -r /home/pen_iso/* /mnt/sdb1
    Lastly I invoke a Grub shell in Ubuntu, check the disk order and install Grub in the pen drive
    Code:
    grub
    geometry (hd0)
    geometry (hd1)
    Since I am using an existing PC and so the internal hard disk, assuming there is only one, will be my first boot disk (hd0) and the pen drive should show up as the second drive (hd1), as Grub counts from zero. Having checked the capacity of the pen drive matches (hd1) I install Grub into the pen drive by commands
    Code:
    root (hd1,0)
    setup (hd1)
    quit
    I then reboot, set the Bios to boot the USB pen drive as my first boot disk, enable the USB legacy support, save the Bios and Slax will appear in a Grub screen awaiting to be fired up.
    Last edited by saikee; 10-28-2007 at 07:14 AM.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

  2. #2
    Join Date
    Sep 2003
    Location
    Knoxville, TN
    Posts
    123
    Saikee,

    I just wanted to take a moment and thank you for taking the time to share with the rest of us all these cool things you test out, they're really helpful. Thanks for the tips!

  3. #3
    Join Date
    Jun 2004
    Location
    Newcastle upon Tyne
    Posts
    2,978
    spowel4,

    My pleasure. Mind if you thank me then I have to thank members and super mods of Justlinux who taught me everything in Linux.

    I have since added Parted Magic, Back Track, DSL, Sidux, Yoper and Berry into the same pen drive taking up about 3.5Gb for the 7 iso. ALthough all of them boot but due to the way some of the iso were written I couldn't get Parted Magic, Sidux and Yoper working. Nevertheless the other 4 iso are operational in a pen drive.

    There is an advantage to keep several Live CD iso in a pen drive as they are very compact. On booting up the files are uncompressed and stored into the ram for execution.

    The nice thing about Linux is once we understand the principle behind then we can play tunes with it.
    Linux user started Jun 2004 - No. 361921
    Using a Linux live CD to clone XP
    To install Linux and keep Windows MBR untouched
    Adding extra Linux & Doing it in a lazy way
    A Grub menu booting 100+ systems & A "Howto" to install and boot 145 systems
    Just cloning tips Just booting tips A collection of booting tips

    Judge asked Linux "You are being charged murdering Windoze by stabbing its heart with a weapon, what was it?" Replied Linux "A Live CD"

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •