ladybird/Kernel/mkmap.sh
Gunnar Beutner c9747a3236 Kernel: Build the x86_64 kernel as an ELF32 executable
Multiboot only supports ELF32 executables. This changes the build
process to build an ELF32 executable which has a 32-bit entry point,
but consists of mostly 64-bit code.
2021-06-25 15:19:09 +02:00

12 lines
283 B
Bash

#!/bin/sh
tmp=$(mktemp)
if [ -f Kernel32 ]; then
kernel_binary=Kernel32
else
kernel_binary=Kernel64
fi
nm -n $kernel_binary | awk '{ if ($2 != "a") print; }' | uniq > "$tmp"
printf "%08x\n" "$(wc -l "$tmp" | cut -f1 -d' ')" > kernel.map
cat "$tmp" >> kernel.map
rm -f "$tmp"