Git Product home page Git Product logo

jslk's Introduction

JSLK Kernel

JSLK is a simple 32-bit hobby kernel designed to run on the x86 architecture (although portability has been taken into consideration). It was started in August 2017 with the objective of learning how a computer operating system works and to improve the coding skills of the main developer. The kernel is mostly written in C with some bits of assembly and has partial compatibility with C++ (a runtime is provided). Some of its features are: extensive HAL API, System V ABI compatibility, memory management, interrupt handling, VGA driver, timers and delays, some synchronization primitives, a growing home-made C library, etc. You can test the current kernel online here.

Build Status GitHub license Project Status Kernel Version

The official documentation can be found here.

Directory Structure

crt: C/C++ Runtime.

docs: Some documentation (writing in progress, thus incomplete).

iso: Filesystem used to build ISO image.

initrd: Files used to build the initrd.

hal: Hardware Abstraction Layer and API.

include: Public kernel headers.

kernel: Main kernel.

lib: Kernel Libraries.

target: Target build recipes.

Supported Architectures

  • x86 (x86common).
  • x86_64 (x64_common).

Note: JSLK is not fully ported to x86_64 architecture yet, if you want to check out the latest features build for x86 instead.

  • Raspberry Pi 1/2/zero (coming soon) (bcm28common).

Building for x86_64

These instructions will help you build JSLK Kernel for the x86 platform.

Prerequisites

JSLK can be built on any UNIX like system, such as any Linux distribution, FreeBSD or macOS. Windows can also be used with the WSL enabled. To build the kernel you first need to install some dependencies and the toolchain.

On Linux:

$ sudo apt-get install nasm wget git qemu xorriso  # Change apt-get install for whatever package manager you are using.
$ wget https://github.com/sofferjacob/edison-toolchain/releases/download/1.0.0/sierra_toolchain_linux_x86_64_v.1.0.0.tar.gz

On macOS:

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ brew install nasm
$ brew install wget
$ brew install qemu
$ brew install xorriso
$ wget https://github.com/sofferjacob/edison-toolchain/releases/download/1.0.0/sierra_toolchain_mac_v.1.0.0.zip

On other operating systems the packages:

  • git
  • nasm
  • qemu
  • i386-elf toolchain (can be built using the scripts here)

Can be built from source or installed from other sources.

Note: GRUB must be re-compiled with the i386-elf architecture as a target on any OS. You can find instructions on how to do so here.

Building

To build JSLK from source copy and paste the following commands in a terminal prompt:

$ git clone https://github.com/sofferjacob/jslk.git
$ cd jslk
$ export TARGET=x64common  # You can change this for whichever target you want
$ make

Note: For this to work, your toolchain must be in your path (you can change this in the Makefile).

To clean the source tree:

$ make clean

And to build an ISO image:

$ make floppy

You can also pass the target as an argument to make instead of defining it as a variable:

$ make TARGET=x64common clean all floppy run

To build the initird:

$ ./make_initrd file1 file1 file2 file2 ... file5 file5

Note: The included utility only works in macOS. Recompile the utility for your host OS using:

$ gcc initrd/make_initrd.c -o make_initrd

Testing

Although JSLK can be tested on real hardware, it is not recommended, since a bug in the kernel can brick your system. Besides installation to a hard drive is not currently supported, thus testing on a Virtual Machine is recommended.

Testing on a VM

Build the kernel and a floppy image, then:

$ make run

Contributing

Check CONTRIBUTING.md for guidelines on how to contribute to the project, create issues and pull requests. We also encourage you to read our code of conduct.

Documentation

You may find the documentation for the project here.

License

JSLK is licensed under the GNU General Public License v3.0 - see the LICENSE file for details. An original copy of the documentation of this product should be included with every derivative work or redistributions of this project.

Acknowledgments

See docs/attrib.txt.

jslk's People

Contributors

sofferjacob avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

nasingfaund

jslk's Issues

Keyboard `key pressed` IRQ gets stuck at boot

Expected behavior

Keyboard to work normally when enabled.

Actual behavior

Unless you press and release the enter key very quickly in GRUB, the key release IRQ gets stuck rendering keyboard unusable when IRQ's are enabled by the kernel.

How to reproduce

Just use the kernel normally.

Project Information

Latest commit when reported: e9cec11
Kernel version(s) affected: v0.0.7pa (in development)
Branches affected:master
Host OS: macOS 10.13
Cross Compiler version: i386-elf-gcc (GCC) 6.2.0

Logger

Now that the project has a VFS in place, it needs a logger stat. It will help debug greatly and will make using breakpoints, timers, printing text to the screen and other forms of more primitive debugging obsolete.

Downloadable floppy image release of JSLK?

Good day @sofferjacob !
I would like to download a floppy image of your JSLK operating system to test it inside QEMU and then maybe inside my laptop's coreboot/SeaBIOS (related to #18) Could I get this JSLK floppy without building it from source? (there are some problems with my Linux environment at the moment)
Best regards

init_region() and deinit_region() don't work

Expected behavior

init_region() and deinit_region() to initialize / deinitialize specified memory region (since not all memory is usable).

Actual behavior

They just don't do anything.

How to reproduce

Run the kernel.

Project Information

Kernel version(s) affected: v0.0.8pa (unreleased, in development)
Branches affected: master
Host OS: macOS 10.13
Cross Compiler version: i386-elf-gcc (GCC) 6.2.0

PMM reading wrong memory map

When reading the memory map passed by multiboot, the kernel skips the first section and reads a false section at the end.

Kernel Memory Map
screen shot 2017-10-06 at 12 27 45 am

Grub Memory map
screen shot 2017-10-06 at 12 32 30 am

Use all the available memory

Instead of assuming the computer has 16 mb of RAM, detect memory and obtain a memory map to initialize usable ram sections so all the available memory can be used.

Using the kernel heap causes a page fault

Expected behavior

Being able to allocate and free memory via the kernel heap.

Actual behavior

When trying to allocate memory with the kernel heap enabled, the kernel throws a page fault (read-only, present) at address 0x0x116000.

How to reproduce

Try to allocate some memory with the heap enabled.

Project Information

Latest commit when reported: 59b531a.
Kernel version(s) affected: v0.0.7pa (unreleased, in development)
Branches affected: ex. master
Host OS: macOS 10.13
Cross Compiler version: i386-elf-gcc (GCC) 6.2.0

Keyboard caps flag remains set

Expected behavior

When the shift key is pressed, the letters should be printed in caps. When released they should be printed normally.

Actual behavior

When the shift key is released, the caps flag remains set and therefore the letters are printed in caps.

How to reproduce

Just type.

Project Information

Latest commit when reported:
Kernel version(s) affected: All (since the intro. of keyboard driver).
Branches affected: master
Host OS: ex. macOS 10.13
Cross Compiler version: i386-elf-gcc (GCC) 6.2.0

Could JSLK still fit on a floppy?

I have noticed "Floppy Images are now obsolete" note at your Makefile. But why? Even today the floppies are still being used, for example - as virtual floppies inside the coreboot open source BIOS. Just imagine: your wonderful OS could be a part of someone's BIOS build! (for coreboot supported motherboard, maybe you have or could get one - see https://www.coreboot.org/Supported_Motherboards )

If you already have a coreboot-supported motherboard, or a real chance to get one, - wouldn't it be cool to be able to launch your own OS straight from the BIOS chip? ;) With one simple command its possible to add any floppy to coreboot BIOS build - and then you see it as a boot entry! Multiple floppies could be added this way (as long as you have enough space left inside the BIOS flash chip, luckily LZMA compression could be used for the stored floppies to reduce their occupied size)

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.