makefile 3.2 KB

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