Giter Site home page Giter Site logo

neo4reo / baremetal-os-1 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from returninfinity/baremetal-os

0.0 1.0 0.0 95 KB

Build scripts for BareMetal OS and its related utilities

CMake 1.55% Makefile 19.28% Shell 44.35% Batchfile 8.53% GDB 1.52% C 24.77%

baremetal-os-1's Introduction

BareMetal OS build scripts

The easiest way to create a BareMetal OS build environment. These scripts will download and compile all of the components needed for using BareMetal OS.

Join the chat at https://gitter.im/ReturnInfinity/BareMetal-OS Build Status

Prerequisites

NASM (Assembly compiler) is required to build the loader and OS, as well as the apps writen in Assembly. QEMU (computer emulator) is required if you plan on running the OS for quick testing. GCC (C compiler) is required for building the BMFS disk utility, the C applications, as well as Newlib. Git is used for pulling the software from GitHub. FreeType is used for rendering the font glyphs in Alloy.

In Ubuntu this can be completed with the following command:

sudo apt-get install nasm qemu gcc git libfreetype6-dev

There are additional dependencies if you are planning on compiling Newlib. They can be installed with the following command:

sudo apt-get install autoconf automake libtool sed gawk bison flex m4 texinfo texi2html unzip make

Initial configuration

git clone https://github.com/ReturnInfinity/BareMetal-OS.git
cd BareMetal-OS
./setup.sh

setup.sh automatically runs build, format, and install

Rebuilding the source code

./build.sh

Installing to the disk image

./install.sh

Test the install with QEMU

./run.sh

Test the install with Bochs

Bochs does not support SATA drives so this is only useful for debugging the kernel. Make sure bochs and bochs-x are installed.

bochs -f bochs.cfg

Build a VMDK disk image for VMware

./vmdk.sh

Build a VDI disk image for VirtualBox

./vdi.sh

The VDI script rewrites the disk ID with the contents of VDI_UUID.bin to avoid the disk warning in VirtualBox.

Build the project using GNU Make

git submodule update --init --recursive
make

Programs in Assembly

Automatic:

./app.sh sysinfo
./run.sh

With GNU Make:

make sysinfo.app

Manual:

cd src/Coreutils/
nasm sysinfo.asm -o ../../bin/sysinfo.app
cd ../../bin
./bmfs bmfs.image create sysinfo.app 2
./bmfs bmfs.image write sysinfo.app
cd ..
./run.sh

BareMetal OS should be running in the QEMU virtual machine and you should see a '>' prompt. You can now run the application by typing

sysinfo.app

Programs in C

C programs can be compiled to take advantage of the BareMetal system calls. Standard ANSI C calls are available via Newlib (see the Newlib section below).

Automatic:

./appc.sh hello-c
./run.sh

With GNU Make:

make hello-c.app

Manual (will not work with standard C library):

gcc -c -m64 -nostdlib -nostartfiles -nodefaultlibs -fomit-frame-pointer -mno-red-zone -o bin/program.o program.c
ld -T src/Coreutils/coreutil.ld -o bin/program.app bin/program.o
cd bin
./bmfs bmfs.image create program.app 2
./bmfs bmfs.image write program.app
cd ..
./run.sh

BareMetal OS should be running in the QEMU virtual machine and you should see a '>' prompt. You can now run the application by typing

program.app

Compiling Newlib

./newlib.sh

The Newlib script will build the Newlib library and also compile a test application (test.app) to verify the build process.

The test application can also be built manually:

cd newlib
gcc -I newlib-2.4.0/newlib/libc/include/ -c test.c -o test.o
ld -T app.ld -o test.app crt0.o test.o libc.a
cp test.app ../bin
cd ../bin
./bmfs bmfs.image create test.app 2
./bmfs bmfs.image write test.app
cd ..
./run.sh

BareMetal OS should be running in the QEMU virtual machine and you should see a '>' prompt. You can now run the application by typing

test.app

baremetal-os-1's People

Contributors

gil0mendes avatar ianseyler avatar scherrey avatar tay10r avatar vilhelmgray avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.