Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,7 @@ gettext gettext-check: $(RELIEFOS_O_MARKER) $(RELIEFOS_DOCS_I18N_INPUTS)
sh $(RELIEFOS_SRC)/scripts/docs-python.sh $(RELIEFOS_SRC)/scripts/update-doc-translations.py \
--output $(O)/Documentation/gettext $(if $(filter gettext-check,$@),--check)

reliefos_run_only_goals := run-only run-installer-only run-iso-only
reliefos_goals := $(filter-out help doctor clean distclean htmldocs gettext gettext-check,$(MAKECMDGOALS))
reliefos_kbuild_goals := $(patsubst $(reliefos_O_absolute)/%,%,$(patsubst $(O)/%,%,$(reliefos_goals)))
ifneq ($(strip $(reliefos_goals)),)
Expand All @@ -249,7 +250,7 @@ endif

# Inspection never creates O. Configuration-independent goals may inspect an
# existing host-only tree without creating a .config as a side effect.
reliefos_config_free_goals := tools fetch fetch-check reliefnt-fetch ntclks-fetch reliefnt-fetch-check ntclks-fetch-check headers_install defconfig olddefconfig menuconfig kernel-menuconfig kernel-olddefconfig kernel-allmodconfig migrate-config regen-component-kconfig
reliefos_config_free_goals := tools fetch fetch-check reliefnt-fetch ntclks-fetch reliefnt-fetch-check ntclks-fetch-check headers_install defconfig olddefconfig menuconfig kernel-menuconfig kernel-olddefconfig kernel-allmodconfig migrate-config regen-component-kconfig $(reliefos_run_only_goals)
ifneq ($(strip $(reliefos_lock_skip)),)
ifneq ($(strip $(reliefos_goals)),)
ifeq ($(wildcard $(reliefos_O_absolute)),)
Expand Down Expand Up @@ -291,13 +292,15 @@ reliefos_hostcc_fingerprint = $(shell sh $(RELIEFOS_SRC)/scripts/reliefos/hostcc
reliefos_native_hostcc = env RELIEFOS_HOST_COMPILER_ID=$(reliefos_hostcc_fingerprint) $(reliefos_hostcc_command)

__kbuild:
ifneq ($(strip $(filter-out $(reliefos_run_only_goals),$(reliefos_kbuild_goals))),)
$(Q)mkdir -p '$(reliefos_O_absolute)'
$(Q)test -f '$(RELIEFOS_O_MARKER)' || printf 'reliefos-build-out version=1 root=%s\n' '$(RELIEFOS_SRC)' > '$(RELIEFOS_O_MARKER)'
+$(Q)CONFIG_SHELL=/bin/sh AWK=awk srctree='$(RELIEFOS_SRC)' objtree=. VPATH='$(RELIEFOS_SRC)' \
$(MAKE) --no-print-directory -rR -C '$(reliefos_O_absolute)' \
-f '$(RELIEFOS_SRC)/scripts/Makefile.port' -f '$(RELIEFOS_SRC)/scripts/Makefile.build' \
obj=scripts/basic KBUILD_HOSTCFLAGS='-O2 -I$(RELIEFOS_SRC)/scripts/include' \
HOSTCC='$(reliefos_native_hostcc)'
endif
+$(Q)CONFIG_SHELL=/bin/sh AWK=awk srctree='$(RELIEFOS_SRC)' objtree=. VPATH='$(RELIEFOS_SRC)' \
RELIEFOS_SRC='$(RELIEFOS_SRC)' ARCH='$(ARCH)' PROFILE='$(PROFILE)' \
SOURCE_DATE_EPOCH='$(SOURCE_DATE_EPOCH)' TOOLCHAIN='$(TOOLCHAIN)' \
Expand Down
2 changes: 1 addition & 1 deletion kernel/reliefnt
7 changes: 7 additions & 0 deletions scripts/help.sh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ ReliefOS build system (Linux Kbuild / Kconfig)
make run boot the VMDK in QEMU (no root required)
make run-iso boot the live ISO in QEMU
make run-installer boot the installer ISO in QEMU
make run-only boot the existing VMDK without rebuilding
make run-iso-only boot the existing live ISO without rebuilding
make run-installer-only boot the existing installer ISO without rebuilding

make test-tools C host tool tests, plain and under ASan/UBSan
make test-build shell contract tests for the build surface
Expand All @@ -72,6 +75,10 @@ Variables
V=1 echo the real command, its working directory and overrides
QEMU_BOOT=uefi|bios run firmware, default uefi
QEMU_FIRMWARE=FILE OVMF firmware for uefi; unused for bios
QEMU_INSTALLER_DISK=FILE attach an optional target disk to installer QEMU (qcow2 by default)
QEMU_INSTALLER_DISK_FORMAT=FORMAT qcow2, raw or vmdk disk image format
QEMU_RUN_DISK=FILE select a disk image for run-only (qcow2 by default; relative to repo root)
QEMU_RUN_DISK_FORMAT=FORMAT qcow2, raw or vmdk disk image format
CPUS=n override Kconfig guest CPU count
MEMORY=4G guest memory for the run targets
TOOLCHAIN=FILE toolchain description, default configs/toolchains/llvm-x86_64.mk
Expand Down
42 changes: 39 additions & 3 deletions scripts/reliefos/Makefile.run
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,16 @@ RELIEFOS_QEMU_NVME ?= $(LEONOS_QEMU_NVME)
QEMU_MEMORY := $(or $(MEMORY),$(CONFIG_QEMU_MEMORY_MB),4096)
QEMU_CPUS := $(or $(CPUS),$(CONFIG_QEMU_SMP_CPUS),4)
comma := ,
QEMU_INSTALLER_DISK ?=
QEMU_INSTALLER_DISK_FORMAT ?= qcow2
QEMU_NETWORK := $(subst ",,$(CONFIG_QEMU_NET_DEVICE))
QEMU_FLAGS := -machine $(if $(filter 1 y yes true,$(RELIEFOS_QEMU_IDE)),pc,q35) $(if $(filter 1,$(QEMU_KVM)),-enable-kvm -cpu host,-cpu max) -m $(QEMU_MEMORY) -smp $(QEMU_CPUS) $(QEMU_FIRMWARE_FLAGS) -display $(QEMU_DISPLAY) -serial $(QEMU_SERIAL) $(QEMU_GPU_FLAGS) $(if $(QEMU_NETWORK),-netdev user,id=net0 -device $(QEMU_NETWORK)$(comma)netdev=net0) -audiodev $(QEMU_AUDIO),id=snd0 $(QEMU_SOUND_FLAGS)
QEMU_NETWORK_FLAGS := $(if $(QEMU_NETWORK),-netdev user$(comma)id=net0 -device $(QEMU_NETWORK)$(comma)netdev=net0)
ifneq ($(strip $(QEMU_INSTALLER_DISK)),)
QEMU_INSTALLER_DISK_PATH := $(if $(filter /%,$(QEMU_INSTALLER_DISK)),$(QEMU_INSTALLER_DISK),$(RELIEFOS_SRC)/$(QEMU_INSTALLER_DISK))
QEMU_INSTALLER_DISK_CHECK := test -f '$(QEMU_INSTALLER_DISK_PATH)' || { echo 'missing installer target disk: $(QEMU_INSTALLER_DISK_PATH)' >&2; exit 1; }
QEMU_INSTALLER_DISK_FLAGS := -drive file=$(QEMU_INSTALLER_DISK_PATH)$(comma)if=none$(comma)id=installer-disk$(comma)format=$(QEMU_INSTALLER_DISK_FORMAT) -device ich9-ahci$(comma)id=installer-ahci -device ide-hd$(comma)drive=installer-disk$(comma)bus=installer-ahci.0
endif
QEMU_FLAGS := -machine $(if $(filter 1 y yes true,$(RELIEFOS_QEMU_IDE)),pc,q35) $(if $(filter 1,$(QEMU_KVM)),-enable-kvm -cpu host,-cpu max) -m $(QEMU_MEMORY) -smp $(QEMU_CPUS) $(QEMU_FIRMWARE_FLAGS) -display $(QEMU_DISPLAY) -serial $(QEMU_SERIAL) $(QEMU_GPU_FLAGS) $(QEMU_NETWORK_FLAGS) -audiodev $(QEMU_AUDIO),id=snd0 $(QEMU_SOUND_FLAGS)
QEMU_DISK := -drive file=$(DISK_VMDK),if=none,id=disk0,format=vmdk
ifneq ($(filter 1 y yes true,$(RELIEFOS_QEMU_NVME)),)
QEMU_DISK += -device nvme,drive=disk0,serial=leonosnvme
Expand All @@ -53,7 +61,17 @@ QEMU_DISK += -device piix3-ide,id=ide -device ide-hd,drive=disk0,bus=ide.0,unit=
else
QEMU_DISK += -device ich9-ahci,id=ahci -device ide-hd,drive=disk0,bus=ahci.0
endif
.PHONY: run run-debug run-iso run-installer
QEMU_RUN_DISK ?=
QEMU_RUN_DISK_FORMAT ?= qcow2
ifneq ($(strip $(QEMU_RUN_DISK)),)
QEMU_RUN_DISK_PATH := $(if $(filter /%,$(QEMU_RUN_DISK)),$(QEMU_RUN_DISK),$(RELIEFOS_SRC)/$(QEMU_RUN_DISK))
QEMU_RUN_DISK_CHECK := test -f '$(QEMU_RUN_DISK_PATH)' || { echo 'missing run disk: $(QEMU_RUN_DISK_PATH)' >&2; exit 1; }
QEMU_RUN_DISK_FLAGS := -drive file=$(QEMU_RUN_DISK_PATH)$(comma)if=none$(comma)id=run-disk$(comma)format=$(QEMU_RUN_DISK_FORMAT) -device ich9-ahci$(comma)id=run-ahci -device ide-hd$(comma)drive=run-disk$(comma)bus=run-ahci.0
else
QEMU_RUN_DISK_CHECK := test -f '$(DISK_VMDK)' || { echo 'missing disk image: $(DISK_VMDK)' >&2; exit 1; }
QEMU_RUN_DISK_FLAGS := $(QEMU_DISK)
endif
.PHONY: run run-debug run-iso run-installer run-only run-installer-only run-iso-only
run run-debug: image-vmdk
$(Q)test '$(QEMU_BOOT)' = bios || test -f '$(QEMU_FIRMWARE)' || { echo 'set QEMU_FIRMWARE to an OVMF firmware image' >&2; exit 1; }
$(Q)$(QEMU) $(QEMU_FLAGS) $(QEMU_DISK) $(if $(filter run-debug,$@),-no-reboot -no-shutdown)
Expand All @@ -62,4 +80,22 @@ run-iso: iso
$(Q)$(QEMU) $(QEMU_FLAGS) -cdrom $(LIVE_ISO) -no-reboot -no-shutdown
run-installer: installer
$(Q)test '$(QEMU_BOOT)' = bios || test -f '$(QEMU_FIRMWARE)'
$(Q)$(QEMU) $(QEMU_FLAGS) -cdrom $(INSTALLER_ISO) -no-reboot -no-shutdown
$(Q)$(QEMU) $(QEMU_FLAGS) $(QEMU_INSTALLER_DISK_FLAGS) -cdrom $(INSTALLER_ISO) -no-reboot -no-shutdown

# These entry points consume existing images only; they deliberately have no
# image-vmdk/iso/installer prerequisites.
run-only:
$(Q)$(QEMU_RUN_DISK_CHECK)
$(Q)test '$(QEMU_BOOT)' = bios || test -f '$(QEMU_FIRMWARE)' || { echo 'set QEMU_FIRMWARE to an OVMF firmware image' >&2; exit 1; }
$(Q)$(QEMU) $(QEMU_FLAGS) $(QEMU_RUN_DISK_FLAGS)

run-iso-only:
$(Q)test -f '$(LIVE_ISO)' || { echo 'missing live ISO: $(LIVE_ISO)' >&2; exit 1; }
$(Q)test '$(QEMU_BOOT)' = bios || test -f '$(QEMU_FIRMWARE)' || { echo 'set QEMU_FIRMWARE to an OVMF firmware image' >&2; exit 1; }
$(Q)$(QEMU) $(QEMU_FLAGS) -cdrom $(LIVE_ISO) -no-reboot -no-shutdown

run-installer-only:
$(Q)test -f '$(INSTALLER_ISO)' || { echo 'missing installer ISO: $(INSTALLER_ISO)' >&2; exit 1; }
$(Q)$(QEMU_INSTALLER_DISK_CHECK)
$(Q)test '$(QEMU_BOOT)' = bios || test -f '$(QEMU_FIRMWARE)' || { echo 'set QEMU_FIRMWARE to an OVMF firmware image' >&2; exit 1; }
$(Q)$(QEMU) $(QEMU_FLAGS) $(QEMU_INSTALLER_DISK_FLAGS) -cdrom $(INSTALLER_ISO) -no-reboot -no-shutdown
Loading