加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
Linker.uk 2.57 KB
一键复制 编辑 原始数据 按行查看 历史
陈诚 提交于 2024-04-10 16:19 . first commit
ifeq (arm64,$(CONFIG_UK_ARCH))
LINUX_HDR_ARM64 := y
RK3568_LDFLAGS-y += -Wl,--entry=_start
RK3568_LDFLAGS-y += -Wl,-m,aarch64elf
RK3568_LINK_LIBGCC_FLAG := -lgcc
endif
##
## Link image
##
RK3568_IMAGE := $(BUILD_DIR)/$(CONFIG_UK_NAME)_rk3568-$(CONFIG_UK_ARCH)
BOOT_IMG := $(BUILD_DIR)/boot.img
RK3568_DEBUG_IMAGE := $(RK3568_IMAGE).dbg
RK3568_LD_SCRIPT_FLAGS := $(addprefix -Wl$(comma)-dT$(comma),\
$(UK_PLAT_RK3568_DEF_LDS))
RK3568_LD_SCRIPT_FLAGS += $(addprefix -Wl$(comma)-T$(comma),\
$(RK3568_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y))
$(RK3568_DEBUG_IMAGE): $(RK3568_ALIBS) $(RK3568_ALIBS-y) $(RK3568_OLIBS) $(RK3568_OLIBS-y) \
$(UK_ALIBS) $(UK_ALIBS-y) $(UK_OLIBS) $(UK_OLIBS-y) \
$(RK3568_LD_SCRIPT-y) $(EXTRA_LD_SCRIPT-y) \
$(UK_PLAT_RK3568_DEF_LDS) $(UK_LDEPS)
$(call build_cmd,LD,,$@,\
$(LD) \
$(RK3568_LDFLAGS) $(RK3568_LDFLAGS-y) \
$(RK3568_OLIBS) $(RK3568_OLIBS-y) \
$(UK_OLIBS) $(UK_OLIBS-y) \
-Wl$(comma)--start-group \
$(RK3568_ALIBS) $(RK3568_ALIBS-y) \
$(UK_ALIBS) $(UK_ALIBS-y) \
$(RK3568_LINK_LIBGCC_FLAG) \
-Wl$(comma)--end-group \
$(LDFLAGS) $(LDFLAGS-y) \
$(RK3568_LD_SCRIPT_FLAGS) \
-o $@)
ifeq ($(CONFIG_OPTIMIZE_PIE),y)
$(call build_uk_reloc,$@)
endif
$(call build_bootinfo,$@)
$(RK3568_IMAGE): $(RK3568_IMAGE).dbg
$(call build_cmd,SCSTRIP,,$@,\
$(STRIP) -s \
$(SECT_STRIP_FLAGS) $(SECT_STRIP_FLAGS-y) \
$(RK3568_STRIPFLAGS) \
$< -o $@ 2>&1 | \
{ $(GREP) -Ev \
"Empty loadable segment detected|section.*lma.*adjusted to.*" || \
true; })
#创建原本的kernel.img
$(call build_cmd,OBJCOPY,,$(RK3568_IMAGE).img,\
$(OBJCOPY) -O binary $(RK3568_DEBUG_IMAGE) $(BUILD_DIR)/kernel.img)
#构建boot.img镜像(FIT格式文件),包含kernel.img、rk3568.dtb、resource.img
$(BOOT_IMG): $(RK3568_IMAGE)
$(LIBRK3568PLAT_BASE)/bootfiles/mk-fitimage.sh $(BUILD_DIR)/boot.img \
$(LIBRK3568PLAT_BASE)/bootfiles/boot.its \
$(BUILD_DIR)/kernel.img \
$(BUILD_DIR)/.tmp_its \
$(LIBRK3568PLAT_BASE)
$(RK3568_IMAGE).sym: $(RK3568_DEBUG_IMAGE)
$(call build_cmd,NM,,$@, $(NM) -n $< > $@)
$(RK3568_IMAGE).gz: $(RK3568_IMAGE)
$(call build_cmd,GZ,,$@, $(GZIP) -f -9 -c $< >$@)
# register images to the build
ifeq ($(CONFIG_PLAT_RK3568),y)
UK_DEBUG_IMAGES-y += $(RK3568_DEBUG_IMAGE)
UK_IMAGES-y += $(RK3568_IMAGE)
UK_IMAGES-y += $(BOOT_IMG)
UK_IMAGES-$(CONFIG_OPTIMIZE_SYMFILE) += $(RK3568_IMAGE).sym
UK_IMAGES-$(CONFIG_OPTIMIZE_COMPRESS) += $(RK3568_IMAGE).gz
endif
# ...for cleaning:
LIBRK3568PLAT_CLEAN += $(call build_clean,$(RK3568_DEBUG_IMAGE).bootinfo)
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化