that is code my bootloader use fat32
i am using that code for loading kernel from usb flash
i am copy boot loader in first sector(512) in flash memory by linux
sudo dd if=boot.bin bs=512 conv=notrunc count=1 of=/dev/sdb
but code kernel.bin where put in usb flash
sudo dd if=kernel.bin bs=? conv=notrunc count=? of/dev/sdb
usb flsh and fat32
- 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: usb flsh and fat32
The following command fixes everything:
Code: Select all
man dd
Re: usb flsh and fat32
It depends on what "logical block" or Cylinder/Head/Sector values your boot loader is passing to the INT 13h BIOS method. If your boot loader is in the first block, and your kernel is in the second block, then you should write your kernel starting at position 512. (Because each block is 512 bytes long)
try:
try:
Code: Select all
dd if=boot.bin bs=512 conv=notrunc skip=1 count=1 of=/dev/sdb
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: usb flsh and fat32
thank you for replying
Do you mean that skipe = 1 means the index increased by 512
Did me use the usb flash with int 13h and dl=0 true
here use the flashe same the floppy disk
Do you mean that skipe = 1 means the index increased by 512
Did me use the usb flash with int 13h and dl=0 true
here use the flashe same the floppy disk
Re: usb flsh and fat32
Yes, I believe that skip=1 will skip a whole block, which you specified is 512 bytes. But I'm no expert, so someone else may chime in with the actual correct answer.
When your bootloader is loaded into memory and executed, the BIOS is responsible for putting the correct "boot drive number" in the DL register. So as long as you don't change the DL register (or you save it and restore it before calling INT 13h), your code should work for a floppy drive, a hard drive, or a USB drive. (It *may* also work for a CD drive, but there are a few issues that you will need to be aware of when trying to read from a CD drive, so you may need to deal with booting from a CD separately if it doesn't work immediately.)
When your bootloader is loaded into memory and executed, the BIOS is responsible for putting the correct "boot drive number" in the DL register. So as long as you don't change the DL register (or you save it and restore it before calling INT 13h), your code should work for a floppy drive, a hard drive, or a USB drive. (It *may* also work for a CD drive, but there are a few issues that you will need to be aware of when trying to read from a CD drive, so you may need to deal with booting from a CD separately if it doesn't work immediately.)
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: 5587
- Joined: Mon Mar 25, 2013 7:01 pm
Re: usb flsh and fat32
Instead of asking us how to use that bootloader, why don't you ask the person who wrote it? They probably included some documentation somewhere that tells you how it's supposed to work.
Re: usb flsh and fat32
Looking at the bootloader code that you linked to, I see where it is reading from the [DriveNumber], but I don't see where it is being set. It looks like it is always going to be set to 0x00.
You need to add a line at the top of the code, after the stack is created, to copy the value from DL to the [DriveNumber] variable.
Also, this code looks like it is expecting the kernel to be the first file in the root directory of the FAT32 file system. So, you will need to format your device as FAT32 first, then use the "dd" command to copy the first block, like you are doing now. Then you need to mount this device as FAT32, and then copy your kernel.bin file to the root folder.
Let us know if you need any more details on how to do this.
You need to add a line at the top of the code, after the stack is created, to copy the value from DL to the [DriveNumber] variable.
Also, this code looks like it is expecting the kernel to be the first file in the root directory of the FAT32 file system. So, you will need to format your device as FAT32 first, then use the "dd" command to copy the first block, like you are doing now. Then you need to mount this device as FAT32, and then copy your kernel.bin file to the root folder.
Let us know if you need any more details on how to do this.
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