I want to make a boot loader to load files from USB Stick. How do I copy bootloader to first sector of USB flash?
"dd if=bootload.bin of=/dev/sdb" not working on real hardware.
How to copy Bootloader to first sector of USB Flash Drive.
Re: How to copy Bootloader to first sector of USB Flash Driv
It's very unlikely that `dd' is not working. IMHO, it actually works (i.e. writes your file to block device `sdb') but something goes wrong at a further stage: BIOS wrongly detects boot type emulation for your flash drive (USB-HDD vs USB-FDD == superfloppy) or your bootloader is doing something wrong.
Re: How to copy Bootloader to first sector of USB Flash Driv
My bootloader simply prints something. I know hot to emulate USB-Floppy, But How do i emulate USB-HDD or USB CD or DVD.Nable wrote:It's very unlikely that `dd' is not working. IMHO, it actually works (i.e. writes your file to block device `sdb') but something goes wrong at a further stage: BIOS wrongly detects boot type emulation for your flash drive (USB-HDD vs USB-FDD == superfloppy) or your bootloader is doing something wrong.
Re: How to copy Bootloader to first sector of USB Flash Driv
I mean that BIOS emulates FDD/HDD for you so you can read from USB devices via INT 0x13 interface. As I've seen in some BIOSes, by default they choose emulation types for flash drives depending on drive size. So if you attach ~large flash stick then BIOS may set emulation type to USB-HDD and then refuse to boot from it if 0th sector doesn't contain valid MBR with 1 bootable partition entry. Forcing the correct mode (HDD if you have MBR and partitions, FDD if filesystem begins from 0th sector) helped me several times.muazzam wrote:My bootloader simply prints something. I know hot to emulate USB-Floppy, But How do i emulate USB-HDD or USB CD or DVD.
- staringlizard
- Posts: 15
- Joined: Wed Aug 13, 2014 1:15 pm
- Contact:
Re: How to copy Bootloader to first sector of USB Flash Driv
If using linux:
1. Find your output device (usb flash drive in your case) by looking into /dev while inserting and removing drive
2. 'dd if=<path to your mbr flat binary file> of=<path to the usb drive e.g. /dev/sdb> bs=512 count=1'
If you are using VMware emulating Linux on a Windows machine:
1. Forget about it, just brings you pain.
If you are using windows:
1. Download dd for windows here http://uranus.chrysocome.net/linux/rawwrite/
2. Find your output device (usb flash drive in your case) by using 'dd --list'
3. 'dd if=<path to your mbr flat binary file> of=<path to the usb drive e.g. \\.\PhysicalDrive2> bs=512 count=1 conv=notrunc'
Be very careful when using dd !
Regards,
StaringL
1. Find your output device (usb flash drive in your case) by looking into /dev while inserting and removing drive
2. 'dd if=<path to your mbr flat binary file> of=<path to the usb drive e.g. /dev/sdb> bs=512 count=1'
If you are using VMware emulating Linux on a Windows machine:
1. Forget about it, just brings you pain.
If you are using windows:
1. Download dd for windows here http://uranus.chrysocome.net/linux/rawwrite/
2. Find your output device (usb flash drive in your case) by using 'dd --list'
3. 'dd if=<path to your mbr flat binary file> of=<path to the usb drive e.g. \\.\PhysicalDrive2> bs=512 count=1 conv=notrunc'
Be very careful when using dd !
Regards,
StaringL