arm64: Don't rely on host readelf for u-boot booti image generation

readelf is not a bootstrap tool and so cannot be relied upon to exist.
On macOS there is no system readelf, and even on Linux or FreeBSD where
it does exist, BUILD_WITH_STRICT_TMPPATH builds won't be able to use it.
Instead of making it a bootstrap tool, just use nm as that suffices and
already is a bootstrap tool.

Fixes:		28482babd0 ("arm64: Use new arm_kernel_boothdr script for generating booti images.")
Reviewed by:	emaste, mmel
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D32734
This commit is contained in:
Jessica Clarke 2021-12-24 19:25:20 +00:00
parent be01656fa4
commit 1846bbd1b3
2 changed files with 7 additions and 7 deletions

View File

@ -94,7 +94,7 @@ CLEAN+= ${KERNEL_KO}.bin
${KERNEL_KO}.bin: ${FULLKERNEL}
@${OBJCOPY} --wildcard --strip-symbol='$$[adtx]*' \
--output-target=binary ${.ALLSRC} ${.TARGET}.temp
@{ readelf -s ${.ALLSRC} | \
@{ ${NM} ${.ALLSRC} | \
${AWK} -f $S/tools/arm_kernel_boothdr.awk -v hdrtype=v8booti && \
cat ${.TARGET}.temp; \
} > ${.TARGET}

View File

@ -144,22 +144,22 @@ function write_v8booti() {
/kernbase/ {
# If the symbol name is exactly "kernbase" save its address.
if ($8 == "kernbase") {
gKernbase = hexstr_to_num($2)
if ($3 == "kernbase") {
gKernbase = hexstr_to_num($1)
}
}
/_start/ {
# If the symbol name is exactly "_start" save its address.
if ($8 == "_start") {
gStart = hexstr_to_num($2)
if ($3 == "_start") {
gStart = hexstr_to_num($1)
}
}
/_end/ {
# If the symbol name is exactly "_end" remember its value.
if ($8 == "_end") {
gEnd = hexstr_to_num($2)
if ($3 == "_end") {
gEnd = hexstr_to_num($1)
}
}