ChibraxOS 2

Changes:
- kernel 6.0.2
- Broken init scripts
- Switch to bun for better peroformance an easier ffi
- Removed grup
- Efi support without graphics (at least graphics werent tested)
- Suppression de toutes les dépendance non libc
- new splash
- broken audio
- typescript support
- ls rewritten to be more reliable
This commit is contained in:
Marc
2022-10-22 13:47:33 +02:00
parent db49f8d205
commit 721c919c7b
76 changed files with 2485 additions and 2665 deletions
+23 -16
View File
@@ -1,26 +1,34 @@
//@ts-check
//@ts-expect-error
const { syscall } = require('./syscall.node')
const errno = require('./errno')
const fs = require('fs')
const path = require('path')
import { dlopen, FFIType } from 'bun:ffi';
import errno from './errno.js'
import * as fs from 'fs'
import * as path from 'path'
const {
symbols: {
syscall,
},
} = dlopen('/usr/lib/libc.so.6', {
syscall: {
args: [ FFIType.int, FFIType.int, FFIType.cstring, FFIType.int ],
returns: FFIType.int,
},
});
// TBD
const SYSCALL_INIT_MODULE = 105
const SYSCALL_FINIT_MODULE = 273
const doProcExists = () => fs.existsSync('/proc')
export const doProcExists = () => fs.existsSync('/proc')
/**
*
* @param {string} path
* @param {string} params
* @param {number} flags
* @deprecated un tested dangerous
* @deprecated untested very dangerous
*/
function finit_module(path, params = "", flags = 0) {
export function finit_module(path, params = "", flags = 0) {
const fileDescriptor = fs.openSync(path, 'r')
const result = syscall(SYSCALL_FINIT_MODULE, fileDescriptor, params, flags)
if(result > 0) {
@@ -34,8 +42,8 @@ function finit_module(path, params = "", flags = 0) {
}
}
function uname() {
if(!doProcExists) {
export function uname() {
if(!doProcExists()) {
throw "Proc don't exists exception"
}
const linuxVersionString = fs.readFileSync('/proc/version').toString()
@@ -44,8 +52,9 @@ function uname() {
/**
* @param {string} modulename
* @deprecated untested very dangerous
*/
function modprobe(modulename) {
export function modprobe(modulename) {
const name = uname()
if(fs.existsSync(path.join('/lib/modules', name, 'kernel', modulename))) {
finit_module(path.join('/lib/modules', name, 'kernel', modulename))
@@ -55,11 +64,9 @@ function modprobe(modulename) {
}
function lsmod() {
if(!doProcExists) {
export function lsmod() {
if(!doProcExists()) {
throw "Proc don't exists exception"
}
return fs.readFileSync('/proc/modules').toString('utf-8').split('\n')
}
module.exports = { modprobe, uname, finit_module, doProcExists, lsmod, syscall }