buildCrossystem.sh 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. #!/bin/bash
  2. set -x
  3. set -e
  4. #Build mosys, which is required for crossystem
  5. # This file is part of PrawnOS (https://www.prawnos.com)
  6. # Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
  7. # PrawnOS is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License version 2
  9. # as published by the Free Software Foundation.
  10. # PrawnOS is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. # You should have received a copy of the GNU General Public License
  15. # along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
  16. # install crossystem
  17. sudo apt install -y vboot-utils
  18. #install clang and pre-reqs
  19. sudo apt install -y clang uuid-dev meson pkg-config cmake libcmocka-dev cargo
  20. #clone flashmap, need to build libfmap
  21. git clone https://github.com/dhendrix/flashmap.git
  22. cd flashmap
  23. make all
  24. sudo make install
  25. #clone mosys. Later releases start depending on the minijail library which we would have to build, and that we don't care about anyway on linux
  26. git clone https://chromium.googlesource.com/chromiumos/platform/mosys
  27. cd mosys
  28. git checkout release-R69-10895.B
  29. # compile
  30. CC=clang meson -Darch=arm build
  31. ninja -C build
  32. # install mosys so crossystem can access it. It EXPECTS it to be right here and fails otherwise...
  33. sudo cp build/mosys /usr/sbin/mosys
  34. # Example crossystem commands, all require root priviledges
  35. #Kernels signature verification:
  36. # crossystem dev_boot_signed_only=1 # enable
  37. # crossystem dev_boot_signed_only=0 # disable
  38. #External media boot:
  39. # crossystem dev_boot_usb=1 # enable
  40. # crossystem dev_boot_usb=0 # disable
  41. #Legacy payload boot:
  42. # crossystem dev_boot_legacy=1 # enable
  43. # crossystem dev_boot_legacy=0 # disable
  44. #Default boot medium:
  45. # crossystem dev_default_boot=disk # internal storage
  46. # crossystem dev_default_boot=usb # external media
  47. # crossystem dev_default_boot=legacy # legacy payload