chore: 适配dadk 0.1.11 (#777)

* chore: 适配dadk 0.1.11
This commit is contained in:
LoGin 2024-04-28 13:39:51 +08:00 committed by GitHub
parent dd8e74ef0d
commit 182b778a3c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
41 changed files with 138 additions and 50 deletions

View File

@ -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

View File

@ -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

View File

@ -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`即可。

View File

@ -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`

View File

@ -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:

View 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:

View File

@ -0,0 +1,9 @@
#include <stdio.h>
int main() {
while(1){
printf("\033[43;37mHello, World!\033[0m\n");
sleep(1);
}
return 0;
}

View File

@ -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的安装目录中

View File

@ -20,5 +20,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"install": {
"in_dragonos_path": "/"
}
},
"target_arch": ["x86_64"]
}

View File

@ -22,5 +22,6 @@
"build_once": true,
"install_once": true
"install_once": true,
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -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"]
}

View File

@ -19,5 +19,6 @@
},
"install": {
"in_dragonos_path": "/"
}
},
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
},
"install": {
"in_dragonos_path": "/"
}
},
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -23,5 +23,6 @@
"envs": [],
"build_once": true,
"install_once": true
"install_once": true,
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
},
"install": {
"in_dragonos_path": "/"
}
},
"target_arch": ["x86_64"]
}

View 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"]
}

View File

@ -20,5 +20,6 @@
"clean": {
"clean_command": null
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -22,5 +22,6 @@
},
"envs": [],
"build_once": false,
"install_once": false
"install_once": false,
"target_arch": ["x86_64"]
}

View File

@ -22,5 +22,6 @@
},
"envs": [],
"build_once": false,
"install_once": false
"install_once": false,
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -20,5 +20,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"clean": {
"clean_command": "make clean"
}
},
"target_arch": ["x86_64"]
}

View File

@ -20,5 +20,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"clean": {
"clean_command": "make clean"
}
},
"target_arch": ["x86_64"]
}

View File

@ -22,5 +22,6 @@
},
"envs": [],
"build_once": false,
"install_once": false
"install_once": false,
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -20,5 +20,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"clean": {
"clean_command": "make clean"
}
},
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"clean": {
"clean_command": "make clean"
}
},
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -18,5 +18,6 @@
},
"install": {
"in_dragonos_path": "/"
}
},
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}

View File

@ -22,5 +22,6 @@
},
"envs": [],
"build_once": false,
"install_once": false
"install_once": false,
"target_arch": ["x86_64"]
}

View File

@ -21,5 +21,6 @@
},
"envs": [],
"build_once": false,
"install_once": false
"install_once": false,
"target_arch": ["x86_64"]
}

View File

@ -19,5 +19,6 @@
"clean": {
"clean_command": "make clean"
},
"envs": []
"envs": [],
"target_arch": ["x86_64"]
}