git: de22251127cd - main - arm_kernel_bothdr.awk: Update to latest ota
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Wed, 17 Apr 2024 03:33:39 UTC
The branch main has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=de22251127cd0e89ce1edb56c58b202496a97ba3 commit de22251127cd0e89ce1edb56c58b202496a97ba3 Author: Warner Losh <imp@FreeBSD.org> AuthorDate: 2024-04-15 21:07:46 +0000 Commit: Warner Losh <imp@FreeBSD.org> CommitDate: 2024-04-17 03:30:17 +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 --- 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) {