first commit

This commit is contained in:
Hjin-Linux
2026-03-04 17:54:26 +02:00
commit cf12e44902
16 changed files with 201 additions and 0 deletions
+42
View File
@@ -0,0 +1,42 @@
MAINCLUB OPEN SOFTWARE LICENSE (MCOSL)
Version 1.0
Copyright (c) 2026 MainClub
All Rights Reserved
1. Purpose
The MainClub Open Software License (MCOSL) ensures that the Licensed Work remains publicly accessible in source code form and may be freely used, studied, modified, and shared on a strictly non-commercial basis.
This License does not qualify as an Open Source license under definitions published by the Open Source Initiative.
2. Definitions
2.1 "Licensed Work" means any software, source code, documentation, or related materials distributed under this License.
2.2 "Derivative Work" means any modification, adaptation, translation, fork, or other work based on the Licensed Work.
2.3 "Distribution" means making the Licensed Work or a Derivative Work available to third parties by any means.
2.4 "Commercial Activity" means any sale, licensing for a fee, paid access, monetized hosting, paid subscription, or other activity intended for commercial advantage or monetary compensation.
3. Grant of Rights
Subject to compliance with this License, each recipient is granted a worldwide, royalty-free, non-exclusive license to:
a) Use the Licensed Work for any purpose;
b) Study and modify the Licensed Work;
c) Create Derivative Works;
d) Distribute the Licensed Work or Derivative Works on a strictly non-commercial basis.
4. Copyleft Requirement
4.1 Any Distribution of the Licensed Work or a Derivative Work must be made under this same License.
4.2 Complete corresponding source code must be provided free of charge.
4.3 No additional legal, contractual, or technical restrictions may be imposed.
4.4 Derivative Works may not be relicensed under any other license.
5. Non-Commercial Restriction
5.1 The Licensed Work and any Derivative Work may not be used for Commercial Activity.
5.2 It is prohibited to:
a) Sell the Licensed Work;
b) Sell a Derivative Work;
c) Charge for access or downloads;
d) Include the Licensed Work in any paid product or service;
e) Provide paid hosting or subscription-based access.
5.3 These restrictions apply equally to all parties, including MainClub.
6. Attribution and Branding
6.1 All copyright notices must be preserved.
6.2 Modifications must be clearly documented.
6.3 The name "MainClub" and related branding may not be used to endorse or promote Derivative Works without prior written permission.
7. No Warranty
THE LICENSED WORK IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND.
8. Limitation of Liability
IN NO EVENT SHALL ANY COPYRIGHT HOLDER BE LIABLE FOR DAMAGES ARISING FROM THE USE OR DISTRIBUTION OF THE LICENSED WORK.
9. Termination
Any violation of this License automatically terminates the rights granted herein.
+23
View File
@@ -0,0 +1,23 @@
CC = x86_64-elf-gcc
LD = x86_64-elf-ld
CFLAGS = -ffreestanding -O2 -Wall -Wextra
LDFLAGS = -T linker.ld -nostdlib
OBJS = \
sys/arch/x86_64/boot.o \
sys/kern/main.o
all: kernel.bin
kernel.bin: $(OBJS)
$(LD) $(LDFLAGS) -o kernel.bin $(OBJS)
sys/arch/x86_64/boot.o:
$(CC) $(CFLAGS) -c sys/arch/x86_64/boot.s -o sys/arch/x86_64/boot.o
sys/kern/main.o:
$(CC) $(CFLAGS) -c sys/kern/main.c -o sys/kern/main.o
clean:
rm -f $(OBJS) kernel.bin
+3
View File
@@ -0,0 +1,3 @@
# LiteOS
Unix like OS created Hjin-BF
View File
View File
View File
+27
View File
@@ -0,0 +1,27 @@
ENTRY(_start)
SECTIONS
{
. = 1M;
.text :
{
*(.multiboot)
*(.text*)
}
.rodata :
{
*(.rodata*)
}
.data :
{
*(.data*)
}
.bss :
{
*(.bss*)
}
}
View File
View File
+17
View File
@@ -0,0 +1,17 @@
.section .multiboot
.align 4
.long 0x1BADB002
.long 0x0
.long -(0x1BADB002)
.section .text
.global _start
.type _start, @function
_start:
cli
call kernel_main
.hang:
hlt
jmp .hang
+54
View File
@@ -0,0 +1,54 @@
[org 0x7C00]
bits 16
KERNEL_OFFSET equ 0x1000
start:
cli
mov [BOOT_DRIVE], dl
xor ax, ax
mov ds, ax
mov es, ax
mov ss, ax
mov sp, 0x7C00
sti
call load_kernel
jmp KERNEL_OFFSET
; -----------------------
; Зчитування kernel
; -----------------------
load_kernel:
mov bx, KERNEL_OFFSET ; куди завантажити
mov dh, 5 ; кількість секторів (тимчасово 5)
mov dl, [BOOT_DRIVE]
mov ah, 0x02 ; BIOS read sector
mov al, dh ; скільки секторів
mov ch, 0x00 ; cylinder
mov dh, 0x00 ; head
mov cl, 0x02 ; сектор 2 (після bootloader)
int 0x13
jc disk_error
ret
disk_error:
mov si, error_msg
.print:
lodsb
cmp al, 0
je $
mov ah, 0x0E
int 0x10
jmp .print
BOOT_DRIVE db 0
error_msg db "Disk read error!", 0
times 510 - ($ - $$) db 0
dw 0xAA55
+19
View File
@@ -0,0 +1,19 @@
[org 0x1000]
bits 16
start:
mov si, message
.print:
lodsb
cmp al, 0
je .hang
mov ah, 0x0E
int 0x10
jmp .print
.hang:
hlt
jmp .hang
message db "Kernel loaded successfully!", 0
+16
View File
@@ -0,0 +1,16 @@
#include <stddef.h>
void kernel_main(void) {
volatile char *video = (volatile char*) 0xB8000;
const char *msg = "LiteOS kernel started";
for (size_t i = 0; msg[i] != '\0'; i++) {
video[i * 2] = msg[i];
video[i * 2 + 1] = 0x07; // світло-сірий текст
}
while (1) {
__asm__("hlt");
}
}
View File
View File
View File