buildCrossystem.sh 2.0 KB

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