diff --git a/hypervisor/Makefile b/hypervisor/Makefile index 3e8dec1a7..1ba75b9b5 100644 --- a/hypervisor/Makefile +++ b/hypervisor/Makefile @@ -34,6 +34,9 @@ include $(BASEDIR)/../scripts/deps.mk include scripts/kconfig/kconfig.mk +LD_IN_TOOL = scripts/genld.sh +BASH = $(shell which bash) + CFLAGS += -Wall -W CFLAGS += -ffunction-sections -fdata-sections CFLAGS += -fshort-wchar -ffreestanding @@ -248,7 +251,7 @@ $(HV_OBJDIR)/$(HV_FILE).bin: $(HV_OBJDIR)/$(HV_FILE).out $(OBJCOPY) -O binary $< $(HV_OBJDIR)/$(HV_FILE).bin $(HV_OBJDIR)/$(HV_FILE).out: $(C_OBJS) $(S_OBJS) - $(CC) -E -x c $(patsubst %, -I%, $(INCLUDE_PATH)) $(ARCH_LDSCRIPT_IN) | grep -v '^#' > $(ARCH_LDSCRIPT) + ${BASH} ${LD_IN_TOOL} $(ARCH_LDSCRIPT_IN) $(ARCH_LDSCRIPT) ${HV_OBJDIR}/.config $(CC) -Wl,-Map=$(HV_OBJDIR)/$(HV_FILE).map -o $@ $(LDFLAGS) $(ARCH_LDFLAGS) -T$(ARCH_LDSCRIPT) $^ .PHONY: clean diff --git a/hypervisor/bsp/ld/link_ram.ld.in b/hypervisor/bsp/ld/link_ram.ld.in index ef6cfd77d..5d71602e4 100644 --- a/hypervisor/bsp/ld/link_ram.ld.in +++ b/hypervisor/bsp/ld/link_ram.ld.in @@ -1,5 +1,3 @@ -#include "config.h" - ENTRY(cpu_primary_start_32) MEMORY diff --git a/hypervisor/scripts/genld.sh b/hypervisor/scripts/genld.sh new file mode 100755 index 000000000..205b9a89c --- /dev/null +++ b/hypervisor/scripts/genld.sh @@ -0,0 +1,13 @@ +#!/bin/bash + +in=$1 +out=$2 +config=$3 + +cp $in $out +grep -v "^#" ${config} | while read line; do + IFS='=' read -ra arr <<<"$line" + field=${arr[0]} + value=${arr[1]} + sed -i "s/\b$field\b/$value/g" $out +done