Failing boot loader?
Failing boot loader?
For my OS, I'm using Mazzanet source as the base. When I downloaded it and installed it the first time, it compiled and worked perfectly. I started modifying it for my own experiments and it still worked correctly. Abandoned original project and started new OS some time later but no longer worked. It compiles with no errors but booting to it results in a blank screen (I get status messages from the boot loader until around half-way through and then nothing). Went back and compiled old original source but no longer works either (same problem). Have tried on both an AMD Athlon and a P4 with same result.
Original boot loader source is attached, can anyone see what the prob could be? Am still a bit shaky with asm knowledge. "Bootup:" message shows, neither "OK" nor "Failed" do.
Also, changes to kernel code don't require changes to the boot loader do they?
Thanks in advance.
[attachment deleted by admin]
Original boot loader source is attached, can anyone see what the prob could be? Am still a bit shaky with asm knowledge. "Bootup:" message shows, neither "OK" nor "Failed" do.
Also, changes to kernel code don't require changes to the boot loader do they?
Thanks in advance.
[attachment deleted by admin]
Re:Failing boot loader?
Oh, and if it helps, here's the MakeFile for it:
That's a black-box piece of code to me, but if it helps someone....
Code: Select all
ALL:
kernel1.o
kernel2.o
kernel.o
START: 0,000000000
,,,START
CODE: 0
,,code
DATA: 0,#10
,,data
BSS: 0,#10
,,bss
Re:Failing boot loader?
Ok, to be frank there is absolutely no way in hell I (Or probably anyone else here) is going to reconstruct that much uncommented assembly to debug it for you.
Will require your kernel to be aware that it is loaded at the real mode address 8000:0000.
As for any other problems all I can say is switch bootstrap (John Fine has a nice, well commented, FAT12 bootstrap. Google for it), because this one looks like it's held together with bits of wire and duct tape.
The far jump to the kernel:Also, changes to kernel code don't require changes to the boot loader do they?
Code: Select all
MOV AX,0x8000
MOV ES,AX
MOV DS,AX
PUSH AX
XOR AX,AX
PUSH AX
RET
As for any other problems all I can say is switch bootstrap (John Fine has a nice, well commented, FAT12 bootstrap. Google for it), because this one looks like it's held together with bits of wire and duct tape.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Failing boot loader?
Code: Select all
padding TIMES 39 DB 0
Move your padding *after* the strings and play with "$" or "$$" in order to ensure there's 2 bytes left before 512 (something like "TIMES 510-$$ should do the trick, but you should better check babysteps bootsector (in .:QuickLinkz:.) to be sure...)
how large is your assembled bootsector ?
<post-scriptum> oh, and, btw, you know GRUB exists, don't you ? If you're not comfortable with assembly or BIOS environment, it can help you starting OS development in pure 32 bits environment rather than having to cope with 16/32 bits transition, FAT accessing, etc.
Those problems are of course interrresting, but they could still be addressed later ...
</post-scriptum>
Re:Failing boot loader?
I didn't actually modify the bootloader (except for a few lines that were commented out and I left them commented out still), but I'll try what you say because hopefully it'll avoid other problems later. Will also check out the babysteps thing again.
Edit: Also, just noticed the other post, I think I will switch bootloader. Everytime I learn some new asm bits, this one seems more like it's a miracle it works at all.
Edit: Also, just noticed the other post, I think I will switch bootloader. Everytime I learn some new asm bits, this one seems more like it's a miracle it works at all.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Failing boot loader?
Yes, booting an x86 system in 32 bits mode is some kind of miracle... there are some many ways to fail. You almost need to be an ASM guru to make such a booter that will work (and i mean work, under all circumstances, on all machines ... not just your )Kemp wrote: Everytime I learn some new asm bits, this one seems more like it's a miracle it works at all.
But this does not mean it's not interresting to do ... provided that it's what you want to do
Re:Failing boot loader?
Ok, I give up, I've tried about four different bootloaders and however many kernels as a starting point and none have made it past booting. I guess it was a bad idea to try this in the first place. :'(
Re:Failing boot loader?
Please, don't give up yet. This isn't something that comes quickly or easily - it has taken me over ten years to get to where I am now. While the situation isn't nearly so bad as when I started - before Linux had become widespread, and resources like OSRC were unknown - it is still a great deal of work and research to implement an OS. Patience is a key factor in this sort of endeavor.
Mind you, if you need to take some time away from your project, you should feel free to take it - sometimes stepping away from a project can help clear your frustrations. But don't think that because you've hit a major stumbling block, that it is necessarily impassable.
Mind you, if you need to take some time away from your project, you should feel free to take it - sometimes stepping away from a project can help clear your frustrations. But don't think that because you've hit a major stumbling block, that it is necessarily impassable.
Re:Failing boot loader?
Well it does seem impassable when you've tried bootloaders wriiten in completely different styles by different people and none of them worked, they didn't even get as far as actually trying to load the OS. Even stuff that used to work has started not to (with no modifications). Beginning to think it's just my comp (or me) being cursed or something.
I'll see what happens, will probably get bored and come back to it within a day anyway. Damn my lack of ability to let go of a project.
I'll see what happens, will probably get bored and come back to it within a day anyway. Damn my lack of ability to let go of a project.
- Pype.Clicker
- Member
- Posts: 5964
- Joined: Wed Oct 18, 2006 2:31 am
- Location: In a galaxy, far, far away
- Contact:
Re:Failing boot loader?
the advice i would give is "start with something simple and stupid".
For a first attemp, just load a small real-mode program in low memory area without any filesystem support (just assume the program will be at a well-known location and will have a well-known size )
Later, you'll be able to setup protected mode and load a bigger kernel from that small real-mode program (known as the 2nd stage boot-loader). Leave any FAT12 stuff to the 2nd stage too.
Most FAT systems (and hard drives file system too) have some room for a "reserved area" ... you'll then put your loader in that area but once again, for a first attempt, you don't even have to bother with this (just see your floppy as an array of sector for a first stage, and widly write to whatever sectors you want using tools like rawwrite or accessing the /dev/fd0 block device directly under Linux).
Good luc|< and, if i can afford a suggestion, don't make run your own bootloader on your "real" machine at a first time ... i used to trash a large amount of HDD with my own bootloaders before i get something working. BOCHS and vmware are there for you if you can't afford a dedicated "crash machine" ...
For a first attemp, just load a small real-mode program in low memory area without any filesystem support (just assume the program will be at a well-known location and will have a well-known size )
Later, you'll be able to setup protected mode and load a bigger kernel from that small real-mode program (known as the 2nd stage boot-loader). Leave any FAT12 stuff to the 2nd stage too.
Most FAT systems (and hard drives file system too) have some room for a "reserved area" ... you'll then put your loader in that area but once again, for a first attempt, you don't even have to bother with this (just see your floppy as an array of sector for a first stage, and widly write to whatever sectors you want using tools like rawwrite or accessing the /dev/fd0 block device directly under Linux).
Good luc|< and, if i can afford a suggestion, don't make run your own bootloader on your "real" machine at a first time ... i used to trash a large amount of HDD with my own bootloaders before i get something working. BOCHS and vmware are there for you if you can't afford a dedicated "crash machine" ...
Re:Failing boot loader?
Thanks for the advice, was pretty much what I was going to do anyway, get the basics in place before trying anything good-looking. Was nice to hear it from someone else though. I'm gonna keep hammering away at the bootloaders, found a new one that just might work