Suppose neither of my computers has a floppy drive......
-
- Posts: 1
- Joined: Sat Mar 10, 2007 1:18 pm
Suppose neither of my computers has a floppy drive......
...and I don't want to use up all of my CD-Rs going through the baby steps of OS development. I want to use my usb flash drive to test my stuff. I know my computer can boot from USB, so all I need to know is how I would get my stuff on there and make it bootable. Can anyone help me out?
If you are working on UNIX/LINUX like system, there is a 'dd' command.
Example:dd if={mbr file} of=/dev/{your falsh} count=1 This will copy your MBR to the beginning of the flash
Example:dd if={kernel file} of=/dev/{your flash} count={kernel size in 512 byte blocks} seek={where you want to put your kernel} This will copy your kernel
For more info read the man page.
For reading from the flash you have to use int 13h ah=42h BIOS function or some function which doesn't use CHS.
Example:dd if={mbr file} of=/dev/{your falsh} count=1 This will copy your MBR to the beginning of the flash
Example:dd if={kernel file} of=/dev/{your flash} count={kernel size in 512 byte blocks} seek={where you want to put your kernel} This will copy your kernel
For more info read the man page.
For reading from the flash you have to use int 13h ah=42h BIOS function or some function which doesn't use CHS.
There only one way i have found that work, with all PC that can boot USB.
That is to make your kernel a mz exe or com file, so that it can load from DOS.
Than you put your usb in and let windows see it as a drive, you then format it and click to add sys file (which makes it bootable).
Next you add your exe kernel to the drive, once it boots to dos type the name of your kernel (or you can add it to autoexe.bat), this works with fdd or hdd emulation.
Note: if you go to pmode emultion stops, but if you go back to realmode it starts again.
As i have a pmode and a go back to realmode fdd and hdd drivers, i can read/write to USB keyfob in my OS.
That is to make your kernel a mz exe or com file, so that it can load from DOS.
Than you put your usb in and let windows see it as a drive, you then format it and click to add sys file (which makes it bootable).
Next you add your exe kernel to the drive, once it boots to dos type the name of your kernel (or you can add it to autoexe.bat), this works with fdd or hdd emulation.
Note: if you go to pmode emultion stops, but if you go back to realmode it starts again.
As i have a pmode and a go back to realmode fdd and hdd drivers, i can read/write to USB keyfob in my OS.
- Kevin McGuire
- Member
- Posts: 843
- Joined: Tue Nov 09, 2004 12:00 am
- Location: United States
- Contact:
RE: usb kernel boot windows linux rawrite fat32
(Overall)
Treat the USB drive in Windows or Linux just like it is a floppy drive.
(Detailed)
Dex almost had it I think. The format on the stick is going to be FAT32, and the BIOS should look at the drive as if it is a normal hard disk with a boot sector. You might __try__ http://www.tux.org/pub/dos/rawrite/.
I have never actually done this myself. It is just a suggestion.
Treat the USB drive in Windows or Linux just like it is a floppy drive.
(Detailed)
Dex almost had it I think. The format on the stick is going to be FAT32, and the BIOS should look at the drive as if it is a normal hard disk with a boot sector. You might __try__ http://www.tux.org/pub/dos/rawrite/.
I have never actually done this myself. It is just a suggestion.
-
- Member
- Posts: 2566
- Joined: Sun Jan 14, 2007 9:15 pm
- Libera.chat IRC: miselin
- Location: Sydney, Australia (I come from a land down under!)
- Contact:
If you have money, go down to a second-hand hardware shop or a wholesaler, find a floppy drive and install it. As humbling as this experience may be, remember that your OS design will help you.
Also look into an emulator (Google: Bochs) and a method of using disk images (Google: vfdwin, winimage, cygwin). Read the Wiki/OSFAQ as well, they have some good information about disk images and emulators.
Also look into an emulator (Google: Bochs) and a method of using disk images (Google: vfdwin, winimage, cygwin). Read the Wiki/OSFAQ as well, they have some good information about disk images and emulators.
Re: RE: usb kernel boot windows linux rawrite fat32
The format is down to size of fob, so most are formatted as fat16, but it will be called FAT under xp eg: if it says FAT12 its FAT12, if it says FAT32 its FAT32, if it says FAT its FAT16.kmcguire wrote:(Overall)
Treat the USB drive in Windows or Linux just like it is a floppy drive.
(Detailed)
Dex almost had it I think. The format on the stick is going to be FAT32, and the BIOS should look at the drive as if it is a normal hard disk with a boot sector. You might __try__ http://www.tux.org/pub/dos/rawrite/.
I have never actually done this myself. It is just a suggestion.
Why XP does not like saying FAT16 I do not know. .
- Combuster
- Member
- Posts: 9301
- Joined: Wed Oct 18, 2006 3:45 am
- Libera.chat IRC: [com]buster
- Location: On the balcony, where I can actually keep 1½m distance
- Contact:
Re: Suppose neither of my computers has a floppy drive......
Ever considered using CD-RWs?dustpyle_x2 wrote:...and I don't want to use up all of my CD-Rs
The bios doesn't know anything about the filesystem that you're using on your USB stick, nor if the code in the boot sector is actually bootable. It only checks the 0x55 0xAA signature and loads the rest of it. The code should use the method your bios supplies for accessing the USB stick for loading the rest of the disk, and then you're all set. There is NOTHING that windows can do that you can't do without it.Dex wrote:There only one way i have found that work, with all PC that can boot USB.
That is to make your kernel a mz exe or com file, so that it can load from DOS.
Than you put your usb in and let windows see it as a drive, you then format it and click to add sys file (which makes it bootable).
Next you add your exe kernel to the drive, once it boots to dos type the name of your kernel (or you can add it to autoexe.bat), this works with fdd or hdd emulation.
Note: if you go to pmode emultion stops, but if you go back to realmode it starts again.
As i have a pmode and a go back to realmode fdd and hdd drivers, i can read/write to USB keyfob in my OS.
@muisei and Candy, What i am saying is right from my experience, i do not say that the BIOS knows what file sys is on the USB or you need Dos.
But if you want to boot your OS from a USB key fob, from differant PC, the only way to do it is use Dos. Why this is the case is not for to tell you, just try it and see.
You may be lucky, but most likey you will get:
Eg: Try put your boot sector on the usb fob in windows of any hobby OS and booting,
You will most likey get "Operating system missing" ,Than try add sys file (dos) and see the differance ?.
I wish people would try things rather that just read some thing.
Here is some problems you get with your methord.
http://menuet.2.forumer.com/index.php?s ... =1112&st=0
But if you want to boot your OS from a USB key fob, from differant PC, the only way to do it is use Dos. Why this is the case is not for to tell you, just try it and see.
You may be lucky, but most likey you will get:
Eg: Try put your boot sector on the usb fob in windows of any hobby OS and booting,
You will most likey get "Operating system missing" ,Than try add sys file (dos) and see the differance ?.
I wish people would try things rather that just read some thing.
Here is some problems you get with your methord.
http://menuet.2.forumer.com/index.php?s ... =1112&st=0
I'm developing my OS on a flash drive and I've never encountered such probles.
I've written my own MBR which loads and executes the first 1024 bytes of the ext2fs file system.There is my first stage bootloader which enable A20 gate,create a memory map,reads the kernel from ext2fs,enter to PM and then execute it.
I've tried it on several PCs and it works great on all of them.
If you set your BIOS to emulate a HDD and use INT 13h AH=42h to read from the flash, I don't see why I have to be lucky.
I've written my own MBR which loads and executes the first 1024 bytes of the ext2fs file system.There is my first stage bootloader which enable A20 gate,create a memory map,reads the kernel from ext2fs,enter to PM and then execute it.
I've tried it on several PCs and it works great on all of them.
If you set your BIOS to emulate a HDD and use INT 13h AH=42h to read from the flash, I don't see why I have to be lucky.
Dex, you are right it doesn't boot on all PCs.
I tested it on 5 laptops and on one quite new desktop PC and everything worked fine.
After your post I decided to test my OS on older PC(about 3 years old).It booted only MBR.I've tried 3 different method to read the block after the MBR and none of the worked.The first method is using the BIOS function int 13h AH=42h, the second is writing CHS data to the HDD ports and the third is writing LBA data to the HDD ports.
I tested them with qemu and all worked.On my laptop only the BIOS function worked.
I think that the problem is in the BIOS.
BTW I'm using FreeBSD 6.1
I tested it on 5 laptops and on one quite new desktop PC and everything worked fine.
After your post I decided to test my OS on older PC(about 3 years old).It booted only MBR.I've tried 3 different method to read the block after the MBR and none of the worked.The first method is using the BIOS function int 13h AH=42h, the second is writing CHS data to the HDD ports and the third is writing LBA data to the HDD ports.
I tested them with qemu and all worked.On my laptop only the BIOS function worked.
I think that the problem is in the BIOS.
BTW I'm using FreeBSD 6.1
- Attachments
-
- mbr.asm
- test program writen in NASM.It must be placed on the first block of the drive.Don't read the comments.I gathered the code from a couple of files and some of the comments are not correct;
- (3.26 KiB) Downloaded 21 times