Skip to content

Commit

Permalink
Run QEMU examples without sudo (#28)
Browse files Browse the repository at this point in the history
Running QEMU should be possible as regular user and we should ideally not be
shipping anything that requires users to execute as root.

While we're at it, remove usage of the environment variable QEMU_PATH as it
wasn't use consequentially anyway.

Signed-off-by: Bjoern Doebel <[email protected]>
  • Loading branch information
bjoernd authored Aug 10, 2020
1 parent fb23210 commit d549f6e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,15 @@ export ROOT

ifeq ($(OS),Windows_NT)
SYSTEM := WIN
SUDO :=
else
UNAME := $(shell uname -s)

ifeq ($(UNAME),Linux)
SYSTEM := LINUX
SUDO := sudo
endif

ifeq ($(UNAME),Darwin)
SYSTEM := MACOS
SUDO :=
endif
endif

Expand Down Expand Up @@ -94,24 +91,24 @@ iso: all
.PHONY: boot
boot: all
@echo "QEMU START"
@ $(SUDO) qemu-system-x86_64 -cdrom $(ISO_FILE) $(QEMU_PARAMS)
@qemu-system-x86_64 -cdrom $(ISO_FILE) $(QEMU_PARAMS)

.PHONY: boot_debug
boot_debug: all iso
$(SUDO) qemu-system-x86_64 -cdrom $(ISO_FILE) $(QEMU_PARAMS) $(QEMU_PARAMS_DEBUG)
qemu-system-x86_64 -cdrom $(ISO_FILE) $(QEMU_PARAMS) $(QEMU_PARAMS_DEBUG)

.PHONY: run
run: all
$(SUDO) "$$QEMU_PATH"/qemu-system-x86_64 -kernel $(TARGET) $(QEMU_PARAMS) $(QEMU_PARAMS_KERNEL)
qemu-system-x86_64 -kernel $(TARGET) $(QEMU_PARAMS) $(QEMU_PARAMS_KERNEL)

.PHONY: debug
debug: all
$(SUDO) "$$QEMU_PATH"/qemu-system-x86_64 -kernel $(TARGET) $(QEMU_PARAMS) $(QEMU_PARAMS_KERNEL) $(QEMU_PARAMS_DEBUG)
qemu-system-x86_64 -kernel $(TARGET) $(QEMU_PARAMS) $(QEMU_PARAMS_KERNEL) $(QEMU_PARAMS_DEBUG)

.PHONY: gdb
gdb: debug
gdb $(TARGET) -ex 'target remote :1234' -ex 'b _start' -ex 'c'
$(SUDO) killall -9 qemu-system-x86_64
killall -9 qemu-system-x86_64

define all_sources
find $(ROOT) -name "*.[hcsS]"
Expand Down

0 comments on commit d549f6e

Please sign in to comment.