Kernel: Make new kernel build process work on macOS

Use objcopy from the toolchain so that the changes introduced in
7236584 will succeed on macOS.

Fixes #8768.
This commit is contained in:
Gunnar Beutner 2021-07-15 18:17:58 +10:00 committed by Gunnar Beutner
parent 3b5b7c5e65
commit e4f05a9046
Notes: sideshowbarker 2024-07-18 08:59:11 +09:00
3 changed files with 5 additions and 3 deletions

View file

@ -167,6 +167,7 @@ else()
set(CMAKE_RANLIB ${TOOLCHAIN_PREFIX}gcc-ranlib)
set(CMAKE_STRIP ${TOOLCHAIN_PREFIX}strip)
set(CMAKE_AR ${TOOLCHAIN_PREFIX}gcc-ar)
set(CMAKE_OBJCOPY ${TOOLCHAIN_PREFIX}objcopy)
endif()
foreach(lang ASM C CXX OBJC OBJCXX)

View file

@ -413,9 +413,9 @@ add_dependencies(${KERNEL_TARGET} kernel_heap)
add_custom_command(
TARGET ${KERNEL_TARGET} POST_BUILD
COMMAND ${TOOLCHAIN_PREFIX}objcopy -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${KERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Kernel
COMMAND ${CMAKE_OBJCOPY} -O elf32-i386 ${CMAKE_CURRENT_BINARY_DIR}/${KERNEL_TARGET} ${CMAKE_CURRENT_BINARY_DIR}/Kernel
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/mkmap.sh
COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
COMMAND ${CMAKE_COMMAND} -E env OBJCOPY=${CMAKE_OBJCOPY} sh ${CMAKE_CURRENT_SOURCE_DIR}/embedmap.sh
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/Kernel ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
)

View file

@ -1,5 +1,6 @@
#!/bin/sh
tmp=$(mktemp)
(cat kernel.map; printf '%b' '\0') > "$tmp"
objcopy --update-section .ksyms="$tmp" Kernel
OBJCOPY="${OBJCOPY:-objcopy}"
"$OBJCOPY" --update-section .ksyms="$tmp" Kernel
rm -f "$tmp"