Loading arch/arm64/boot/Makefile +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,17 @@ DTB_LIST := $(dtb-y) endif DTB_OBJS := $(shell find $(obj)/dts/ -name \*.dtb) # 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} ${KBUILD_AFLAGS}" --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) Loading scripts/link-vmlinux.sh +52 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,31 @@ 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= local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" ${RTIC_MPGEN} --objcopy="${OBJCOPY}" --objdump="${OBJDUMP}" \ --binpath='' --vmlinux=${1} --config=${KCONFIG_CONFIG} && \ cat rtic_mp.c | ${CC} ${aflags} -c -o ${2} -x c - && \ cp rtic_mp.c ${4} && \ ${NM} --print-size --size-sort ${2} > ${3} && \ RTIC_MP_O=${2} || echo “RTIC MP generation has failed” # NM - save generated variable sizes for verification # RTIC_MP_O is our retval - great success if set to generated .o file # Echo statement above prints the error message in case any of the # above RTIC MP generation commands fail and it ensures rtic mp failure # does not cause kernel compilation to fail. } # Create map file with all symbols from ${1} # See mksymap for additional details mksysmap() Loading @@ -164,6 +189,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() Loading Loading @@ -226,6 +253,15 @@ modpost_link vmlinux.o # modpost vmlinux.o to check for section mismatches ${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o # 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_LIBS+=" " KBUILD_VMLINUX_LIBS+=$RTIC_MP_O fi kallsymso="" kallsyms_vmlinux="" if [ -n "${CONFIG_KALLSYMS}" ]; then Loading Loading @@ -278,6 +314,22 @@ 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 # Note: Check initilally if RTIC_MP_O is not empty or uninitialized, # as incase RTIC_MPGEN is set and failure occurs in RTIC_MP_O # generation, below check for comparing object sizes fails # due to an empty RTIC_MP_O object. if [ ! -z ${RTIC_MP_O} ]; 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 Loading Loading
arch/arm64/boot/Makefile +11 −0 Original line number Diff line number Diff line Loading @@ -28,6 +28,17 @@ DTB_LIST := $(dtb-y) endif DTB_OBJS := $(shell find $(obj)/dts/ -name \*.dtb) # 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} ${KBUILD_AFLAGS}" --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) Loading
scripts/link-vmlinux.sh +52 −0 Original line number Diff line number Diff line Loading @@ -142,6 +142,31 @@ 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= local aflags="${KBUILD_AFLAGS} ${KBUILD_AFLAGS_KERNEL} \ ${NOSTDINC_FLAGS} ${LINUXINCLUDE} ${KBUILD_CPPFLAGS}" ${RTIC_MPGEN} --objcopy="${OBJCOPY}" --objdump="${OBJDUMP}" \ --binpath='' --vmlinux=${1} --config=${KCONFIG_CONFIG} && \ cat rtic_mp.c | ${CC} ${aflags} -c -o ${2} -x c - && \ cp rtic_mp.c ${4} && \ ${NM} --print-size --size-sort ${2} > ${3} && \ RTIC_MP_O=${2} || echo “RTIC MP generation has failed” # NM - save generated variable sizes for verification # RTIC_MP_O is our retval - great success if set to generated .o file # Echo statement above prints the error message in case any of the # above RTIC MP generation commands fail and it ensures rtic mp failure # does not cause kernel compilation to fail. } # Create map file with all symbols from ${1} # See mksymap for additional details mksysmap() Loading @@ -164,6 +189,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() Loading Loading @@ -226,6 +253,15 @@ modpost_link vmlinux.o # modpost vmlinux.o to check for section mismatches ${MAKE} -f "${srctree}/scripts/Makefile.modpost" vmlinux.o # 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_LIBS+=" " KBUILD_VMLINUX_LIBS+=$RTIC_MP_O fi kallsymso="" kallsyms_vmlinux="" if [ -n "${CONFIG_KALLSYMS}" ]; then Loading Loading @@ -278,6 +314,22 @@ 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 # Note: Check initilally if RTIC_MP_O is not empty or uninitialized, # as incase RTIC_MPGEN is set and failure occurs in RTIC_MP_O # generation, below check for comparing object sizes fails # due to an empty RTIC_MP_O object. if [ ! -z ${RTIC_MP_O} ]; 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 Loading