login
Header Space

 
 

usb booting a custom linux distro ....

October 15, 2006 - 4:12am
Submitted by the_virus on October 15, 2006 - 4:12am.
Linux

Compiled 2.6.17.1 kernel in vmware with scsi support in it and it works fine if I boot using the image. Now, what I wanted was to boot this image from a USB mem card and run linux from it. This USB boot was done in a laptop whoose hard drive is NTFS(windows). After the kernel boots, it obviously fails at mounting FS (since hard-drive is NTFS) but without trying to get scsi drives which is what my mem-card was shown as in vmware.

One thing I observed in the normal boot was the USB gets enabled after the init loads up and then those partitions get mounted. But if this is so, how can I configure the kernel so that it can detect the mem-card as hard-drive and use it prior to starting of init. Is it possible at all ???

Another doubt is .. how do I just have the kernel image without the need to use initrd image along with it. Maybe I should not include loadable modules support or something, could you tell me where this is to be done ????

Thanks.

Booting from USB

October 15, 2006 - 5:42am
Anonymous (not verified)

First check your BIOS to see what boot devices it supports.
If it does not support one you want to use, you will have to
consider re-paritioning your hard-disk to include a linux boot
partition, getting the NT boot loader to boot a kernel image stored
in NTFS (used to be possible, but I never tried it), or using
loadlin (used to be able to change from running windows to running
linux - I have not used loadlin this millenium, so I have not idea
if it still works).

Most linux distributions put as many drivers
as possible into modules to keep the kernel size down to something
reasonable. All the modules they expect to need to mount the root
file system go onto an initial ram-disk, which is used as a
temporary root filesystem.

It is possible to put usb drivers on the initial ram-disk,
but this is a layer of confusion that you do not need as
you know exactly which drivers you need for your laptop.
Mount you usb device, and use lsmod to see which modules are
required. Recompile the kernel with those modules built in.
You should then be able to boot directly into your root filesystem
without fiddling with an initial ramdisk.

Expect things to go horribly wrong if you have multiple USB
storage devices or some real SCSI/SATA devices. The kernel assigns
names to SCSI devices in a random order, so you would need a
program on a ramdisk to work out which name matches the root
device.

still some prob ...

October 15, 2006 - 10:49am

thanks for the replay mate!! but I am still stuck. I included the USB mass storage to be compiled as part of kernel and then manually edited the .config files to include the various modules needed(I guess) and buit the new bzImage however, I get the same errors as before. One more thing is that although I compile buslogic as part of kernel, mkinitrd keeps saying the module is missing after a make modules_install. I manually copy the modules to the /lib/modules/2.6.17.1 to resolve this ... By the way, I could see scsi dump messages in vmware when I boot with the image but I don't see even these dump messages when booted through USB. Hey, if it's k with you, can I send you my .config .. maybe you can figure out better where I am going wrong ....

thanks.

PCLinuxOS installs to and boo

October 15, 2006 - 9:42pm
Anonymous (not verified)

PCLinuxOS installs to and boots fine from a usb device.

sorry mate!! I wanted to make

October 16, 2006 - 12:19pm

sorry mate!! I wanted to make my own custom distro so that I can understand few things more clearly and ofcourse I need it too ... anyways, thanks for responding.

Compiled in means no module

October 17, 2006 - 4:21pm
Anonymouse (not verified)

When you compile a driver into a kernel, no module is created
or required. There is no need to load the module as the driver is
already in place. The mkinitrd program does not check
to see if the driver is compiled in, and gives you a missleading
error message.

There is no point in sending me a config file - my bios does
not recognise any of my USB mass storage devices. I know my way
through the boot sequence because I wanted to boot into an LVM
device (before LVM converted to the device mapper).

I have no idea what a USB device looks like through VMware.
VMware could have its own USB driver, and present a completely
different interface to lilo/grub and linux. This is a layer of
complication I would avoid.

Other people's experience of BIOS USB drivers would also make
me avoid going straight for a USB boot. I would go for loading
grub from CD, and asking grub what hard discs it sees. It is
very likely that the BIOS does such a bad job of USB mass storage
that grub cannot use it.

If you have some good evidence that the BIOS actually works
(most barely work for standard tasks, let alone something as
complex as USB), then it is worth putting all the drivers you need
into the kernel. Boot the kernel from CD, mount the USB device,
and use lsmod to see which drivers you need. Create a new CD that
has those drivers, and repeat. When you can access the USB device
and get lsmod to tell you that no modules are loaded, then it is
worth tring to boot from USB.

You would need to get the USB

October 16, 2006 - 9:06pm
Anonymous (not verified)

You would need to get the USB and usb-storage drivers initialized earlier, and then you can pass the appropriate root=/dev/... option to the kernel so that it mounts the USB partition. I have modified older Fedora installations by hacking up the standard initrd.img to contain the needed USB modules, with the linuxrc script poking things and waiting for the devices to be discovered.

However, I've yet to find a USB drive that can be used by a PC BIOS to load LILO and the kernel+initrd, yet leave the USB hardware in the right state for the Linux kernel to pick it up and continue booting. I actually had to hack a sleep into the initrd linuxrc script and physically disconnect/reconnect the USB drive after the kernel and initrd image were loaded into RAM, so it would be completely reinitialized before getting to the point in the boot process where the partitions are enumerated and / is mounted.

There is a kernel patch float

October 17, 2006 - 8:42am
Anonymous (not verified)

There is a kernel patch floating around that handles this. I can't remember where the one for the 2.6 kernel is located.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
speck-geostationary