加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Linker.uk 2.85 KB
一键复制 编辑 原始数据 按行查看 历史
王国琨 提交于 2024-11-13 14:10 . plat/d9: refactor the static page table
ifeq (arm64,$(CONFIG_UK_ARCH))
D9_LDFLAGS-y += -Wl,--entry=_start
D9_LDFLAGS-y += -Wl,-m,aarch64elf
D9_LINK_LIBGCC_FLAG := -lgcc
endif
##
## Link image
##
ifneq ($(UK_IMAGE_NAME_OVERWRITE),)
D9_IMAGE := $(BUILD_DIR)/$(UK_IMAGE_NAME_OVERWRITE)
else
D9_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_d9-$(CONFIG_UK_ARCH)
endif
D9_DEBUG_IMAGE := $(D9_IMAGE).dbg
D9_STATIC_PT := $(BUILD_DIR)/tn_static_pgtable
ifeq ($(CONFIG_STATIC_PGTABLE),y)
D9_STATIC_PT_OBLIB := $(D9_STATIC_PT).o
else
D9_STATIC_PT_OBLIB :=
endif
D9_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-dT$(comma),\
$(UK_PLAT_D9_DEF_LDS))
D9_LD_SCRIPT_FLAGS += $(addprefix -Wl$(comma)-T$(comma),\
$(D9_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
ifeq ($(CONFIG_STATIC_PGTABLE),y)
$(D9_STATIC_PT_OBLIB): $(D9_OLIBS-y) $(STATIC_PAGE_TOOLS)
$(call build_static_pgtable,$(word 1, $<),$(D9_STATIC_PT))
endif
$(D9_DEBUG_IMAGE): $(D9_ALIBS) $(D9_ALIBS-y) $(D9_OLIBS) $(D9_OLIBS-y) \
$(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \
$(D9_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y) \
$(UK_PLAT_D9_DEF_LDS) $(UK_LDEPS) \
$(D9_STATIC_PT_OBLIB)
$(call build_cmd,LD,,$@,\
$(LD) \
$(D9_LDFLAGS) $(D9_LDFLAGS-y) \
$(D9_OLIBS) $(D9_OLIBS-y) \
$(UK_OLIBS) $(UK_OLIBS-y) \
$(D9_STATIC_PT_OBLIB) \
-Wl$(comma)--start-group \
$(D9_ALIBS) $(D9_ALIBS-y) \
$(UK_ALIBS) $(UK_ALIBS-y) \
$(D9_LINK_LIBGCC_FLAG) \
-Wl$(comma)--end-group \
$(LDFLAGS) $(LDFLAGS-y) \
$(D9_LD_SCRIPT_FLAGS) \
-o $@)
ifeq ($(CONFIG_OPTIMIZE_PIE),y)
$(call build_uk_reloc,$@)
endif
ifeq ($(CONFIG_STATIC_PGTABLE),y)
$(call update_static_pgtable,$@,$(D9_STATIC_PT))
endif
$(D9_IMAGE): $(D9_IMAGE).dbg
$(call build_cmd,SCSTRIP,,$@,\
$(STRIP) -s \
$(SECT_STRIP_FLAGS) $(SECT_STRIP_FLAGS-y) \
$(D9_STRIPFLAGS) \
$< -o $@ 2>&1 | \
{ $(GREP) -Ev \
"Empty loadable segment detected|section.*lma.*adjusted to.*" || \
true; })
$(call build_bootinfo,$@)
$(call build_cmd,OBJCOPY,,$(D9_IMAGE).img,\
$(OBJCOPY) -O binary $(D9_IMAGE) $(BUILD_DIR)/kernel.img)
ifeq ($(CONFIG_BOOT_PROTO_LXBOOT),y)
$(D9_IMAGE).lxboot: $(D9_IMAGE)
$(call build_cmd,MKLINUX,,$(D9_IMAGE).img, $(SCRIPTS_DIR)/mklinux.py \
$(BUILD_DIR)/kernel.img $(D9_IMAGE).dbg)
endif
$(D9_IMAGE).sym: $(D9_DEBUG_IMAGE)
$(call build_cmd,NM,,$@, $(NM) -n $< > $@)
$(D9_IMAGE).gz: $(D9_IMAGE)
$(call build_cmd,GZ,,$@, $(GZIP) -f -9 -c $< >$@)
# register images to the build
ifeq ($(CONFIG_PLAT_D9),y)
UK_DEBUG_IMAGES-y += $(D9_DEBUG_IMAGE)
UK_IMAGES-y += $(D9_IMAGE)
ifeq ($(CONFIG_BOOT_PROTO_LXBOOT),y)
UK_IMAGES-y += $(D9_IMAGE).lxboot
endif
UK_IMAGES-$(CONFIG_OPTIMIZE_SYMFILE) += $(D9_IMAGE).sym
UK_IMAGES-$(CONFIG_OPTIMIZE_COMPRESS) += $(D9_IMAGE).gz
endif
# ...for cleaning:
LIBD9PLAT_CLEAN += $(call build_clean,$(D9_DEBUG_IMAGE).bootinfo)
LIBD9PLAT_CLEAN += $(call build_clean,$(BUILD_DIR)/kernel.img)
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化