makefile 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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.29
  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: build_dirs
  60. build_dirs:
  61. mkdir -p build/logs/
  62. .PHONY: kernel
  63. kernel:
  64. $(MAKE) build_dirs
  65. rm -rf build/logs/kernel-log.txt
  66. bash -x scripts/buildKernel.sh $(KVER) 2>&1 | tee build/logs/kernel-log.txt
  67. .PHONY: initramfs
  68. initramfs:
  69. $(MAKE) build_dirs
  70. rm -rf build/logs/kernel-log.txt
  71. bash -x scripts/buildInitramFs.sh $(BASE) 2>&1 | tee build/logs/initramfs-log.txt
  72. #makes the base filesystem image, no kernel only if the base image isnt present
  73. .PHONY: filesystem
  74. filesystem:
  75. $(MAKE) build_dirs
  76. rm -rf build/logs/kernel-log.txt
  77. [ -f $(BASE) ] || bash -x scripts/buildFilesystem.sh $(KVER) $(DEBIAN_SUITE) $(BASE) 2>&1 | tee build/logs/fs-log.txt
  78. .PHONY: kernel_inject
  79. kernel_inject: #Targets an already built .img and swaps the old kernel with the newly compiled kernel
  80. scripts/injectKernelIntoFS.sh $(KVER) $(OUTNAME)
  81. .PHONY: kernel_update
  82. kernel_update:
  83. $(MAKE) initramfs
  84. $(MAKE) kernel
  85. $(MAKE) kernel_inject
  86. .PHONY: injected_image
  87. injected_image: #makes a copy of the base image with a new injected kernel
  88. $(MAKE) kernel
  89. cp $(BASE) $(OUTNAME)
  90. $(MAKE) kernel_inject
  91. .PHONY: image
  92. image:
  93. $(MAKE) clean_img
  94. $(MAKE) filesystem
  95. $(MAKE) initramfs
  96. $(MAKE) kernel
  97. #Make a new copy of the filesystem image
  98. cp $(BASE) $(OUTNAME)
  99. $(MAKE) kernel_inject
  100. .PHONY: live_image
  101. live_image:
  102. echo "TODO"
  103. .PHONY: kernel_config
  104. kernel_config:
  105. scripts/crossmenuconfig.sh $(KVER)
  106. .PHONY: patch_kernel
  107. patch_kernel:
  108. scripts/patchKernel.sh