Date: Wed, 24 Apr 2024 23:58:41 GMT From: Warner Losh <imp@FreeBSD.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Subject: git: 9857f824ec77 - stable/14 - arm_kernel_bothdr.awk: Update to latest ota Message-ID: <202404242358.43ONwfnT040397@gitrepo.freebsd.org>
next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=9857f824ec77cdc27c82e0871356eb2e9662fc86 commit 9857f824ec77cdc27c82e0871356eb2e9662fc86 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-04-15 21:07:46 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-24 23:57:55 +0000 arm_kernel_bothdr.awk: Update to latest ota The latest ota is the first one in FreeBSD that treats 0 + "0xf" as being '0' instead of '15'. Don't use this old trick anymore to convert from hexidecimal to a number. Write a function to do that instead. This fixes kernel.bin building on arm*. awk on 14 doesn't need this, but to build FreeBSD stable/14's kernel.bin on 15 we'll need it, so fast MFC. MFC After: 3 days Sponsored by: Netflix Reviewed by: kevans Differential Revision: https://reviews.freebsd.org/D44801 (cherry picked from commit de22251127cd0e89ce1edb56c58b202496a97ba3) --- sys/tools/arm_kernel_boothdr.awk | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/tools/arm_kernel_boothdr.awk b/sys/tools/arm_kernel_boothdr.awk index dcc65ab40b66..e0f193f7922c 100644 --- a/sys/tools/arm_kernel_boothdr.awk +++ b/sys/tools/arm_kernel_boothdr.awk @@ -47,6 +47,10 @@ BEGIN { } gHdrType = hdrtype + for (i = 0; i < 16; i++) { + hex[sprintf("%x", i)] = i; + hex[sprintf("%X", i)] = i; + } } function addr_to_offset(addr) { @@ -56,11 +60,13 @@ function addr_to_offset(addr) { function hexstr_to_num(str) { - # Prepend a 0x onto the string, then coerce it to a number by doing - # arithmetic with it, which makes awk run it through strtod(), - # which handles hex numbers that have a 0x prefix. + sum = 0; + len = length(str); + for (i = 1; i <= len; i++) { + sum = sum * 16 + hex[substr(str, i, 1)]; + } - return 0 + ("0x" str) + return sum; } function write_le32(num) {
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202404242358.43ONwfnT040397>