mirror of
https://github.com/justinian/jsix.git
synced 2025-12-09 16:04:32 -08:00
Rename Popcorn to jsix.
See README.md for more information.
This commit is contained in:
23
LICENSE.md
23
LICENSE.md
@@ -1,8 +1,8 @@
|
||||
# Popcorn
|
||||
# jsix
|
||||
|
||||
Popcorn itself is released under the terms of the MIT license:
|
||||
jsix itself is released under the terms of the MIT license:
|
||||
|
||||
> Copyright © 2018 Justin C. Miller, https://devjustinian.com
|
||||
> Copyright (c) 2018 Justin C. Miller, https://devjustinian.com
|
||||
> <justin@devjustinian.com>
|
||||
>
|
||||
> Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
@@ -25,11 +25,11 @@ Popcorn itself is released under the terms of the MIT license:
|
||||
|
||||
# Included works
|
||||
|
||||
Popcorn includes and/or is derived from a number of other works, listed here.
|
||||
jsix includes and/or is derived from a number of other works, listed here.
|
||||
|
||||
## Catch2
|
||||
|
||||
Popcorn uses [Catch2](https://github.com/catchorg/Catch2) for testing. Catch2 is
|
||||
jsix uses [Catch2](https://github.com/catchorg/Catch2) for testing. Catch2 is
|
||||
released under the terms of the Boost Software license:
|
||||
|
||||
> Boost Software License - Version 1.0 - August 17th, 2003
|
||||
@@ -58,7 +58,7 @@ released under the terms of the Boost Software license:
|
||||
|
||||
## cpptoml
|
||||
|
||||
Popcorn uses the [cpptoml](https://github.com/skystrife/cpptoml) library for
|
||||
jsix uses the [cpptoml](https://github.com/skystrife/cpptoml) library for
|
||||
parsing TOML configuration files. cpptoml is released under the terms of the
|
||||
MIT license:
|
||||
|
||||
@@ -83,8 +83,9 @@ MIT license:
|
||||
|
||||
## printf
|
||||
|
||||
Popcorn uses 's tiny [printf](https://github.com/mpaland/printf) library for its
|
||||
`*printf()` functions, which is also released under the terms of the MIT license:
|
||||
jsix uses Marco Paland's tiny [printf](https://github.com/mpaland/printf)
|
||||
library for its `*printf()` functions, which is also released under the terms
|
||||
of the MIT license:
|
||||
|
||||
> The MIT License (MIT)
|
||||
>
|
||||
@@ -110,14 +111,14 @@ Popcorn uses 's tiny [printf](https://github.com/mpaland/printf) library for its
|
||||
|
||||
## GNU-EFI
|
||||
|
||||
Popcorn's UEFI bootloader initially used
|
||||
jsix's UEFI bootloader initially used
|
||||
[GNU-EFI](https://gnu-efi.sourceforge.net), and still uses one file (the linker
|
||||
script for the bootloader) from that project. GNU-EFI claims to be released
|
||||
under the BSD license. Again, I could not find its specific license file, so I
|
||||
am reproducing a generic 3-clause BSD license (the most restrictive, so as not
|
||||
to assume any extra rights that may not actually be granted) for it here:
|
||||
|
||||
> Copyright © Nigel Croxon
|
||||
> Copyright (c) Nigel Croxon
|
||||
>
|
||||
> Redistribution and use in source and binary forms, with or without
|
||||
> modification, are permitted provided that the following conditions are met:
|
||||
@@ -146,5 +147,5 @@ to assume any extra rights that may not actually be granted) for it here:
|
||||
|
||||
## Intel EFI Application Toolkit
|
||||
|
||||
Popcorn's UEFI loader uses code from Intel's EFI Application toolkit. Relevant
|
||||
jsix's UEFI loader uses code from Intel's EFI Application toolkit. Relevant
|
||||
code includes license statements at the top of each file.
|
||||
|
||||
18
README.md
18
README.md
@@ -1,6 +1,6 @@
|
||||
# popcorn: A toy OS kernel
|
||||
# jsix: A toy OS kernel
|
||||
|
||||
**popcorn** is the kernel for the hobby OS that I am currently building. It's
|
||||
**jsix** is the kernel for the hobby OS that I am currently building. It's
|
||||
far from finished, or even being usable. Instead, it's a sandbox for me to play
|
||||
with kernel-level code and explore architectures.
|
||||
|
||||
@@ -25,9 +25,15 @@ The design goals of the project are:
|
||||
temporarily) in some places to allow me to play around with the related
|
||||
hardware.
|
||||
|
||||
A note on the name: This kernel was originally named Popcorn, but I have since
|
||||
discovered that the Popcorn Linux project is also developing a kernel with that
|
||||
name, started around the same time as this project. So I've renamed this kernel
|
||||
jsix (Always styled _jsix_ or `j6`, never capitalized) as an homage to L4, xv6,
|
||||
and my wonderful wife.
|
||||
|
||||
## Building
|
||||
|
||||
Popcorn uses the [Ninja][] build tool, and generates the build files for it
|
||||
jsix uses the [Ninja][] build tool, and generates the build files for it
|
||||
with a custom tool called [Bonnibel][]. Bonnibel requires [Python 3][] and can
|
||||
be downloaded with `pip`:
|
||||
|
||||
@@ -51,13 +57,13 @@ Requrirements:
|
||||
|
||||
If you have `clang` and `curl` installed, runing the `scripts/build_sysroot_clang.sh`
|
||||
script will download and build a nasm/binutils/LLVM toolchain configured for building
|
||||
Popcorn host binaries.
|
||||
jsix host binaries.
|
||||
|
||||
### Building and running Popcorn
|
||||
### Building and running jsix
|
||||
|
||||
Once the toolchain has been set up, running Bonnibel's `pb` command will set up the
|
||||
build configuration, and `ninja -C build` will actually run the build. If you
|
||||
have `qemu-system-x86_64` installed, the `qemu.sh` script will to run Popcorn
|
||||
have `qemu-system-x86_64` installed, the `qemu.sh` script will to run jsix
|
||||
in QEMU `-nographic` mode.
|
||||
|
||||
I personally run this either from a real debian amd64 testing/buster machine or
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
name: Popcorn
|
||||
name: jsix
|
||||
templates: scripts/templates
|
||||
modules:
|
||||
kernel:
|
||||
output: popcorn.elf
|
||||
output: jsix.elf
|
||||
target: host
|
||||
deps:
|
||||
- elf
|
||||
|
||||
8
qemu.sh
8
qemu.sh
@@ -35,13 +35,13 @@ fi
|
||||
|
||||
if [[ -n $TMUX ]]; then
|
||||
if [[ -n $debug ]]; then
|
||||
tmux split-window "gdb ${build}/popcorn.elf" &
|
||||
tmux split-window "gdb ${build}/jsix.elf" &
|
||||
else
|
||||
tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
|
||||
fi
|
||||
elif [[ $DESKTOP_SESSION = "i3" ]]; then
|
||||
if [[ -n $debug ]]; then
|
||||
i3-msg exec i3-sensible-terminal -- -e "gdb ${PWD}/${build}/popcorn.elf" &
|
||||
i3-msg exec i3-sensible-terminal -- -e "gdb ${PWD}/${build}/jsix.elf" &
|
||||
else
|
||||
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
|
||||
fi
|
||||
@@ -50,12 +50,12 @@ fi
|
||||
exec qemu-system-x86_64 \
|
||||
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
|
||||
-drive "if=pflash,format=raw,file=${build}/${flash_name}.fd" \
|
||||
-drive "format=raw,file=${build}/popcorn.img" \
|
||||
-drive "format=raw,file=${build}/jsix.img" \
|
||||
-monitor telnet:localhost:45454,server,nowait \
|
||||
-smp 4 \
|
||||
-m 512 \
|
||||
-d mmu,int,guest_errors \
|
||||
-D popcorn.log \
|
||||
-D jsix.log \
|
||||
-cpu Broadwell \
|
||||
-M q35 \
|
||||
-no-reboot \
|
||||
|
||||
@@ -50,16 +50,16 @@ build $builddir/ovmf_vars.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars.fd
|
||||
build $builddir/ovmf_vars_d.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars_d.fd
|
||||
name = ovmf_vars_d.fd
|
||||
|
||||
build $builddir/popcorn.elf | $builddir/popcorn.elf.debug : strip $builddir/host/popcorn.elf
|
||||
build $builddir/jsix.elf | $builddir/jsix.elf.debug : strip $builddir/host/jsix.elf
|
||||
name = kernel
|
||||
|
||||
build $builddir/popcorn.dump : dump $builddir/host/popcorn.elf
|
||||
build $builddir/jsix.dump : dump $builddir/host/jsix.elf
|
||||
name = kernel
|
||||
|
||||
build $builddir/popcorn.elf-gdb.py : cp ${srcroot}/assets/debugging/popcorn.elf-gdb.py
|
||||
build $builddir/jsix.elf-gdb.py : cp ${srcroot}/assets/debugging/jsix.elf-gdb.py
|
||||
name = kernel debug python scripts
|
||||
|
||||
build $builddir/fatroot/popcorn.elf : cp $builddir/popcorn.elf
|
||||
build $builddir/fatroot/jsix.elf : cp $builddir/jsix.elf
|
||||
name = kernel to FAT image
|
||||
|
||||
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi
|
||||
@@ -69,18 +69,18 @@ build $builddir/fatroot/initrd.img : makerd ${srcroot}/assets/initrd.toml | $
|
||||
${builddir}/native/makerd $
|
||||
${builddir}/user/nulldrv
|
||||
|
||||
build $builddir/popcorn.img : makefat | $
|
||||
build $builddir/jsix.img : makefat | $
|
||||
$builddir/fatroot/initrd.img $
|
||||
$builddir/fatroot/popcorn.elf $
|
||||
$builddir/fatroot/jsix.elf $
|
||||
$builddir/fatroot/efi/boot/bootx64.efi
|
||||
name = popcorn.img
|
||||
name = jsix.img
|
||||
|
||||
default $
|
||||
$builddir/ovmf_vars.fd $
|
||||
$builddir/ovmf_vars_d.fd $
|
||||
$builddir/popcorn.dump $
|
||||
$builddir/popcorn.elf-gdb.py $
|
||||
$builddir/popcorn.img
|
||||
$builddir/jsix.dump $
|
||||
$builddir/jsix.elf-gdb.py $
|
||||
$builddir/jsix.img
|
||||
{% endblock %}
|
||||
|
||||
# vim: ft=ninja et ts=4 sts=4 sw=4
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
{{ super() }}
|
||||
|
||||
ccflags = $ccflags $
|
||||
-DKERNEL_FILENAME=L\"popcorn.elf\" $
|
||||
-DKERNEL_FILENAME=L\"jsix.elf\" $
|
||||
-DGNU_EFI_USE_MS_ABI $
|
||||
-DHAVE_USE_MS_ABI $
|
||||
-DEFI_DEBUG=0 $
|
||||
|
||||
@@ -22,7 +22,7 @@ ccflags = $ccflags $
|
||||
-g $
|
||||
-mcmodel=large $
|
||||
-D__ELF__ $
|
||||
-D__POPCORN__ $
|
||||
-D__JSIX__ $
|
||||
-isystem${srcroot}/sysroot/include $
|
||||
--sysroot="${srcroot}/sysroot"
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ ccflags = $ccflags $
|
||||
-g $
|
||||
-mcmodel=large $
|
||||
-D__ELF__ $
|
||||
-D__POPCORN__ $
|
||||
-D__JSIX__ $
|
||||
-isystem${srcroot}/sysroot/include $
|
||||
--sysroot="${srcroot}/sysroot"
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ console::initialize(const wchar_t *version)
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "ClearScreen");
|
||||
|
||||
m_out->SetAttribute(m_out, EFI_LIGHTCYAN);
|
||||
m_out->OutputString(m_out, (wchar_t *)L"Popcorn loader ");
|
||||
m_out->OutputString(m_out, (wchar_t *)L"jsix loader ");
|
||||
|
||||
m_out->SetAttribute(m_out, EFI_LIGHTMAGENTA);
|
||||
m_out->OutputString(m_out, (wchar_t *)version);
|
||||
|
||||
@@ -6,6 +6,6 @@ GUID(0x964e5b22,0x6459,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b, guid_simp
|
||||
GUID(0x09576e91,0x6d3f,0x11d2,0x8e,0x39,0x00,0xa0,0xc9,0x69,0x72,0x3b, guid_device_path);
|
||||
GUID(0x8b843e20,0x8132,0x4852,0x90,0xcc,0x55,0x1a,0x4e,0x4a,0x7f,0x1c, guid_device_path_to_text);
|
||||
|
||||
GUID(0x10d0669c,0x9ec6,0x4268,0xbc,0x48,0xff,0x74,0x75,0x21,0xfe,0x07, guid_popcorn_vendor);
|
||||
GUID(0x10d0669c,0x9ec6,0x4268,0xbc,0x48,0xff,0x74,0x75,0x21,0xfe,0x07, guid_jsix_vendor);
|
||||
|
||||
// vim: ft=c
|
||||
|
||||
@@ -51,15 +51,15 @@ detect_debug_mode(EFI_RUNTIME_SERVICES *run, kernel_args *header) {
|
||||
uint8_t debug = 0;
|
||||
UINTN var_size = sizeof(debug);
|
||||
|
||||
#ifdef __POPCORN_SET_DEBUG_UEFI_VAR__
|
||||
debug = __POPCORN_SET_DEBUG_UEFI_VAR__;
|
||||
#ifdef __JSIX_SET_DEBUG_UEFI_VAR__
|
||||
debug = __JSIX_SET_DEBUG_UEFI_VAR__;
|
||||
uint32_t attrs =
|
||||
EFI_VARIABLE_NON_VOLATILE |
|
||||
EFI_VARIABLE_BOOTSERVICE_ACCESS |
|
||||
EFI_VARIABLE_RUNTIME_ACCESS;
|
||||
status = run->SetVariable(
|
||||
var_name,
|
||||
&guid_popcorn_vendor,
|
||||
&guid_jsix_vendor,
|
||||
attrs,
|
||||
var_size,
|
||||
&debug);
|
||||
@@ -68,14 +68,14 @@ detect_debug_mode(EFI_RUNTIME_SERVICES *run, kernel_args *header) {
|
||||
|
||||
status = run->GetVariable(
|
||||
var_name,
|
||||
&guid_popcorn_vendor,
|
||||
&guid_jsix_vendor,
|
||||
nullptr,
|
||||
&var_size,
|
||||
&debug);
|
||||
CHECK_EFI_STATUS_OR_RETURN(status, "detect_debug_mode::GetVariable");
|
||||
|
||||
if (debug)
|
||||
header->flags |= POPCORN_FLAG_DEBUG;
|
||||
header->flags |= JSIX_FLAG_DEBUG;
|
||||
|
||||
return EFI_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
#define DATA_HEADER_MAGIC 0x600dda7a
|
||||
#define DATA_HEADER_VERSION 1
|
||||
|
||||
#define POPCORN_FLAG_DEBUG 0x00000001
|
||||
#define JSIX_FLAG_DEBUG 0x00000001
|
||||
|
||||
#pragma pack(push, 1)
|
||||
struct kernel_args {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
MAGIC equ 0x600db007 ; Popcorn OS header magic number
|
||||
MAGIC equ 0x600db007 ; jsix OS header magic number
|
||||
|
||||
section .header
|
||||
align 4
|
||||
|
||||
@@ -37,7 +37,7 @@ init_console()
|
||||
console *cons = new (&g_console) console(com1);
|
||||
|
||||
cons->set_color(0x21, 0x00);
|
||||
cons->puts("Popcorn OS ");
|
||||
cons->puts("jsix OS ");
|
||||
cons->set_color(0x08, 0x00);
|
||||
cons->puts(GIT_VERSION " booting...\n");
|
||||
|
||||
@@ -47,7 +47,7 @@ init_console()
|
||||
void
|
||||
kernel_main(kernel_args *header)
|
||||
{
|
||||
bool waiting = header && (header->flags && POPCORN_FLAG_DEBUG);
|
||||
bool waiting = header && (header->flags && JSIX_FLAG_DEBUG);
|
||||
while (waiting);
|
||||
|
||||
kutil::assert_set_callback(__kernel_assert);
|
||||
@@ -71,7 +71,7 @@ kernel_main(kernel_args *header)
|
||||
|
||||
init_console();
|
||||
|
||||
log::debug(logs::boot, " Popcorn header is at: %016lx", header);
|
||||
log::debug(logs::boot, " jsix header is at: %016lx", header);
|
||||
log::debug(logs::boot, " Framebuffer is at: %016lx", header->frame_buffer);
|
||||
log::debug(logs::boot, " Kernel data is at: %016lx", header->data);
|
||||
log::debug(logs::boot, " Memory map is at: %016lx", header->memory_map);
|
||||
|
||||
@@ -47,12 +47,12 @@ enum class efi_memory_type : uint32_t
|
||||
|
||||
efi_max,
|
||||
|
||||
popcorn_kernel = 0x80000000,
|
||||
popcorn_data,
|
||||
popcorn_initrd,
|
||||
popcorn_scratch,
|
||||
jsix_kernel = 0x80000000,
|
||||
jsix_data,
|
||||
jsix_initrd,
|
||||
jsix_scratch,
|
||||
|
||||
popcorn_max
|
||||
jsix_max
|
||||
};
|
||||
|
||||
struct efi_memory_descriptor
|
||||
@@ -123,9 +123,9 @@ public:
|
||||
|
||||
void add_used_frames(kutil::vm_space &vm) {
|
||||
for (auto *desc : map) {
|
||||
if (desc->type == efi_memory_type::popcorn_data ||
|
||||
desc->type == efi_memory_type::popcorn_initrd ||
|
||||
desc->type == efi_memory_type::popcorn_kernel)
|
||||
if (desc->type == efi_memory_type::jsix_data ||
|
||||
desc->type == efi_memory_type::jsix_initrd ||
|
||||
desc->type == efi_memory_type::jsix_kernel)
|
||||
{
|
||||
uintptr_t virt_addr = desc->physical_start + kernel_offset;
|
||||
vm.commit(virt_addr, desc->pages * frame_size);
|
||||
@@ -135,9 +135,9 @@ public:
|
||||
|
||||
void page_in_kernel(page_manager &pm, page_table *pml4) {
|
||||
for (auto *desc : map) {
|
||||
if (desc->type == efi_memory_type::popcorn_kernel ||
|
||||
desc->type == efi_memory_type::popcorn_data ||
|
||||
desc->type == efi_memory_type::popcorn_initrd)
|
||||
if (desc->type == efi_memory_type::jsix_kernel ||
|
||||
desc->type == efi_memory_type::jsix_data ||
|
||||
desc->type == efi_memory_type::jsix_initrd)
|
||||
{
|
||||
uintptr_t virt_addr = desc->physical_start + kernel_offset;
|
||||
pm.page_in(pml4, desc->physical_start, virt_addr, desc->pages);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#pragma once
|
||||
/// \file initrd.h
|
||||
/// Definitions defining the simple inital ramdisk file format used by the
|
||||
/// popcorn kernel.
|
||||
/// jsix kernel.
|
||||
|
||||
#include <stdint.h>
|
||||
#include "kutil/vector.h"
|
||||
|
||||
Reference in New Issue
Block a user