增加安装至系统grub的选项

This commit is contained in:
pointer-to-bios 2024-04-04 21:38:44 +08:00
parent 88acd1900f
commit bec4634857
1 changed files with 27 additions and 8 deletions

View File

@ -1,20 +1,20 @@
SOURCE := $(shell pwd)/src/scripts SOURCE := $(shell pwd)/scripts
.PHONY: all clear run debug config disass .PHONY: all clear run debug disass
all: config all: metaverse_kernel
@make -C src all --no-print-directory @make -C src all --no-print-directory
clear: config clear: metaverse_kernel
@make -C src clear --no-print-directory @make -C src clear --no-print-directory
run: config run: metaverse_kernel
@make -C test run --no-print-directory @make -C test run --no-print-directory
debug: config debug: metaverse_kernel
@make -C test debug --no-print-directory @make -C test debug --no-print-directory
config: metaverse_kernel:
@if [ "${shell uname -s}" != "Linux" ]; then \ @if [ "${shell uname -s}" != "Linux" ]; then \
echo -e "\e[1;33mMetaverse\e[0m must build under \e[1;35mLinux\e[0m or itself."; \ echo -e "\e[1;33mMetaverse\e[0m must build under \e[1;35mLinux\e[0m or itself."; \
exit -1; \ exit -1; \
@ -22,9 +22,28 @@ config:
@if [ -f "metaverse_kernel" ]; then \ @if [ -f "metaverse_kernel" ]; then \
echo; \ echo; \
else \ else \
touch metaverse_kernel; \
"${SOURCE}/depcheck"; \ "${SOURCE}/depcheck"; \
if [ $$? != 0 ]; then \
exit $$?; \
fi; \
touch metaverse_kernel; \
fi
@if [ $$? != 0 ]; then \
exit -1; \
fi fi
disass: disass:
objdump -D src/metaverse.elf > kerndisass.txt objdump -D src/metaverse.elf > kerndisass.txt
install-grub:
@cp src/metaverse.elf /boot/
@if ! grep -q "Metaverse" /boot/grub/grub.cfg; then \
echo -e 'menuentry "Metaverse" {\n set root=(hd0,gpt1)\n multiboot2 /metaverse.elf\n}\n' >> \
/boot/grub/grub.cfg; \
echo -e 'Added Metaverse into grub entries.'; \
else \
echo -e 'Metaverse entry exists.'; \
fi
remove-grub:
@-rm /boot/metaverse.elf