diff --git a/Cargo.lock b/Cargo.lock index c5c8083..dc802d6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -12,9 +12,14 @@ checksum = "8f68f53c83ab957f72c32642f3868eec03eb974d1fb82e453128456482613d36" name = "kernel" version = "0.1.0" dependencies = [ + "lib_example", "limine", ] +[[package]] +name = "lib_example" +version = "0.1.0" + [[package]] name = "limine" version = "0.3.1" diff --git a/Cargo.toml b/Cargo.toml index 3141e70..1d44ee7 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [workspace] -members = [ +members = [ + "lib_example", "kernel" ] resolver = "2" diff --git a/docs/.obsidian/app.json b/docs/.obsidian/app.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/docs/.obsidian/app.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/docs/.obsidian/appearance.json b/docs/.obsidian/appearance.json new file mode 100644 index 0000000..9e26dfe --- /dev/null +++ b/docs/.obsidian/appearance.json @@ -0,0 +1 @@ +{} \ No newline at end of file diff --git a/docs/.obsidian/core-plugins.json b/docs/.obsidian/core-plugins.json new file mode 100644 index 0000000..b977c25 --- /dev/null +++ b/docs/.obsidian/core-plugins.json @@ -0,0 +1,31 @@ +{ + "file-explorer": true, + "global-search": true, + "switcher": true, + "graph": true, + "backlink": true, + "canvas": true, + "outgoing-link": true, + "tag-pane": true, + "properties": false, + "page-preview": true, + "daily-notes": true, + "templates": true, + "note-composer": true, + "command-palette": true, + "slash-command": false, + "editor-status": true, + "bookmarks": true, + "markdown-importer": false, + "zk-prefixer": false, + "random-note": false, + "outline": true, + "word-count": true, + "slides": false, + "audio-recorder": false, + "workspaces": false, + "file-recovery": true, + "publish": false, + "sync": true, + "webviewer": false +} \ No newline at end of file diff --git a/docs/.obsidian/graph.json b/docs/.obsidian/graph.json new file mode 100644 index 0000000..42a46ec --- /dev/null +++ b/docs/.obsidian/graph.json @@ -0,0 +1,22 @@ +{ + "collapse-filter": true, + "search": "", + "showTags": false, + "showAttachments": false, + "hideUnresolved": false, + "showOrphans": true, + "collapse-color-groups": true, + "colorGroups": [], + "collapse-display": true, + "showArrow": false, + "textFadeMultiplier": 0, + "nodeSizeMultiplier": 1, + "lineSizeMultiplier": 1, + "collapse-forces": true, + "centerStrength": 0.518713248970312, + "repelStrength": 10, + "linkStrength": 1, + "linkDistance": 250, + "scale": 1, + "close": true +} \ No newline at end of file diff --git a/docs/.obsidian/workspace.json b/docs/.obsidian/workspace.json new file mode 100644 index 0000000..730b8e1 --- /dev/null +++ b/docs/.obsidian/workspace.json @@ -0,0 +1,198 @@ +{ + "main": { + "id": "20da7b1c0adc4114", + "type": "split", + "children": [ + { + "id": "a20540b7c1ddbfca", + "type": "tabs", + "children": [ + { + "id": "e1fb15cab546d0b6", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Usage/Building The Kernel.md", + "mode": "source", + "source": false + }, + "icon": "lucide-file", + "title": "Building The Kernel" + } + } + ] + }, + { + "id": "6bf1f87bf81a3031", + "type": "tabs", + "children": [ + { + "id": "add883d295e04659", + "type": "leaf", + "state": { + "type": "markdown", + "state": { + "file": "Usage/Building The Kernel.md", + "mode": "preview", + "source": false + }, + "icon": "lucide-file", + "title": "Building The Kernel" + } + } + ] + } + ], + "direction": "vertical" + }, + "left": { + "id": "8c92fa79437d4f31", + "type": "split", + "children": [ + { + "id": "e4a9f8318da249b0", + "type": "tabs", + "children": [ + { + "id": "da6fd2aac65f47f1", + "type": "leaf", + "state": { + "type": "file-explorer", + "state": { + "sortOrder": "alphabetical", + "autoReveal": false + }, + "icon": "lucide-folder-closed", + "title": "Files" + } + }, + { + "id": "3f86b26f003a0d1a", + "type": "leaf", + "state": { + "type": "search", + "state": { + "query": "tag:#usage", + "matchingCase": false, + "explainSearch": false, + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical" + }, + "icon": "lucide-search", + "title": "Search" + } + }, + { + "id": "39755dd9db653e17", + "type": "leaf", + "state": { + "type": "bookmarks", + "state": {}, + "icon": "lucide-bookmark", + "title": "Bookmarks" + } + } + ] + } + ], + "direction": "horizontal", + "width": 200, + "collapsed": true + }, + "right": { + "id": "baa2a8e61b737fa6", + "type": "split", + "children": [ + { + "id": "b628e7116722c59a", + "type": "tabs", + "children": [ + { + "id": "eb1781be59af8c30", + "type": "leaf", + "state": { + "type": "backlink", + "state": { + "file": "Usage/Building The Kernel.md", + "collapseAll": false, + "extraContext": false, + "sortOrder": "alphabetical", + "showSearch": false, + "searchQuery": "", + "backlinkCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-coming-in", + "title": "Backlinks for Building The Kernel" + } + }, + { + "id": "18e4602ee5825e11", + "type": "leaf", + "state": { + "type": "outgoing-link", + "state": { + "file": "Usage/Building The Kernel.md", + "linksCollapsed": false, + "unlinkedCollapsed": true + }, + "icon": "links-going-out", + "title": "Outgoing links from Building The Kernel" + } + }, + { + "id": "df5aadad9f62dff1", + "type": "leaf", + "state": { + "type": "tag", + "state": { + "sortOrder": "frequency", + "useHierarchy": false, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-tags", + "title": "Tags" + } + }, + { + "id": "9bc68cb074d39ab5", + "type": "leaf", + "state": { + "type": "outline", + "state": { + "file": "Usage/Building The Kernel.md", + "followCursor": false, + "showSearch": false, + "searchQuery": "" + }, + "icon": "lucide-list", + "title": "Outline of Building The Kernel" + } + } + ], + "currentTab": 2 + } + ], + "direction": "horizontal", + "width": 300 + }, + "left-ribbon": { + "hiddenItems": { + "switcher:Open quick switcher": false, + "graph:Open graph view": false, + "canvas:Create new canvas": false, + "daily-notes:Open today's daily note": false, + "templates:Insert template": false, + "command-palette:Open command palette": false + } + }, + "active": "e1fb15cab546d0b6", + "lastOpenFiles": [ + "Usage", + "Welcome.md", + "Usage/Building The Kernel.md" + ] +} \ No newline at end of file diff --git a/docs/Usage/Building The Kernel.md b/docs/Usage/Building The Kernel.md new file mode 100644 index 0000000..8de145e --- /dev/null +++ b/docs/Usage/Building The Kernel.md @@ -0,0 +1,12 @@ +#usage +### Requirements +- Latest rust nightly release +> rustup update +> rustup override set nightly +- Specific rustup components that can be installed with the following commands: +> rustup component add rust-src +> rustup component add llvm-tools-preview + +### Building +run the following command (in the root directory of the project) +> ./run.sh diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 2e813c9..8c855f6 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -5,6 +5,7 @@ edition = "2021" [dependencies] limine = "0.3.1" +lib_example = { path = "../lib_example" } [features] default = [] diff --git a/kernel/src/main.rs b/kernel/src/main.rs index a257fb9..ccf2a82 100644 --- a/kernel/src/main.rs +++ b/kernel/src/main.rs @@ -6,6 +6,8 @@ use core::arch::asm; use limine::request::{FramebufferRequest, RequestsEndMarker, RequestsStartMarker}; use limine::BaseRevision; +use lib_example; + /// Sets the base revision to the latest revision supported by the crate. /// See specification for further info. /// Be sure to mark all limine requests with #[used], otherwise they may be removed by the compiler. @@ -32,6 +34,8 @@ unsafe extern "C" fn kmain() -> ! { // removed by the linker. assert!(BASE_REVISION.is_supported()); + lib_example::add_nums(1, 2); + if let Some(framebuffer_response) = FRAMEBUFFER_REQUEST.get_response() { if let Some(framebuffer) = framebuffer_response.framebuffers().next() { for i in 0..100_u64 { diff --git a/lib_example/Cargo.toml b/lib_example/Cargo.toml new file mode 100644 index 0000000..4ea006a --- /dev/null +++ b/lib_example/Cargo.toml @@ -0,0 +1,6 @@ +[package] +name = "lib_example" +version.workspace = true +edition.workspace = true + +[dependencies] diff --git a/lib_example/src/lib.rs b/lib_example/src/lib.rs new file mode 100644 index 0000000..1f8117c --- /dev/null +++ b/lib_example/src/lib.rs @@ -0,0 +1,5 @@ +#![no_std] + +pub fn add_nums(x: i32, y: i32) -> i32 { + x + y +} \ No newline at end of file