X-Git-Url: https://scm.lunaixsky.com/lunaix-os.git/blobdiff_plain/aa2843fdbdd9b5cc579d198fd1a9ec874642706e..0765e7c133eb393d8cd0292af444543c2edf8ccc:/lunaix-os/makefile?ds=sidebyside diff --git a/lunaix-os/makefile b/lunaix-os/makefile index 7513516..c332bf7 100644 --- a/lunaix-os/makefile +++ b/lunaix-os/makefile @@ -10,6 +10,8 @@ export ARCH DEPS := $(CC) $(LD) $(AR) xorriso grub-mkrescue +CMDLINE ?= console=/dev/ttyFB0 + kbuild_dir := build kbin_dir := $(kbuild_dir)/bin os_img_dir := $(kbuild_dir)/img @@ -37,15 +39,19 @@ $(kbuild_dir): @mkdir -p $(os_img_dir)/boot/grub @mkdir -p $(os_img_dir)/usr +.PHONY: kernel export BUILD_DIR=$(kbin_dir) export BUILD_NAME=$(kbin) -$(kbin): +kernel: $(call status,TASK,$(notdir $@)) @$(MAKE) $(MKFLAGS) -I $(mkinc_dir) -f kernel.mk all -$(kimg): usr/build $(kbin) +.PHONY: image +export KCMD=$(CMDLINE) +export _OS_NAME=$(OS_NAME) +image: usr/build kernel $(call status,TASK,$(notdir $@)) - @./config-grub.sh ${OS_NAME} $(os_img_dir)/boot/grub/grub.cfg + @./config-grub.sh $(os_img_dir)/boot/grub/grub.cfg @cp -r usr/build/* $(os_img_dir)/usr @cp -r $(kbin_dir)/* $(os_img_dir)/boot @grub-mkrescue -o $(kimg) $(os_img_dir) -- -volid "$(OS_ID) $(OS_VER)" -system_id "$(OS_NAME)" @@ -57,10 +63,10 @@ check: $(DEPS) check-cc GRUB_TEMPLATE prepare: check $(os_img_dir) export BUILD_MODE=release -bootable: $(kbuild_dir) $(kimg) +bootable: $(kbuild_dir) image export BUILD_MODE=debug -bootable-debug: $(kbuild_dir) $(kimg) +bootable-debug: $(kbuild_dir) image user: $(call status,$@) @@ -72,8 +78,6 @@ instable: CFLAGS := -g -std=gnu99 -ffreestanding $(O) $(W) $(ARCH_OPT) -D__LUNAI instable: all all-debug: bootable-debug - @echo "Dumping the disassembled kernel code to $(kbuild_dir)/kdump.txt" - @i686-elf-objdump -S $(kbin) > $(kbuild_dir)/kdump.txt clean: @rm -rf $(kbuild_dir) || exit 1 @@ -89,11 +93,9 @@ debug-qemu: all-debug @i686-elf-objcopy --only-keep-debug $(kbin) $(kbuild_dir)/kernel.dbg @qemu-system-i386 $(call get_qemu_options,$(kimg)) @sleep 1 - @$(QEMU_MON_TERM) -- telnet 127.0.0.1 $(QEMU_MON_PORT) - @gdb -s $(kbuild_dir)/kernel.dbg -ex "target remote localhost:1234" + @QMPORT=$(QEMU_MON_PORT) gdb $(kbin) -ex "target remote localhost:1234" debug-qemu-vscode: all-debug - @i686-elf-objcopy --only-keep-debug $(kbin) $(kbuild_dir)/kernel.dbg @qemu-system-i386 $(call get_qemu_options,$(kimg)) @sleep 0.5 @telnet 127.0.0.1 $(QEMU_MON_PORT)