LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Problem with booting a self-made floppy distro (https://www.linuxquestions.org/questions/linux-general-1/problem-with-booting-a-self-made-floppy-distro-401313/)

d1s4st3r 01-09-2006 04:06 PM

Problem with booting a self-made floppy distro
 
Hi everyone,
I just tried to make my very own first distro (mainly following this guide: http://www.creo.hu/~csaba/lowlife/).
I made it entirely in a chrooted environment (to prevent any kind of trouble :scratch:), and I use Debian GNU/Linux.
Now, the floppy image is ready and I tried to run it with QEmu, but I got the following problems:
QEmu says that "direct booting from floppy is no longer supported. Please use a boot loader program instead.". That's ok because my floppy image ("x86 boot sector") just contains the kernel in the first kbytes, and the gzipped root filesystem just after.
Now the problem is that I don't know how to configure a valid boot loader (such as LILO or Grub or SysLinux) and write it to the first 512 bytes of the floppy image to make it boot. I already tried to fetch a floppy distro from the Internet, dd the MBR from it and then catting it before the floppy image to a new one (I mean, "cat MBR FLOPIMG > NEWIMG"), but no way to make it boot anyway (quite reasonable, after all :p).
I'm trying this stuff with QEmu because the distro doesn't fits very good on a floppy (a total of 1,8MB against 1,44MB), and, if things will work, I'm planning to add more features and burn it on a pocket 8cm CD.
Does anyone know how can I add a bootloader to this floppy image so that it can boot correctly (with both QEmu and... PC!)? Please note that I'm working on the image, so many programs say that "it's not a valid block device" (infact it's not /dev/fd0).
Many thanks for any help!:D :D :D
Cheers!

pixellany 01-09-2006 04:34 PM

Can't be much help except to point out that you can't write to the mbr with your "cat" command. You need to use dd.
For example, the grub manual will tell you how to install grub to the floppy---but I dont know if you need stage 1 or more.

If you know what you need in the mbr (eg bootfile), and the size (typically 446* bytes), then do this:
dd if=bootfile of=/dev/fd0 bs=446 count=1

*A boot sector is 512 bytes, including 4 16-byte partition table entries and a 2-byte "signature". This leaves 446 bytes for boot code.

d1s4st3r 01-11-2006 07:22 AM

I realized that the boot problem is due to the 2.6.* Linux kernel.
With 2.4.* kernel, it boots perfectly.
I'm still failing in installing a bootloader on the floppy image to boot with kernel 2.6.*.
pixellany's suggestion is good, but it's not working, basically for the reasons:
1) my kernel image should have the exact name of the one that the "grabbed" bootloader expects to find to make it boot
2) I'm working on a file, not a block device, and this causes some problems (maybe because bootloader wants "/dev/fd0" to write MBR and/or to boot, but can't find it)
Hope to find a solution asap.
I you have any kind suggestion, I'm glad to hear about!


All times are GMT -5. The time now is 04:12 PM.