• Stars
    star
    80
  • Rank 390,766 (Top 8 %)
  • Language
    Ada
  • License
    Other
  • Created almost 12 years ago
  • Updated over 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Ada Bare Bones OS development tutorial source code

Bare Bones

Introduction

This source provides a complete port of the C Bare Bones tutorial from http://wiki.osdev.org. I copied and modified the linker script from the D port as the original didn't work for me and also did the same with the startup code from the original C port.

The full documentation and build instructions for this project can be found here.

Note I am currently in the process of updating this repository.

$ git clone https://github.com/Lucretia/bare_bones.git
$ cd bare_bones/build/gnat

Prerequisites

To test using make QEMU, you will need GRUB 2 installed for the grub2-mkrescue (GRUB 2 should be installed if you're on a modern distribution) command. This command also requires xorriso - which you will have to install separately.

Debian

$ sudo apt-get install qemu xorriso

Gentoo

I have sudo installed on my machine:

$ sudo emerge -av libisoburn

I also used my Free Ada build scripts to build useable bare metal cross compilers.

x86

GRUB

$ mkdir -p others/{build,source}
$ cd others/source
$ git clone git://git.savannah.gnu.org/grub.git
$ cd grub
$ ./autogen.sh
$ mkdir ../../build/grub && cd ../../build/grub
$ ../../source/grub/configure --prefix=`pwd`/../../../gen/pc/grub --target=i586-elf
$ make -j4
$ make install

Booting the kernel

The qemu target will also make the kernel image and boot.iso.

$ make rts
$ make qemu

Debugging the kernel

From the build/gnat directory, in one shell, type the following:

$ make qemud

then in another shell, type:

$ ./gdb-qemu.sh

Boot the kernel within QEMU and GDB will break into the kernel at the main program. e.g.:

$ ./gdb-qemu.sh
GNU gdb (Gentoo 7.10.1 vanilla) 7.10.1
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://bugs.gentoo.org/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from gen/pc/debug/disk/boot/bare_bones-i586.elf...done.
0x0000fff0 in ?? ()
Breakpoint 1 at 0x100c20: file /home/laguest/src/mine/bare_bones/src/bare_bones.adb, line 15.


Breakpoint 1, bare_bones () at /home/laguest/src/mine/bare_bones/src/bare_bones.adb:15
15	procedure Bare_Bones is
(gdb)
(gdb) bt
#0  bare_bones () at /home/laguest/src/mine/bare_bones/src/bare_bones.adb:15
(gdb) list
10	--  with System.Address_To_Access_Conversions;
11	--  with Ada.Unchecked_Conversion;
12
13	use type Multiboot.Magic_Values;
14
15	procedure Bare_Bones is
16	   Line : Screen_Height_Range := Screen_Height_Range'First;
17	begin
18	   null;
19	   Clear;
(gdb) q
A debugging session is active.

	Inferior 1 [Remote target] will be detached.

Quit anyway? (y or n) y
Detaching from program: /home/laguest/src/mine/bare_bones/build/gnat/gen/pc/debug/disk/boot/bare_bones-i586.elf, Remote target
Ending remote debugging.

Bugs

None at present.

Who did this?

Luke A. Guest

Future

I intend to get this very basic kernel building on a number of boards that I have lying around:

  • Raspberry Pi (original version)
  • Pandaboard
  • Arduino Uno
  • ChipKit Uno32
  • STM32F4-Discovery
  • MSP430 Launchpad

This will show that Ada 2012 can be built and booted directly on top of any type type of board from small limited devices and upwards.

Ada features to add

  • Port to Ada 2012.
  • Secondary stack so that indefinite types can be returned easily.
  • Move runtime building to Free Ada.

Licence

As advised in the forum sticky on osdev.org, the code here is released under the CC0 license placing this work under public domain with no copyright.

More Repositories

1

tamp

The Ada Microkernel Project
Ada
110
star
2

free-ada

Build scripts for FSF GCC and AdaCore tools
Shell
48
star
3

orenda

An experiment in language design and compiler building.
CMake
15
star
4

adavulkan

Ada 2012 binding to Vulkan
Ada
13
star
5

ether

An SCGI library for Ada
Ada
10
star
6

meta-ada

Meta layer for Yocto which adds support for Ada.
Ada
7
star
7

so

Simple Oberon-0 Compiler
Ada
7
star
8

tamp2

The Ada Monolithic kernel Project
Ada
6
star
9

jni

Ada bindings to the Java 11 Native Interface API.
Ada
5
star
10

hs610-info

Information on HUION's HS610 tablet
5
star
11

hack-howto

My Hackintosh instructions, so I don't forget
Shell
4
star
12

raytracer_challenge

Raytracer Challenge in Ada 2012
Ada
3
star
13

test_binding

Testing binding to C++ from Ada 2012
Ada
3
star
14

ada-overlay

Gentoo Ada overlay
Shell
3
star
15

uca

Unicode Components for Ada
Ada
3
star
16

lispy

An implementation of a Lisp from Build your own Lisp written in Ada 2012.
C
2
star
17

aplug

Ada 2012 binding to LADSPA
Ada
2
star
18

xpressada

Ada sample applications for the LPCXpresso boards
Ada
2
star
19

adaspir-v

Ada 2012 implementation of the SPIR-V common data types
Ada
2
star
20

ada-vscode

Basic syntax highlighting for Ada and GPR
1
star
21

pc_tut

Parser Combinators Tutorial
Ada
1
star
22

password

A simple random password generator
Ada
1
star
23

etc

Configs and crap.
Shell
1
star
24

wxada_orig

Original hand written wxAda sources, see README.
Ada
1
star
25

niestu-nail

Archive of NiEstu Application Infrastructure Library (from 2012)
Ada
1
star
26

mesa-amdgpu

Mesa master and Dave Airlie's semi-interesting branch merged into amdgpu/radv branch
C
1
star
27

samueltardieu-postgres-ada

Archive version of Samuel Tardieu's clean up of postgres-ada, it's no longer on his github account or the net. I don't know how much this differs from the coreland version.
Ada
1
star