Computer with floppy
Computer with floppy
After a low point in my life I am picking back up where I left off!
Along my break I ran into a computer that has a floppy drive, yea I know it's a little old. Luckily I have some floppies. So my question is can I put my os on the floppy and run it on real hardware? I have never tested it on real hardware but tested on qemu and worked. It is a floppy image so would I just copy or burn the files? I haven't dealt with floppies since I was like 4
Along my break I ran into a computer that has a floppy drive, yea I know it's a little old. Luckily I have some floppies. So my question is can I put my os on the floppy and run it on real hardware? I have never tested it on real hardware but tested on qemu and worked. It is a floppy image so would I just copy or burn the files? I haven't dealt with floppies since I was like 4
Re: Computer with floppy
I actually did this when I first started working on a 16-bit version of my OS, years ago. I had "forgotten" a few things about floppies that you might want to keep in mind...
1. Floppies are unreliable. At several points, I had to write my OS to the floppy disk 2 or 3 times before it was readable by the same drive it was written in.
2. Floppies are slow. It would take several seconds to boot an OS that was essentially a boot loader, and a CLI program that only understood a few commands. Using the hard drive, cd-rom or usb thumb drive, I can boot a much more complex OS and CLI in way under a second.
3. Floppy drives are obsolete, and rather difficult to find, nowadays. USB floppy drives are actually pretty common, but I don't know if you can boot off of them. And if you can, I'm not sure that it would "look" like an actual Floppy Disk Controller from the 1980's to your OS. It would probably look more like a USB thumbdrive... but that's just a guess.
But to answer your question, yes, you can boot a (very small) OS from a floppy drive. You'll need to download a utility that can write a floppy image to a floppy disk, if you are using Windows. Linux is probably just a "dd -if disk.img -of /dev/fda".
Let us know how it works out for you.
1. Floppies are unreliable. At several points, I had to write my OS to the floppy disk 2 or 3 times before it was readable by the same drive it was written in.
2. Floppies are slow. It would take several seconds to boot an OS that was essentially a boot loader, and a CLI program that only understood a few commands. Using the hard drive, cd-rom or usb thumb drive, I can boot a much more complex OS and CLI in way under a second.
3. Floppy drives are obsolete, and rather difficult to find, nowadays. USB floppy drives are actually pretty common, but I don't know if you can boot off of them. And if you can, I'm not sure that it would "look" like an actual Floppy Disk Controller from the 1980's to your OS. It would probably look more like a USB thumbdrive... but that's just a guess.
But to answer your question, yes, you can boot a (very small) OS from a floppy drive. You'll need to download a utility that can write a floppy image to a floppy disk, if you are using Windows. Linux is probably just a "dd -if disk.img -of /dev/fda".
Let us know how it works out for you.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
-
- Member
- Posts: 5588
- Joined: Mon Mar 25, 2013 7:01 pm
Re: Computer with floppy
Yes. I do this with my OS project, so I'm pretty familiar with the process.feare56 wrote:So my question is can I put my os on the floppy and run it on real hardware?
Write the image directly to the disk, using a utility such as dd or a hex editor with raw disk access like HxD. You'll probably want to format the disk first, to verify that it can be written and read correctly and ensure the sector layout is standard.feare56 wrote:It is a floppy image so would I just copy or burn the files?
Re: Computer with floppy
Ok, while testing a floppy image I found online and put my kernel.bin in by using magiciso, it says on boot something like "image file not found". If it makes a difference I just drag and dropped the kernel file in. I'm on windows and I'm using RawWrite to write to floppy
Re: Computer with floppy
What boot loader are you using? Is it "smart" enough to boot from a floppy disk?
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: Computer with floppy
From what I am guessing there is no boot loader but when I test an iso that has only the kernel on it via qemu it works. Granted the only thing I did different was told magiciso to make the iso boot to kernel.bin
Re: Computer with floppy
Hi,
For floppy there is no El Torito, it's not ISO, the firmware doesn't load the entire file (and only loads one sector); and because of all this the boot loader needs to be designed for it (e.g. that loads the remainder of the "boot loader"/kernel), and magicISO makes no sense at all because it works on CD/ISO images and not floppy.
Cheers,
Brendan
If your "kernel.bin" has real mode startup code and expects to run at 0x00007C00; then it's plausible for CD, assuming magicISO creates the necessary El Torito information which causes the entire "boot loader" (your kernel) to be loaded and executed.feare56 wrote:From what I am guessing there is no boot loader but when I test an iso that has only the kernel on it via qemu it works. Granted the only thing I did different was told magiciso to make the iso boot to kernel.bin
For floppy there is no El Torito, it's not ISO, the firmware doesn't load the entire file (and only loads one sector); and because of all this the boot loader needs to be designed for it (e.g. that loads the remainder of the "boot loader"/kernel), and magicISO makes no sense at all because it works on CD/ISO images and not floppy.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Computer with floppy
Ok so find or make a boot loader, put it in first sector, and then point it to the kernel in the second sector? Is grub able to boot from floppy?
Re: Computer with floppy
Hi,
Cheers,
Brendan
GRUB is able to boot from floppy; but it expects the kernel to have a special header and starts the kernel in 32-bit protected mode (not real mode); and will expect the floppy to be formatted with a "known" file system (e.g. FAT) and will load the kernel from that file system.feare56 wrote:Ok so find or make a boot loader, put it in first sector, and then point it to the kernel in the second sector? Is grub able to boot from floppy?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Computer with floppy
Actually, the chainloader command with a block list argument (as in (fd0)1+x) should do just fine for a real mode kernel written to the floppy starting from the second sector.Brendan wrote:GRUB is able to boot from floppy; but it expects the kernel to have a special header and starts the kernel in 32-bit protected mode (not real mode); and will expect the floppy to be formatted with a "known" file system (e.g. FAT) and will load the kernel from that file system.
Re: Computer with floppy
Hi,
Note that for someone who has written a real mode kernel, writing a boot loader for floppy should be a simple ~20 minute job. It'd probably take longer to figure out how to get GRUB to work, and you can bet that ~20 minute boot loader will be far more efficient and much easier to extend/adapt later.
Cheers,
Brendan
Yes; as long as GRUB isn't on the floppy, and as long as you don't mind fixing it every time the size of anything changes. Basically, "best case" is a crippled pain in the neck.Icee wrote:Actually, the chainloader command with a block list argument (as in (fd0)1+x) should do just fine for a real mode kernel written to the floppy starting from the second sector.Brendan wrote:GRUB is able to boot from floppy; but it expects the kernel to have a special header and starts the kernel in 32-bit protected mode (not real mode); and will expect the floppy to be formatted with a "known" file system (e.g. FAT) and will load the kernel from that file system.
Note that for someone who has written a real mode kernel, writing a boot loader for floppy should be a simple ~20 minute job. It'd probably take longer to figure out how to get GRUB to work, and you can bet that ~20 minute boot loader will be far more efficient and much easier to extend/adapt later.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Computer with floppy
That depends. If that real mode kernel is just a better Hello World, you can't conclude much from it. Unfortunately, most of the people asking how to write a boot sector are complete beginners, and it's not a ~20 minute job for them. It will take them longer, and even if they succeed in the end, it will show who wrote that so called boot loader, and it will be a source of endless pain because of how bad that boot loader is.Brendan wrote:Note that for someone who has written a real mode kernel, writing a boot loader for floppy should be a simple ~20 minute job.
People should only be guided into writing a custom bootloader if they know what they are doing and why they need it. Beginners are not in this category.
Re: Computer with floppy
Hi,
Of course for people writing a protected mode and/or long kernel it'd be potentially different (that "X hours" spent learning about real mode and BIOS is much more likely to be time wasted). It could also be argued that writing a real mode kernel is a complete waste of time (and that would imply the "X hours" learning about real mode and BIOS plus the ~20 minutes implementing boot loader plus the "Y hours" implementing the kernel all adds up to "X + Y + 20/60" hours of wasted time).
Cheers,
Brendan
In that case, you'd spend "X hours" learning things that you'd need to know for both the boot loader and the real mode kernel, and ~20 minutes implementing the boot loader. That "X hours" isn't wasted, it's unavoidable because you have to learn it eventually (for the kernel).Kevin wrote:That depends. If that real mode kernel is just a better Hello World, you can't conclude much from it. Unfortunately, most of the people asking how to write a boot sector are complete beginners, and it's not a ~20 minute job for them. It will take them longer, and even if they succeed in the end, it will show who wrote that so called boot loader, and it will be a source of endless pain because of how bad that boot loader is.Brendan wrote:Note that for someone who has written a real mode kernel, writing a boot loader for floppy should be a simple ~20 minute job.
Of course for people writing a protected mode and/or long kernel it'd be potentially different (that "X hours" spent learning about real mode and BIOS is much more likely to be time wasted). It could also be argued that writing a real mode kernel is a complete waste of time (and that would imply the "X hours" learning about real mode and BIOS plus the ~20 minutes implementing boot loader plus the "Y hours" implementing the kernel all adds up to "X + Y + 20/60" hours of wasted time).
People should be guided into using the right tool for the job. For a real mode kernel GRUB is not the right tool (it's pointless bloat that achieves nothing). For an advanced OS GRUB is not the right tool (it severely limits design flexibility). For someone learning how things work, avoiding learning how boot loaders work is the opposite of their goal so GRUB is probably not the right tool for that either. For all other cases GRUB may be the right tool (assuming other cases actually exist).Kevin wrote:People should only be guided into writing a custom bootloader if they know what they are doing and why they need it. Beginners are not in this category.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: Computer with floppy
So in your opinion scrap my real mode os and create a long mode or protected mode kernel?Brendan wrote: Of course for people writing a protected mode and/or long kernel it'd be potentially different (that "X hours" spent learning about real mode and BIOS is much more likely to be time wasted). It could also be argued that writing a real mode kernel is a complete waste of time (and that would imply the "X hours" learning about real mode and BIOS plus the ~20 minutes implementing boot loader plus the "Y hours" implementing the kernel all adds up to "X + Y + 20/60" hours of wasted time).
Re: Computer with floppy
Hi,
For example; if you assume it's going to take about 10 years to write a usable OS, then (for a real mode OS) you'd be releasing an OS in 2025 that's designed for the (severe) limitations of 40 year-old hardware.
Cheers,
Brendan
I'm not sure what your goals are, but in general it's almost always a better idea to use long mode and/or protected mode.feare56 wrote:So in your opinion scrap my real mode os and create a long mode or protected mode kernel?Brendan wrote: Of course for people writing a protected mode and/or long kernel it'd be potentially different (that "X hours" spent learning about real mode and BIOS is much more likely to be time wasted). It could also be argued that writing a real mode kernel is a complete waste of time (and that would imply the "X hours" learning about real mode and BIOS plus the ~20 minutes implementing boot loader plus the "Y hours" implementing the kernel all adds up to "X + Y + 20/60" hours of wasted time).
For example; if you assume it's going to take about 10 years to write a usable OS, then (for a real mode OS) you'd be releasing an OS in 2025 that's designed for the (severe) limitations of 40 year-old hardware.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.