Hello everyone,now I'm trying to write a boot sector
I had read some documents
What bother me is whether the boot sector must have a function to locate where is the loader.bin
I don't know where to find a good tutorial about boot sector,thanks for give me some advise
PS.Is the boot sector always means dos boot sector?
question about boot sector
Re: question about boot sector
Google.
Programming is not about using a language to solve a problem, it's about using logic to find a solution !
Re: question about boot sector
To program a boot sector, check the wiki resources below.taxus wrote:Hello everyone,now I'm trying to write a boot sector
To write a boot sector using dd
Code: Select all
dd if=boot0.bin of=(partition) bs=1 skip=0 seek=0 count=512 conv=notrunc
No it's not a must, a boot sector may load code from anywhere, or execute random instructions, or just hang.taxus wrote:I had read some documents. What bother me is whether the boot sector must have a function to locate where is the loader.bin
Did you check the wiki? 3 hits on the same site. PS. boot sector always means boot sector.taxus wrote:I don't know where to find a good tutorial about boot sector,thanks for give me some advise
PS.Is the boot sector always means dos boot sector?
Re: question about boot sector
bluemoon wrote:To program a boot sector, check the wiki resources below.taxus wrote:Hello everyone,now I'm trying to write a boot sector
To write a boot sector using ddCode: Select all
dd if=boot0.bin of=(partition) bs=1 skip=0 seek=0 count=512 conv=notrunc
No it's not a must, a boot sector may load code from anywhere, or execute random instructions, or just hang.taxus wrote:I had read some documents. What bother me is whether the boot sector must have a function to locate where is the loader.bin
Did you check the wiki? 3 hits on the same site. PS. boot sector always means boot sector.taxus wrote:I don't know where to find a good tutorial about boot sector,thanks for give me some advise
PS.Is the boot sector always means dos boot sector?
Wow,quite thanks for that ,your answer give me a lot of help,thanks
Re: question about boot sector
yea,I had read three or four documents,but I just don't know whether the boot sector must find the loader.binberkus wrote:Have you tried reading before writing?
What problems did you encounter with writing? There are no specifics. All I can advise is go read some more documentation.
that means,can the loader.bin in a static address that the boot sector don't need a function to find where it is?
and also the loader don't need a function to find where is the kernel,does it possible?
Re: question about boot sector
It's up to your design where to place your 2nd stage loader
Some common examples:
It will be ugly to place it on special sectors, or have the user to reformat the disk just to upgrade a bigger kernel.
Some common examples:
- * in a file in boot partition (which you need to understand the file system and code in limited space, less than 512 bytes)
- * pre-defined sectors. If you have your own FS, you may put things starting right after the boot sector
- * For FAT, the reserved area is safe to abuse, and is configurable for different size
- * Fetch from TFTP. Ok this is not so common.
It will be ugly to place it on special sectors, or have the user to reformat the disk just to upgrade a bigger kernel.
Yes, if you pre-calculate the sector number of 2nd stage loader (and kernel images) and put that information into the loader.also the loader don't need a function to find where is the kernel,does it possible?
Re: question about boot sector
I'm so appreciate for your help
It works now,I used a function to find the loader
maybe later I will try to calculate the address before that
It works now,I used a function to find the loader
maybe later I will try to calculate the address before that