makefile 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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=5.2.9
  13. ifeq ($(PRAWNOS_SUITE),)
  14. PRAWNOS_SUITE=buster
  15. endif
  16. OUTNAME=PrawnOS-$(PRAWNOS_SUITE)-Alpha-c201-libre-2GB.img
  17. BASE=$(OUTNAME)-BASE
  18. #Usage:
  19. #run make image
  20. #this will generate two images named OUTNAME and OUTNAME-BASE
  21. #-BASE is only the filesystem with no kernel.
  22. #if you make any changes to the kernel or kernel config with make kernel_config
  23. #run kernel_inject
  24. .PHONY: clean
  25. clean:
  26. @echo "Enter one of:"
  27. @echo " clean_kernel - which deletes the untar'd kernel folder from build"
  28. @echo " clean_ath - which deletes the untar'd ath9k driver folder from build"
  29. @echo " clean_img - which deletes the built PrawnOS image, this is ran when make image is ran"
  30. @echo " clean_fs - which deletes the built PrawnOS base image"
  31. @echo " clean_all - which does all of the above"
  32. @echo " in most cases none of these need to be used manually as most cleanup steps are handled automatically"
  33. .PHONY: clean_kernel
  34. clean_kernel:
  35. rm -rf build/linux-4.*
  36. .PHONY: clean_ath
  37. clean_ath:
  38. rm -rf build/open-ath9k-htc-firmware
  39. .PHONY: clean_img
  40. clean_img:
  41. rm -f $(OUTNAME)
  42. .PHONY: clean_fs
  43. clean_fs:
  44. rm -r $(BASE)
  45. .PHONY: clean_all
  46. clean_all:
  47. make clean_kernel
  48. make clean_ath
  49. make clean_img
  50. make clean_fs
  51. .PHONY: kernel
  52. kernel:
  53. scripts/buildKernel.sh $(KVER)
  54. .PHONY: initramfs
  55. initramfs:
  56. scripts/buildInitramFs.sh
  57. #makes the base filesystem image, no kernel only if the base image isnt present
  58. .PHONY: filesystem
  59. filesystem:
  60. [ -f $(BASE) ] || scripts/buildFilesystem.sh $(KVER)
  61. .PHONY: kernel_inject
  62. kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
  63. scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
  64. .PHONY: injected_image
  65. injected_image: #makes a copy of the base image with a new injected kernel
  66. make kernel
  67. cp $(BASE) $(OUTNAME)
  68. make kernel_inject
  69. .PHONY: image
  70. image:
  71. make clean_img
  72. make filesystem
  73. make initramfs
  74. make kernel
  75. #Make a new copy of the filesystem image
  76. cp $(BASE) $(OUTNAME)
  77. make kernel_inject
  78. .PHONY: live_image
  79. live_image:
  80. echo "TODO"
  81. .PHONY: kernel_config
  82. kernel_config:
  83. scripts/crossmenuconfig.sh $(KVER)
  84. .PHONY: patch_kernel
  85. patch_kernel:
  86. scripts/patchKernel.sh