LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Booting a usb pen drive from lilo (https://www.linuxquestions.org/questions/slackware-14/booting-a-usb-pen-drive-from-lilo-667436/)

cwwilson721 09-03-2008 10:05 PM

Booting a usb pen drive from lilo
 
I know it SHOULD be easy.

Here's my config:
Code:

/dev/hda1 Windows
/dev/hdb1 Slackware
/dev/hdb2 Linux Swap

Now I have a pen drive, it always gets put into /dev/sda, and is formatted as a Fat16 drive (sda1)
I installed Slax on it from their "Slax for USB".

Due to older hardware limitations, I cannot boot direct from this drive.

However, I SHOULD be able to boot to it using lilo, right?

So far, miserable failure.
Here is my lilo.conf (Works fine dual booting XP/Slackware) :
Code:

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
lba32 # Allow booting past 1024th cylinder with a recent BIOS
boot = /dev/hda
compact # faster, but won't work on all systems.
prompt
timeout = 50
# VESA framebuffer console @ 1024x768x64k
vga = 791
# End LILO global section
# Windows bootable partition config begins
other = /dev/hda1
label = Windows
table = /dev/hda
# Windows bootable partition config ends
# Linux bootable partition config begins
image = /boot/vmlinuz
initrd = /boot/initrd.gz
root = /dev/hdb1
label = Slackware
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends

I've tried to mount it as a Linux partion using liloconfig. (Nope. Just NOTHING happens when I select it at the menu)

I've tried as a Windows/DOS partition (Same results)

Ideas?

rkrishna 09-04-2008 02:09 AM

hello cwwilson,
i hope this method should work,(i have never tried :) )

copy the first few sector of usb to ur hard disk, ask lilo to load that image(use dd to copy the image)
for eg. copy the image of usb disk to the /boot by
Code:

# dd if=/dev/sda of=/boot/usb.image bs=446 count=1
and put an entry in lilo to point to this image.

i hope it should work
best of luck and please reply if it works

hope u were on a long vacation (no posts for a long time )
regards rkrishna

gnashley 09-04-2008 02:56 AM

Since your BIOS won't boot from USB, you need to put your kernel and initrd for the USB drive along side your regular kernels. If your kernel doesn't include the necessary USB features, you'll have to use an initrd which loads the modules. You'll need to pass the 'rootdelay' option also -even if the kernel includes USB support, the drivers don't finish initializing before lilo tries to mount /. the rootdelay(usually 5-15 seconds works) tells the kernel to wait before trying to mount root.

cwwilson721 09-04-2008 05:09 PM

Quote:

Originally Posted by gnashley (Post 3269189)
Since your BIOS won't boot from USB, you need to put your kernel and initrd for the USB drive along side your regular kernels. If your kernel doesn't include the necessary USB features, you'll have to use an initrd which loads the modules. You'll need to pass the 'rootdelay' option also -even if the kernel includes USB support, the drivers don't finish initializing before lilo tries to mount /. the rootdelay(usually 5-15 seconds works) tells the kernel to wait before trying to mount root.

I figure you mean to put the vmlinuz and initrd.gz from the pen drive to /boot of my Slackware disk, correct?

And, then, add a lilo section to point to these? With "append = rootdelay 10" and "root = /dev/sda1"?

gnashley 09-05-2008 01:53 AM

That's right. That should get you going. You can also create a bootable CD with those items(using mkrescue) and be able to use your USB stick on other machines which can't boot USB from BIOS. You can use syslinux to make the USB drive bootable itself in order to be able to boot it directly on machines whih allow booting USB from BIOS. Of course, you can use lilo or grub or syslinux for all the above -your choice.

cwwilson721 09-07-2008 02:14 PM

Already have a bootable CD with Slax on it.

And by trying your suggestion, it STARTED to boot, but when it got to the "Switching Device" part (I'm assuming the '/' for the usb), it locks up....

Oh, well, I'm getting closer...

gnashley 09-08-2008 02:06 AM

Are you using the rootdelay option in the kernel commandline? Please post your new lilo.conf file

aus9 09-08-2008 07:58 AM

assuming your bios can boot from usb?

I have successfully made a bootable slax for usb using grub.
If the first assumption is true, I can give you a step by step guide.

Otherwise what you are supposed to dowload the slax for usb and unpack it then write /boot and /slax to usb then

Code:

su
cd /pathway to usb/boot
sh liloinst.sh
(follow instructions)


pathway may be /media/disk or /mnt/usb or whatever.

2) Either take a punt and reboot to test or run a dd command to test lilo is in mbr of stick

dd if=/devsdX bs=512 count=1 (output goes to screen)

where sdX is sda or sdb etc depending on where stick is mounted

keefaz 09-08-2008 08:46 AM

use bs=446 to copy bootloader bytes, else you copy also the partition table
http://en.wikipedia.org/wiki/Master_boot_record

cwwilson721 09-08-2008 08:57 AM

Quote:

Originally Posted by aus9 (Post 3273246)
assuming your bios can boot from usb?

Not a bootable USB bios (As stated in my first post).

I'll post my new lilo.conf as soon as I get to my linux box.

Thanks

gnashley 09-08-2008 11:29 AM

I use grub, but I think your entry should look about like this:

# Linux bootable partition config begins
image = /boot/vmlinuz-for-usb
initrd = /boot/initrd.gz-for-usb
root = /dev/sda1
append = rootdelay=10
label = Slackware
read-only # Partitions should be mounted read-only for checking
# Linux bootable partition config ends

If the installation matches the version on your hard disk you could even use the same kernel as for the HD, but adjust the name of the kernel and initrd.gz if they are different than for HD. If you have hard-linked all the necessary filesystem, USB and SCSI stuff into the kernel you don't need an initrd at all.

My entry using grub looks like this:

#1 Linux bootable partition config begins
title Slack-11.0 bootsplash on (/dev/hdb3) GUI Login rootdelay
kernel (hd0,0)/vmlinuz-2.4.35.1-rootdelay root=/dev/hdb3 ro rootdelay=20 vga=791 ide0=ata66 hdd=ide-scsi
initrd (hd0,0)/initrd
# Linux bootable partition config ends

You may notice that this is for a 2.4 kernel which didn't used to support the rootdelay feature. But it will staring with 2.4.37 as my patch has been accepted into the main kernel tree. I'm not sure when this feature first made it into the 2.6 kernel, but I'm sure that anything later than 2.6.15 will have it.

I'll explain a little more about why you need this option. Even if you have the USB drivers hard-linked in your kernel, the drivers are pretty slow to register. Normally, the kernel finishes decompressing itself and already tries to mount / before the USB drivers are ready. The rootdelay option tells the kernel to delay the given time before trying mount /. If the USB device has more than one partition you may need to allow even more time. A 512MB FLASH with a single partition might only need 3 seconds or less. But a 7 partition 40GB USB *harddrive* might need 15-20 seconds. The amount of time needed could eadily vary bewteen 1 second and 30 seconds. You can also create an initrd which includes a 'sleep' command, but using rootdelay is handier.


All times are GMT -5. The time now is 10:42 PM.