mirror of
https://github.com/DragonOS-Community/DragonOS.git
synced 2025-06-08 14:16:47 +00:00
parent
dd8e74ef0d
commit
182b778a3c
2
.github/actions/import-toolchain/action.yml
vendored
2
.github/actions/import-toolchain/action.yml
vendored
@ -23,7 +23,7 @@ runs:
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-build-tools
|
||||
dadk_version: 0.1.6
|
||||
dadk_version: 0.1.11
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
|
20
.github/workflows/cache-toolchain.yml
vendored
20
.github/workflows/cache-toolchain.yml
vendored
@ -34,7 +34,7 @@ jobs:
|
||||
uses: actions/cache@v3
|
||||
env:
|
||||
cache-name: cache-build-tools
|
||||
dadk_version: 0.1.6
|
||||
dadk_version: 0.1.11
|
||||
with:
|
||||
path: |
|
||||
~/.cargo
|
||||
@ -78,18 +78,14 @@ jobs:
|
||||
|
||||
rustup default nightly
|
||||
|
||||
cargo install dadk --version 0.1.6
|
||||
cargo install dadk --version 0.1.11
|
||||
|
||||
|
||||
fork_toolchain_from="nightly-2023-08-15-x86_64-unknown-linux-gnu"
|
||||
custom_toolchain="nightly-2023-08-15-x86_64-unknown-linux_dragonos-gnu"
|
||||
custom_toolchain_dir="$(dirname $(rustc --print sysroot))/${custom_toolchain}"
|
||||
echo "Custom toolchain does not exist, creating..."
|
||||
rustup toolchain install ${fork_toolchain_from}
|
||||
rustup component add --toolchain ${fork_toolchain_from} rust-src
|
||||
rustup target add --toolchain ${fork_toolchain_from} x86_64-unknown-linux-musl
|
||||
cp -r $(dirname $(rustc --print sysroot))/${fork_toolchain_from} ${custom_toolchain_dir}
|
||||
self_contained_dir=${custom_toolchain_dir}/lib/rustlib/x86_64-unknown-linux-musl/lib/self-contained
|
||||
cp -f ${self_contained_dir}/crt1.o ${self_contained_dir}/rcrt1.o
|
||||
userapp_musl_toolchain="nightly-2023-08-15-x86_64-unknown-linux-gnu"
|
||||
|
||||
rustup toolchain install ${userapp_musl_toolchain}
|
||||
rustup component add --toolchain ${userapp_musl_toolchain} rust-src
|
||||
rustup target add --toolchain ${userapp_musl_toolchain} x86_64-unknown-linux-musl
|
||||
|
||||
|
||||
|
||||
|
@ -276,7 +276,7 @@ make clean
|
||||
# 下载DragonStub
|
||||
git submodule update --init --recursive --force
|
||||
|
||||
make kernel -j $(nproc) && make write_diskimage && make qemu
|
||||
make run
|
||||
```
|
||||
|
||||
请注意,由于是在控制台运行qemu,当你想要退出的时候,输入`Ctrl+A`然后按`X`即可。
|
||||
|
@ -39,4 +39,3 @@ cargo generate --git https://git.mirrors.dragonos.org/DragonOS-Community/Rust-Ap
|
||||
如果您需要移植别的库/程序到DragonOS,请参考模板内的配置。
|
||||
|
||||
由于DragonOS目前不支持动态链接,因此目前需要在RUSTFLAGS里面指定`-C target-feature=+crt-static -C link-arg=-no-pie`
|
||||
并且需要使用上文提到的工具链`nightly-2023-08-15-x86_64-unknown-linux_dragonos-gnu`
|
||||
|
@ -7,7 +7,7 @@ GARBAGE := $(foreach DIR,$(DIRS),$(addprefix $(DIR)/,$(GARBAGE_PATTERNS)))
|
||||
|
||||
DADK_VERSION=$(shell dadk -V | awk 'END {print $$2}')
|
||||
# 最小的DADK版本
|
||||
MIN_DADK_VERSION = 0.1.10
|
||||
MIN_DADK_VERSION = 0.1.11
|
||||
DADK_CACHE_DIR = $(ROOT_PATH)/bin/dadk_cache
|
||||
|
||||
ECHO:
|
||||
|
20
user/apps/riscv_init/Makefile
Normal file
20
user/apps/riscv_init/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
ifeq ($(ARCH), x86_64)
|
||||
CROSS_COMPILE=x86_64-linux-musl-
|
||||
else ifeq ($(ARCH), riscv64)
|
||||
CROSS_COMPILE=riscv64-linux-musl-
|
||||
endif
|
||||
|
||||
CC=$(CROSS_COMPILE)gcc
|
||||
|
||||
.PHONY: all
|
||||
all: main.c
|
||||
$(CC) -static -o init main.c
|
||||
|
||||
.PHONY: install clean
|
||||
install: all
|
||||
mv init $(DADK_CURRENT_BUILD_DIR)/init
|
||||
|
||||
clean:
|
||||
rm init *.o
|
||||
|
||||
fmt:
|
9
user/apps/riscv_init/main.c
Normal file
9
user/apps/riscv_init/main.c
Normal file
@ -0,0 +1,9 @@
|
||||
#include <stdio.h>
|
||||
|
||||
int main() {
|
||||
while(1){
|
||||
printf("\033[43;37mHello, World!\033[0m\n");
|
||||
sleep(1);
|
||||
}
|
||||
return 0;
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
# The toolchain we use.
|
||||
# You can get it by running DragonOS' `tools/bootstrap.sh`
|
||||
TOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux_dragonos-gnu"
|
||||
TOOLCHAIN="+nightly-2023-08-15-x86_64-unknown-linux-gnu"
|
||||
RUSTFLAGS+="-C target-feature=+crt-static -C link-arg=-no-pie"
|
||||
|
||||
# 如果是在dadk中编译,那么安装到dadk的安装目录中
|
||||
|
@ -20,5 +20,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -22,5 +22,6 @@
|
||||
|
||||
"build_once": true,
|
||||
|
||||
"install_once": true
|
||||
"install_once": true,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -22,7 +22,13 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": [],
|
||||
"envs": [
|
||||
{
|
||||
"key": "CC",
|
||||
"value": "x86_64-linux-musl-gcc"
|
||||
}
|
||||
],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -23,5 +23,6 @@
|
||||
"envs": [],
|
||||
"build_once": true,
|
||||
|
||||
"install_once": true
|
||||
"install_once": true,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
27
user/dadk/config/riscv_init-0.1.0.dadk
Normal file
27
user/dadk/config/riscv_init-0.1.0.dadk
Normal file
@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "riscv_init",
|
||||
"version": "0.1.0",
|
||||
"description": "临时的riscv下的初始化程序",
|
||||
"rust_target": null,
|
||||
"task_type": {
|
||||
"BuildFromSource": {
|
||||
"Local": {
|
||||
"path": "apps/riscv_init"
|
||||
}
|
||||
}
|
||||
},
|
||||
"depends": [],
|
||||
"build": {
|
||||
"build_command": "make install"
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/bin"
|
||||
},
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false,
|
||||
"target_arch": ["riscv64"]
|
||||
}
|
@ -20,5 +20,6 @@
|
||||
"clean": {
|
||||
"clean_command": null
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -22,5 +22,6 @@
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -22,5 +22,6 @@
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -20,5 +20,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -20,5 +20,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -22,5 +22,6 @@
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -20,5 +20,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -18,5 +18,6 @@
|
||||
},
|
||||
"install": {
|
||||
"in_dragonos_path": "/"
|
||||
}
|
||||
},
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
@ -22,5 +22,6 @@
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -21,5 +21,6 @@
|
||||
},
|
||||
"envs": [],
|
||||
"build_once": false,
|
||||
"install_once": false
|
||||
"install_once": false,
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
@ -19,5 +19,6 @@
|
||||
"clean": {
|
||||
"clean_command": "make clean"
|
||||
},
|
||||
"envs": []
|
||||
"envs": [],
|
||||
"target_arch": ["x86_64"]
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user