sign.sh 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #!/bin/sh
  2. # This script creates u-boot FIT image containing the kernel and the DT,
  3. # then signs it using futility from vboot-utils.
  4. # The resulting file is called uImage.kpart.
  5. BOARD_DIR=$(dirname $0)/${BOARD_NAME}
  6. mkimage=$HOST_DIR/bin/mkimage
  7. futility=$HOST_DIR/bin/futility
  8. devkeys=$HOST_DIR/share/vboot/devkeys
  9. run() { echo "$@"; "$@"; }
  10. die() { echo "$@" >&2; exit 1; }
  11. test -f $BINARIES_DIR/Image || \
  12. die "No kernel image found"
  13. test -x $mkimage || \
  14. die "No mkimage found (host-uboot-tools has not been built?)"
  15. test -x $futility || \
  16. die "No futility found (host-vboot-utils has not been built?)"
  17. # kernel.its references Image and mt8173-elm.dtb, and all three
  18. # files must be in current directory for mkimage.
  19. run cp $BOARD_DIR/kernel.its $BINARIES_DIR/kernel.its || exit 1
  20. echo "# entering $BINARIES_DIR for the next command"
  21. (cd $BINARIES_DIR && run $mkimage -f kernel.its uImage.itb) || exit 1
  22. # futility requires non-empty file to be supplied with --bootloader
  23. # even if it does not make sense for the target platform.
  24. echo > $BINARIES_DIR/dummy.txt
  25. run $futility vbutil_kernel \
  26. --keyblock $devkeys/kernel.keyblock \
  27. --signprivate $devkeys/kernel_data_key.vbprivk \
  28. --arch aarch64 \
  29. --version 1 \
  30. --config $BOARD_DIR/kernel.args \
  31. --vmlinuz $BINARIES_DIR/uImage.itb \
  32. --bootloader $BINARIES_DIR/dummy.txt \
  33. --pack $BINARIES_DIR/uImage.kpart || exit 1
  34. rm -f $BINARIES_DIR/kernel.its $BINARIES_DIR/dummy.txt