OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Mar 29, 2024 3:37 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: Bootloader design issues
PostPosted: Tue Sep 19, 2017 10:20 pm 
Offline
User avatar

Joined: Tue Sep 19, 2017 10:03 pm
Posts: 3
Location: La Habana, Cuba
Hello, my name is Javier and I live in Cuba. I'm 16 years old and I'm new here, so, forgive me if this is a nonsense topic, but I want to design a new multiboot compliant bootloader. I got the GNU GRUB bootloader source code (in its two "flavours"), so I got a small and humble basis in how that kind of things should work.
I copyied the stage 1 code from GRUB, and i found it was pretty straightforward, but I analize, and analize the code and I can't fix a bug where the bootloader shows me not one, but five notification strings and then halt. I analized the control flow of the program and everything seems normal to me!! I don't know why it behaves that way. :?:

Sorry for any poor english you may found in this post. Greetings from Cuba :D Javier

_________________
Join us now and share the software, You'll be free, hackers, you'll be free...


Top
 Profile  
 
 Post subject: Re: Bootloader design issues
PostPosted: Wed Sep 20, 2017 6:16 am 
Offline
Member
Member

Joined: Thu Jul 03, 2014 5:18 am
Posts: 84
Location: The Netherlands
Can you show us the source code?

_________________
My blog: http://www.rivencove.com/


Top
 Profile  
 
 Post subject: Re: Bootloader design issues
PostPosted: Wed Sep 20, 2017 11:45 am 
Offline
User avatar

Joined: Tue Sep 19, 2017 10:03 pm
Posts: 3
Location: La Habana, Cuba
Sure, here it is!! ( This is the code from GRUB in its 0.93 version )
I copyied the code just as it is there.

Perhaps the problem is not the source code at all, perhaps it was my mistake
when installing it to the iso image. I'm not sure.

In any case, thank you very much for your reply. :mrgreen: :mrgreen:

Attachment:
stage1.S [9.23 KiB]
Downloaded 41 times

_________________
Join us now and share the software, You'll be free, hackers, you'll be free...


Top
 Profile  
 
 Post subject: Re: Bootloader design issues
PostPosted: Thu Sep 21, 2017 3:20 am 
Offline
Member
Member
User avatar

Joined: Sat Jan 15, 2005 12:00 am
Posts: 8561
Location: At his keyboard!
Hi,

freelancerdev wrote:
Sure, here it is!! ( This is the code from GRUB in its 0.93 version )
I copyied the code just as it is there.

Perhaps the problem is not the source code at all, perhaps it was my mistake
when installing it to the iso image. I'm not sure.


If it worked in GRUB 0.93, you changed nothing, and it doesn't work for you; then it'd have to be a problem with how you're using it (and not a problem with the source code itself).

Note that I'd recommend writing your own code anyway. More specifically, you'd (eventually) want:
  • A 1st stage boot loader for "floppy on BIOS"
  • A 1st stage boot loader for "MBR partitioned hard disk on BIOS"
  • A 1st stage boot loader for "GPT partitioned hard disk on BIOS"
  • A 1st stage boot loader for "no emulation El Torito/CD on BIOS"
  • A 1st stage boot loader for "PXE/network boot on BIOS"
  • Maybe a boot loader for UEFI (depending on which version/s of multi-boot you're planning to support)

For all of these cases, there's enough differences to make it impractical/silly to attempt to cover 2 or more situations with the same code. For example, for the boot loader in an ISO/CD image (the "no emulation El Torito" one), the BIOS loads the entire boot loader (up to about 600 KiB and not just the first 512 bytes); and the boot loader needs to use 2 KiB sectors (not 512 byte sectors), needs to use "int 0x15 extensions" (and never CHS), needs to handle the ISO9660 file system (and not raw sectors or partitions), etc.


Cheers,

Brendan

_________________
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.


Top
 Profile  
 
 Post subject: Re: Bootloader design issues
PostPosted: Thu Sep 21, 2017 5:45 pm 
Offline
User avatar

Joined: Tue Sep 19, 2017 10:03 pm
Posts: 3
Location: La Habana, Cuba
First of all, thanks to Brendan for his gentle reply!! :D :D

I understand, there are differences between the different ways a machine boots. Thanks for making me notice that! I'll test my own code later when I have time for coding, cause' I'm studying all the day!! Now I see why GRUB 2 places boot code in so many folders. I recently adquired a copy of the multiboot specification document ( yeah, it sounds unimportand but that kind of things are pretty rare here ), so I'll be working in the second stage. I hope having something practical in not too many time. BTW, I was going to name it Clover, but I noticed it was already being used. All the suggestions are accepted. :)

Cheers, Javier

PD: Nice avatar Brendan!!! :D :D :D :mrgreen:

_________________
Join us now and share the software, You'll be free, hackers, you'll be free...


Top
 Profile  
 
 Post subject: Re: Bootloader design issues
PostPosted: Fri Sep 22, 2017 1:25 am 
Offline
Member
Member

Joined: Thu Jul 05, 2012 5:12 am
Posts: 923
Location: Finland
Brendan wrote:
  • A 1st stage boot loader for "GPT partitioned hard disk on BIOS"


What is your current idea of implementing this? To be specific, where should be the auxiliary code for doing the proper parsing of the GPT structures. I have not thought about this lately but I do remember that there were some problems / inelegancy no matter how much I tried. :D

Perhaps there is a solution that makes sense.

_________________
Undefined behavior since 2012


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot], nullpointer and 132 guests


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 post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group