Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 62114105 authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge "ARM: RTIC 3.0: Enabling MPGen"

parents 82c13980 12e1b34f
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -28,6 +28,17 @@ else
DTB_OBJS := $(shell find $(obj)/dts/ -name \*.dtb)
endif

# Add RTIC DTB to the DTB list if RTIC MPGen is enabled
ifdef RTIC_MPGEN
DTB_OBJS += rtic_mp.dtb
endif

rtic_mp.dtb: vmlinux FORCE
	$(RTIC_MPGEN) --objcopy="${OBJCOPY}" --objdump="${OBJDUMP}" \
	--binpath="" --vmlinux="vmlinux" --config=${KCONFIG_CONFIG} \
	--cc="${CC}" --dts=rtic_mp.dts && \
	$(DTC) -O dtb -o rtic_mp.dtb -b 0 $(DTC_FLAGS) rtic_mp.dts

$(obj)/Image: vmlinux FORCE
	$(call if_changed,objcopy)

scripts/link-vmlinux.sh

100755 → 100644
+42 −0
Original line number Diff line number Diff line
@@ -145,6 +145,25 @@ kallsyms()
	${CC} ${aflags} -c -o ${2} ${afile}
}

# Generates ${2} .o file with RTIC MP's from the ${1} object file (vmlinux)
# ${3} the file name where the sizes of the RTIC MP structure are stored
# just in case, save copy of the RTIC mp to ${4}
# Note: RTIC_MPGEN has to be set if MPGen is available
rtic_mp()
{
	# assume that RTIC_MP_O generation may fail
	RTIC_MP_O=

	${RTIC_MPGEN} --objcopy="${OBJCOPY}" --objdump="${OBJDUMP}" \
	--binpath='' --vmlinux=${1} --config=${KCONFIG_CONFIG} && \
	cat rtic_mp.c | ${CC} -c -o ${2} -x c - && \
	cp rtic_mp.c ${4} && \
	${NM} --print-size --size-sort ${2} > ${3} && \
	RTIC_MP_O=${2}
	# NM - save generated variable sizes for verification
	# RTIC_MP_O is our retval - great success if set to generated .o file
}

# Create map file with all symbols from ${1}
# See mksymap for additional details
mksysmap()
@@ -169,6 +188,8 @@ cleanup()
	rm -f System.map
	rm -f vmlinux
	rm -f vmlinux.o
	rm -f .tmp_rtic_mp_sz*
	rm -f rtic_mp.*
}

on_exit()
@@ -231,6 +252,15 @@ fi;
# final build of init/
${MAKE} -f "${srctree}/scripts/Makefile.build" obj=init GCC_PLUGINS_CFLAGS="${GCC_PLUGINS_CFLAGS}"

# Generate RTIC MP placeholder compile unit of the correct size
# and add it to the list of link objects
# this needs to be done before generating kallsyms
if [ ! -z ${RTIC_MPGEN+x} ]; then
	rtic_mp vmlinux.o rtic_mp.o .tmp_rtic_mp_sz1 .tmp_rtic_mp1.c
	KBUILD_VMLINUX_MAIN+=" "
	KBUILD_VMLINUX_MAIN+=$RTIC_MP_O
fi

kallsymso=""
kallsyms_vmlinux=""
if [ -n "${CONFIG_KALLSYMS}" ]; then
@@ -276,6 +306,18 @@ if [ -n "${CONFIG_KALLSYMS}" ]; then
	fi
fi

# Update RTIC MP object by replacing the place holder
# with actual MP data of the same size
# Also double check that object size did not change
if [ ! -z ${RTIC_MPGEN+x} ]; then
	rtic_mp "${kallsyms_vmlinux}" rtic_mp.o .tmp_rtic_mp_sz2 \
                .tmp_rtic_mp2.c
	if ! cmp -s .tmp_rtic_mp_sz1 .tmp_rtic_mp_sz2; then
		echo >&2 'ERROR: RTIC MP object files size mismatch'
		exit 1
	fi
fi

info LD vmlinux
vmlinux_link "${kallsymso}" vmlinux