OSDev.org

The Place to Start for Operating System Developers
It is currently Sun Mar 26, 2017 1:04 pm

All times are UTC - 6 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: OS/Z and BOOTBOOT Protocol
PostPosted: Thu Oct 13, 2016 6:51 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 65
Hi there!

After a couple years gap, I've started os dev again. I've started from scratch, and after a few weeks my new OS reached the first milestone, it can boot! :-) It can't do much more than drawing color boxes on screen, but this post isn't about OS/Z (not to confuse with z/OS). It's about the boot loader.

Have you ever wondered how good it would be if the firmware'd set up long mode, load your initrd and start executing your kernel right away? It was just a dream, you had to roll your own loader or learn to use one. But BIOS is ancient, needs lots of assembly; GRUB is a beast, almost an OS on it's own; and EFI is a real interface nightmare. Who want to struggle with all that stuff just to start the kernel?

I've solved that in an elegant way: my boot loader resides in ROM. On boot, it will locate the kernel text segment in the first ELF64 executable on the first init ramdisk on the first bootable partition of the first drive (hope you can follow :-)). It's doing it by looking for file magic, so file system independently. After that it sets up a minimal, well defined long mode environment (with framebuffer) and calls the kernel's entry point. The whole procedure is described in detail at

BOOTBOOT Protocol

(the name refers to 64 bits) The reference implementations for BIOS and EFI can be found there as well. My basic principle is K.I.S.S., so the code base is minimal with the least dependencies possible.

And the best part is, it's Public Domain! So you can use those ROM images to boot your own kernel from your own filesystem without the need of writing an fs driver! Never been easier to start OS development! They work with qemu, bochs and real hardware as well (at your own risk). If you don't want to mess with ROMs, you can boot the loader from disk too, as it supports:

- Standard MBR booting on GPT disks (real mode)
- MultiBoot (prot mode)
- BIOS Expansion ROM (real mode)
- UEFI OS loader application (long mode)
- PCI Option ROM (long mode)

It doesn't matter which one is used, your kernel will start with the same, well-known long mode environment.

Tested with FAT12, cpio, tar and FS/Z (not to confuse with Zfs) initrd formats on FAT12, FAT16 and FAT32 EFI System Partitions.

Hope it helps somebody,
bzt

ps.: any testing result would be appreciated! Let me know how it worked for you!


Last edited by bzt on Thu Dec 29, 2016 3:44 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject: Re: OS/Z and BOOTBOOT Protocol
PostPosted: Wed Dec 28, 2016 9:24 pm 
Offline
Member
Member
User avatar

Joined: Sun Dec 25, 2016 1:54 am
Posts: 181
sorry... why is it great with gpl v3?

_________________
Plagiarize. Plagiarize. Let not one line escape thine eyes...


Top
 Profile  
 
 Post subject: Re: OS/Z and BOOTBOOT Protocol
PostPosted: Thu Dec 29, 2016 3:18 pm 
Offline
Member
Member
User avatar

Joined: Thu Oct 13, 2016 4:55 pm
Posts: 65
dchapiesky wrote:
sorry... why is it great with gpl v3?

I wanted it to be permissive. Just to make sure I've re-licensed BOOTBOOT as Public Domain.
The permission to use my loader in any way you wish is hereby granted.

The licensing terms of OS/Z hasn't changed.

Bests,
bzt


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

All times are UTC - 6 hours


Who is online

Users browsing this forum: mikegonta and 2 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