diff --git a/.github/actions/import-toolchain/action.yml b/.github/actions/import-toolchain/action.yml index 3938fa86..466e2d40 100644 --- a/.github/actions/import-toolchain/action.yml +++ b/.github/actions/import-toolchain/action.yml @@ -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 diff --git a/.github/workflows/cache-toolchain.yml b/.github/workflows/cache-toolchain.yml index 8c35039a..a58b700f 100644 --- a/.github/workflows/cache-toolchain.yml +++ b/.github/workflows/cache-toolchain.yml @@ -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 + diff --git a/docs/introduction/build_system.md b/docs/introduction/build_system.md index 7707120e..c746e66a 100644 --- a/docs/introduction/build_system.md +++ b/docs/introduction/build_system.md @@ -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`即可。 diff --git a/docs/userland/appdev/rust-quick-start.md b/docs/userland/appdev/rust-quick-start.md index f3f72638..57839ff9 100644 --- a/docs/userland/appdev/rust-quick-start.md +++ b/docs/userland/appdev/rust-quick-start.md @@ -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` diff --git a/user/Makefile b/user/Makefile index 636d4a96..4c4ed87d 100644 --- a/user/Makefile +++ b/user/Makefile @@ -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: diff --git a/user/apps/riscv_init/Makefile b/user/apps/riscv_init/Makefile new file mode 100644 index 00000000..a75ff55d --- /dev/null +++ b/user/apps/riscv_init/Makefile @@ -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: diff --git a/user/apps/riscv_init/main.c b/user/apps/riscv_init/main.c new file mode 100644 index 00000000..aab66227 --- /dev/null +++ b/user/apps/riscv_init/main.c @@ -0,0 +1,9 @@ +#include + +int main() { + while(1){ + printf("\033[43;37mHello, World!\033[0m\n"); + sleep(1); + } + return 0; +} \ No newline at end of file diff --git a/user/apps/test-blockcache/Makefile b/user/apps/test-blockcache/Makefile index 74ab45f2..a4c3cfe7 100644 --- a/user/apps/test-blockcache/Makefile +++ b/user/apps/test-blockcache/Makefile @@ -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的安装目录中 diff --git a/user/dadk/config/about.dadk b/user/dadk/config/about.dadk index da18c840..18fd05ef 100644 --- a/user/dadk/config/about.dadk +++ b/user/dadk/config/about.dadk @@ -20,5 +20,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/clear-0.1.0.dadk b/user/dadk/config/clear-0.1.0.dadk index 161acd0f..690b00bf 100644 --- a/user/dadk/config/clear-0.1.0.dadk +++ b/user/dadk/config/clear-0.1.0.dadk @@ -18,5 +18,6 @@ }, "install": { "in_dragonos_path": "/" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/core_utils-9.4.0.dadk b/user/dadk/config/core_utils-9.4.0.dadk index d9d9dec9..61c01449 100644 --- a/user/dadk/config/core_utils-9.4.0.dadk +++ b/user/dadk/config/core_utils-9.4.0.dadk @@ -22,5 +22,6 @@ "build_once": true, - "install_once": true + "install_once": true, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/dmesg-0.1.0.dadk b/user/dadk/config/dmesg-0.1.0.dadk index 8f4e85f5..f1832699 100644 --- a/user/dadk/config/dmesg-0.1.0.dadk +++ b/user/dadk/config/dmesg-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/dog_0_1_0.dadk b/user/dadk/config/dog_0_1_0.dadk index 09d4a7d8..1e145150 100644 --- a/user/dadk/config/dog_0_1_0.dadk +++ b/user/dadk/config/dog_0_1_0.dadk @@ -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"] } \ No newline at end of file diff --git a/user/dadk/config/dragon_reach-0.1.0.dadk b/user/dadk/config/dragon_reach-0.1.0.dadk index 8d63c996..bf0472a3 100644 --- a/user/dadk/config/dragon_reach-0.1.0.dadk +++ b/user/dadk/config/dragon_reach-0.1.0.dadk @@ -19,5 +19,6 @@ }, "install": { "in_dragonos_path": "/" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/held-0.1.0.dadk b/user/dadk/config/held-0.1.0.dadk index 43177aee..eb9124a5 100644 --- a/user/dadk/config/held-0.1.0.dadk +++ b/user/dadk/config/held-0.1.0.dadk @@ -19,5 +19,6 @@ }, "install": { "in_dragonos_path": "/" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/http_server-0.1.0.dadk b/user/dadk/config/http_server-0.1.0.dadk index acf383dd..e06b5d45 100644 --- a/user/dadk/config/http_server-0.1.0.dadk +++ b/user/dadk/config/http_server-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/musl_1_2_4.dadk b/user/dadk/config/musl_1_2_4.dadk index 25e9102c..6f9ee8a0 100644 --- a/user/dadk/config/musl_1_2_4.dadk +++ b/user/dadk/config/musl_1_2_4.dadk @@ -23,5 +23,6 @@ "envs": [], "build_once": true, - "install_once": true + "install_once": true, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/nova_shell-0.1.0.dadk b/user/dadk/config/nova_shell-0.1.0.dadk index a4a3aacb..ba4b0db9 100644 --- a/user/dadk/config/nova_shell-0.1.0.dadk +++ b/user/dadk/config/nova_shell-0.1.0.dadk @@ -19,5 +19,6 @@ }, "install": { "in_dragonos_path": "/" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/riscv_init-0.1.0.dadk b/user/dadk/config/riscv_init-0.1.0.dadk new file mode 100644 index 00000000..65fb566f --- /dev/null +++ b/user/dadk/config/riscv_init-0.1.0.dadk @@ -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"] +} \ No newline at end of file diff --git a/user/dadk/config/tar_1_35.dadk b/user/dadk/config/tar_1_35.dadk index 787c39b8..e6f99916 100644 --- a/user/dadk/config/tar_1_35.dadk +++ b/user/dadk/config/tar_1_35.dadk @@ -20,5 +20,6 @@ "clean": { "clean_command": null }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_alarm_0_1_0.dadk b/user/dadk/config/test_alarm_0_1_0.dadk index d3df7607..4693cce0 100644 --- a/user/dadk/config/test_alarm_0_1_0.dadk +++ b/user/dadk/config/test_alarm_0_1_0.dadk @@ -22,5 +22,6 @@ }, "envs": [], "build_once": false, - "install_once": false + "install_once": false, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_backlog_0_1_0.dadk b/user/dadk/config/test_backlog_0_1_0.dadk index c5316228..faaa6635 100644 --- a/user/dadk/config/test_backlog_0_1_0.dadk +++ b/user/dadk/config/test_backlog_0_1_0.dadk @@ -22,5 +22,6 @@ }, "envs": [], "build_once": false, - "install_once": false + "install_once": false, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_bind-0.1.0.dadk b/user/dadk/config/test_bind-0.1.0.dadk index 6204fc03..1f480c42 100644 --- a/user/dadk/config/test_bind-0.1.0.dadk +++ b/user/dadk/config/test_bind-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_blockcache_0_1_0.dadk b/user/dadk/config/test_blockcache_0_1_0.dadk index 22ff8d4a..0bd1e517 100644 --- a/user/dadk/config/test_blockcache_0_1_0.dadk +++ b/user/dadk/config/test_blockcache_0_1_0.dadk @@ -20,5 +20,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_dup3_0_1_0.dadk b/user/dadk/config/test_dup3_0_1_0.dadk index d452b0e9..70c03609 100644 --- a/user/dadk/config/test_dup3_0_1_0.dadk +++ b/user/dadk/config/test_dup3_0_1_0.dadk @@ -18,5 +18,6 @@ }, "clean": { "clean_command": "make clean" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_for_robustfutex_0_1_0.dadk b/user/dadk/config/test_for_robustfutex_0_1_0.dadk index 3859db15..f73f507a 100644 --- a/user/dadk/config/test_for_robustfutex_0_1_0.dadk +++ b/user/dadk/config/test_for_robustfutex_0_1_0.dadk @@ -20,5 +20,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_fstat-0.1.0.dadk b/user/dadk/config/test_fstat-0.1.0.dadk index 7bda5d55..46f63898 100644 --- a/user/dadk/config/test_fstat-0.1.0.dadk +++ b/user/dadk/config/test_fstat-0.1.0.dadk @@ -18,5 +18,6 @@ }, "clean": { "clean_command": "make clean" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_fstatfs_0_1_0.dadk b/user/dadk/config/test_fstatfs_0_1_0.dadk index c5ae0ba9..24d3074e 100644 --- a/user/dadk/config/test_fstatfs_0_1_0.dadk +++ b/user/dadk/config/test_fstatfs_0_1_0.dadk @@ -22,5 +22,6 @@ }, "envs": [], "build_once": false, - "install_once": false + "install_once": false, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_gettimeofday-0.1.0.dadk b/user/dadk/config/test_gettimeofday-0.1.0.dadk index c4d62691..aaa2f615 100644 --- a/user/dadk/config/test_gettimeofday-0.1.0.dadk +++ b/user/dadk/config/test_gettimeofday-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_kvm_0_1_0.dadk b/user/dadk/config/test_kvm_0_1_0.dadk index 4aebd063..b9918b6a 100644 --- a/user/dadk/config/test_kvm_0_1_0.dadk +++ b/user/dadk/config/test_kvm_0_1_0.dadk @@ -20,5 +20,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_mkfifo-0.1.0.dadk b/user/dadk/config/test_mkfifo-0.1.0.dadk index 8eba14ad..1d9dc135 100644 --- a/user/dadk/config/test_mkfifo-0.1.0.dadk +++ b/user/dadk/config/test_mkfifo-0.1.0.dadk @@ -18,5 +18,6 @@ }, "clean": { "clean_command": "make clean" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_mount_1_0_0.dadk b/user/dadk/config/test_mount_1_0_0.dadk index 942bc3eb..2d475089 100644 --- a/user/dadk/config/test_mount_1_0_0.dadk +++ b/user/dadk/config/test_mount_1_0_0.dadk @@ -18,5 +18,6 @@ }, "clean": { "clean_command": "make clean" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_pty-0.1.0.dadk b/user/dadk/config/test_pty-0.1.0.dadk index a6ab1e25..90dfccf5 100644 --- a/user/dadk/config/test_pty-0.1.0.dadk +++ b/user/dadk/config/test_pty-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_ramfs-0.1.0.dadk b/user/dadk/config/test_ramfs-0.1.0.dadk index 8eca983e..07817f37 100644 --- a/user/dadk/config/test_ramfs-0.1.0.dadk +++ b/user/dadk/config/test_ramfs-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_shm-0.1.0.dadk b/user/dadk/config/test_shm-0.1.0.dadk index 1f1d9c89..515bddee 100644 --- a/user/dadk/config/test_shm-0.1.0.dadk +++ b/user/dadk/config/test_shm-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_signal-0.1.0.dadk b/user/dadk/config/test_signal-0.1.0.dadk index 59e37750..ea4660d6 100644 --- a/user/dadk/config/test_signal-0.1.0.dadk +++ b/user/dadk/config/test_signal-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_socket-0.1.0.dadk b/user/dadk/config/test_socket-0.1.0.dadk index e363a0f6..315813dc 100644 --- a/user/dadk/config/test_socket-0.1.0.dadk +++ b/user/dadk/config/test_socket-0.1.0.dadk @@ -18,5 +18,6 @@ }, "install": { "in_dragonos_path": "/" - } + }, + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_sqlite3-3.42.0.dadk b/user/dadk/config/test_sqlite3-3.42.0.dadk index f8685376..8bdf7359 100644 --- a/user/dadk/config/test_sqlite3-3.42.0.dadk +++ b/user/dadk/config/test_sqlite3-3.42.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] } diff --git a/user/dadk/config/test_statfs_0_1_0.dadk b/user/dadk/config/test_statfs_0_1_0.dadk index b8297f23..2ea5ff06 100644 --- a/user/dadk/config/test_statfs_0_1_0.dadk +++ b/user/dadk/config/test_statfs_0_1_0.dadk @@ -22,5 +22,6 @@ }, "envs": [], "build_once": false, - "install_once": false + "install_once": false, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_statx_0_1_0.dadk b/user/dadk/config/test_statx_0_1_0.dadk index ea694e98..07ff640a 100644 --- a/user/dadk/config/test_statx_0_1_0.dadk +++ b/user/dadk/config/test_statx_0_1_0.dadk @@ -21,5 +21,6 @@ }, "envs": [], "build_once": false, - "install_once": false + "install_once": false, + "target_arch": ["x86_64"] } \ No newline at end of file diff --git a/user/dadk/config/test_uart-0.1.0.dadk b/user/dadk/config/test_uart-0.1.0.dadk index 6aee36ad..b30cc293 100644 --- a/user/dadk/config/test_uart-0.1.0.dadk +++ b/user/dadk/config/test_uart-0.1.0.dadk @@ -19,5 +19,6 @@ "clean": { "clean_command": "make clean" }, - "envs": [] + "envs": [], + "target_arch": ["x86_64"] }