trace-boot 895 B

123456789101112131415161718192021222324
  1. #!/usr/bin/env bash
  2. set -eu
  3. . common
  4. set -- ${cli_trace_boot:-} "$@"
  5. while getopts a: OPT; do
  6. case "$OPT" in
  7. a)
  8. arch="$OPTARG"
  9. ;;
  10. esac
  11. done
  12. set_common_vars "$arch" false
  13. time ./run -a "$arch" -e 'init=/poweroff.out' -T exec_tb
  14. time ./qemu-trace2txt -a "$arch"
  15. # Instruction count.
  16. # We could put this on a separate script, but it just adds more arch boilerplate to a new script.
  17. # So let's just leave it here for now since it did not add a significant processing time.
  18. echo "instructions $(wc -l "${qemu_trace_txt_file}" | cut -d' ' -f1)"
  19. entry_addr=$("${root_dir}/runtc" readelf -h "${build_dir}/linux-custom/vmlinux" | grep 'Entry point address' | sed -E 's/.*: *//')
  20. echo "entry_address ${entry_addr}"
  21. sed "/${entry_addr}/q" "${qemu_trace_txt_file}" >"${qemu_out_dir}/trace-boot.txt"
  22. echo "instructions_firmware $(wc -l "${qemu_out_dir}/trace-boot.txt" | cut -d' ' -f1)"