Rename Popcorn to jsix.

See README.md for more information.
This commit is contained in:
Justin C. Miller
2019-05-27 12:48:10 -07:00
parent 2b0cd6f2f2
commit 6285517ef7
17 changed files with 67 additions and 60 deletions

View File

@@ -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> > <justin@devjustinian.com>
> >
> Permission is hereby granted, free of charge, to any person obtaining a copy > 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 # 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 ## 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: released under the terms of the Boost Software license:
> Boost Software License - Version 1.0 - August 17th, 2003 > Boost Software License - Version 1.0 - August 17th, 2003
@@ -58,7 +58,7 @@ released under the terms of the Boost Software license:
## cpptoml ## 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 parsing TOML configuration files. cpptoml is released under the terms of the
MIT license: MIT license:
@@ -83,8 +83,9 @@ MIT license:
## printf ## printf
Popcorn uses 's tiny [printf](https://github.com/mpaland/printf) library for its jsix uses Marco Paland's tiny [printf](https://github.com/mpaland/printf)
`*printf()` functions, which is also released under the terms of the MIT license: library for its `*printf()` functions, which is also released under the terms
of the MIT license:
> The MIT License (MIT) > The MIT License (MIT)
> >
@@ -110,14 +111,14 @@ Popcorn uses 's tiny [printf](https://github.com/mpaland/printf) library for its
## GNU-EFI ## 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 [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 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 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 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: 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 > Redistribution and use in source and binary forms, with or without
> modification, are permitted provided that the following conditions are met: > 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 ## 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. code includes license statements at the top of each file.

View File

@@ -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 far from finished, or even being usable. Instead, it's a sandbox for me to play
with kernel-level code and explore architectures. 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 temporarily) in some places to allow me to play around with the related
hardware. 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 ## 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 with a custom tool called [Bonnibel][]. Bonnibel requires [Python 3][] and can
be downloaded with `pip`: be downloaded with `pip`:
@@ -51,13 +57,13 @@ Requrirements:
If you have `clang` and `curl` installed, runing the `scripts/build_sysroot_clang.sh` 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 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 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 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. in QEMU `-nographic` mode.
I personally run this either from a real debian amd64 testing/buster machine or I personally run this either from a real debian amd64 testing/buster machine or

View File

@@ -1,8 +1,8 @@
name: Popcorn name: jsix
templates: scripts/templates templates: scripts/templates
modules: modules:
kernel: kernel:
output: popcorn.elf output: jsix.elf
target: host target: host
deps: deps:
- elf - elf

View File

@@ -35,13 +35,13 @@ fi
if [[ -n $TMUX ]]; then if [[ -n $TMUX ]]; then
if [[ -n $debug ]]; then if [[ -n $debug ]]; then
tmux split-window "gdb ${build}/popcorn.elf" & tmux split-window "gdb ${build}/jsix.elf" &
else else
tmux split-window -l 10 "sleep 1; telnet localhost 45454" & tmux split-window -l 10 "sleep 1; telnet localhost 45454" &
fi fi
elif [[ $DESKTOP_SESSION = "i3" ]]; then elif [[ $DESKTOP_SESSION = "i3" ]]; then
if [[ -n $debug ]]; 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 else
i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' & i3-msg exec i3-sensible-terminal -- -e 'telnet localhost 45454' &
fi fi
@@ -50,12 +50,12 @@ fi
exec qemu-system-x86_64 \ exec qemu-system-x86_64 \
-drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \ -drive "if=pflash,format=raw,readonly,file=${assets}/ovmf/x64/ovmf_code.fd" \
-drive "if=pflash,format=raw,file=${build}/${flash_name}.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 \ -monitor telnet:localhost:45454,server,nowait \
-smp 4 \ -smp 4 \
-m 512 \ -m 512 \
-d mmu,int,guest_errors \ -d mmu,int,guest_errors \
-D popcorn.log \ -D jsix.log \
-cpu Broadwell \ -cpu Broadwell \
-M q35 \ -M q35 \
-no-reboot \ -no-reboot \

View File

@@ -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 build $builddir/ovmf_vars_d.fd : cp $srcroot/assets/ovmf/x64/ovmf_vars_d.fd
name = 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 name = kernel
build $builddir/popcorn.dump : dump $builddir/host/popcorn.elf build $builddir/jsix.dump : dump $builddir/host/jsix.elf
name = kernel 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 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 name = kernel to FAT image
build $builddir/fatroot/efi/boot/bootx64.efi : cp $builddir/boot/boot.efi 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}/native/makerd $
${builddir}/user/nulldrv ${builddir}/user/nulldrv
build $builddir/popcorn.img : makefat | $ build $builddir/jsix.img : makefat | $
$builddir/fatroot/initrd.img $ $builddir/fatroot/initrd.img $
$builddir/fatroot/popcorn.elf $ $builddir/fatroot/jsix.elf $
$builddir/fatroot/efi/boot/bootx64.efi $builddir/fatroot/efi/boot/bootx64.efi
name = popcorn.img name = jsix.img
default $ default $
$builddir/ovmf_vars.fd $ $builddir/ovmf_vars.fd $
$builddir/ovmf_vars_d.fd $ $builddir/ovmf_vars_d.fd $
$builddir/popcorn.dump $ $builddir/jsix.dump $
$builddir/popcorn.elf-gdb.py $ $builddir/jsix.elf-gdb.py $
$builddir/popcorn.img $builddir/jsix.img
{% endblock %} {% endblock %}
# vim: ft=ninja et ts=4 sts=4 sw=4 # vim: ft=ninja et ts=4 sts=4 sw=4

View File

@@ -3,7 +3,7 @@
{{ super() }} {{ super() }}
ccflags = $ccflags $ ccflags = $ccflags $
-DKERNEL_FILENAME=L\"popcorn.elf\" $ -DKERNEL_FILENAME=L\"jsix.elf\" $
-DGNU_EFI_USE_MS_ABI $ -DGNU_EFI_USE_MS_ABI $
-DHAVE_USE_MS_ABI $ -DHAVE_USE_MS_ABI $
-DEFI_DEBUG=0 $ -DEFI_DEBUG=0 $

View File

@@ -22,7 +22,7 @@ ccflags = $ccflags $
-g $ -g $
-mcmodel=large $ -mcmodel=large $
-D__ELF__ $ -D__ELF__ $
-D__POPCORN__ $ -D__JSIX__ $
-isystem${srcroot}/sysroot/include $ -isystem${srcroot}/sysroot/include $
--sysroot="${srcroot}/sysroot" --sysroot="${srcroot}/sysroot"

View File

@@ -21,7 +21,7 @@ ccflags = $ccflags $
-g $ -g $
-mcmodel=large $ -mcmodel=large $
-D__ELF__ $ -D__ELF__ $
-D__POPCORN__ $ -D__JSIX__ $
-isystem${srcroot}/sysroot/include $ -isystem${srcroot}/sysroot/include $
--sysroot="${srcroot}/sysroot" --sysroot="${srcroot}/sysroot"

View File

@@ -40,7 +40,7 @@ console::initialize(const wchar_t *version)
CHECK_EFI_STATUS_OR_RETURN(status, "ClearScreen"); CHECK_EFI_STATUS_OR_RETURN(status, "ClearScreen");
m_out->SetAttribute(m_out, EFI_LIGHTCYAN); 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->SetAttribute(m_out, EFI_LIGHTMAGENTA);
m_out->OutputString(m_out, (wchar_t *)version); m_out->OutputString(m_out, (wchar_t *)version);

View File

@@ -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(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(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 // vim: ft=c

View File

@@ -51,15 +51,15 @@ detect_debug_mode(EFI_RUNTIME_SERVICES *run, kernel_args *header) {
uint8_t debug = 0; uint8_t debug = 0;
UINTN var_size = sizeof(debug); UINTN var_size = sizeof(debug);
#ifdef __POPCORN_SET_DEBUG_UEFI_VAR__ #ifdef __JSIX_SET_DEBUG_UEFI_VAR__
debug = __POPCORN_SET_DEBUG_UEFI_VAR__; debug = __JSIX_SET_DEBUG_UEFI_VAR__;
uint32_t attrs = uint32_t attrs =
EFI_VARIABLE_NON_VOLATILE | EFI_VARIABLE_NON_VOLATILE |
EFI_VARIABLE_BOOTSERVICE_ACCESS | EFI_VARIABLE_BOOTSERVICE_ACCESS |
EFI_VARIABLE_RUNTIME_ACCESS; EFI_VARIABLE_RUNTIME_ACCESS;
status = run->SetVariable( status = run->SetVariable(
var_name, var_name,
&guid_popcorn_vendor, &guid_jsix_vendor,
attrs, attrs,
var_size, var_size,
&debug); &debug);
@@ -68,14 +68,14 @@ detect_debug_mode(EFI_RUNTIME_SERVICES *run, kernel_args *header) {
status = run->GetVariable( status = run->GetVariable(
var_name, var_name,
&guid_popcorn_vendor, &guid_jsix_vendor,
nullptr, nullptr,
&var_size, &var_size,
&debug); &debug);
CHECK_EFI_STATUS_OR_RETURN(status, "detect_debug_mode::GetVariable"); CHECK_EFI_STATUS_OR_RETURN(status, "detect_debug_mode::GetVariable");
if (debug) if (debug)
header->flags |= POPCORN_FLAG_DEBUG; header->flags |= JSIX_FLAG_DEBUG;
return EFI_SUCCESS; return EFI_SUCCESS;
} }

View File

@@ -7,7 +7,7 @@
#define DATA_HEADER_MAGIC 0x600dda7a #define DATA_HEADER_MAGIC 0x600dda7a
#define DATA_HEADER_VERSION 1 #define DATA_HEADER_VERSION 1
#define POPCORN_FLAG_DEBUG 0x00000001 #define JSIX_FLAG_DEBUG 0x00000001
#pragma pack(push, 1) #pragma pack(push, 1)
struct kernel_args { struct kernel_args {

View File

@@ -1,4 +1,4 @@
MAGIC equ 0x600db007 ; Popcorn OS header magic number MAGIC equ 0x600db007 ; jsix OS header magic number
section .header section .header
align 4 align 4

View File

@@ -37,7 +37,7 @@ init_console()
console *cons = new (&g_console) console(com1); console *cons = new (&g_console) console(com1);
cons->set_color(0x21, 0x00); cons->set_color(0x21, 0x00);
cons->puts("Popcorn OS "); cons->puts("jsix OS ");
cons->set_color(0x08, 0x00); cons->set_color(0x08, 0x00);
cons->puts(GIT_VERSION " booting...\n"); cons->puts(GIT_VERSION " booting...\n");
@@ -47,7 +47,7 @@ init_console()
void void
kernel_main(kernel_args *header) kernel_main(kernel_args *header)
{ {
bool waiting = header && (header->flags && POPCORN_FLAG_DEBUG); bool waiting = header && (header->flags && JSIX_FLAG_DEBUG);
while (waiting); while (waiting);
kutil::assert_set_callback(__kernel_assert); kutil::assert_set_callback(__kernel_assert);
@@ -71,7 +71,7 @@ kernel_main(kernel_args *header)
init_console(); 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, " Framebuffer is at: %016lx", header->frame_buffer);
log::debug(logs::boot, " Kernel data is at: %016lx", header->data); log::debug(logs::boot, " Kernel data is at: %016lx", header->data);
log::debug(logs::boot, " Memory map is at: %016lx", header->memory_map); log::debug(logs::boot, " Memory map is at: %016lx", header->memory_map);

View File

@@ -47,12 +47,12 @@ enum class efi_memory_type : uint32_t
efi_max, efi_max,
popcorn_kernel = 0x80000000, jsix_kernel = 0x80000000,
popcorn_data, jsix_data,
popcorn_initrd, jsix_initrd,
popcorn_scratch, jsix_scratch,
popcorn_max jsix_max
}; };
struct efi_memory_descriptor struct efi_memory_descriptor
@@ -123,9 +123,9 @@ public:
void add_used_frames(kutil::vm_space &vm) { void add_used_frames(kutil::vm_space &vm) {
for (auto *desc : map) { for (auto *desc : map) {
if (desc->type == efi_memory_type::popcorn_data || if (desc->type == efi_memory_type::jsix_data ||
desc->type == efi_memory_type::popcorn_initrd || desc->type == efi_memory_type::jsix_initrd ||
desc->type == efi_memory_type::popcorn_kernel) desc->type == efi_memory_type::jsix_kernel)
{ {
uintptr_t virt_addr = desc->physical_start + kernel_offset; uintptr_t virt_addr = desc->physical_start + kernel_offset;
vm.commit(virt_addr, desc->pages * frame_size); vm.commit(virt_addr, desc->pages * frame_size);
@@ -135,9 +135,9 @@ public:
void page_in_kernel(page_manager &pm, page_table *pml4) { void page_in_kernel(page_manager &pm, page_table *pml4) {
for (auto *desc : map) { for (auto *desc : map) {
if (desc->type == efi_memory_type::popcorn_kernel || if (desc->type == efi_memory_type::jsix_kernel ||
desc->type == efi_memory_type::popcorn_data || desc->type == efi_memory_type::jsix_data ||
desc->type == efi_memory_type::popcorn_initrd) desc->type == efi_memory_type::jsix_initrd)
{ {
uintptr_t virt_addr = desc->physical_start + kernel_offset; uintptr_t virt_addr = desc->physical_start + kernel_offset;
pm.page_in(pml4, desc->physical_start, virt_addr, desc->pages); pm.page_in(pml4, desc->physical_start, virt_addr, desc->pages);

View File

@@ -1,7 +1,7 @@
#pragma once #pragma once
/// \file initrd.h /// \file initrd.h
/// Definitions defining the simple inital ramdisk file format used by the /// Definitions defining the simple inital ramdisk file format used by the
/// popcorn kernel. /// jsix kernel.
#include <stdint.h> #include <stdint.h>
#include "kutil/vector.h" #include "kutil/vector.h"