Kernel: Split debug symbols into a separate file
This speeds up the boot process considerably when specifying the kernel image via -initrd.
This commit is contained in:
parent
b708b23b13
commit
98f8ecd9d2
Notes:
sideshowbarker
2024-07-18 08:48:37 +09:00
Author: https://github.com/gunnarbeutner Commit: https://github.com/SerenityOS/serenity/commit/98f8ecd9d2c Pull-request: https://github.com/SerenityOS/serenity/pull/8795 Reviewed-by: https://github.com/Hendiadyoin1
6 changed files with 10 additions and 5 deletions
|
@ -418,10 +418,14 @@ add_custom_command(
|
|||
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 ${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
|
||||
COMMAND ${CMAKE_OBJCOPY} --only-keep-debug Kernel Kernel.debug
|
||||
COMMAND ${CMAKE_OBJCOPY} --strip-debug Kernel
|
||||
COMMAND ${CMAKE_OBJCOPY} --add-gnu-debuglink=Kernel.debug Kernel
|
||||
BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/kernel.map
|
||||
)
|
||||
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel" DESTINATION boot)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Kernel.debug" DESTINATION boot)
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/kernel.map" DESTINATION res)
|
||||
|
||||
serenity_install_headers(Kernel)
|
||||
|
|
|
@ -97,6 +97,7 @@ fi
|
|||
|
||||
chmod 0400 mnt/res/kernel.map
|
||||
chmod 0400 mnt/boot/Kernel
|
||||
chmod 0400 mnt/boot/Kernel.debug
|
||||
chmod 600 mnt/etc/shadow
|
||||
chmod 755 mnt/res/devel/templates/*.postcreate
|
||||
echo "done"
|
||||
|
|
|
@ -31,7 +31,7 @@ DisassemblyModel::DisassemblyModel(const Debug::DebugSession& debug_session, con
|
|||
const ELF::Image* elf = nullptr;
|
||||
|
||||
if (containing_function.value().address_low >= 0xc0000000) {
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel");
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel.debug");
|
||||
if (file_or_error.is_error())
|
||||
return;
|
||||
kernel_elf = make<ELF::Image>(file_or_error.value()->bytes());
|
||||
|
|
|
@ -42,7 +42,7 @@ DisassemblyModel::DisassemblyModel(Profile& profile, ProfileNode& node)
|
|||
FlatPtr base_address = 0;
|
||||
if (m_node.address() >= 0xc0000000) {
|
||||
if (!m_kernel_file) {
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel");
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel.debug");
|
||||
if (file_or_error.is_error())
|
||||
return;
|
||||
m_kernel_file = file_or_error.release_value();
|
||||
|
|
|
@ -201,7 +201,7 @@ Result<NonnullOwnPtr<Profile>, String> Profile::load_from_perfcore_file(const St
|
|||
|
||||
auto& object = json.value().as_object();
|
||||
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel");
|
||||
auto file_or_error = MappedFile::map("/boot/Kernel.debug");
|
||||
OwnPtr<ELF::Image> kernel_elf;
|
||||
if (!file_or_error.is_error())
|
||||
kernel_elf = make<ELF::Image>(file_or_error.value()->bytes());
|
||||
|
|
|
@ -84,7 +84,7 @@ Vector<Symbol> symbolicate_thread(pid_t pid, pid_t tid)
|
|||
regions.append(RegionWithSymbols {
|
||||
.base = 0xc0000000,
|
||||
.size = 0x3fffffff,
|
||||
.path = "/boot/Kernel",
|
||||
.path = "/boot/Kernel.debug",
|
||||
.is_relative = false });
|
||||
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue