Makefile 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # User defined preferences in following file
  2. include config.mk
  3. LB_BAS = $(LB_MIR)/stable/$(LB_VER)
  4. LB_SHA = SHA512SUMS
  5. LB_SIG = SHA512SUMS.sig
  6. LB_REC = 0x969A979505E8C5B2
  7. LB_KEYSERVER = hkp://ha.pool.sks-keyservers.net
  8. LBR_NAM = libreboot_r$(LB_VER)_$(LBR_LOD)_$(LBR_COM)_$(LBR_SIZ)mb
  9. LBR_TXZ = $(LBR_NAM).tar.xz
  10. LBR_DWN = $(LB_BAS)/rom/$(LBR_LOD)/$(LBR_TXZ)
  11. LBR_FIL = $(LBR_COM)_$(LBR_SIZ)mb_$(LBR_KEY)_$(LBR_DIS).rom
  12. LBU_NAM = libreboot_r$(LB_VER)_util
  13. LBU_TXZ = $(LBU_NAM).tar.xz
  14. LBU_DWN = $(LB_BAS)/$(LBU_TXZ)
  15. PKG = package
  16. BLD = build
  17. BLD_LBR = $(BLD)/$(LBR_NAM)
  18. BLD_LBU = $(BLD)/$(LBU_NAM)
  19. CBFSDIR = $(BLD_LBU)/cbfstool/$(LBU_CPU)
  20. CBFSTOOL = $(CBFSDIR)/cbfstool
  21. ICH9DIR = $(BLD_LBU)/ich9deblob/$(LBU_CPU)
  22. ICH9GEN = $(ICH9DIR)/ich9gen
  23. ICH9FIL = ich9fdgbe_$(LBR_SIZ)m.bin
  24. IMG = images
  25. BLD_LBC = $(BLD)/libreboot_custom
  26. LBR_CUS = $(LBR_COM)_$(LBR_SIZ)mb_$(LBR_KEY)_$(LBR_DIS)_cust.rom
  27. LBR_IMG = $(IMG_NAM).$(IMG_EXT)
  28. all: $(BLD_LBC)/$(LBR_CUS)
  29. $(BLD_LBC)/$(LBR_CUS): $(BLD_LBR)/$(LBR_FIL) $(IMG)/$(LBR_IMG) $(CBFSTOOL)
  30. @if [ "$(LBR_MAC)" = "00:00:00:00:00:00" ]; then \
  31. echo "Error:The LBR_MAC variable needs to be updated in config.mk"; \
  32. exit 1; \
  33. fi
  34. mkdir -p $(BLD_LBC)
  35. cp $(BLD_LBR)/$(LBR_FIL) $(BLD_LBC)/$(LBR_CUS)
  36. # Update rom to use appropriate mac address
  37. $(ICH9GEN) --macaddress $(LBR_MAC)
  38. mv $(ICH9FIL) $(BLD_LBC)
  39. rm ich9*.bin mkgbe*
  40. cd $(BLD_LBC); dd if=$(ICH9FIL) of=$(LBR_CUS) bs=12k count=1 conv=notrunc
  41. # Copy in desired splash image to build folder
  42. cp $(IMG)/$(LBR_IMG) $(BLD_LBC)/background.$(IMG_EXT)
  43. # Update grub.cfg
  44. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) extract -n grub.cfg -f $(BLD_LBC)/grub_orig.cfg
  45. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) remove -n grub.cfg
  46. sed -e 's:background.jpg:background.$(IMG_EXT):' $(BLD_LBC)/grub_orig.cfg > $(BLD_LBC)/grub_cust.cfg
  47. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) add -n grub.cfg -f $(BLD_LBC)/grub_cust.cfg -t raw
  48. # Update grubtest.cfg
  49. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) extract -n grubtest.cfg -f $(BLD_LBC)/grubtest_orig.cfg
  50. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) remove -n grubtest.cfg
  51. sed -e 's:background.jpg:background.$(IMG_EXT):' $(BLD_LBC)/grubtest_orig.cfg > $(BLD_LBC)/grubtest_cust.cfg
  52. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) add -n grubtest.cfg -f $(BLD_LBC)/grubtest_cust.cfg -t raw
  53. # Update background (boot splash) file
  54. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) remove -n background.jpg
  55. $(CBFSTOOL) $(BLD_LBC)/$(LBR_CUS) add -n background.$(IMG_EXT) -f $(BLD_LBC)/background.$(IMG_EXT) -t raw
  56. $(BLD_LBR)/$(LBR_FIL): $(PKG)/$(LBR_TXZ)
  57. mkdir -p $(BLD)
  58. tar -C $(BLD) -xf $(PKG)/$(LBR_TXZ)
  59. touch $@
  60. $(PKG)/$(LBR_TXZ): $(PKG)/$(LB_SHA)
  61. mkdir -p $(@D)
  62. wget -O $(PKG)/$(LBR_TXZ) $(LBR_DWN)
  63. cd $(PKG); cat $(LB_SHA) | grep $(LBR_NAM) | sed -e 's:./rom/grub/::' | sha512sum -c
  64. touch $@
  65. $(CBFSTOOL): $(PKG)/$(LBU_TXZ)
  66. mkdir -p $(BLD)
  67. tar -C $(BLD) -xf $(PKG)/$(LBU_TXZ)
  68. touch $@
  69. $(PKG)/$(LBU_TXZ): $(PKG)/$(LB_SHA)
  70. mkdir -p $(PKG)
  71. wget -O $(PKG)/$(LBU_TXZ) $(LBU_DWN)
  72. cd $(PKG); cat $(LB_SHA) | grep $(LBU_NAM) | sha512sum -c
  73. touch $@
  74. $(PKG)/$(LB_SHA): config.mk
  75. mkdir -p $(PKG)
  76. wget -O $(PKG)/$(LB_SHA) $(LB_BAS)/$(LB_SHA)
  77. wget -O $(PKG)/$(LB_SIG) $(LB_BAS)/$(LB_SIG)
  78. gpg --keyserver $(LB_KEYSERVER) --recv-keys $(LB_REC)
  79. cd $(PKG); gpg --verify $(LB_SIG)
  80. touch $@
  81. clean:
  82. rm -Rf $(BLD)
  83. distclean:
  84. rm -Rf $(PKG) $(BLD)
  85. .PHONY:
  86. all clean distclean