From bec4634857fd691f3a954c86db9725fd7b132e48 Mon Sep 17 00:00:00 2001 From: pointer-to-bios Date: Thu, 4 Apr 2024 21:38:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=AE=89=E8=A3=85=E8=87=B3?= =?UTF-8?q?=E7=B3=BB=E7=BB=9Fgrub=E7=9A=84=E9=80=89=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/Makefile b/Makefile index 3316f1c..1145cd8 100644 --- a/Makefile +++ b/Makefile @@ -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 -clear: config +clear: metaverse_kernel @make -C src clear --no-print-directory -run: config +run: metaverse_kernel @make -C test run --no-print-directory -debug: config +debug: metaverse_kernel @make -C test debug --no-print-directory -config: +metaverse_kernel: @if [ "${shell uname -s}" != "Linux" ]; then \ echo -e "\e[1;33mMetaverse\e[0m must build under \e[1;35mLinux\e[0m or itself."; \ exit -1; \ @@ -22,9 +22,28 @@ config: @if [ -f "metaverse_kernel" ]; then \ echo; \ else \ - touch metaverse_kernel; \ "${SOURCE}/depcheck"; \ + if [ $$? != 0 ]; then \ + exit $$?; \ + fi; \ + touch metaverse_kernel; \ + fi + @if [ $$? != 0 ]; then \ + exit -1; \ fi disass: 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