|
@@ -38,19 +38,47 @@ endif
|
|
|
check_arch:
|
|
|
@bash tools/check_arch.sh
|
|
|
|
|
|
+# ===> Following are oscomp specific
|
|
|
.PHONY: all
|
|
|
-all: kernel user
|
|
|
+all:
|
|
|
+ #@make ARCH=x86_64 ci-build
|
|
|
+ @make ARCH=riscv64 ci-build
|
|
|
|
|
|
+ci-update-submodules:
|
|
|
+ @echo "更新子模块"
|
|
|
+ @sudo chown -R $(shell whoami) .
|
|
|
+ @git submodule update --recursive --init
|
|
|
+
|
|
|
+ci-build: ci-kernel ci-user ci-gendisk
|
|
|
+
|
|
|
+ci-run: ci-build ci-start
|
|
|
+
|
|
|
+ci-kernel: ci-update-submodules
|
|
|
+ @echo "Compile $(ARCH) Kernel..."
|
|
|
+ @$(MAKE) -C ./kernel all ARCH=$(ARCH) || (echo "Kernel compilation failed" && exit 1)
|
|
|
+
|
|
|
+ci-user:
|
|
|
+ @echo "Compile $(ARCH) User..."
|
|
|
+ @$(MAKE) -C ./user all ARCH=$(ARCH) FORCE_UNSAFE_CONFIGURE=1 || (echo "User compilation failed" && exit 1)
|
|
|
|
|
|
-.PHONY: kernel
|
|
|
-kernel: check_arch update-submodules
|
|
|
- mkdir -p bin/kernel/
|
|
|
-
|
|
|
- $(MAKE) -C ./kernel all ARCH=$(ARCH) || (sh -c "echo 内核编译失败" && exit 1)
|
|
|
-
|
|
|
-.PHONY: user
|
|
|
-user: check_arch
|
|
|
- $(MAKE) -C ./user all ARCH=$(ARCH) || (sh -c "echo 用户程序编译失败" && exit 1)
|
|
|
+ci-gendisk:
|
|
|
+ @echo "Generate disk image"
|
|
|
+ifeq ($(ARCH),x86_64)
|
|
|
+ @bash -c "cd tools && bash grub_auto_install.sh"
|
|
|
+endif
|
|
|
+ @bash -c "cd oscomp && sudo DADK=$(DADK) ARCH=$(ARCH) bash write_disk_image.sh --bios=legacy"
|
|
|
+
|
|
|
+ci-start:
|
|
|
+ @echo "Booting $(ARCH)"
|
|
|
+ @cd oscomp && bash ci-start-$(ARCH).sh
|
|
|
+
|
|
|
+.PHONY: kernel user write_diskimage write_diskimage-uefi qemu qemu-nographic qemu-uefi qemu-vnc qemu-uefi-vnc
|
|
|
+kernel user write_diskimage write_diskimage-uefi qemu qemu-nographic qemu-uefi qemu-vnc qemu-uefi-vnc:
|
|
|
+ @echo "The target \"$@\" is deprecated in this branch. Please use ci-* target instead."
|
|
|
+ @echo "To see the available targets, run \"make help\"."
|
|
|
+ @false
|
|
|
+
|
|
|
+# <===
|
|
|
|
|
|
.PHONY: clean
|
|
|
clean:
|
|
@@ -78,74 +106,6 @@ else
|
|
|
gdb-multiarch -n -x tools/.gdbinit
|
|
|
endif
|
|
|
|
|
|
-# 写入磁盘镜像
|
|
|
-write_diskimage: check_arch
|
|
|
- @echo "write_diskimage arch=$(ARCH)"
|
|
|
- bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo DADK=$(DADK) ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=legacy && cd .."
|
|
|
-
|
|
|
-# 写入磁盘镜像(uefi)
|
|
|
-write_diskimage-uefi: check_arch
|
|
|
- bash -c "export ARCH=$(ARCH); cd tools && bash grub_auto_install.sh && sudo DADK=$(DADK) ARCH=$(ARCH) bash $(ROOT_PATH)/tools/write_disk_image.sh --bios=uefi && cd .."
|
|
|
-# 不编译,直接启动QEMU
|
|
|
-qemu: check_arch
|
|
|
- sh -c "cd oscomp && bash run-qemu.sh --bios=legacy --display=window && cd .."
|
|
|
-
|
|
|
-# 不编译,直接启动QEMU,不显示图像
|
|
|
-qemu-nographic: check_arch
|
|
|
- sh -c "cd oscomp && bash run-qemu.sh --bios=legacy --display=nographic && cd .."
|
|
|
-
|
|
|
-# 不编译,直接启动QEMU(UEFI)
|
|
|
-qemu-uefi: check_arch
|
|
|
- sh -c "cd oscomp && bash run-qemu.sh --bios=uefi --display=window && cd .."
|
|
|
-# 不编译,直接启动QEMU,使用VNC Display作为图像输出
|
|
|
-qemu-vnc: check_arch
|
|
|
- sh -c "cd oscomp && bash run-qemu.sh --bios=legacy --display=vnc && cd .."
|
|
|
-# 不编译,直接启动QEMU(UEFI),使用VNC Display作为图像输出
|
|
|
-qemu-uefi-vnc: check_arch
|
|
|
- sh -c "cd oscomp && bash run-qemu.sh --bios=uefi --display=vnc && cd .."
|
|
|
-
|
|
|
-# 编译并写入磁盘镜像
|
|
|
-build: check_arch
|
|
|
- $(MAKE) all -j $(NPROCS)
|
|
|
- $(MAKE) write_diskimage || exit 1
|
|
|
-
|
|
|
-# 在docker中编译,并写入磁盘镜像
|
|
|
-docker: check_arch
|
|
|
- @echo "使用docker构建"
|
|
|
- sudo bash tools/build_in_docker.sh || exit 1
|
|
|
- $(MAKE) write_diskimage || exit 1
|
|
|
-
|
|
|
-# uefi方式启动
|
|
|
-run-uefi: check_arch
|
|
|
- $(MAKE) all -j $(NPROCS)
|
|
|
- $(MAKE) write_diskimage-uefi || exit 1
|
|
|
- $(MAKE) qemu-uefi
|
|
|
-
|
|
|
-# 编译并启动QEMU
|
|
|
-run: check_arch
|
|
|
- $(MAKE) all -j $(NPROCS)
|
|
|
- $(MAKE) write_diskimage || exit 1
|
|
|
- $(MAKE) qemu
|
|
|
-
|
|
|
-# uefi方式启动,使用VNC Display作为图像输出
|
|
|
-run-uefi-vnc: check_arch
|
|
|
- $(MAKE) all -j $(NPROCS)
|
|
|
- $(MAKE) write_diskimage-uefi || exit 1
|
|
|
- $(MAKE) qemu-uefi-vnc
|
|
|
-
|
|
|
-# 编译并启动QEMU,使用VNC Display作为图像输出
|
|
|
-run-vnc: check_arch
|
|
|
- $(MAKE) all -j $(NPROCS)
|
|
|
- $(MAKE) write_diskimage || exit 1
|
|
|
- $(MAKE) qemu-vnc
|
|
|
-
|
|
|
-# 在docker中编译,并启动QEMU
|
|
|
-run-docker: check_arch
|
|
|
- @echo "使用docker构建并运行"
|
|
|
- sudo bash tools/build_in_docker.sh || exit 1
|
|
|
- $(MAKE) write_diskimage || exit 1
|
|
|
- $(MAKE) qemu
|
|
|
-
|
|
|
fmt: check_arch
|
|
|
@echo "格式化代码"
|
|
|
FMT_CHECK=$(FMT_CHECK) $(MAKE) fmt -C kernel
|
|
@@ -159,9 +119,7 @@ log-monitor:
|
|
|
.PHONY: update-submodules
|
|
|
update-submodules:
|
|
|
@echo "更新子模块"
|
|
|
- @sudo chown -R $(USER):$(USER) .
|
|
|
@git submodule update --recursive --init
|
|
|
- # @git submodule foreach git pull origin master
|
|
|
|
|
|
.PHONY: update-submodules-by-mirror
|
|
|
update-submodules-by-mirror:
|
|
@@ -171,29 +129,28 @@ update-submodules-by-mirror:
|
|
|
@git config --global --unset url."https://git.mirrors.dragonos.org.cn/DragonOS-Community/".insteadOf
|
|
|
|
|
|
help:
|
|
|
- @echo "编译:"
|
|
|
- @echo " make all -j <n> - 本地编译,不运行,n为要用于编译的CPU核心数"
|
|
|
- @echo " make build - 本地编译,并写入磁盘镜像"
|
|
|
- @echo " make docker - Docker编译,并写入磁盘镜像"
|
|
|
- @echo ""
|
|
|
- @echo "编译并运行:"
|
|
|
- @echo " make run-docker - Docker编译,写入磁盘镜像,并在QEMU中运行"
|
|
|
- @echo " make run - 本地编译,写入磁盘镜像,并在QEMU中运行"
|
|
|
- @echo " make run-uefi - 以uefi方式启动运行"
|
|
|
+ @echo "用法:"
|
|
|
+ @echo " make <target> ARCH=<arch>"
|
|
|
@echo ""
|
|
|
- @echo "运行:"
|
|
|
- @echo " make qemu - 不编译,直接从已有的磁盘镜像启动运行"
|
|
|
- @echo " make qemu-uefi - 不编译,直接从已有的磁盘镜像以UEFI启动运行"
|
|
|
+ @echo "Example:"
|
|
|
+ @echo " make ci-run ARCH=riscv64"
|
|
|
@echo ""
|
|
|
+ @echo "When <arch> is not specified, the default value in env.mk will be used."
|
|
|
@echo ""
|
|
|
- @echo "注: 对于上述的run, run-uefi, qemu, qemu-uefi命令可以在命令后加上-vnc后缀,来通过vnc连接到DragonOS, 默认会在5900端口运行vnc服务器。如:make run-vnc "
|
|
|
+ @echo "Targets:"
|
|
|
+ @echo " make ci-run - 本地编译,写入磁盘镜像,并在QEMU中运行"
|
|
|
+ @echo " make ci-kernel - 编译内核"
|
|
|
+ @echo " make ci-gendisk - 写入磁盘镜像"
|
|
|
+ @echo " make ci-build - 编译并写入磁盘镜像"
|
|
|
+ @echo " make ci-start - 不编译,直接启动运行"
|
|
|
@echo ""
|
|
|
@echo "其他:"
|
|
|
- @echo " make clean - 清理编译产生的文件"
|
|
|
- @echo " make fmt - 格式化代码"
|
|
|
- @echo " make log-monitor - 启动日志监控"
|
|
|
- @echo " make docs - 生成文档"
|
|
|
- @echo " make clean-docs - 清理文档"
|
|
|
+ @echo " make all - 用于 CI 编译"
|
|
|
+ @echo " make clean - 清理编译产生的文件"
|
|
|
+ @echo " make fmt - 格式化代码"
|
|
|
+ @echo " make log-monitor - 启动日志监控"
|
|
|
+ @echo " make docs - 生成文档"
|
|
|
+ @echo " make clean-docs - 清理文档"
|
|
|
@echo ""
|
|
|
@echo " make update-submodules - 更新子模块"
|
|
|
@echo " make update-submodules-by-mirror - 从镜像更新子模块"
|