mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-14 06:12:01 +01:00
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
This commit is contained in:
parent
f070188c3a
commit
de22251127
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user