diff --git a/Makefile b/Makefile index d7eff244..a422a74d 100644 --- a/Makefile +++ b/Makefile @@ -150,8 +150,6 @@ ACPICA_INSTALL := $(shell [ -d $(ACPICA_DEST_DIR)/source ] || endif ASM_OFFSETS_C := asm-offsets.c -ASM_OFFSETS_S := asm-offsets.s -ASM_OFFSETS_H := asm-offsets.h ASM_OFFSETS_SH := $(KTF_ROOT)/tools/asm-offsets/asm-offsets.sh SOURCES := $(shell find . -name \*.c -and -not -name $(ASM_OFFSETS_C)) @@ -160,6 +158,9 @@ ASM_SOURCES := $(shell find . -name \*.S) ASM_OFFSETS := $(shell find . -name $(ASM_OFFSETS_C)) LINK_SCRIPT := $(shell find . -name \*.ld) +ASM_OFFSETS_S := $(ASM_OFFSETS:.c=.s) +ASM_OFFSETS_H := $(addprefix include/,$(ASM_OFFSETS:.c=.h)) + SYMBOLS_NAME := symbols SYMBOLS_TOOL := symbols.py SYMBOLS_DIR := tools/symbols @@ -184,19 +185,20 @@ endif $(PREP_LINK_SCRIPT) : $(LINK_SCRIPT) $(VERBOSE) $(CC) $(AFLAGS) -E -P -C -x c $< -o $@ -$(TARGET): $(OBJS) $(PREP_LINK_SCRIPT) +$(TARGET_DEBUG): $(OBJS) $(PREP_LINK_SCRIPT) @echo "LD " $@ $(VERBOSE) $(LD) -T $(PREP_LINK_SCRIPT) -o $@ $(OBJS) $(PFMLIB_LINKER_FLAGS) @echo "GEN " $(SYMBOLS_NAME).S - $(VERBOSE) $(NM) -p --format=posix $(TARGET) | $(PYTHON) $(SYMBOLS_DIR)/$(SYMBOLS_TOOL) + $(VERBOSE) $(NM) -p --format=posix $@ | $(PYTHON) $(SYMBOLS_DIR)/$(SYMBOLS_TOOL) @echo "CC " $(SYMBOLS_NAME).S $(VERBOSE) $(CC) -c -o $(SYMBOLS_NAME).o $(AFLAGS) $(SYMBOLS_NAME).S $(VERBOSE) rm -rf $(SYMBOLS_NAME).S - @echo "LD " $(TARGET) $(SYMBOLS_NAME).o + @echo "LD " $@ $(SYMBOLS_NAME).o $(VERBOSE) $(LD) -T $(PREP_LINK_SCRIPT) -o $@ $(OBJS) $(PFMLIB_LINKER_FLAGS) $(SYMBOLS_NAME).o + +$(TARGET): $(TARGET_DEBUG) @echo "STRIP" - $(VERBOSE) $(OBJCOPY) --only-keep-debug $(TARGET) $(TARGET_DEBUG) - $(VERBOSE) $(STRIP) $(STRIP_OPTS) $(TARGET) + $(VERBOSE) $(STRIP) $(STRIP_OPTS) -o $@ $< $(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL) @echo "UNTAR libpfm" @@ -217,10 +219,12 @@ $(PFMLIB_ARCHIVE): $(PFMLIB_TARBALL) @echo "CC " $@ $(VERBOSE) $(CC) -c -o $@ $(CFLAGS) $< -$(ASM_OFFSETS_H): $(ASM_OFFSETS) - @echo "GEN" include/$(shell dirname $<)/$(ASM_OFFSETS_H) - $(VERBOSE) $(CC) $(CFLAGS) -S -g0 -o $(KTF_ROOT)/$(shell dirname $<)/$(ASM_OFFSETS_S) $< - $(VERBOSE) $(ASM_OFFSETS_SH) $(KTF_ROOT)/$(shell dirname $<)/$(ASM_OFFSETS_S) $(KTF_ROOT)/include/$(shell dirname $<)/$(ASM_OFFSETS_H) +$(ASM_OFFSETS_S): $(ASM_OFFSETS) + $(VERBOSE) $(CC) $(CFLAGS) -S -g0 -o $@ $< + +$(ASM_OFFSETS_H): $(ASM_OFFSETS_S) + @echo "GEN" $@ + $(VERBOSE) $(ASM_OFFSETS_SH) $< $@ DEPFILES := $(OBJS:.o=.d) -include $(wildcard $(DEPFILES)) @@ -236,11 +240,10 @@ clean: $(VERBOSE) find $(KTF_ROOT) -name \*.xz -delete $(VERBOSE) find $(KTF_ROOT) -name cscope.\* -delete $(VERBOSE) find $(KTF_ROOT) -maxdepth 1 \( -name tags -or -name TAGS \) -delete - $(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_S) -delete - $(VERBOSE) find $(KTF_ROOT) -name $(ASM_OFFSETS_H) -delete $(VERBOSE) find $(PFMLIB_DIR) -mindepth 1 ! -name $(PFMLIB_NAME)-$(PFMLIB_VER).tar.gz -delete + $(VERBOSE) $(RM) -f $(ASM_OFFSETS_H) $(ASM_OFFSETS_S) $(VERBOSE) $(RM) -rf $(ACPICA_DEST_DIR)/source - $(VERBOSE) $(RM) -f $(TARGET_DEBUG) + $(VERBOSE) $(RM) -f $(TARGET_DEBUG) $(TARGET) $(VERBOSE) $(RM) -rf $(GRUB_DIR) # Check whether we can use kvm for qemu @@ -268,18 +271,18 @@ QEMU_PARAMS += $(QEMU_PARAMS_NOGFX) QEMU_PARAMS_DEBUG := -s -S & -ISO_FILE := boot.iso +ISO_FILE := ktf.iso ifneq ($(SYSTEM), LINUX) -$(ISO_FILE): dockerboot.iso +$(ISO_FILE): docker${ISO_FILE} else $(ISO_FILE): $(TARGET) @echo "GEN ISO" $(ISO_FILE) - $(VERBOSE) $(GRUB_FILE) --is-x86-multiboot2 $(TARGET) || { echo "Multiboot not supported"; exit 1; } + $(VERBOSE) $(GRUB_FILE) --is-x86-multiboot2 $< || { echo "Multiboot not supported"; exit 1; } $(VERBOSE) $(RM) -rf $(GRUB_DIR) && mkdir -p $(GRUB_DIR)/grub - $(VERBOSE) cp $(TARGET) $(GRUB_DIR)/ + $(VERBOSE) cp $< $(GRUB_DIR)/ $(VERBOSE) cp $(GRUB_CONFIG) $(GRUB_DIR)/grub/grub.cfg - $(VERBOSE) $(XZ) -q -f $(GRUB_DIR)/$(TARGET) + $(VERBOSE) $(XZ) -q -f $(GRUB_DIR)/$< $(VERBOSE) $(GRUB_MKRESCUE) --install-modules="$(GRUB_MODULES)" --fonts=no --compress=xz -o $(ISO_FILE) grub &> /dev/null endif diff --git a/README.md b/README.md index 9958c42e..5d520b12 100644 --- a/README.md +++ b/README.md @@ -28,11 +28,11 @@ Some more features are in the making. Check out the issues. The quick start is to run the following commands. The content of the file tests/test.c will be executed. Note, the last command will block. -Build a boot.iso from scratch, in the docker container. +Build a ktf.iso from scratch, in the docker container. ``` make clean -make docker:boot.iso +make docker:ktf.iso ``` Boot the resulting image: @@ -66,17 +66,17 @@ make docker:all * Native ``` -make boot.iso +make ktf.iso ``` * Docker ``` -make docker:boot.iso +make docker:ktf.iso ``` The `make` command generates the `kernel64.bin` multiboot-compatible ELF file, that you can directly boot with QEMU. -The `make boot.iso` command takes the `kernel64.bin`, places it in `grub/boot/` directory hierarchy and generates a `boot.iso` +The `make ktf.iso` command takes the `kernel64.bin`, places it in `grub/boot/` directory hierarchy and generates a `ktf.iso` out of the `grub/` (using `grub/boot/grub/grub.cfg` as a default GRUB config). #### Fedora @@ -127,7 +127,7 @@ memory=1024 serial= [ 'file:/tmp/kernel.log', 'pty' ] -disk = [ '/home/user/boot.iso,,hdc,cdrom' ] +disk = [ '/home/user/ktf.iso,,hdc,cdrom' ] on_reboot = "destroy" @@ -223,4 +223,3 @@ and we're actively sharing ideas, bugs and anything related to KTF there. Feel f ![GitHub](https://img.shields.io/github/license/awslabs/ktf) This project is licensed under the BSD 2-Clause License. - diff --git a/tools/ci/build-docker.sh b/tools/ci/build-docker.sh index c73ebb83..2826af97 100755 --- a/tools/ci/build-docker.sh +++ b/tools/ci/build-docker.sh @@ -2,7 +2,7 @@ # # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # -# This script builds the project's boot.iso file in the docker environment +# This script builds the project's ktf.iso file in the docker environment set -e COMPILER=$1 @@ -16,4 +16,4 @@ cd "$SCRIPTDIR"/../.. # Build project in docker make clean V=1 -make docker:boot.iso V=1 CC=$COMPILER +make docker:ktf.iso V=1 CC=$COMPILER diff --git a/tools/ci/launch-test.sh b/tools/ci/launch-test.sh index 55993cf3..7d84caab 100755 --- a/tools/ci/launch-test.sh +++ b/tools/ci/launch-test.sh @@ -2,7 +2,7 @@ # # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # -# This script builds the project's boot.iso file in the docker environment and +# This script builds the project's ktf.iso file in the docker environment and # next launches a test and checks for a successful timeout. set -e @@ -18,7 +18,7 @@ cd "$SCRIPTDIR"/../.. # Build project in docker echo "Building project from scratch" make clean V=1 -make UNITTEST=1 docker:boot.iso V=1 CC=$COMPILER +make UNITTEST=1 docker:ktf.iso V=1 CC=$COMPILER # Use QEMU to launch the guest echo "Launching KTF" diff --git a/tools/xen_config/config b/tools/xen_config/config index ca692781..0bda93d5 100644 --- a/tools/xen_config/config +++ b/tools/xen_config/config @@ -4,7 +4,7 @@ memory=1024 serial= [ 'file:/tmp/kernel.log', 'pty' ] -disk = [ '/home/user/boot.iso,,hdc,cdrom' ] +disk = [ '/home/user/ktf.iso,,hdc,cdrom' ] on_reboot = "destroy"