mirror of
https://codeberg.org/andersonarc/reliant-system.git
synced 2025-11-21 08:20:57 -05:00
profiling requires patching systemd during initramfs build; remove runtime profiling option
This commit is contained in:
parent
501d68bf7e
commit
4ac936df5b
6 changed files with 65 additions and 24 deletions
24
tools/reliant-profiling-patch-systemd
Normal file
24
tools/reliant-profiling-patch-systemd
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#!/usr/bin/sh
|
||||
|
||||
# Create a new file to be patched
|
||||
binary=/usr/lib/systemd/systemd-volatile-root
|
||||
target=/usr/lib/systemd/systemd-volatile-root.reliant-profiling
|
||||
cp $binary $target
|
||||
|
||||
# We must NOP calls to umount and rmdir
|
||||
hex_offsets=$(objdump -d "$binary" | grep -E 'call.*(umount|rmdir)' | awk '{ print $1 }' | tr -d ':')
|
||||
for hex_offset in $hex_offsets; do
|
||||
dec_offset=$(perl -le "print hex(\"$hex_offset\")")
|
||||
printf '\x90\x90\x90\x90\x90' | dd of="$target" bs=1 seek=$dec_offset conv=notrunc
|
||||
done
|
||||
|
||||
# Verify the patch has succeeded
|
||||
for hex_offset in $hex_offsets; do
|
||||
echo -n "$hex_offset: "
|
||||
opcode=$(objdump -d "$target" | grep $hex_offset | awk '{ print $3 }')
|
||||
if [ $opcode -eq 90 ]; then
|
||||
echo "OK"
|
||||
else
|
||||
echo "FAIL"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Add a link
Reference in a new issue