kernel: x86: MMU: Build system support for x86 MMU

Makefile rule to create the MMU page tables at boot time. This
rule invokes the gen_mmu.py script to create a binary which is
then placed into the kernel image using objcopy.
Makefile.mmu is included only when CONFIG_X86_MMU is enabled.

JIRA: ZEP-2095

Signed-off-by: Adithya Baglody <adithya.nagaraj.baglody@intel.com>
This commit is contained in:
Adithya Baglody 2017-05-22 11:24:34 +05:30 committed by Anas Nashif
commit 83644a493e
2 changed files with 28 additions and 0 deletions

View file

@ -893,6 +893,9 @@ WARN_ABOUT_DEPRECATION := $(if $(CONFIG_BOARD_DEPRECATED),echo -e \
ifeq ($(ARCH),x86)
include $(srctree)/arch/x86/Makefile.idt
ifeq ($(CONFIG_X86_MMU),y)
include $(srctree)/arch/x86/Makefile.mmu
endif
endif
ifeq ($(CONFIG_GEN_ISR_TABLES),y)

25
arch/x86/Makefile.mmu Normal file
View file

@ -0,0 +1,25 @@
ifeq ($(KBUILD_VERBOSE),1)
GENMMU_EXTRA_ARGS := -v
else
GENMMU_EXTRA_ARGS :=
endif
GENMMU := $(ZEPHYR_BASE)/scripts/gen_mmu.py
OUTPUT_FORMAT ?= elf32-i386
OUTPUT_ARCH ?= i386
quiet_cmd_gen_mmu = GMMU $@
cmd_gen_mmu = \
( \
$(OBJCOPY) -I $(OUTPUT_FORMAT) -O binary -j mmulist $< mmulist.bin && \
python $(GENMMU) -i mmulist.bin -o mmu_tables.bin $(GENMMU_EXTRA_ARGS)\
)
mmu_tables.o: $(PREBUILT_KERNEL) $(GENMMU)
$(call cmd,gen_mmu)
$(Q)$(OBJCOPY) -I binary -B $(OUTPUT_ARCH) -O $(OUTPUT_FORMAT) \
--rename-section .data=.mmu_data mmu_tables.bin $@
GENERATED_KERNEL_OBJECT_FILES += mmu_tables.o