mirror of
https://github.com/asterinas/asterinas.git
synced 2025-06-09 05:16:47 +00:00
Reorganize the codebase
This commit is contained in:
parent
888853a6de
commit
271a16d492
20
.gitattributes
vendored
20
.gitattributes
vendored
@ -1,10 +1,10 @@
|
|||||||
src/apps/hello_world/hello_world filter=lfs diff=lfs merge=lfs -text
|
regression/apps/hello_world/hello_world filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/fork/fork filter=lfs diff=lfs merge=lfs -text
|
regression/apps/fork/fork filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/hello_c/hello filter=lfs diff=lfs merge=lfs -text
|
regression/apps/hello_c/hello filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/execve/execve filter=lfs diff=lfs merge=lfs -text
|
regression/apps/execve/execve filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/execve/hello filter=lfs diff=lfs merge=lfs -text
|
regression/apps/execve/hello filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/fork_c/fork filter=lfs diff=lfs merge=lfs -text
|
regression/apps/fork_c/fork filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/signal_c/signal_test filter=lfs diff=lfs merge=lfs -text
|
regression/apps/signal_c/signal_test filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/busybox/busybox filter=lfs diff=lfs merge=lfs -text
|
regression/apps/busybox/busybox filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/pthread/pthread_test filter=lfs diff=lfs merge=lfs -text
|
regression/apps/pthread/pthread_test filter=lfs diff=lfs merge=lfs -text
|
||||||
src/apps/hello_pie/hello filter=lfs diff=lfs merge=lfs -text
|
regression/apps/hello_pie/hello filter=lfs diff=lfs merge=lfs -text
|
||||||
|
4
.gitignore
vendored
4
.gitignore
vendored
@ -13,8 +13,8 @@ target/
|
|||||||
**/.DS_Store
|
**/.DS_Store
|
||||||
|
|
||||||
# Ramdisk file
|
# Ramdisk file
|
||||||
src/ramdisk/initramfs/
|
regression/ramdisk/initramfs/
|
||||||
src/ramdisk/build/
|
regression/ramdisk/build/
|
||||||
|
|
||||||
# qemu log file
|
# qemu log file
|
||||||
qemu.log
|
qemu.log
|
||||||
|
0
src/Cargo.lock → Cargo.lock
generated
0
src/Cargo.lock → Cargo.lock
generated
@ -3,11 +3,15 @@ name = "jinux"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
edition = "2021"
|
edition = "2021"
|
||||||
|
|
||||||
|
[[bin]]
|
||||||
|
name = "jinux"
|
||||||
|
path = "kernel/main.rs"
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
limine = "0.1.10"
|
limine = "0.1.10"
|
||||||
jinux-frame = { path = "framework/jinux-frame" }
|
jinux-frame = { path = "framework/jinux-frame" }
|
||||||
jinux-std = { path = "services/libs/jinux-std" }
|
jinux-std = { path = "services/libs/jinux-std" }
|
||||||
component = { path = "services/comp-sys/component" }
|
component = { path = "services/libs/comp-sys/component" }
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
x86_64 = "0.14.2"
|
x86_64 = "0.14.2"
|
||||||
@ -33,4 +37,4 @@ members = [
|
|||||||
"services/libs/cpio-decoder",
|
"services/libs/cpio-decoder",
|
||||||
]
|
]
|
||||||
|
|
||||||
exclude = ["services/comp-sys/controlled", "services/comp-sys/cargo-component"]
|
exclude = ["services/libs/comp-sys/controlled", "services/libs/comp-sys/cargo-component"]
|
22
Makefile
22
Makefile
@ -1,6 +1,6 @@
|
|||||||
.PHONY: all build clean docs fmt run setup test tools
|
.PHONY: all build clean docs fmt run setup test tools
|
||||||
|
|
||||||
all: build test
|
all: build
|
||||||
|
|
||||||
setup:
|
setup:
|
||||||
@rustup component add rust-src
|
@rustup component add rust-src
|
||||||
@ -9,28 +9,28 @@ setup:
|
|||||||
@cargo install mdbook
|
@cargo install mdbook
|
||||||
|
|
||||||
build:
|
build:
|
||||||
@make --no-print-directory -C src/ramdisk
|
@make --no-print-directory -C regression/ramdisk
|
||||||
@cd src && cargo kbuild
|
@cargo kbuild
|
||||||
|
|
||||||
tools:
|
tools:
|
||||||
@cd src/services/comp-sys && cargo install --path cargo-component
|
@cd services/libs/comp-sys && cargo install --path cargo-component
|
||||||
|
|
||||||
run: build
|
run: build
|
||||||
@cd src && cargo krun
|
@cargo krun
|
||||||
|
|
||||||
test: build
|
test: build
|
||||||
@cd src && cargo ktest
|
@cargo ktest
|
||||||
|
|
||||||
docs:
|
docs:
|
||||||
@cd src && cargo doc # Build Rust docs
|
@cargo doc # Build Rust docs
|
||||||
@echo "" # Add a blank line
|
@echo "" # Add a blank line
|
||||||
@cd docs && mdbook build # Build mdBook
|
@cd docs && mdbook build # Build mdBook
|
||||||
|
|
||||||
check:
|
check:
|
||||||
@cd src && cargo fmt --check # Check Rust format issues
|
@cargo fmt --check # Check Rust format issues
|
||||||
@cd src && cargo clippy # Check common programming mistakes
|
@cargo clippy # Check common programming mistakes
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
@cd src && cargo clean
|
@cargo clean
|
||||||
@cd docs && mdbook clean
|
@cd docs && mdbook clean
|
||||||
@make --no-print-directory -C src/ramdisk clean
|
@make --no-print-directory -C regression/ramdisk clean
|
||||||
|
41
README.md
41
README.md
@ -23,16 +23,16 @@ As a zero-cost, least-privilege OS, Jinux provides the best of both worlds: the
|
|||||||
## How to build and test
|
## How to build and test
|
||||||
|
|
||||||
While most code is written in Rust, the project-scope build process is governed
|
While most code is written in Rust, the project-scope build process is governed
|
||||||
by Makefile.
|
by Makefile. The following commands are intended for use on an Ubuntu server that has installed qemu-system-x86_64.
|
||||||
|
|
||||||
Before downloading source code, install and init Git LFS since the project manage binaries with Git LFS.
|
### Preparation
|
||||||
|
Before downloading source code, install and init Git LFS since the project manages binaries with Git LFS.
|
||||||
```bash
|
```bash
|
||||||
# 1. install git-lfs
|
# 1. install git-lfs
|
||||||
brew install git-lfs # for mac
|
apt install git-lfs
|
||||||
apt install git-lfs # for ubuntu
|
|
||||||
|
|
||||||
# 2. init git-lfs for current user
|
# 2. init git-lfs for current user
|
||||||
git lfs install --skip-repo # for mac & ubuntu
|
git lfs install --skip-repo
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, download source codes as normal.
|
Then, download source codes as normal.
|
||||||
@ -46,22 +46,29 @@ all developmennt tools are installed.
|
|||||||
make setup
|
make setup
|
||||||
```
|
```
|
||||||
|
|
||||||
Then, install some standalone tools (e.g., `cargo-component`) under the project directory.
|
### build
|
||||||
``` bash
|
Then, we can build the project.
|
||||||
make tools
|
|
||||||
```
|
|
||||||
|
|
||||||
Set environmental variables to enable `cargo` find installed tools.
|
|
||||||
```bash
|
```bash
|
||||||
export PATH=`pwd`/src/target/bin:${PATH}
|
make build
|
||||||
```
|
|
||||||
|
|
||||||
Then, we can build and test the project.
|
|
||||||
```bash
|
|
||||||
make
|
|
||||||
```
|
```
|
||||||
|
|
||||||
If everything goes well, then we can run the OS.
|
If everything goes well, then we can run the OS.
|
||||||
```bash
|
```bash
|
||||||
make run
|
make run
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### Test
|
||||||
|
We can run unit tests and integration tests if building succeeds.
|
||||||
|
```bash
|
||||||
|
make test
|
||||||
|
```
|
||||||
|
|
||||||
|
If we want to check access control policy among components, install some standalone tools (e.g., `cargo-component`), and set environmental variables to enable `cargo` find installed tools under the project directory.
|
||||||
|
``` bash
|
||||||
|
make tools
|
||||||
|
export PATH=`pwd`/target/bin:${PATH}
|
||||||
|
```
|
||||||
|
Then we can use the tool to check access control policy.
|
||||||
|
```bash
|
||||||
|
cargo component-check
|
||||||
|
```
|
||||||
|
@ -25,7 +25,7 @@ cp target/limine/limine-cd.bin target/iso_root
|
|||||||
cp target/limine/limine-cd-efi.bin target/iso_root
|
cp target/limine/limine-cd-efi.bin target/iso_root
|
||||||
|
|
||||||
# Copy ramdisk
|
# Copy ramdisk
|
||||||
cp ramdisk/build/ramdisk.cpio target/iso_root
|
cp regression/ramdisk/build/ramdisk.cpio target/iso_root
|
||||||
|
|
||||||
xorriso -as mkisofs \
|
xorriso -as mkisofs \
|
||||||
-b limine-cd.bin \
|
-b limine-cd.bin \
|
@ -12,7 +12,7 @@ spin = "0.9.4"
|
|||||||
volatile = { version = "0.4.5", features = ["unstable"] }
|
volatile = { version = "0.4.5", features = ["unstable"] }
|
||||||
buddy_system_allocator = "0.9.0"
|
buddy_system_allocator = "0.9.0"
|
||||||
pod = { git = "https://github.com/jinzhao-dev/pod", rev = "7fa2ed2" }
|
pod = { git = "https://github.com/jinzhao-dev/pod", rev = "7fa2ed2" }
|
||||||
align_ext = { path = "../align_ext" }
|
align_ext = { path = "../libs/align_ext" }
|
||||||
intrusive-collections = "0.9.5"
|
intrusive-collections = "0.9.5"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
lazy_static = { version = "1.0", features = ["spin_no_std"] }
|
lazy_static = { version = "1.0", features = ["spin_no_std"] }
|
3
regression/apps/hello_c/hello
Executable file
3
regression/apps/hello_c/hello
Executable file
@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:dda5a7d6081cc2252056375d0550731ef2fd24789aa5f17da189a36bf78c588d
|
||||||
|
size 871896
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user