How to make NTLDR load boot files larger than 512bytes?
How to make NTLDR load boot files larger than 512bytes?
Normally, NTLDR could chainload boot files (i.e a 512 bytes boot sector file). And when the file is larger than 512bytes, NTLDR only loads the first 512bytes to memory.
But if the boot file meets some special requirements, NTLDR will load the entire file, even if it is very large. And GRUB4DOS is a good example: GRLDR.MBR is 9KB, and it could be loaded by NTLDR directly.
It is said that two of the requirements are:
1. The boot file must be larger than 8kb (16 sectors)
2. The second sector of the boot file must be a series of NOPs, follow by a JMP, to the very start of the boot file.
But still, NTLDR only loads the first 512bytes of my boot file, so there might be some other requirements to the boot file.
Any suggestions?
But if the boot file meets some special requirements, NTLDR will load the entire file, even if it is very large. And GRUB4DOS is a good example: GRLDR.MBR is 9KB, and it could be loaded by NTLDR directly.
It is said that two of the requirements are:
1. The boot file must be larger than 8kb (16 sectors)
2. The second sector of the boot file must be a series of NOPs, follow by a JMP, to the very start of the boot file.
But still, NTLDR only loads the first 512bytes of my boot file, so there might be some other requirements to the boot file.
Any suggestions?
-
- Member
- Posts: 41
- Joined: Thu Aug 09, 2012 5:10 am
Re: How to make NTLDR load boot files larger than 512bytes?
This may be a silly question, but why are you trying to have NTLDR load your boot file?
Is there something NTLDR can do that GRUB can't?
Otherwise, I'd say save yourself the pain and just use GRUB.
Is there something NTLDR can do that GRUB can't?
Otherwise, I'd say save yourself the pain and just use GRUB.
<PixelToast> but i cant mouse
Porting is good if you want to port, not if you want maximum quality. -- sortie
Porting is good if you want to port, not if you want maximum quality. -- sortie
- Griwes
- Member
- Posts: 374
- Joined: Sat Jul 30, 2011 10:07 am
- Libera.chat IRC: Griwes
- Location: Wrocław/Racibórz, Poland
- Contact:
Re: How to make NTLDR load boot files larger than 512bytes?
And I would just save myself a pain and just write a proper bootloader from scratch, so you can just both chainload it and boot using BIOS only.
As a matter of fact, I did this before and I really like having full control over PC during boot.
As a matter of fact, I did this before and I really like having full control over PC during boot.
Reaver Project :: Repository :: Ohloh project page
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
<klange> This is a horror story about what happens when you need a hammer and all you have is the skulls of the damned.
<drake1> as long as the lock is read and modified by atomic operations
Re: How to make NTLDR load boot files larger than 512bytes?
Actually, some of my friends decided to try my OS, and currently I use GRUB or just BIOS to load my OS. But my friends do not know what GRUB is, and refuse to install it.halofreak1990 wrote:This may be a silly question, but why are you trying to have NTLDR load your boot file?
Is there something NTLDR can do that GRUB can't?
So having my OS able to be loaded by NTLDR, as well as GRUB, would make it easier for users who do not use GRUB to try my OS.
Re: How to make NTLDR load boot files larger than 512bytes?
zrhbob, be quiet. NTLDR loads 512 bytes in any way. grldr.mbr's starting code loads the rest of itself (using dirty trick).
Do you have Live CD/flash drive with your OS?zrhbob wrote:Actually, some of my friends decided to try my OS, and currently I use GRUB or just BIOS to load my OS. But my friends do not know what GRUB is, and refuse to install it.
So having my OS able to be loaded by NTLDR, as well as GRUB, would make it easier for users who do not use GRUB to try my OS.
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to make NTLDR load boot files larger than 512bytes?
I'm sorry, but please forgive my poor English, I am not going to be mad
According to the author of GRUB4DOS, NTLDR will load the entire file as long as the file meets the requirement
See
http://bbs.znpc.net/forum.php?mod=viewthread&tid=6176
In this page, the authors of GRUB4DOS are discussing how to make grldrstart.s smaller and stronger. The author said that NTLDR loads the first 16 sectors of GRLDR, then the first 16sectors load the rest of GRLDR. And NTLDR loads the entire 18 sectors of GRLDR.MBR to memory.
According to the author of GRUB4DOS, NTLDR will load the entire file as long as the file meets the requirement
See
http://bbs.znpc.net/forum.php?mod=viewthread&tid=6176
In this page, the authors of GRUB4DOS are discussing how to make grldrstart.s smaller and stronger. The author said that NTLDR loads the first 16 sectors of GRLDR, then the first 16sectors load the rest of GRLDR. And NTLDR loads the entire 18 sectors of GRLDR.MBR to memory.
Re: How to make NTLDR load boot files larger than 512bytes?
Translate, please If you are so mistrustful, ask your question to the authors of GRUB4DOS.
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to make NTLDR load boot files larger than 512bytes?
What I would suggest is:
Make NTLDR load your boot-sector and make your boot-sector load everything else. It will work like BIOS loaded you.
Make NTLDR load your boot-sector and make your boot-sector load everything else. It will work like BIOS loaded you.
Re: How to make NTLDR load boot files larger than 512bytes?
Distribute a premature OS to friends and let them run on real machine may not be a good idea (You/your friend may damage something in the progress).
I would recommend let your friend try it on an emulator first, it's much more acceptable even for strangers, and zero-risk.
If you are asking your friend for testing environment, make sure they acknowledge the risk involved and do it the way you planed/supported (e.g. boot on grub).
Ok, back to the topic, NTLDR is not designed to load non-windows OS, so if you are looking for a way to have NTLDR load your boot loader it is not a reliable solution.
The usual way is have a boot manager sit before the chain, and have the boot manager chain-load "your OS" or NTLDR; note that however such boot manager not necessary resident on local harddisk, it can be on a bootable removable media (CD, USB) - I suggest you look into grub on CD/USB, or even simpler, boot your OS on USB (with BIOS HDD emulations).
I would recommend let your friend try it on an emulator first, it's much more acceptable even for strangers, and zero-risk.
If you are asking your friend for testing environment, make sure they acknowledge the risk involved and do it the way you planed/supported (e.g. boot on grub).
Ok, back to the topic, NTLDR is not designed to load non-windows OS, so if you are looking for a way to have NTLDR load your boot loader it is not a reliable solution.
The usual way is have a boot manager sit before the chain, and have the boot manager chain-load "your OS" or NTLDR; note that however such boot manager not necessary resident on local harddisk, it can be on a bootable removable media (CD, USB) - I suggest you look into grub on CD/USB, or even simpler, boot your OS on USB (with BIOS HDD emulations).
Re: How to make NTLDR load boot files larger than 512bytes?
I have checked what NTLDR does. Additionally to first sector loaded into memory at 7C00h it loads first 16 sectors into memory at 0D000h and jumps to 0D00h:256h.
If you have seen bad English in my words, tell me what's wrong, please.
Re: How to make NTLDR load boot files larger than 512bytes?
Thank you, egos! I'll have a try.