makefile 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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_basefs - which deletes the built PrawnOS base image"
  31. @echo " clean_initramfs - which deletes the built PrawnOS initramfs image that gets injected into the kernel"
  32. @echo " clean_all - which does all of the above"
  33. @echo " in most cases none of these need to be used manually as most cleanup steps are handled automatically"
  34. .PHONY: clean_kernel
  35. clean_kernel:
  36. rm -rf build/linux-$(KVER)
  37. .PHONY: clean_ath
  38. clean_ath:
  39. rm -rf build/open-ath9k-htc-firmware
  40. .PHONY: clean_img
  41. clean_img:
  42. rm -f $(OUTNAME)
  43. .PHONY: clean_basefs
  44. clean_basefs:
  45. rm -r $(BASE)
  46. .PHONY: clean_initramfs
  47. clean_initramfs:
  48. rm -r build/PrawnOS-initramfs.cpio.gz
  49. .PHONY: clean_all
  50. clean_all:
  51. make clean_kernel
  52. make clean_ath
  53. make clean_img
  54. make clean_fs
  55. make clean_initramfs
  56. .PHONY: kernel
  57. kernel:
  58. scripts/buildKernel.sh $(KVER)
  59. .PHONY: initramfs
  60. initramfs:
  61. scripts/buildInitramFs.sh
  62. #makes the base filesystem image, no kernel only if the base image isnt present
  63. .PHONY: filesystem
  64. filesystem:
  65. [ -f $(BASE) ] || scripts/buildFilesystem.sh $(KVER)
  66. .PHONY: kernel_inject
  67. kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
  68. scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
  69. .PHONY: injected_image
  70. injected_image: #makes a copy of the base image with a new injected kernel
  71. make kernel
  72. cp $(BASE) $(OUTNAME)
  73. make kernel_inject
  74. .PHONY: image
  75. image:
  76. make clean_img
  77. make filesystem
  78. make initramfs
  79. make kernel
  80. #Make a new copy of the filesystem image
  81. cp $(BASE) $(OUTNAME)
  82. make kernel_inject
  83. .PHONY: live_image
  84. live_image:
  85. echo "TODO"
  86. .PHONY: kernel_config
  87. kernel_config:
  88. scripts/crossmenuconfig.sh $(KVER)
  89. .PHONY: patch_kernel
  90. patch_kernel:
  91. scripts/patchKernel.sh