2 Star 9 Fork 3

zzhicanfly/juner_os

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Makefile 1.68 KB
一键复制 编辑 原始数据 按行查看 历史
zzhicanfly 提交于 2020-10-26 22:01 . make fix
.PHONY: all amd64 crate_esp run clean install-depends build rcore-fs-fuse pack
all: amd64 run
BOOTLOADER_DIR := bootloader
OVMF = ${BOOTLOADER_DIR}/OVMF.fd
USER_DIR = user
OUT_IMG = build/SYS.img
USER_QCOW2 = build/x86_64.qcow2
rcore_fs_fuse_revision := 7f5eeac
# build
build:
@cd bootloader && cargo build --release
@cd kernel && cargo build --release
@make pack
# 编译bootloader和kernel
amd64:
@make build
@make crate_esp
# x86_64编译出的文件目录
crate_esp:
@mkdir -p build/pc/esp/EFI/kernel build/pc/esp/EFI/Boot
@cp target/x86_64-unknown-uefi/release/bootloader.efi build/pc/esp/EFI/Boot/BootX64.efi
@cp target/amd64/release/kernel build/pc/esp/EFI/kernel/kernel.elf
# QEMU运行x86_64
run:
@qemu-system-x86_64 \
-bios ${OVMF} \
-drive format=raw,file=fat:rw:build/pc/esp \
-m 4096 \
-smp 2 \
-serial mon:stdio \
-device isa-debug-exit \
-drive format=qcow2,file=$(USER_QCOW2),media=disk,cache=writeback,id=sfsimg,if=none \
-device ahci,id=ahci0 \
-device ide-hd,drive=sfsimg,bus=ahci0.0
# -nographic \
# 清理编译出来的文件
clean:
@cargo clean
@rm -rf build
# 依赖安装
install-depends:
rustup install nightly
rustup default nightly
rustup component add rust-src
rustup component add llvm-tools-preview
# 安装依赖
rcore-fs-fuse:
ifneq ($(shell rcore-fs-fuse dir image git-version), $(rcore_fs_fuse_revision))
@echo Installing rcore-fs-fuse
@cargo install rcore-fs-fuse --git https://github.com/rcore-os/rcore-fs --rev $(rcore_fs_fuse_revision) --force
endif
# 打包文件
pack:
@mkdir -p build
@rcore-fs-fuse $(OUT_IMG) $(USER_DIR) zip
@qemu-img convert -f raw $(OUT_IMG) -O qcow2 $(USER_QCOW2)
@qemu-img resize $(USER_QCOW2) +1G
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Rust
1
https://gitee.com/zzhicanfly/juner_os.git
git@gitee.com:zzhicanfly/juner_os.git
zzhicanfly
juner_os
juner_os
master

搜索帮助