makefile 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. # This file is part of PrawnOS (http://www.prawnos.com)
  2. # Copyright (c) 2018 Hal Emmerich <hal@halemmerich.com>
  3. # PrawnOS is free software: you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License version 2
  5. # as published by the Free Software Foundation.
  6. # PrawnOS is distributed in the hope that it will be useful,
  7. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  8. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  9. # GNU General Public License for more details.
  10. # You should have received a copy of the GNU General Public License
  11. # along with PrawnOS. If not, see <https://www.gnu.org/licenses/>.
  12. KVER=4.17.19
  13. OUTNAME=PrawnOS-Alpha-c201-libre-2GB.img
  14. BASE=$(OUTNAME)-BASE
  15. #Usage:
  16. #run make image
  17. #this will generate two images named OUTNAME and OUTNAME-BASE
  18. #-BASE is only the filesystem with no kernel.
  19. #if you make any changes to the kernel or kernel config with make kernel_config
  20. #run kernel_inject
  21. .PHONY: clean
  22. clean:
  23. @echo "Enter one of:"
  24. @echo " clean_kernel - which deletes the untar'd kernel folder from build"
  25. @echo " clean_ath - which deletes the untar'd ath9k driver folder from build"
  26. @echo " clean_img - which deletes the built PrawnOS image, this is ran when make image is ran"
  27. @echo " clean_fs - which deletes the built PrawnOS base image"
  28. @echo " clean_all - which does all of the above"
  29. @echo " in most cases none of these need to be used manually as most cleanup steps are handled automatically"
  30. .PHONY: clean_kernel
  31. clean_kernel:
  32. rm -rf build/linux-4.*
  33. .PHONY: clean_ath
  34. clean_ath:
  35. rm -rf build/open-ath9k-htc-firmware
  36. .PHONY: clean_img
  37. clean_img:
  38. rm -f $(OUTNAME)
  39. .PHONY: clean_fs
  40. clean_fs:
  41. rm -r $(BASE)
  42. .PHONY: clean_all
  43. clean_all:
  44. make clean_kernel
  45. make clean_ath
  46. make clean_img
  47. make clean_fs
  48. .PHONY: kernel
  49. kernel:
  50. scripts/buildKernel.sh $(KVER)
  51. #makes the base filesystem image, no kernel only if the base image isnt present
  52. .PHONY: filesystem
  53. filesystem:
  54. [ -f $(BASE) ] || scripts/buildFilesystem.sh $(KVER)
  55. .PHONY: kernel_inject
  56. kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
  57. scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
  58. .PHONY: injected_image
  59. injected_image: #makes a copy of the base image with a new injected kernel
  60. make kernel
  61. cp PrawnOS-Alpha-c201-libre-2GB.img-BASE PrawnOS-Alpha-c201-libre-2GB.img
  62. make kernel_inject
  63. .PHONY: image
  64. image:
  65. make clean_img
  66. make kernel
  67. make filesystem
  68. #Make a new copy of the filesystem image
  69. cp $(BASE) $(OUTNAME)
  70. make kernel_inject
  71. .PHONY: live_image
  72. live_image:
  73. echo "TODO"
  74. .PHONY: kernel_config
  75. kernel_config:
  76. scripts/crossmenuconfig.sh $(KVER)
  77. .PHONY: patch_kernel
  78. patch_kernel:
  79. scripts/patchKernel.sh