flat assembler
Message board for the users of flat assembler.

Index > OS Construction > Help: Loading Stage Two Bootloader From Stage One Bootloader

Author
Thread Post new topic Reply to topic
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
My Stage One bootloader is 16 bit, its assembled Raw Binary File..
The Second Stage bootloader is also a 16 bit, its again assembled Raw Binary File..

The Second Stage Bootloader is copy and pasted on the floppy disk, rather that copying it to some particular sector.. Now my question is how can i find the second stage bootloader using the Stage one bootloader..??

The file system is FAT12..
Post 01 Apr 2012, 11:06
View user's profile Send private message Reply with quote
SeproMan



Joined: 11 Oct 2009
Posts: 60
Location: Belgium
SeproMan
Take a look at the bootloader at the end of this post. It's just what you need!
http://board.flatassembler.net/topic.php?t=11748

_________________
Real Address Mode.
Post 01 Apr 2012, 12:56
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
Ok.. I will try to understand the code.. Thanks a lot.. Smile

Tell me one more thing..
Suppose my kernel is in C.. Then how should i compile it so that the Bootloader(you have given the link for) may load it..
Post 01 Apr 2012, 17:18
View user's profile Send private message Reply with quote
xleelz



Joined: 12 Mar 2011
Posts: 86
Location: In Google Code Server... waiting for someone to download me
xleelz
Note: Some thinking required...
http://wiki.osdev.org/Bare_Bones
Post 01 Apr 2012, 18:27
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
@xleelz: Thanks a lot.. I dinn see that.. Razz
Post 02 Apr 2012, 17:49
View user's profile Send private message Reply with quote
ACP



Joined: 23 Sep 2006
Posts: 204
ACP
uautkarsh wrote:

Suppose my kernel is in C.. Then how should i compile it so that the Bootloader(you have given the link for) may load it..


That really depends on what you want to achieve and how much work you would like to invest into it. You can compile it as MZ,PE or ELF file for example assuming you will include appropriate process loader into second stage bootloader. The other option is to make it raw binary and load it into predefined address space and just jump to correct entry point.

The decision should also be based on your architectural decision like: when do you enable memory management, do you use protected mode or long mode etc and on which system booting stage you enable those CPU/system features.
Post 03 Apr 2012, 08:41
View user's profile Send private message Reply with quote
uautkarsh



Joined: 30 Mar 2012
Posts: 8
Location: India
uautkarsh
Ok.. I haven't thought of this much..
Anyways.. In my second Bootloader i will go into the protected mode..
I will try all the above suggestions.. Smile
Thanks a lot..
Post 03 Apr 2012, 14:59
View user's profile Send private message Reply with quote
flash



Joined: 11 Mar 2006
Posts: 55
Location: Cuba
flash
Or you can use GRUB, jejeje. This is a basic template for a multiboot compilant binary code:
Code:
bits 32
MULTIBOOT_HEADER_MAGIC    equ 0x1BADB002
MULTIBOOT_HEADER_FLAGS        equ 0x00010000
CHECKSUM              equ -(MULTIBOOT_HEADER_MAGIC + MULTIBOOT_HEADER_FLAGS)
LOADBASE              equ 0x00100000          ; the load base address
org LOADBASE

                 jmp     multiboot_entry

align    4
multiboot_header:
                  dd MULTIBOOT_HEADER_MAGIC
                   dd MULTIBOOT_HEADER_FLAGS
                   dd CHECKSUM
                 dd multiboot_header
                 dd LOADBASE
                 dd 0
                        dd 0
                        dd multiboot_entry
     
multiboot_entry:
                 ; as much code as the file system support Wink 
    
Post 05 Apr 2012, 14:56
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on GitHub, YouTube, Twitter.

Website powered by rwasa.