mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-09-19 21:20:31 +02:00
Compare commits
125 Commits
123639e3db
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| 489a81eb6d | |||
| 272e306ba2 | |||
| f1f7fa2925 | |||
| 9e189bbd06 | |||
| 688e541c58 | |||
| 387e6dd771 | |||
| a0951d1127 | |||
| f59e5d8e2b | |||
| 4530c6f2e3 | |||
| e0714ad929 | |||
| 058a70a16e | |||
| e1c2525783 | |||
| 69875b8e10 | |||
| 1722964f66 | |||
| 63596046d1 | |||
| 40b120c26b | |||
| bf654d4c19 | |||
| 94ff1ec49a | |||
| 08021d71c2 | |||
| 856551a36d | |||
| 7c025e1036 | |||
| 60a2f5cbff | |||
| 3b565ce056 | |||
| 089875ac1f | |||
| 2dc01a93b9 | |||
| cebae0ed80 | |||
| d165f14a4d | |||
| 5afd77433d | |||
| 08ec187842 | |||
| 2dc4a4d16b | |||
| ca55077032 | |||
| 113dac006f | |||
| 88887c0163 | |||
| 0c41ea82dd | |||
| bbc56b714b | |||
| 6a5b4c98d6 | |||
| 50eec6d485 | |||
| 40b1a3e0bb | |||
| 59cbc1784c | |||
| 6725b616f3 | |||
| 7507655d34 | |||
| 2aad50cd59 | |||
| f7b9c9e410 | |||
| 4878cec84d | |||
| 04be963383 | |||
| 5043b6dc97 | |||
| a65d804f1e | |||
| cf079dbd17 | |||
| 828578cc57 | |||
| 7cb4cdf0f2 | |||
| 300f2cb434 | |||
| 2c94101884 | |||
| 08f93ec812 | |||
| e99be6e5dc | |||
| e075a79867 | |||
| cd52750fec | |||
| f115bdfe37 | |||
| 76bf71ff65 | |||
| c4695497f5 | |||
| d9ca4265ef | |||
| b32dd39262 | |||
| c6900c8571 | |||
| c0402ef642 | |||
| 16e04411f2 | |||
| b09cd4ada4 | |||
| abee462f2a | |||
| cb49e77947 | |||
| 93b49afa3f | |||
| 6c3791ce81 | |||
| d17b06f589 | |||
| 2fc37b4b47 | |||
| 4ebede5b99 | |||
| a82328904e | |||
| 823a1fd011 | |||
| 5fb0d1098f | |||
| dcaa15ab01 | |||
| f5f6464c60 | |||
| 74c374a3a2 | |||
| de09b71e0a | |||
| eb23cd3de8 | |||
| 07ed4e940b | |||
| ff83f69154 | |||
| 0363bcaa0f | |||
| 1a9b211368 | |||
| e9e33d4b4d | |||
| 3b37a0b17d | |||
| 77b0b448e2 | |||
| c7fb6a2bc8 | |||
| 2d1d7624e9 | |||
| a32374f6cc | |||
| 897c2667af | |||
| 446eca846e | |||
| c3e2d8c8bc | |||
| b094c60a39 | |||
| 798cc79399 | |||
| 6a2e9a7919 | |||
| d0a1b40910 | |||
| 0fd3d72998 | |||
| 425855899f | |||
| f648167b9f | |||
| 36fef51e8f | |||
| b6b5f70934 | |||
| 58094bd017 | |||
| cdd399017e | |||
| 15204cda63 | |||
| 8173aea83b | |||
| aad748c5ca | |||
| 8db320799b | |||
| 04c3bc53b6 | |||
| d722a02cda | |||
| 6fe1d47fb3 | |||
| 005f1189c1 | |||
| 86781a5881 | |||
| 61ab5723df | |||
| 6050cdd1db | |||
| 8c927b535d | |||
| 5f0bd5ea10 | |||
| 8822c56815 | |||
| bb0221252c | |||
| 1ceeb0ab55 | |||
| bb4c038794 | |||
| 786cf8cd9c | |||
| 189b61018f | |||
| e973584123 | |||
| afdf8c7733 |
@@ -21,6 +21,7 @@ CONFIG_OPTION_BACKEND_NONE=y
|
||||
# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set
|
||||
CONFIG_COMPRESS_RAMSTAGE_LZMA=y
|
||||
# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set
|
||||
# CONFIG_COMPRESS_RAMSTAGE_ZSTD is not set
|
||||
CONFIG_SEPARATE_ROMSTAGE=y
|
||||
CONFIG_INCLUDE_CONFIG_FILE=y
|
||||
CONFIG_COLLECT_TIMESTAMPS=y
|
||||
@@ -99,6 +100,7 @@ CONFIG_VENDOR_DELL=y
|
||||
# CONFIG_VENDOR_PRODRIVE is not set
|
||||
# CONFIG_VENDOR_PROTECTLI is not set
|
||||
# CONFIG_VENDOR_PURISM is not set
|
||||
# CONFIG_VENDOR_QOTOM is not set
|
||||
# CONFIG_VENDOR_RAPTOR_CS is not set
|
||||
# CONFIG_VENDOR_RAZER is not set
|
||||
# CONFIG_VENDOR_RODA is not set
|
||||
@@ -127,7 +129,7 @@ CONFIG_CBFS_SIZE=0xEEE000
|
||||
CONFIG_CONSOLE_SERIAL=y
|
||||
CONFIG_LINEAR_FRAMEBUFFER_MAX_HEIGHT=2160
|
||||
CONFIG_LINEAR_FRAMEBUFFER_MAX_WIDTH=3840
|
||||
CONFIG_MAX_CPUS=16
|
||||
CONFIG_MAX_CPUS=8
|
||||
# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set
|
||||
CONFIG_POST_DEVICE=y
|
||||
CONFIG_POST_IO=y
|
||||
@@ -149,19 +151,21 @@ CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 3040 Micro"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout"
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
|
||||
CONFIG_USE_PM_ACPI_TIMER=y
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
|
||||
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
|
||||
# CONFIG_BOARD_DELL_E4300 is not set
|
||||
# CONFIG_BOARD_DELL_E6400 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
|
||||
CONFIG_BOARD_DELL_OPTIPLEX_3040=y
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set
|
||||
@@ -205,7 +209,8 @@ CONFIG_GFX_GMA_PANEL_1_ON_EDP=y
|
||||
CONFIG_DRIVERS_UART_8250IO=y
|
||||
CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72
|
||||
CONFIG_HEAP_SIZE=0x100000
|
||||
CONFIG_EC_GPE_SCI=0x50
|
||||
# CONFIG_BOOTMEDIA_SMM_BWP is not set
|
||||
# CONFIG_DRIVERS_EFI_FW_INFO is not set
|
||||
CONFIG_BOARD_ROMSIZE_KB_16384=y
|
||||
# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set
|
||||
# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set
|
||||
@@ -249,6 +254,7 @@ CONFIG_SMM_RESERVED_SIZE=0x200000
|
||||
CONFIG_SMM_MODULE_STACK_SIZE=0x800
|
||||
CONFIG_ACPI_BERT_SIZE=0x0
|
||||
CONFIG_DRIVERS_I2C_DESIGNWARE_CLOCK_MHZ=120
|
||||
CONFIG_CPU_PT_ROM_MAP_GB=512
|
||||
CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xe0000000
|
||||
CONFIG_ACPI_CPU_STRING="CP%02X"
|
||||
@@ -266,7 +272,6 @@ CONFIG_SOC_INTEL_I2C_DEV_MAX=6
|
||||
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_M_VAL=0x30
|
||||
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_N_VAL=0xc35
|
||||
CONFIG_FSP_HEADER_PATH="3rdparty/fsp/KabylakeFspBinPkg/Include/"
|
||||
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
|
||||
CONFIG_SOC_INTEL_COMMON_DEBUG_CONSENT=0
|
||||
CONFIG_INTEL_GMA_BCLV_OFFSET=0xc8254
|
||||
CONFIG_INTEL_GMA_BCLV_WIDTH=16
|
||||
@@ -284,6 +289,8 @@ CONFIG_SOC_INTEL_GFX_FRAMEBUFFER_OFFSET=0x0
|
||||
CONFIG_PCIE_LTR_MAX_SNOOP_LATENCY=0x1003
|
||||
CONFIG_PCIE_LTR_MAX_NO_SNOOP_LATENCY=0x1003
|
||||
CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0
|
||||
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_CBFS_CACHE_ALIGN=8
|
||||
CONFIG_SOC_INTEL_COMMON_SKYLAKE_BASE=y
|
||||
CONFIG_SOC_INTEL_KABYLAKE=y
|
||||
CONFIG_SKYLAKE_SOC_PCH_H=y
|
||||
@@ -293,7 +300,7 @@ CONFIG_SKYLAKE_SOC_PCH_H=y
|
||||
CONFIG_FSP_T_LOCATION=0xfffe0000
|
||||
CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB=y
|
||||
CONFIG_FIXED_SMBUS_IO_BASE=0xefa0
|
||||
CONFIG_CBFS_CACHE_ALIGN=8
|
||||
CONFIG_UART_BITBANG_TX_DELAY_MS=5
|
||||
CONFIG_SOC_INTEL_COMMON=y
|
||||
|
||||
#
|
||||
@@ -431,7 +438,6 @@ CONFIG_UDELAY_TSC=y
|
||||
CONFIG_TSC_MONOTONIC_TIMER=y
|
||||
CONFIG_TSC_SYNC_MFENCE=y
|
||||
CONFIG_HAVE_SMI_HANDLER=y
|
||||
CONFIG_CPU_PT_ROM_MAP_GB=512
|
||||
CONFIG_SMM_TSEG=y
|
||||
CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8
|
||||
CONFIG_AP_STACK_SIZE=0x800
|
||||
@@ -500,7 +506,6 @@ CONFIG_ARCH_ALL_STAGES_X86_32=y
|
||||
CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y
|
||||
CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y
|
||||
CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y
|
||||
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_PC80_SYSTEM=y
|
||||
CONFIG_HAVE_CMOS_DEFAULT=y
|
||||
CONFIG_POSTCAR_STAGE=y
|
||||
@@ -564,6 +569,8 @@ CONFIG_INTEL_GMA_ADD_VBT=y
|
||||
# CONFIG_SOFTWARE_I2C is not set
|
||||
CONFIG_I2C_TRANSFER_TIMEOUT_US=500000
|
||||
CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
|
||||
CONFIG_DRAM_SUPPORT_DDR4=y
|
||||
CONFIG_DRAM_SUPPORT_DDR3=y
|
||||
# end of Devices
|
||||
|
||||
#
|
||||
@@ -571,8 +578,8 @@ CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
|
||||
#
|
||||
CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000
|
||||
# CONFIG_DRIVERS_EFI_VARIABLE_STORE is not set
|
||||
# CONFIG_DRIVERS_EFI_FW_INFO is not set
|
||||
# CONFIG_ELOG is not set
|
||||
# CONFIG_DRIVERS_HWID_DMI is not set
|
||||
CONFIG_CACHE_MRC_SETTINGS=y
|
||||
CONFIG_MRC_SETTINGS_PROTECT=y
|
||||
# CONFIG_DRIVERS_OPTION_CFR is not set
|
||||
@@ -610,6 +617,7 @@ CONFIG_USE_FSP_NOTIFY_PHASE_READY_TO_BOOT=y
|
||||
CONFIG_USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE=y
|
||||
# CONFIG_DISPLAY_FSP_TIMESTAMPS is not set
|
||||
# CONFIG_BUILDING_WITH_DEBUG_FSP is not set
|
||||
CONFIG_FSP_VGA_MODE12_BPP=0x0
|
||||
CONFIG_INTEL_GMA_ACPI=y
|
||||
CONFIG_VBT_CBFS_COMPRESSION_LZMA=y
|
||||
# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set
|
||||
@@ -670,7 +678,6 @@ CONFIG_PLATFORM_HAS_DRAM_CLEAR=y
|
||||
CONFIG_BOOTMEDIA_LOCK_NONE=y
|
||||
# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set
|
||||
# CONFIG_BOOTMEDIA_LOCK_CHIP is not set
|
||||
# CONFIG_BOOTMEDIA_SMM_BWP is not set
|
||||
# end of Security
|
||||
|
||||
CONFIG_ACPI_HAVE_PCAT_8259=y
|
||||
@@ -811,6 +818,9 @@ CONFIG_DECOMPRESS_OFAST=y
|
||||
# Boot Logo Configuration
|
||||
#
|
||||
# CONFIG_BMP_LOGO is not set
|
||||
CONFIG_PLATFORM_POST_RENDER_DELAY_SEC=5
|
||||
CONFIG_PLATFORM_OFF_MODE_CHARGING_INDICATOR_LOGO_PATH="3rdparty/blobs/mainboard/$(MAINBOARDDIR)/off_mode_charging.bmp"
|
||||
# CONFIG_FRAMEBUFFER_SPLASH_TEXT is not set
|
||||
# end of Boot Logo Configuration
|
||||
|
||||
CONFIG_WARNINGS_ARE_ERRORS=y
|
||||
|
||||
@@ -21,6 +21,7 @@ CONFIG_OPTION_BACKEND_NONE=y
|
||||
# CONFIG_USE_CBFS_FILE_OPTION_BACKEND is not set
|
||||
CONFIG_COMPRESS_RAMSTAGE_LZMA=y
|
||||
# CONFIG_COMPRESS_RAMSTAGE_LZ4 is not set
|
||||
# CONFIG_COMPRESS_RAMSTAGE_ZSTD is not set
|
||||
CONFIG_SEPARATE_ROMSTAGE=y
|
||||
CONFIG_INCLUDE_CONFIG_FILE=y
|
||||
CONFIG_COLLECT_TIMESTAMPS=y
|
||||
@@ -99,6 +100,7 @@ CONFIG_VENDOR_DELL=y
|
||||
# CONFIG_VENDOR_PRODRIVE is not set
|
||||
# CONFIG_VENDOR_PROTECTLI is not set
|
||||
# CONFIG_VENDOR_PURISM is not set
|
||||
# CONFIG_VENDOR_QOTOM is not set
|
||||
# CONFIG_VENDOR_RAPTOR_CS is not set
|
||||
# CONFIG_VENDOR_RAZER is not set
|
||||
# CONFIG_VENDOR_RODA is not set
|
||||
@@ -125,7 +127,7 @@ CONFIG_FMDFILE=""
|
||||
CONFIG_MAINBOARD_VENDOR="Dell Inc."
|
||||
CONFIG_CBFS_SIZE=0xEEE000
|
||||
CONFIG_CONSOLE_SERIAL=y
|
||||
CONFIG_MAX_CPUS=16
|
||||
CONFIG_MAX_CPUS=8
|
||||
# CONFIG_ONBOARD_VGA_IS_PRIMARY is not set
|
||||
CONFIG_POST_DEVICE=y
|
||||
CONFIG_POST_IO=y
|
||||
@@ -147,19 +149,21 @@ CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 3040 Micro"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
CONFIG_CMOS_LAYOUT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.layout"
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
|
||||
CONFIG_USE_PM_ACPI_TIMER=y
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
|
||||
CONFIG_BOOT_DEVICE_SPI_FLASH_BUS=0
|
||||
# CONFIG_BOARD_DELL_E4300 is not set
|
||||
# CONFIG_BOARD_DELL_E6400 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E7240 is not set
|
||||
CONFIG_BOARD_DELL_OPTIPLEX_3040=y
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_780_MT is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_780_USFF is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_9020_SFF is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_9020_MT is not set
|
||||
# CONFIG_BOARD_DELL_OPTIPLEX_3050 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E5420 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E5520 is not set
|
||||
# CONFIG_BOARD_DELL_LATITUDE_E6220 is not set
|
||||
@@ -203,7 +207,8 @@ CONFIG_GFX_GMA_PANEL_1_ON_EDP=y
|
||||
CONFIG_DRIVERS_UART_8250IO=y
|
||||
CONFIG_PC_CMOS_BASE_PORT_BANK1=0x72
|
||||
CONFIG_HEAP_SIZE=0x100000
|
||||
CONFIG_EC_GPE_SCI=0x50
|
||||
# CONFIG_BOOTMEDIA_SMM_BWP is not set
|
||||
# CONFIG_DRIVERS_EFI_FW_INFO is not set
|
||||
CONFIG_BOARD_ROMSIZE_KB_16384=y
|
||||
# CONFIG_COREBOOT_ROMSIZE_KB_256 is not set
|
||||
# CONFIG_COREBOOT_ROMSIZE_KB_512 is not set
|
||||
@@ -247,6 +252,7 @@ CONFIG_SMM_RESERVED_SIZE=0x200000
|
||||
CONFIG_SMM_MODULE_STACK_SIZE=0x800
|
||||
CONFIG_ACPI_BERT_SIZE=0x0
|
||||
CONFIG_DRIVERS_I2C_DESIGNWARE_CLOCK_MHZ=120
|
||||
CONFIG_CPU_PT_ROM_MAP_GB=512
|
||||
CONFIG_PRERAM_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_DOMAIN_RESOURCE_32BIT_LIMIT=0xe0000000
|
||||
CONFIG_ACPI_CPU_STRING="CP%02X"
|
||||
@@ -264,7 +270,6 @@ CONFIG_SOC_INTEL_I2C_DEV_MAX=6
|
||||
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_M_VAL=0x30
|
||||
CONFIG_SOC_INTEL_COMMON_LPSS_UART_CLK_N_VAL=0xc35
|
||||
CONFIG_FSP_HEADER_PATH="3rdparty/fsp/KabylakeFspBinPkg/Include/"
|
||||
CONFIG_FSP_FD_PATH="3rdparty/fsp/KabylakeFspBinPkg/Fsp.fd"
|
||||
CONFIG_SOC_INTEL_COMMON_DEBUG_CONSENT=0
|
||||
CONFIG_INTEL_GMA_BCLV_OFFSET=0xc8254
|
||||
CONFIG_INTEL_GMA_BCLV_WIDTH=16
|
||||
@@ -282,6 +287,8 @@ CONFIG_SOC_INTEL_GFX_FRAMEBUFFER_OFFSET=0x0
|
||||
CONFIG_PCIE_LTR_MAX_SNOOP_LATENCY=0x1003
|
||||
CONFIG_PCIE_LTR_MAX_NO_SNOOP_LATENCY=0x1003
|
||||
CONFIG_SOC_PHYSICAL_ADDRESS_WIDTH=0
|
||||
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_CBFS_CACHE_ALIGN=8
|
||||
CONFIG_SOC_INTEL_COMMON_SKYLAKE_BASE=y
|
||||
CONFIG_SOC_INTEL_KABYLAKE=y
|
||||
CONFIG_SKYLAKE_SOC_PCH_H=y
|
||||
@@ -291,7 +298,7 @@ CONFIG_SKYLAKE_SOC_PCH_H=y
|
||||
CONFIG_FSP_T_LOCATION=0xfffe0000
|
||||
CONFIG_SOC_INTEL_COMMON_BLOCK_P2SB=y
|
||||
CONFIG_FIXED_SMBUS_IO_BASE=0xefa0
|
||||
CONFIG_CBFS_CACHE_ALIGN=8
|
||||
CONFIG_UART_BITBANG_TX_DELAY_MS=5
|
||||
CONFIG_SOC_INTEL_COMMON=y
|
||||
|
||||
#
|
||||
@@ -429,7 +436,6 @@ CONFIG_UDELAY_TSC=y
|
||||
CONFIG_TSC_MONOTONIC_TIMER=y
|
||||
CONFIG_TSC_SYNC_MFENCE=y
|
||||
CONFIG_HAVE_SMI_HANDLER=y
|
||||
CONFIG_CPU_PT_ROM_MAP_GB=512
|
||||
CONFIG_SMM_TSEG=y
|
||||
CONFIG_SMM_PCI_RESOURCE_STORE_NUM_SLOTS=8
|
||||
CONFIG_AP_STACK_SIZE=0x800
|
||||
@@ -498,7 +504,6 @@ CONFIG_ARCH_ALL_STAGES_X86_32=y
|
||||
CONFIG_RESERVED_PHYSICAL_ADDRESS_BITS_SUPPORT=y
|
||||
CONFIG_X86_TOP4G_BOOTMEDIA_MAP=y
|
||||
CONFIG_POSTRAM_CBFS_CACHE_IN_BSS=y
|
||||
CONFIG_RAMSTAGE_CBFS_CACHE_SIZE=0x4000
|
||||
CONFIG_PC80_SYSTEM=y
|
||||
CONFIG_HAVE_CMOS_DEFAULT=y
|
||||
CONFIG_POSTCAR_STAGE=y
|
||||
@@ -556,6 +561,8 @@ CONFIG_INTEL_GMA_ADD_VBT=y
|
||||
# CONFIG_SOFTWARE_I2C is not set
|
||||
CONFIG_I2C_TRANSFER_TIMEOUT_US=500000
|
||||
CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
|
||||
CONFIG_DRAM_SUPPORT_DDR4=y
|
||||
CONFIG_DRAM_SUPPORT_DDR3=y
|
||||
# end of Devices
|
||||
|
||||
#
|
||||
@@ -563,8 +570,8 @@ CONFIG_RESOURCE_ALLOCATION_TOP_DOWN=y
|
||||
#
|
||||
CONFIG_CRB_TPM_BASE_ADDRESS=0xfed40000
|
||||
# CONFIG_DRIVERS_EFI_VARIABLE_STORE is not set
|
||||
# CONFIG_DRIVERS_EFI_FW_INFO is not set
|
||||
# CONFIG_ELOG is not set
|
||||
# CONFIG_DRIVERS_HWID_DMI is not set
|
||||
CONFIG_CACHE_MRC_SETTINGS=y
|
||||
CONFIG_MRC_SETTINGS_PROTECT=y
|
||||
# CONFIG_DRIVERS_OPTION_CFR is not set
|
||||
@@ -602,6 +609,7 @@ CONFIG_USE_FSP_NOTIFY_PHASE_READY_TO_BOOT=y
|
||||
CONFIG_USE_FSP_NOTIFY_PHASE_END_OF_FIRMWARE=y
|
||||
# CONFIG_DISPLAY_FSP_TIMESTAMPS is not set
|
||||
# CONFIG_BUILDING_WITH_DEBUG_FSP is not set
|
||||
CONFIG_FSP_VGA_MODE12_BPP=0x0
|
||||
CONFIG_INTEL_GMA_ACPI=y
|
||||
CONFIG_VBT_CBFS_COMPRESSION_LZMA=y
|
||||
# CONFIG_VBT_CBFS_COMPRESSION_LZ4 is not set
|
||||
@@ -663,7 +671,6 @@ CONFIG_PLATFORM_HAS_DRAM_CLEAR=y
|
||||
CONFIG_BOOTMEDIA_LOCK_NONE=y
|
||||
# CONFIG_BOOTMEDIA_LOCK_CONTROLLER is not set
|
||||
# CONFIG_BOOTMEDIA_LOCK_CHIP is not set
|
||||
# CONFIG_BOOTMEDIA_SMM_BWP is not set
|
||||
# end of Security
|
||||
|
||||
CONFIG_ACPI_HAVE_PCAT_8259=y
|
||||
@@ -804,6 +811,9 @@ CONFIG_DECOMPRESS_OFAST=y
|
||||
# Boot Logo Configuration
|
||||
#
|
||||
# CONFIG_BMP_LOGO is not set
|
||||
CONFIG_PLATFORM_POST_RENDER_DELAY_SEC=5
|
||||
CONFIG_PLATFORM_OFF_MODE_CHARGING_INDICATOR_LOGO_PATH="3rdparty/blobs/mainboard/$(MAINBOARDDIR)/off_mode_charging.bmp"
|
||||
# CONFIG_FRAMEBUFFER_SPLASH_TEXT is not set
|
||||
# end of Boot Logo Configuration
|
||||
|
||||
CONFIG_WARNINGS_ARE_ERRORS=y
|
||||
|
||||
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 MT"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -150,7 +150,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -148,7 +148,7 @@ CONFIG_MEMLAYOUT_LD_FILE="src/arch/x86/memlayout.ld"
|
||||
# CONFIG_FATAL_ASSERTS is not set
|
||||
CONFIG_INTEL_GMA_VBT_FILE="src/mainboard/$(MAINBOARDDIR)/data.vbt"
|
||||
CONFIG_PRERAM_CBMEM_CONSOLE_SIZE=0xc00
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="OptiPlex 7020/9020 SFF"
|
||||
CONFIG_MAINBOARD_SMBIOS_PRODUCT_NAME="Precision T1700 SFF"
|
||||
# CONFIG_CONSOLE_POST is not set
|
||||
CONFIG_MAX_SOCKET=1
|
||||
CONFIG_CMOS_DEFAULT_FILE="src/mainboard/$(MAINBOARDDIR)/cmos.default"
|
||||
|
||||
@@ -24,5 +24,5 @@ payload_uboot=""
|
||||
cbfscfg=""
|
||||
|
||||
premake="corebootpremake"
|
||||
mkhelper="coreboot_pad_one_byte"
|
||||
postmake="mkcorebootbin"
|
||||
mkhelper="$if_not_dry_build coreboot_pad_one_byte"
|
||||
postmake="$if_not_dry_build mkcorebootbin"
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
|
||||
autoconfargs="--with-platform=coreboot --disable-werror"
|
||||
configureargs="--with-platform=coreboot --disable-werror"
|
||||
makeargs="FS_PAYLOAD_MODULES=\"\""
|
||||
buildtype="autohell"
|
||||
mkhelper="mkpayload_grub"
|
||||
mkhelper="$if_not_dry_build mkpayload_grub"
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
postmake="copyps1bios"
|
||||
mkhelper="$if_not_dry_build copyps1bios"
|
||||
postmake="$if_not_dry_build copyps1bios"
|
||||
|
||||
@@ -6,7 +6,7 @@ acpica arm-none-eabi-binutils arm-none-eabi-gcc arm-none-eabi-newlib \
|
||||
autogen base-devel bison cdrtools cmake curl device-mapper doxygen \
|
||||
dtc e2fsprogs flex freetype2 fuse2 gawk gcc-ada gdb gettext git \
|
||||
help2man innoextract libftdi libgpiod libjaylink libpciaccess libusb nasm \
|
||||
ncurses openssl 7zip ccache less libx86 \
|
||||
ncurses openssl 7zip less libx86 \
|
||||
pandoc parted pciutils perl perl-libwww python python-setuptools rsync \
|
||||
sharutils subversion swig texinfo ttf-dejavu unarchiver unzip wget xz zlib mtools \
|
||||
"
|
||||
|
||||
@@ -13,6 +13,6 @@ libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 libusb-1.0-0-dev \
|
||||
libusb-dev lz4 lzma lzma-alone m4 nasm openssl 7zip parted pciutils \
|
||||
perl pkg-config python3 python3-distutils-extra python3-pkg-resources python3-pycryptodome \
|
||||
python3-pyelftools python3-setuptools python-is-python3 sharutils swig unar \
|
||||
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev ccache \
|
||||
unifont unifont-bin unzip uuid-dev wget xfonts-unifont zlib1g-dev \
|
||||
g++-mipsel-linux-gnu make genisoimage mtools libx86-1 libx86-dev libstdc++-arm-none-eabi-newlib autoconf-archive \
|
||||
"
|
||||
|
||||
@@ -10,5 +10,5 @@ innoextract intltool libftdi-devel libselinux-devel libusb1 libusb1-devel \
|
||||
nasm ncurses-devel openssl-devel p7zip p7zip-plugins pandoc parted \
|
||||
pciutils-devel perl perl-libwww-perl python-unversioned-command python3 \
|
||||
python3-setuptools rsync sharutils subversion texinfo unar unifont \
|
||||
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel ccache swig \
|
||||
unifont-fonts unifont-ttf-fonts unzip wget xz zlib-devel swig \
|
||||
"
|
||||
|
||||
@@ -11,5 +11,5 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel \
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unar unifont unifont-fonts \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unar unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel tar unar libtool \
|
||||
"
|
||||
|
||||
@@ -11,6 +11,6 @@ libselinux-devel libusb1 libusb1-devel nasm ncurses-devel openssl-devel openssl-
|
||||
p7zip p7zip-plugins pandoc parted pciutils-devel perl perl-libwww-perl \
|
||||
python-unversioned-command python3 python3-setuptools rsync sharutils \
|
||||
subversion systemd-devel texinfo unifont unifont-fonts uuid-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel ccache swig python3-devel \
|
||||
unifont-ttf-fonts unzip wget xz zlib-devel swig python3-devel \
|
||||
libuuid-devel gnutls-devel tar unar libtool \
|
||||
"
|
||||
|
||||
@@ -11,7 +11,7 @@ dev-libs/libgpiod app-arch/sharutils dev-libs/libtomcrypt sys-devel/autogen \
|
||||
media-libs/freetype sys-fs/e2fsprogs sys-fs/lvm2 dev-libs/libusb \
|
||||
sys-block/parted sys-fs/mtools app-arch/lz4 dev-libs/leancrypto sys-fs/fuse \
|
||||
sys-apps/dtc net-libs/gnutls net-misc/curl dev-build/cmake dev-vcs/git \
|
||||
dev-util/ccache dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
|
||||
dev-embedded/libftdi app-arch/innoextract sys-devel/gcc \
|
||||
sys-apps/pciutils app-crypt/efitools gnustep-base/gnustep-make gnustep-base/gnustep-base \
|
||||
app-arch/unar app-arch/7zip dev-lang/python dev-python/setuptools dev-python/ply \
|
||||
sys-libs/libselinux dev-python/pyelftools dev-python/pycparser dev-python/cffi \
|
||||
|
||||
@@ -12,6 +12,6 @@ libpython3-dev libsdl2-dev libselinux1-dev libssl-dev libtool libusb-1.0-0 \
|
||||
libusb-1.0-0-dev lz4 lzma lzma-alone m4 nasm openssl p7zip p7zip-full parted \
|
||||
pciutils perl pkg-config python3 python3-pkg-resources python3-pycryptodome \
|
||||
python3-pyelftools python3-setuptools python-is-python3 sharutils swig \
|
||||
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev ccache \
|
||||
fonts-unifont unar unifont unzip uuid-dev wget zlib1g-dev \
|
||||
g++-mipsel-linux-gnu make genisoimage mtools \
|
||||
"
|
||||
|
||||
@@ -8,5 +8,5 @@ freetype freetype-devel fuse gawk gcc-ada gdb gettext gettext-devel git \
|
||||
gnutls-devel help2man innoextract libftdi1 libpciaccess libusb libuuid-devel \
|
||||
nasm ncurses ncurses-devel openssl openssl-devel 7zip parted pciutils perl \
|
||||
perl-LWP python python3 python3-devel python3-setuptools rsync sharutils \
|
||||
subversion swig texinfo unar unzip wget xz zlib ccache \
|
||||
subversion swig texinfo unar unzip wget xz zlib \
|
||||
"
|
||||
|
||||
@@ -2,4 +2,3 @@
|
||||
|
||||
makeargs="-f lbmkbofhmakefile"
|
||||
cleanargs="-f lbmkbofhmakefile"
|
||||
mkhelper="copyps1bios"
|
||||
|
||||
@@ -1,138 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2025 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
# Import MrChromebox project into xbmk
|
||||
|
||||
# NOTE: variable naming scheme:
|
||||
# mr_ for variables/functions dealing with MrChromebox
|
||||
# mx_ for variables/functions pertaining to Libreboot setup
|
||||
# because i am a non-binary blob
|
||||
|
||||
spdx="# SPDX-License-Identifier: GPL-3.0-or-later"
|
||||
|
||||
# temporary work variables
|
||||
mr_tmpdir="" # dir to clone tmp repos in
|
||||
|
||||
# NOTE: upstream for our purposes: https://review.coreboot.org/coreboot
|
||||
mr_cbrepo="https://github.com/mrchromebox/coreboot"
|
||||
mr_cbbranch="MrChromebox-2503" # branch in mrchromebox
|
||||
mr_cbrev="ecd9fa6a177e00132ec214252a2b9cebbb01e25f" # relative to base
|
||||
mr_cbrevbase="38f5f7c48024d9fca4b6bbd88914423c34da709c" # 25.03 upstream base
|
||||
mr_cbtree="chromebook" # tree name in xbmk
|
||||
|
||||
# NOTE: upstream for our purposes: https://github.com/tianocore/edk2.git
|
||||
mr_edk2repo="https://github.com/mrchromebox/edk2"
|
||||
mr_edk2branch="uefipayload_2502" # branch in mrchromebox
|
||||
mr_edk2rev="feaf6b976b7cc72a18ed364f273751c943a9e7d0" # relative to base
|
||||
mr_edk2revbase="fbe0805b2091393406952e84724188f8c1941837" # 2025.02 upstream
|
||||
mr_edk2tree="chromebook" # tree name in xbmk
|
||||
|
||||
# mxlibreboot was here
|
||||
prep_mr_import()
|
||||
{
|
||||
if [ -f "$xbmkpwd/CHANGELOG" ]; then
|
||||
|
||||
err "Project import disabled on releases" "prep_mr_import" "$@"
|
||||
fi
|
||||
|
||||
mr_tmpdir="`mktemp -d || err "can't make mrtmpdir"`" || \
|
||||
err "can't make mrtmpdir" "prep_mr_coreboot" "$@"
|
||||
|
||||
x_ remkdir "$mr_tmpdir"
|
||||
|
||||
x_ prep_mx_edk2conf
|
||||
|
||||
x_ prep_mr_projects
|
||||
|
||||
x_ rm -Rf "$mr_tmpdir"
|
||||
}
|
||||
|
||||
# create config/git/edk2/pkg.cfg
|
||||
prep_mx_edk2conf()
|
||||
{
|
||||
x_ remkdir "config/git/edk2"
|
||||
|
||||
x_ prep_mr_file "config/git/edk2/pkg.cfg" \
|
||||
"$spdx" \
|
||||
"" \
|
||||
"rev=\"HEAD\"" \
|
||||
"url=\"https://codeberg.org/libreboot/edk2\"" \
|
||||
"bkup_url=\"https://git.disroot.org/libreboot/edk2\""
|
||||
}
|
||||
|
||||
# prep config/PROJECT/TREE/ for various projects
|
||||
prep_mr_projects()
|
||||
{
|
||||
x_ prep_mr "coreboot" "$mr_cbrepo" "$mr_cbbranch" "$mr_cbrev" \
|
||||
"$mr_cbrevbase" "$mr_cbtree"
|
||||
|
||||
x_ prep_mr "edk2" "$mr_edk2repo" "$mr_edk2branch" "$mr_edk2rev" \
|
||||
"$mr_edk2revbase" "$mr_edk2tree"
|
||||
}
|
||||
|
||||
# create config/PROJECT/TREE/target.cfg
|
||||
# and config/PROJECT/TREE/patches/
|
||||
prep_mr()
|
||||
{
|
||||
mr_projectname="$1"
|
||||
mr_repo="$2"
|
||||
mr_branch="$3"
|
||||
mr_rev="$4"
|
||||
mr_revbase="$5"
|
||||
mr_tree="$6"
|
||||
|
||||
x_ prep_mr_clone "$@"
|
||||
x_ prep_mr_patch "$@"
|
||||
|
||||
x_ prep_mr_file "config/$1/$6/target.cfg" \
|
||||
"$spdx" \
|
||||
"" \
|
||||
"tree=\"$6\"" \
|
||||
"rev=\"$5\""
|
||||
}
|
||||
|
||||
prep_mr_clone()
|
||||
{
|
||||
mr_tmpclone="$mr_tmpdir/$1"
|
||||
|
||||
x_ git clone "$2" "$mr_tmpclone"
|
||||
|
||||
x_ git -C "$mr_tmpclone" checkout "$3"
|
||||
# we don't reset, because we format-patch between revbase..rev
|
||||
}
|
||||
|
||||
prep_mr_patch()
|
||||
{
|
||||
mr_tmpclone="$mr_tmpdir/$1"
|
||||
mx_patchdir="config/$1/$6/patches"
|
||||
|
||||
x_ remkdir "$mx_patchdir"
|
||||
|
||||
if [ "$4" != "$5" ]; then
|
||||
|
||||
x_ git -C "$mr_tmpclone" format-patch $5..$4
|
||||
x_ mv "$mr_tmpclone"/*.patch "$mx_patchdir"
|
||||
fi
|
||||
|
||||
# if no patches were created, rmdir will succeed
|
||||
rmdir "$mx_patchdir" 1>/dev/null 2>/dev/null || :
|
||||
}
|
||||
|
||||
prep_mr_file()
|
||||
{
|
||||
mr_filename="$1"
|
||||
shift 1
|
||||
|
||||
x_ rm -f "$mr_filename"
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
printf "%s\n" "$1" >> "$mr_filename" || \
|
||||
err "Can't write '$1' to '$mr_filename'" prep_mr_file "$@"
|
||||
|
||||
shift 1
|
||||
done
|
||||
|
||||
printf "Created '%s'\n" "$mr_filename"
|
||||
}
|
||||
Vendored
+66
-244
@@ -1,77 +1,51 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2020-2021,2023-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2020-2021,2023-2026 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
|
||||
url=""
|
||||
bkup_url=""
|
||||
|
||||
depend=""
|
||||
loc=""
|
||||
subcurl=""
|
||||
subcurl_bkup=""
|
||||
subgit=""
|
||||
subgit_bkup=""
|
||||
subhash=""
|
||||
eval "`newvar url bkup_url depend loc subcurl subcurl_bkup subgit subgit_bkup \
|
||||
subhash`"
|
||||
|
||||
tmpgit="$xbtmp/gitclone"
|
||||
tmpgitcache="$xbtmp/tmpgit"
|
||||
|
||||
fetch_targets()
|
||||
multi_tree_fetch()
|
||||
{
|
||||
if [ -d "src/$project/$tree" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ -d "src/$project/$tree" ] && return 0
|
||||
|
||||
git_prep "$url" "$bkup_url" "$xbmkpwd/$configdir/$tree/patches" \
|
||||
"src/$project/$tree" "submod"
|
||||
}
|
||||
|
||||
fetch_project()
|
||||
single_tree_fetch()
|
||||
{
|
||||
xgcctree=""
|
||||
|
||||
. "config/git/$project/pkg.cfg" || \
|
||||
err "Can't read config 'config/git/$project/pkg.cfg'" \
|
||||
"fetch_project" "@"
|
||||
|
||||
if [ -z "$url" ] || \
|
||||
[ -z "$bkup_url" ]; then
|
||||
"single_tree_fetch" "@"
|
||||
|
||||
if [ -z "$url" ] || [ -z "$bkup_url" ]; then
|
||||
err "url/bkup_url not both set 'config/git/$project/pkg.cfg'" \
|
||||
"fetch_project" "$@"
|
||||
"single_tree_fetch" "$@"
|
||||
fi
|
||||
|
||||
if [ -n "$xgcctree" ]; then
|
||||
|
||||
x_ ./mk -f coreboot "$xgcctree"
|
||||
fi
|
||||
|
||||
if [ -n "$depend" ]; then
|
||||
[ -n "$xgcctree" ] && \
|
||||
x_ "$mk" -f coreboot "$xgcctree"
|
||||
|
||||
[ -n "$depend" ] && \
|
||||
for d in $depend ; do
|
||||
|
||||
x_ ./mk -f $d
|
||||
x_ "$mk" -f $d
|
||||
done
|
||||
fi
|
||||
|
||||
clone_project
|
||||
$if_single_tree \
|
||||
clone_project; :
|
||||
}
|
||||
|
||||
clone_project()
|
||||
{
|
||||
if ! singletree "$project"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
loc="src/$project"
|
||||
|
||||
if [ -d "$loc" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ -d "$loc" ] && return 0
|
||||
|
||||
remkdir "${tmpgit%/*}"
|
||||
git_prep "$url" "$bkup_url" "$xbmkpwd/config/$project/patches" "$loc"
|
||||
@@ -84,23 +58,16 @@ git_prep()
|
||||
_patchdir="$3"
|
||||
_loc="$4" # $1 and $2 are gitrepo and gitrepo_backup
|
||||
|
||||
if [ -z "$rev" ]; then
|
||||
|
||||
[ -z "$rev" ] && \
|
||||
err "$project/$tree: rev not set" "git_prep" "$@"
|
||||
fi
|
||||
|
||||
xbget git "$1" "$2" "$tmpgit" "$rev" "$_patchdir"
|
||||
|
||||
if singletree "$project" || \
|
||||
[ $# -gt 4 ]; then
|
||||
|
||||
if singletree "$project" || [ $# -gt 4 ]; then
|
||||
dx_ fetch_submodule "$mdir/module.list"
|
||||
fi
|
||||
|
||||
if [ "$_loc" != "${_loc%/*}" ]; then
|
||||
|
||||
x_ xbmkdir "${_loc%/*}"
|
||||
fi
|
||||
[ "$_loc" != "${_loc%/*}" ] && \
|
||||
x_ mkdir -p "${_loc%/*}"
|
||||
|
||||
x_ mv "$tmpgit" "$_loc"
|
||||
}
|
||||
@@ -108,73 +75,28 @@ git_prep()
|
||||
fetch_submodule()
|
||||
{
|
||||
mcfgdir="$mdir/${1##*/}"
|
||||
eval "`newvar st subcurl subcurl_bkup subgit subgit_bkup subhash`"
|
||||
|
||||
st=""
|
||||
subcurl=""
|
||||
subcurl_bkup=""
|
||||
subgit=""
|
||||
subgit_bkup=""
|
||||
subhash=""
|
||||
|
||||
if e "$mcfgdir/module.cfg" f missing; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
e "$mcfgdir/module.cfg" f missing && return 0
|
||||
. "$mcfgdir/module.cfg" || \
|
||||
err "Can't read '$mcfgdir/module.cfg'" "fetch_submodules" "$@"
|
||||
|
||||
if [ -n "$subgit" ] || \
|
||||
[ -n "$subgit_bkup" ]; then
|
||||
|
||||
st="$st git"
|
||||
fi
|
||||
|
||||
if [ -n "$subcurl" ] || \
|
||||
[ -n "$subcurl_bkup" ]; then
|
||||
|
||||
st="$st curl"
|
||||
fi
|
||||
|
||||
st="${st# }"
|
||||
|
||||
if [ "$st" = "git curl" ]; then
|
||||
|
||||
[ -n "$subgit" ] && [ -n "$subgit_bkup" ] && \
|
||||
st="git"
|
||||
[ -n "$subcurl" ] && [ -n "$subcurl_bkup" ] && \
|
||||
st="curl$st"
|
||||
[ "$st" = "curlgit" ] && \
|
||||
err "$mdir: git+curl defined" "fetch_submodule" "$@"
|
||||
fi
|
||||
|
||||
if [ -z "$st" ]; then
|
||||
|
||||
[ -z "$st" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$st" = "curl" ]; then
|
||||
|
||||
if [ -z "$subcurl" ] || [ -z "$subcurl_bkup" ]; then
|
||||
err "subcurl/subcurl_bkup not both set" \
|
||||
"fetch_submodule" "$@"
|
||||
fi
|
||||
|
||||
elif [ -z "$subgit" ] || \
|
||||
[ -z "$subgit_bkup" ]; then
|
||||
|
||||
err "subgit/subgit_bkup not both set" "fetch_submodule" "$@"
|
||||
|
||||
elif [ -z "$subhash" ]; then
|
||||
|
||||
[ -z "$subhash" ] && \
|
||||
err "subhash not set" "fetch_submodule" "$@"
|
||||
fi
|
||||
|
||||
if [ "$st" = "git" ]; then
|
||||
|
||||
[ "$st" = "git" ] && \
|
||||
x_ rm -Rf "$tmpgit/$1"
|
||||
|
||||
xbget "$st" "$subgit" "$subgit_bkup" "$tmpgit/$1" \
|
||||
"$subhash" "$mdir/${1##*/}/patches"
|
||||
else
|
||||
|
||||
xbget "$st" "$subcurl" "$subcurl_bkup" "$tmpgit/$1" \
|
||||
"$subhash" "$mdir/${1##*/}/patches"
|
||||
fi
|
||||
eval "xbget \"\$st\" \"\$sub$st\" \"\$sub${st}_bkup\" \"\$tmpgit/\$1\" \
|
||||
\"\$subhash\" \"\$mdir/\${1##*/}/patches\""
|
||||
}
|
||||
|
||||
# TODO: in the following functions, argument numbers are used
|
||||
@@ -183,151 +105,85 @@ fetch_submodule()
|
||||
|
||||
xbget()
|
||||
{
|
||||
if [ "$1" != "curl" ] && \
|
||||
[ "$1" != "copy" ] && \
|
||||
[ "$1" != "git" ]; then
|
||||
|
||||
[ "$1" != "curl" ] && [ "$1" != "copy" ] && [ "$1" != "git" ] && \
|
||||
err "Bad dlop (arg 1)" "xbget" "$@"
|
||||
fi
|
||||
|
||||
for url in "$2" "$3"; do
|
||||
|
||||
if [ -z "$url" ]; then
|
||||
|
||||
[ -z "$url" ] && \
|
||||
err "empty URL given in" "xbget" "$@"
|
||||
|
||||
elif ! try_fetch "$url" "$@"; then
|
||||
|
||||
try_fetch_$1 "$url" "$@" || \
|
||||
continue
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
|
||||
git)
|
||||
|
||||
if [ ! -d "$4" ]; then
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
if [ ! -f "$4" ]; then
|
||||
continue
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
return 0 # successful download/copy
|
||||
[ -e "$4" ] && return 0; : # successful download/copy
|
||||
done
|
||||
|
||||
err "failed to download file/repository" "xbget" "$@"; :
|
||||
}
|
||||
|
||||
try_fetch()
|
||||
{
|
||||
if [ "$2" = "git" ]; then
|
||||
|
||||
if ! try_fetch_git "$@"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
else
|
||||
|
||||
if ! try_fetch_file "$@"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
try_fetch_git()
|
||||
{
|
||||
# 1st argument $1 is the current git remote being tried,
|
||||
# let's say it was https://foo.example.com/repo, then cached
|
||||
# directories becomes cache/mirror/foo.example.com/repo
|
||||
|
||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||
|
||||
cached="clone"
|
||||
[ "$XBMK_CACHE_MIRROR" = "y" ] && \
|
||||
cached="mirror"
|
||||
else
|
||||
|
||||
cached="clone"
|
||||
fi
|
||||
|
||||
cached="$cached/${1#*://}"
|
||||
cached="$XBMK_CACHE/$cached"
|
||||
|
||||
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
||||
|
||||
if ! try_$2 "$cached" "$@"; then
|
||||
x_ mkdir -p "${5%/*}" "${cached%/*}"
|
||||
|
||||
try_$2 "$cached" "$@" || \
|
||||
return 1
|
||||
elif [ ! -d "$cached" ]; then
|
||||
|
||||
[ ! -d "$cached" ] && \
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$5" ]; then
|
||||
|
||||
tmpclone "$cached" "$5" "$6" "$7" || \
|
||||
err "Can't clone final repo" "try_fetch" "$@"; :
|
||||
fi
|
||||
|
||||
if [ ! -d "$5" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
[ ! -d "$5" ] && \
|
||||
return 1; :
|
||||
}
|
||||
|
||||
try_fetch_file()
|
||||
try_fetch_copy()
|
||||
{
|
||||
try_fetch_curl "$@" || return 1; :
|
||||
}
|
||||
|
||||
try_fetch_curl()
|
||||
{
|
||||
cached="file/$6"
|
||||
cached="$XBMK_CACHE/$cached"
|
||||
|
||||
x_ xbmkdir "${5%/*}" "${cached%/*}"
|
||||
x_ mkdir -p "${5%/*}" "${cached%/*}"
|
||||
|
||||
if bad_checksum "$6" "$cached" 2>/dev/null; then
|
||||
|
||||
x_ rm -f "$cached"
|
||||
fi
|
||||
|
||||
if [ ! -f "$cached" ]; then
|
||||
|
||||
if ! try_$2 "$cached" "$@"; then
|
||||
|
||||
[ -f "$cached" ] || \
|
||||
try_$2 "$cached" "$@" || \
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -f "$5" ]; then
|
||||
if bad_checksum "$6" "$5" 2>/dev/null; then
|
||||
x_ cp "$cached" "$5"
|
||||
fi
|
||||
fi
|
||||
[ -f "$5" ] && bad_checksum "$6" "$5" 2>/dev/null && \
|
||||
x_ cp "$cached" "$5"
|
||||
|
||||
if [ ! -f "$cached" ]; then
|
||||
|
||||
return 1
|
||||
|
||||
elif bad_checksum "$6" "$cached"; then
|
||||
|
||||
x_ rm -f "$cached"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ "$cached" != "$5" ]; then
|
||||
|
||||
[ "$cached" != "$5" ] && \
|
||||
x_ cp "$cached" "$5"
|
||||
fi
|
||||
|
||||
if bad_checksum "$6" "$5"; then
|
||||
|
||||
x_ rm -f "$5"
|
||||
return 1
|
||||
|
||||
elif [ ! -f "$5" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
@@ -336,22 +192,8 @@ try_curl()
|
||||
{
|
||||
ua="Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Firefox/91.0"
|
||||
|
||||
case "$2" in
|
||||
|
||||
https://www.supermicro.com/*)
|
||||
|
||||
ua="curl/8.6.0"
|
||||
;;
|
||||
|
||||
*)
|
||||
:
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
( x_ curl --location --retry 3 -A "$ua" "$2" -o "$1" ) \
|
||||
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) \
|
||||
|| return 1; :
|
||||
|| ( x_ wget --tries 3 -U "$ua" "$2" -O "$1" ) || return 1; :
|
||||
}
|
||||
|
||||
try_copy()
|
||||
@@ -367,62 +209,43 @@ try_git()
|
||||
x_ rm -Rf "$tmpgitcache"
|
||||
|
||||
if [ ! -d "$gitdest" ]; then
|
||||
|
||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||
|
||||
( x_ git clone --mirror "$2" "$tmpgitcache" ) || \
|
||||
return 1
|
||||
else
|
||||
|
||||
( x_ git clone "$2" "$tmpgitcache" ) || return 1
|
||||
fi
|
||||
|
||||
x_ xbmkdir "${gitdest%/*}"
|
||||
x_ mkdir -p "${gitdest%/*}"
|
||||
x_ mv "$tmpgitcache" "$gitdest"
|
||||
fi
|
||||
|
||||
if git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
||||
[ "$forcepull" != "y" ]; then
|
||||
|
||||
# don't try to pull the latest changes if the given target
|
||||
# revision already exists locally. this saves a lot of time
|
||||
# during release builds, and reduces the chance that we will
|
||||
# interact with grub.git or gnulib.git overall during runtime
|
||||
|
||||
return 0
|
||||
fi
|
||||
git -C "$gitdest" show "$7" 1>/dev/null 2>/dev/null && \
|
||||
[ "$forcepull" != "y" ] && \
|
||||
return 0 # don't pull changes if target rev exists locally
|
||||
|
||||
if [ "$XBMK_CACHE_MIRROR" = "y" ]; then
|
||||
|
||||
( x_ git -C "$gitdest" fetch ) || :; :
|
||||
( x_ git -C "$gitdest" update-server-info ) || :; :
|
||||
else
|
||||
|
||||
( x_ git -C "$gitdest" pull --all ) || :; :
|
||||
fi
|
||||
}
|
||||
|
||||
bad_checksum()
|
||||
{
|
||||
if e "$2" f missing; then
|
||||
|
||||
e "$2" f missing && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
build_sbase
|
||||
|
||||
eval "$build_sbase"
|
||||
csum="$(x_ "$sha512sum" "$2" | awk '{print $1}')" || \
|
||||
err "!sha512 '$2' $1" bad_checksum "$@"
|
||||
|
||||
if [ "$csum" = "$1" ]; then
|
||||
|
||||
[ "$csum" = "$1" ] && \
|
||||
return 1
|
||||
else
|
||||
|
||||
x_ rm -f "$2"
|
||||
|
||||
printf "BAD SHA512 %s, '%s'; need %s\n" "$csum" "$2" "$1" 1>&2
|
||||
fi
|
||||
x_ rm -f "$2"
|
||||
printf "BAD SHA512 %s, '%s'; need %s\n" "$csum" "$2" "$1" 1>&2
|
||||
}
|
||||
|
||||
tmpclone()
|
||||
@@ -430,9 +253,8 @@ tmpclone()
|
||||
( x_ git clone "$1" "$2" ) || return 1
|
||||
( x_ git -C "$2" reset --hard "$3" ) || return 1
|
||||
|
||||
if [ ! -d "$4" ]; then
|
||||
[ ! -d "$4" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
tmpclone_patchlist="`mktemp || err "Can't create tmp patch list"`" || \
|
||||
err "Can't create tmp patch list" "tmpclone" "$@"
|
||||
+97
-320
@@ -2,52 +2,23 @@
|
||||
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
# Copyright (c) 2020-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2025 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||
|
||||
export LANG=C.UTF-8
|
||||
export LC_COLLATE=C.UTF-8
|
||||
export LC_ALL=C.UTF-8
|
||||
|
||||
projectname="libreboot"
|
||||
projectsite="https://libreboot.org/"
|
||||
|
||||
# TODO: consider just erroring here instead of hardcoding a default
|
||||
if [ -z "${PATH+x}" ]; then
|
||||
export PATH="/usr/local/bin:/usr/bin:/bin:/usr/local/games:/usr/games"
|
||||
fi
|
||||
|
||||
sha512sum="util/sbase/sha512sum"
|
||||
|
||||
aur_notice=""
|
||||
basetmp=""
|
||||
board=""
|
||||
checkvarschk=""
|
||||
checkvarsxbmk=""
|
||||
configdir=""
|
||||
datadir=""
|
||||
is_child=""
|
||||
python=""
|
||||
pyver=""
|
||||
reinstall=""
|
||||
relname=""
|
||||
version=""
|
||||
versiondate=""
|
||||
xbmklock=""
|
||||
xbmkpath=""
|
||||
xbmkpwd=""
|
||||
xbmkpwd=""
|
||||
xbtmp=""
|
||||
eval "`newvar aur_notice basetmp board checkvarschk checkvarsxbmk configdir \
|
||||
datadir is_child python pyver reinstall relname version versiondate \
|
||||
xbmklock xbmkpath xbtmp sha512sum`"
|
||||
|
||||
xbmk_init()
|
||||
{
|
||||
xbmkpwd="`pwd || err "Cannot generate PWD"`" || err "!" xbmk_init "$@"
|
||||
xbmklock="$xbmkpwd/lock"
|
||||
basetmp="$xbmkpwd/xbmkwd"
|
||||
sha512sum="$xbmkpwd/util/sbase/sha512sum"
|
||||
|
||||
if [ $# -gt 0 ] && [ "$1" = "dependencies" ]; then
|
||||
|
||||
x_ xbmkpkg "$@"
|
||||
exit 0
|
||||
fi
|
||||
@@ -55,193 +26,115 @@ xbmk_init()
|
||||
id -u 1>/dev/null 2>/dev/null || \
|
||||
err "suid check failed" "xbmk_init" "$@"
|
||||
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
|
||||
[ "$(id -u)" = "0" ] && \
|
||||
err "this command as root is not permitted" "xbmk_init" "$@"
|
||||
fi
|
||||
|
||||
export PWD="$xbmkpwd"
|
||||
x_ xbmkdir "$basetmp"
|
||||
x_ mkdir -p "$basetmp" "cache"
|
||||
|
||||
if [ ! -e "cache" ]; then
|
||||
|
||||
x_ xbmkdir "cache"
|
||||
fi
|
||||
|
||||
for init_cmd in get_version set_env set_threads git_init child_exec; do
|
||||
|
||||
if ! xbmk_$init_cmd "$@"; then
|
||||
|
||||
break
|
||||
fi
|
||||
done
|
||||
eval "$(printf "get_ver set_env set_threads git_init xchild\n" | awk \
|
||||
'{ for (i=1; i<=NF; i++) $i = $i " \"$@\" || return 0;"; print }')"
|
||||
}
|
||||
|
||||
xbmkpkg()
|
||||
{
|
||||
xchk xbmkpkg "$@"
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
|
||||
[ $# -gt 2 ] && \
|
||||
reinstall="$3"
|
||||
fi
|
||||
|
||||
. "config/dependencies/$2" || \
|
||||
err "Can't read 'config/dependencies/$2'" "xbmkpkg" "$@"
|
||||
|
||||
if [ -z "$pkg_add" ] || \
|
||||
[ -z "$pkglist" ]; then
|
||||
|
||||
if [ -z "$pkg_add" ] || [ -z "$pkglist" ]; then
|
||||
err "pkg_add/pkglist not both set" "xbmkpkg" "$@"
|
||||
fi
|
||||
|
||||
if [ "$2" == "gentoo" ]; then
|
||||
|
||||
if [ -z "$pkg_use" ] || \
|
||||
[ -z "$pkg_use_file" ]; then
|
||||
|
||||
if [ -z "$pkg_use" ] || [ -z "$pkg_use_file" ]; then
|
||||
err "pkg_use/pkg_use_file not both set" "xbmkpkg" "$@"
|
||||
fi
|
||||
|
||||
printf "Updating package use...\n"
|
||||
printf "Writing into %s" "$pkg_use_file..."
|
||||
|
||||
if [ ! -d "`dirname $pkg_use_file`" ]; then
|
||||
|
||||
x_ mkdir -p "`dirname $pkg_use_file`"
|
||||
fi
|
||||
x_ mkdir -p "`dirname $pkg_use_file`"
|
||||
|
||||
printf "%s\n" "$pkg_use" >> "$pkg_use_file"
|
||||
fi
|
||||
|
||||
x_ $pkg_add $pkglist
|
||||
|
||||
if [ -n "$aur_notice" ]; then
|
||||
|
||||
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2
|
||||
fi
|
||||
[ -n "$aur_notice" ] && \
|
||||
printf "You need AUR packages: %s\n" "$aur_notice" 1>&2; :
|
||||
}
|
||||
|
||||
xbmk_get_version()
|
||||
get_ver()
|
||||
{
|
||||
if [ -f ".version" ]; then
|
||||
|
||||
[ ! -f ".version" ] || \
|
||||
read -r version < ".version" || \
|
||||
err "can't read version file" "xbmk_get_version" "$@"
|
||||
fi
|
||||
|
||||
if [ -f ".versiondate" ]; then
|
||||
|
||||
err "can't read version file" "get_ver" "$@"
|
||||
[ ! -f ".versiondate" ] || \
|
||||
read -r versiondate < ".versiondate" || \
|
||||
err "can't read versiondate" xbmk_get_version "$@"
|
||||
fi
|
||||
err "can't read versiondate" get_ver "$@"
|
||||
|
||||
if [ -f ".version" ] && \
|
||||
[ -z "$version" ]; then
|
||||
|
||||
err "version not set" "xbmk_get_version" "$@"
|
||||
fi
|
||||
|
||||
if [ -f ".versiondate" ] && \
|
||||
[ -z "$versiondate" ]; then
|
||||
|
||||
err "versiondate not set" "xbmk_get_version" "$@"
|
||||
fi
|
||||
|
||||
if [ ! -e ".git" ] && \
|
||||
[ ! -f ".version" ]; then
|
||||
[ -f ".version" ] && [ -z "$version" ] && \
|
||||
err "version not set" "get_ver" "$@"
|
||||
[ -f ".versiondate" ] && [ -z "$versiondate" ] && \
|
||||
err "versiondate not set" "get_ver" "$@"
|
||||
|
||||
[ ! -e ".git" ] && [ ! -f ".version" ] && \
|
||||
version="unknown"
|
||||
fi
|
||||
|
||||
if [ ! -e ".git" ] && \
|
||||
[ ! -f ".versiondate" ]; then
|
||||
|
||||
[ ! -e ".git" ] && [ ! -f ".versiondate" ] && \
|
||||
versiondate="1716415872"
|
||||
fi
|
||||
|
||||
xbmk_sanitize_version
|
||||
|
||||
if [ -n "$version" ]; then
|
||||
|
||||
relname="$projectname-$version"
|
||||
fi
|
||||
[ -n "$version" ] && \
|
||||
relname="$projectname-$version"; :
|
||||
}
|
||||
|
||||
# a parent instance will cause this function to return 0.
|
||||
# a child instance will return 1, skipping further initialisation
|
||||
# after this function is called.
|
||||
xbmk_set_env()
|
||||
set_env()
|
||||
{
|
||||
is_child="n"
|
||||
|
||||
xbmkpath="$PATH"
|
||||
|
||||
# unify all temporary files/directories in a single TMPDIR
|
||||
|
||||
if [ -n "${TMPDIR+x}" ] && \
|
||||
[ "${TMPDIR%_*}" != "$basetmp/xbmk" ]; then
|
||||
|
||||
[ -n "${TMPDIR+x}" ] && [ "${TMPDIR%_*}" != "$basetmp/xbmk" ] && \
|
||||
unset TMPDIR
|
||||
fi
|
||||
|
||||
if [ -n "${TMPDIR+x}" ]; then
|
||||
|
||||
export TMPDIR="$TMPDIR"
|
||||
xbtmp="$TMPDIR"
|
||||
fi
|
||||
|
||||
if [ -n "${TMPDIR+x}" ]; then
|
||||
|
||||
[ -n "${TMPDIR+x}" ] && \
|
||||
is_child="y"
|
||||
fi
|
||||
|
||||
if [ "$is_child" = "y" ]; then
|
||||
|
||||
# child instance of xbmk, so we stop init after this point
|
||||
# and execute the given user command upon return:
|
||||
|
||||
xbmk_child_set_env
|
||||
|
||||
return 1
|
||||
else
|
||||
|
||||
# parent instance of xbmk, so we continue initialising.
|
||||
# a parent instance of xbmk never processes its own
|
||||
# command directly; instead, it calls a child instance
|
||||
# of xbmk, and exits with the corresponding return status.
|
||||
|
||||
xbmk_parent_set_env
|
||||
|
||||
return 0
|
||||
return 1 # child instance. discontinue initialisation.
|
||||
fi
|
||||
xbmk_parent_set_env
|
||||
}
|
||||
|
||||
xbmk_child_set_env()
|
||||
{
|
||||
xbmk_child_set_tmp
|
||||
|
||||
if [ -z "${XBMK_CACHE+x}" ]; then
|
||||
|
||||
err "XBMK_CACHE unset on child" "xbmk_set_env" "$@"
|
||||
fi
|
||||
|
||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||
|
||||
xbmk_set_threads; :
|
||||
fi
|
||||
|
||||
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
||||
|
||||
xbmk_set_mirror
|
||||
fi
|
||||
[ -z "${XBMK_CACHE+x}" ] && \
|
||||
err "XBMK_CACHE unset on child" "set_env" "$@"
|
||||
[ -z "${XBMK_THREADS+x}" ] && \
|
||||
set_threads
|
||||
[ -z "${XBMK_CACHE_MIRROR+x}" ] && \
|
||||
xbmk_set_mirror; :
|
||||
}
|
||||
|
||||
xbmk_child_set_tmp()
|
||||
{
|
||||
badtmp=""
|
||||
locktmp=""
|
||||
xbtmpchk=""
|
||||
eval "`newvar badtmp locktmp xbtmpchk`"
|
||||
|
||||
xbtmpchk="`findpath "$TMPDIR" || err "!findpath $TMPDIR"`" || \
|
||||
err "!findpath '$TMPDIR'" "xbmk_child_set_tmp" "$@"
|
||||
@@ -250,15 +143,12 @@ xbmk_child_set_tmp()
|
||||
err "can't read '$xbmklock'" "xbmk_child_set_tmp" "$@"
|
||||
|
||||
if [ "$locktmp" != "$xbtmpchk" ]; then
|
||||
|
||||
badtmp="TMPDIR '$xbtmpchk' changed; was '$locktmp'"
|
||||
|
||||
printf "bad TMPDIR init, '%s': %s\n" "$TMPDIR" "$badtmp" 1>&2
|
||||
err "'$xbmklock' present with bad tmpdir. is a build running?"
|
||||
fi
|
||||
|
||||
xbtmp="$xbtmpchk"
|
||||
|
||||
export TMPDIR="$xbtmpchk"
|
||||
}
|
||||
|
||||
@@ -267,7 +157,7 @@ xbmk_parent_set_env()
|
||||
xbmk_parent_check_tmp
|
||||
|
||||
printf "%s\n" "$xbtmp" > "$xbmklock" || \
|
||||
err "cannot create '$xbmklock'" xbmk_set_env "$@"; :
|
||||
err "cannot create '$xbmklock'" set_env "$@"; :
|
||||
|
||||
# not really critical for security, but it's a barrier
|
||||
# against the user to make them think twice before deleting it
|
||||
@@ -275,15 +165,11 @@ xbmk_parent_set_env()
|
||||
|
||||
x_ chmod -w "$xbmklock"
|
||||
|
||||
xbmk_parent_set_export
|
||||
forx 'xbmk_%s' parent_set_export set_version
|
||||
|
||||
xbmk_set_version
|
||||
remkdir "$xbtmp" "$xbtmp/xbmkpath"
|
||||
|
||||
remkdir "$xbtmp" "$xbtmp/gnupath" "$xbtmp/xbmkpath"
|
||||
|
||||
xbmk_set_pyver
|
||||
|
||||
xbmk_set_mirror
|
||||
forx 'xbmk_set_%s' pyver mirror
|
||||
}
|
||||
|
||||
xbmk_parent_check_tmp()
|
||||
@@ -297,29 +183,20 @@ xbmk_parent_check_tmp()
|
||||
x_ touch "$xbmklist"
|
||||
|
||||
for xtmpdir in "$basetmp"/xbmk_*; do
|
||||
|
||||
if [ -e "$xtmpdir" ]; then
|
||||
|
||||
[ ! -e "$xtmpdir" ] || \
|
||||
printf "%s\n" "$xtmpdir" >> "$xbmklist" || \
|
||||
err "can't write '$xtmpdir' to '$xbmklist'" \
|
||||
"xbmk_parent_check_tmp" "$@"; :
|
||||
fi
|
||||
done
|
||||
|
||||
# set up a unified temporary directory, for common deletion later:
|
||||
|
||||
export TMPDIR="`x_ mktemp -d -t xbmk_XXXXXXXX`" || \
|
||||
err "can't export TMPDIR" "xbmk_parent_check_tmp" "$@"
|
||||
|
||||
xbtmp="$TMPDIR"
|
||||
|
||||
while read -r xtmpdir; do
|
||||
|
||||
if [ "$xtmpdir" = "$xbtmp" ]; then
|
||||
|
||||
err "pre-existing '$xbtmp'" "xbmk_parent_check_tmp" "$@"
|
||||
fi
|
||||
|
||||
[ "$xtmpdir" = "$xbtmp" ] && \
|
||||
err "pre-existing $xbtmp" xbmk_parent_check_tmp "$@"; :
|
||||
done < "$xbmklist" || \
|
||||
err "Can't read xbmklist: '$xbmklist'" "xbmk_parent_check_tmp" "$@"
|
||||
|
||||
@@ -330,133 +207,84 @@ xbmk_parent_set_export()
|
||||
{
|
||||
export XBMK_CACHE="$xbmkpwd/cache"
|
||||
|
||||
if [ -e "$XBMK_CACHE" ] && \
|
||||
[ ! -d "$XBMK_CACHE" ]; then
|
||||
|
||||
[ -e "$XBMK_CACHE" ] && [ ! -d "$XBMK_CACHE" ] && \
|
||||
err "cachedir '$XBMK_CACHE' is a file" \
|
||||
"xbmk_parent_set_export" "$@"
|
||||
fi
|
||||
|
||||
export PATH="$xbtmp/xbmkpath:$xbtmp/gnupath:$PATH"
|
||||
export PATH="$xbtmp/xbmkpath:$PATH"
|
||||
xbmkpath="$PATH"
|
||||
|
||||
# if "y": a coreboot target won't be built if target.cfg says release=n
|
||||
# (this is used to exclude certain build targets from releases)
|
||||
|
||||
if [ -z "${XBMK_RELEASE+x}" ]; then
|
||||
|
||||
[ -z "${XBMK_RELEASE+x}" ] && \
|
||||
export XBMK_RELEASE="n"
|
||||
fi
|
||||
|
||||
if [ "$XBMK_RELEASE" = "Y" ]; then
|
||||
|
||||
[ "$XBMK_RELEASE" = "Y" ] && \
|
||||
export XBMK_RELEASE="y"
|
||||
fi
|
||||
|
||||
if [ "$XBMK_RELEASE" != "y" ]; then
|
||||
|
||||
export XBMK_RELEASE="n"
|
||||
fi
|
||||
[ "$XBMK_RELEASE" != "y" ] && \
|
||||
export XBMK_RELEASE="n"; :
|
||||
}
|
||||
|
||||
xbmk_set_threads()
|
||||
set_threads()
|
||||
{
|
||||
if [ -z "${XBMK_THREADS+x}" ]; then
|
||||
|
||||
[ -z "${XBMK_THREADS+x}" ] && \
|
||||
export XBMK_THREADS=1
|
||||
fi
|
||||
|
||||
if ! expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
||||
1>/dev/null 2>/dev/null; then
|
||||
|
||||
export XBMK_THREADS=1
|
||||
fi
|
||||
expr "X$XBMK_THREADS" : "X-\{0,1\}[0123456789][0123456789]*$" \
|
||||
1>/dev/null 2>/dev/null || \
|
||||
export XBMK_THREADS=1; :
|
||||
}
|
||||
|
||||
xbmk_set_version()
|
||||
{
|
||||
version_="$version"
|
||||
|
||||
if [ -e ".git" ]; then
|
||||
|
||||
[ ! -e ".git" ] || \
|
||||
version="$(git describe --tags HEAD 2>&1)" || \
|
||||
version="git-$(git rev-parse HEAD 2>&1)" || \
|
||||
version="$version_"
|
||||
fi
|
||||
|
||||
versiondate_="$versiondate"
|
||||
|
||||
if [ -e ".git" ]; then
|
||||
|
||||
[ ! -e ".git" ] || \
|
||||
versiondate="$(git show --no-patch --no-notes \
|
||||
--pretty='%ct' HEAD)" || versiondate="$versiondate_"
|
||||
fi
|
||||
|
||||
if [ -z "$version" ] || \
|
||||
[ -z "$versiondate" ]; then
|
||||
|
||||
err "version and/or versiondate unset" "xbmk_set_version" "$@"
|
||||
fi
|
||||
|
||||
update_xbmkver "."
|
||||
|
||||
relname="$projectname-$version"
|
||||
|
||||
export LOCALVERSION="-$projectname-${version%%-*}"
|
||||
}
|
||||
|
||||
xbmk_set_pyver()
|
||||
{
|
||||
pyver="2"
|
||||
python="python3"
|
||||
pyver="2"
|
||||
pyv="import sys; print(sys.version_info[:])"
|
||||
|
||||
if ! pybin python3 1>/dev/null; then
|
||||
|
||||
pybin python3 1>/dev/null || \
|
||||
python="python"
|
||||
fi
|
||||
|
||||
if [ "$python" = "python3" ]; then
|
||||
|
||||
[ "$python" = "python3" ] && \
|
||||
pyver="3"
|
||||
fi
|
||||
|
||||
if ! pybin "$python" 1>/dev/null; then
|
||||
|
||||
pybin "$python" 1>/dev/null || \
|
||||
pyver=""
|
||||
fi
|
||||
|
||||
if [ -n "$pyver" ]; then
|
||||
|
||||
[ -z "$pyver" ] || \
|
||||
"`x_ pybin "$python"`" -c "$pyv" 1>/dev/null \
|
||||
2>/dev/null || \
|
||||
err "Can't detect Python version." "xbmk_set_pyver" "$@"
|
||||
fi
|
||||
|
||||
if [ -n "$pyver" ]; then
|
||||
|
||||
pyver="$("$(pybin "$python")" -c "$pyv" | awk '{print $1}')"
|
||||
|
||||
pyver="${pyver#(}"
|
||||
|
||||
pyver="${pyver%,}"
|
||||
fi
|
||||
|
||||
if [ "${pyver%%.*}" != "3" ]; then
|
||||
|
||||
[ "${pyver%%.*}" != "3" ] && \
|
||||
err "Bad python version (must by 3.x)" "xbmk_set_pyver" "$@"
|
||||
fi
|
||||
|
||||
# set up python in PATH (environmental variable):
|
||||
|
||||
(
|
||||
x_ cd "$xbtmp/xbmkpath"
|
||||
|
||||
x_ ln -s "`x_ pybin "$python"`" python || \
|
||||
err "can't make symlink" "xbmk_set_pyver" "$@"
|
||||
|
||||
) || \
|
||||
err "Can't link Python in $xbtmp/xbmkpath" "xbmk_set_pyver" "$@"; :
|
||||
) || err "Can't link Python in $xbtmp/xbmkpath" xbmk_set_pyver "$@"; :
|
||||
}
|
||||
|
||||
# Use direct path, to prevent a hang if Python is using a virtual environment,
|
||||
@@ -467,60 +295,37 @@ pybin()
|
||||
py="import sys; quit(1) if sys.prefix == sys.base_prefix else quit(0)"
|
||||
|
||||
venv=1
|
||||
|
||||
if ! command -v "$1" 1>/dev/null 2>/dev/null; then
|
||||
|
||||
command -v "$1" 1>/dev/null 2>/dev/null || \
|
||||
venv=0
|
||||
fi
|
||||
|
||||
if [ $venv -gt 0 ]; then
|
||||
|
||||
if ! "$1" -c "$py" 1>/dev/null 2>/dev/null; then
|
||||
|
||||
[ $venv -lt 1 ] || \
|
||||
"$1" -c "$py" 1>/dev/null 2>/dev/null || \
|
||||
venv=0
|
||||
fi
|
||||
fi
|
||||
|
||||
# ideally, don't rely on PATH or hardcoded paths if python venv.
|
||||
# use the *real*, direct executable linked to by the venv symlink:
|
||||
|
||||
if [ $venv -gt 0 ] && \
|
||||
[ -L "`command -v "$1" 2>/dev/null`" ]; then
|
||||
|
||||
# try the direct path from PATH first. the binary specified by venv
|
||||
# can be called directly, which then removes use of the venv
|
||||
if [ $venv -gt 0 ] && [ -L "`command -v "$1" 2>/dev/null`" ]; then
|
||||
pypath="$(findpath \
|
||||
"$(command -v "$1" 2>/dev/null)" 2>/dev/null || :)"
|
||||
|
||||
if [ -e "$pypath" ] && \
|
||||
[ ! -d "$pypath" ] && \
|
||||
if [ -e "$pypath" ] && [ ! -d "$pypath" ] && \
|
||||
[ -x "$pypath" ]; then
|
||||
|
||||
printf "%s\n" "$pypath"
|
||||
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
# if python venv: fall back to common PATH directories for checking:
|
||||
|
||||
[ $venv -gt 0 ] && for pypath in "/usr/local/bin" "/usr/bin"; do
|
||||
|
||||
if [ -e "$pypath/$1" ] && \
|
||||
! -d "$pypath/$1" ] && \
|
||||
if [ -e "$pypath/$1" ] && [ ! -d "$pypath/$1" ] && \
|
||||
[ -x "$pypath/$1" ]; then
|
||||
|
||||
printf "%s/%s\n" "$pypath" "$1"
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
done && return 1
|
||||
|
||||
# Defer to normal command -v if not a venv:
|
||||
|
||||
if ! command -v "$1" 2>/dev/null; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
# Defer to normal command -v if not a venv
|
||||
command -v "$1" 2>/dev/null || \
|
||||
return 1; :
|
||||
}
|
||||
|
||||
xbmk_set_mirror()
|
||||
@@ -533,79 +338,51 @@ xbmk_set_mirror()
|
||||
# it's slower, and uses more disk space, and some upstreams might not
|
||||
# appreciate it, so it should only be used for development or archival
|
||||
|
||||
if [ -z "${XBMK_CACHE_MIRROR+x}" ]; then
|
||||
|
||||
[ -z "${XBMK_CACHE_MIRROR+x}" ] && \
|
||||
export XBMK_CACHE_MIRROR="n"
|
||||
fi
|
||||
|
||||
if [ "$XBMK_CACHE_MIRROR" != "y" ]; then
|
||||
|
||||
export XBMK_CACHE_MIRROR="n"
|
||||
fi
|
||||
[ "$XBMK_CACHE_MIRROR" != "y" ] && \
|
||||
export XBMK_CACHE_MIRROR="n"; :
|
||||
}
|
||||
|
||||
xbmk_git_init()
|
||||
git_init()
|
||||
{
|
||||
# the git identity check is only needed for: ./mk -b coreboot [args]
|
||||
|
||||
# the git identity check is only needed for: "$mk" -b coreboot [args]
|
||||
[ "${2-}" = "-b" ] && [ "${3-}" = "coreboot" ] && \
|
||||
for gitarg in "user.name" "user.email"; do
|
||||
|
||||
gitcmd="git config --includes $gitarg"
|
||||
|
||||
if ! $gitcmd 1>/dev/null 2>/dev/null; then
|
||||
|
||||
git config --includes $gitarg 1>/dev/null 2>/dev/null || \
|
||||
err "Run this first: $gitcmd \"your ${gitcmd##*.}\"" \
|
||||
"xbmk_git_init" "$@"
|
||||
fi
|
||||
"git_init" "$@"; :
|
||||
done
|
||||
|
||||
if [ -L ".git" ]; then
|
||||
|
||||
err "'$xbmkpwd/.git' is a symlink" "xbmk_git_init" "$@"
|
||||
fi
|
||||
|
||||
if [ -e ".git" ]; then
|
||||
|
||||
[ -L ".git" ] && \
|
||||
err "'$xbmkpwd/.git' is a symlink" "git_init" "$@"
|
||||
[ -e ".git" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
# GNU-specific extensions of date are used.
|
||||
# TODO: that is a bug. fix it!
|
||||
|
||||
x_ date --version | grep "GNU coreutils" 1>/dev/null 2>/dev/null || \
|
||||
err "Non-GNU date implementation" "xbmk_git_init" "$@"
|
||||
|
||||
cdate="`x_ date -Rud @$versiondate || err "can't get date"`" || \
|
||||
err "can't get date" "xbmk_git_init" "$@"
|
||||
(
|
||||
export GIT_COMMITTER_DATE="@$versiondate +0000"
|
||||
export GIT_AUTHOR_DATE="@$versiondate +0000"
|
||||
|
||||
x_ git init 1>/dev/null 2>/dev/null
|
||||
|
||||
x_ git add -A . 1>/dev/null 2>/dev/null
|
||||
|
||||
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
||||
commit -m "$projectname $version" --date "$cdate" \
|
||||
commit -m "$projectname $version" \
|
||||
--author="xbmk <xbmk@example.com>" 1>/dev/null 2>/dev/null
|
||||
|
||||
x_ git -c user.name="xbmk" -c user.email="xbmk@example.com" \
|
||||
tag -a "$version" -m "$projectname $version" \
|
||||
1>/dev/null 2>/dev/null; :
|
||||
|
||||
) || err "Can't initialise workdir" git_init "$@"; :
|
||||
}
|
||||
|
||||
xbmk_child_exec()
|
||||
xchild()
|
||||
{
|
||||
xbmk_rval=0
|
||||
|
||||
( x_ ./mk "$@" ) \
|
||||
|| xbmk_rval=1
|
||||
( x_ "$mk" "$@" ) || xbmk_rval=1
|
||||
|
||||
( x_ rm -Rf "$xbtmp" ) \
|
||||
|| xbmk_rval=1
|
||||
|
||||
( x_ rm -f "$xbmklock" ) \
|
||||
|| xbmk_rval=1
|
||||
( x_ rm -Rf "$xbtmp" ) || xbmk_rval=1
|
||||
( x_ rm -f "$xbmklock" ) || xbmk_rval=1
|
||||
|
||||
exit $xbmk_rval
|
||||
}
|
||||
|
||||
xbmk_init "$@"
|
||||
@@ -2,200 +2,117 @@
|
||||
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
cbcfgsdir="config/coreboot"
|
||||
tmpromdel="$XBMK_CACHE/DO_NOT_FLASH"
|
||||
nvmutil="util/nvmutil/nvmutil"
|
||||
ifdtool="elf/coreboot/default/ifdtool"
|
||||
|
||||
checkvars="CONFIG_GBE_BIN_PATH"
|
||||
checkvars="CONFIG_GBE_BIN_PATH ${checkvarsxbmk-} ${checkvarschk-}"
|
||||
|
||||
if [ -n "$checkvarsxbmk" ]; then
|
||||
|
||||
checkvars="$checkvars $checkvarsxbmk"
|
||||
fi
|
||||
|
||||
if [ -n "$checkvarschk" ]; then
|
||||
|
||||
checkvars="$checkvars $checkvarschk"
|
||||
fi
|
||||
|
||||
archive=""
|
||||
board=""
|
||||
boarddir=""
|
||||
IFD_platform=""
|
||||
ifdprefix=""
|
||||
new_mac=""
|
||||
tmpromdir=""
|
||||
tree=""
|
||||
xchanged=""
|
||||
|
||||
eval "`setvars "" $checkvars`"
|
||||
eval "`newvar archive board boarddir IFD_platform ifdprefix \
|
||||
new_mac nuke tmpromdir tree xchanged $checkvars`"
|
||||
|
||||
inject()
|
||||
{
|
||||
remkdir "$tmpromdel"
|
||||
|
||||
if [ $# -lt 1 ]; then
|
||||
|
||||
err "No options specified" "inject" "$@"
|
||||
fi
|
||||
[ $# -lt 1 ] && err "No options specified" "inject" "$@"
|
||||
|
||||
archive="$1";
|
||||
new_mac="xx:xx:xx:xx:xx:xx"
|
||||
|
||||
nuke=""
|
||||
xchanged=""
|
||||
|
||||
[ $# -gt 1 ] && case "$2" in
|
||||
|
||||
nuke)
|
||||
|
||||
new_mac=""
|
||||
nuke="nuke"
|
||||
;;
|
||||
|
||||
setmac)
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
|
||||
new_mac="$3" && \
|
||||
|
||||
if [ -z "$new_mac" ]; then
|
||||
|
||||
err "Empty MAC address specified" "inject" "$@"
|
||||
fi
|
||||
[ -z "$new_mac" ] && \
|
||||
err "Empty MAC address" "inject" "$@"; :
|
||||
fi
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
err "Unrecognised inject mode: '$2'" "inject" "$@" ;;
|
||||
esac
|
||||
|
||||
if [ "$new_mac" = "keep" ]; then
|
||||
|
||||
[ "$new_mac" = "keep" ] && \
|
||||
new_mac=""
|
||||
fi
|
||||
|
||||
check_release
|
||||
|
||||
if check_target; then
|
||||
|
||||
if ! patch_release; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
patch_release || return 0
|
||||
fi
|
||||
|
||||
if [ "$xchanged" = "y" ]; then
|
||||
|
||||
[ "$xchanged" = "y" ] && \
|
||||
remktar
|
||||
fi
|
||||
|
||||
if [ "$xchanged" = "y" ]; then
|
||||
|
||||
printf "\n'%s' was modified\n" "$archive" 1>&2
|
||||
|
||||
else
|
||||
|
||||
printf "\n'%s' was NOT modified\n" "$archive" 1>&2
|
||||
fi
|
||||
|
||||
x_ rm -Rf "$tmpromdel"
|
||||
}
|
||||
|
||||
check_release()
|
||||
{
|
||||
if [ -L "$archive" ]; then
|
||||
|
||||
[ -L "$archive" ] && \
|
||||
err "'$archive' is a symlink" "check_release" "$@"
|
||||
fi
|
||||
|
||||
if e "$archive" f missing; then
|
||||
|
||||
e "$archive" f missing && \
|
||||
err "'$archive' missing" "check_release" "$@"
|
||||
fi
|
||||
|
||||
archivename="`basename "$archive" || err "Can't get '$archive' name"`" \
|
||||
|| err "can't get '$archive' name" "check_release" "$@"
|
||||
|
||||
if [ -z "$archivename" ]; then
|
||||
|
||||
[ -z "$archivename" ] && \
|
||||
err "Can't determine archive name" "check_release" "$@"
|
||||
fi
|
||||
|
||||
case "$archivename" in
|
||||
|
||||
*_src.tar.xz)
|
||||
|
||||
err "'$archive' is a src archive!" "check_release" "$@"
|
||||
;;
|
||||
|
||||
grub_*|seagrub_*|custom_*|seauboot_*|seabios_withgrub_*)
|
||||
|
||||
err "'$archive' is a ROM image" "check_release" "$@"
|
||||
;;
|
||||
|
||||
*.tar.xz) _stripped_prefix="${archivename#*_}"
|
||||
|
||||
board="${_stripped_prefix%.tar.xz}"
|
||||
;;
|
||||
|
||||
*)
|
||||
|
||||
err "'$archive': cannot detect board" "check_release" "$@"
|
||||
;;
|
||||
|
||||
esac; :
|
||||
}
|
||||
|
||||
check_target()
|
||||
{
|
||||
if [ "$board" != "${board#serprog_}" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
[ "$board" = "${board#serprog_}" ] || return 1
|
||||
|
||||
boarddir="$cbcfgsdir/$board"
|
||||
|
||||
. "$boarddir/target.cfg" || \
|
||||
err "Can't read '$boarddir/target.cfg'" "check_target" "$@"
|
||||
|
||||
if [ -z "$tree" ]; then
|
||||
|
||||
[ -z "$tree" ] && \
|
||||
err "tree unset in '$boarddir/target.cfg'" "check_target" "$@"
|
||||
fi
|
||||
|
||||
x_ ./mk -d coreboot "$tree"
|
||||
x_ "$mk" -d coreboot "$tree"
|
||||
|
||||
ifdtool="elf/coreboot/$tree/ifdtool"
|
||||
|
||||
if [ -n "$IFD_platform" ]; then
|
||||
|
||||
ifdprefix="-p $IFD_platform"
|
||||
fi
|
||||
[ -n "$IFD_platform" ] && \
|
||||
ifdprefix="-p $IFD_platform"; :
|
||||
}
|
||||
|
||||
patch_release()
|
||||
{
|
||||
if [ "$nuke" != "nuke" ]; then
|
||||
|
||||
x_ ./mk download "$board"
|
||||
fi
|
||||
[ "$nuke" != "nuke" ] && \
|
||||
x_ "$mk" download "$board"
|
||||
|
||||
has_hashes="n"
|
||||
tmpromdir="$tmpromdel/bin/$board"
|
||||
|
||||
remkdir "${tmpromdir%"/bin/$board"}"
|
||||
|
||||
x_ tar -xf "$archive" -C "${tmpromdir%"/bin/$board"}"
|
||||
|
||||
for _hashes in "vendorhashes" "blobhashes"; do
|
||||
|
||||
if e "$tmpromdir/$_hashes" f; then
|
||||
|
||||
has_hashes="y"
|
||||
hashfile="$_hashes"
|
||||
|
||||
@@ -203,41 +120,29 @@ patch_release()
|
||||
fi
|
||||
done
|
||||
|
||||
if ! readkconfig; then
|
||||
readkconfig || return 1
|
||||
|
||||
return 1
|
||||
|
||||
elif [ -n "$new_mac" ] && \
|
||||
[ -n "$CONFIG_GBE_BIN_PATH" ]; then
|
||||
|
||||
modify_mac
|
||||
fi
|
||||
[ -n "$new_mac" ] && [ -n "$CONFIG_GBE_BIN_PATH" ] && \
|
||||
modify_mac; :
|
||||
}
|
||||
|
||||
readkconfig()
|
||||
{
|
||||
x_ rm -f "$xbtmp/cbcfg"
|
||||
|
||||
fx_ scankconfig x_ find "$boarddir/config" -type f
|
||||
|
||||
if e "$xbtmp/cbcfg" f missing; then
|
||||
|
||||
e "$xbtmp/cbcfg" f missing && \
|
||||
return 1
|
||||
fi
|
||||
|
||||
. "$xbtmp/cbcfg" || \
|
||||
err "Can't read '$xbtmp/cbcfg'" "readkconfig" "$@"
|
||||
|
||||
if ! setvfile "$@"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
setvfile "$@" || return 1; :
|
||||
}
|
||||
|
||||
scankconfig()
|
||||
{
|
||||
for cbc in $checkvars; do
|
||||
|
||||
grep "$cbc" "$1" 2>/dev/null 1>>"$xbtmp/cbcfg" || :
|
||||
done
|
||||
}
|
||||
@@ -246,45 +151,35 @@ modify_mac()
|
||||
{
|
||||
x_ cp "${CONFIG_GBE_BIN_PATH##*../}" "$xbtmp/gbe"
|
||||
|
||||
if [ -n "$new_mac" ] && \
|
||||
[ "$new_mac" != "restore" ]; then
|
||||
|
||||
x_ make -C util/nvmutil clean
|
||||
|
||||
x_ make -C util/nvmutil
|
||||
|
||||
if [ -n "$new_mac" ] && [ "$new_mac" != "restore" ]; then
|
||||
forx 'x_ make -C util/nvmutil %s' clean nvmutil
|
||||
x_ "$nvmutil" "$xbtmp/gbe" setmac "$new_mac"
|
||||
fi
|
||||
|
||||
fx_ newmac x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
||||
fx_ newmac x_ find "$tmpromdir" -mindepth 1 -maxdepth 1 \
|
||||
-type f -name "*.rom"
|
||||
|
||||
printf "\nThe following GbE NVM data will be written:\n"
|
||||
|
||||
x_ "$nvmutil" "$xbtmp/gbe" dump | grep -v "bytes read from file" || :
|
||||
}
|
||||
|
||||
newmac()
|
||||
{
|
||||
if e "$1" f; then
|
||||
|
||||
xchanged="y"
|
||||
|
||||
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
||||
fi
|
||||
e "$1" f || return 0
|
||||
xchanged="y"
|
||||
x_ "$ifdtool" $ifdprefix -i GbE:"$xbtmp/gbe" "$1" -O "$1"
|
||||
}
|
||||
|
||||
remktar()
|
||||
{
|
||||
(
|
||||
x_ cd "${tmpromdir%"/bin/$board"}"
|
||||
x_ cd "${tmpromdir%"/bin/$board"}"
|
||||
|
||||
printf "Re-building tar archive (please wait)\n"
|
||||
|
||||
mkrom_tarball "bin/$board" 1>/dev/null
|
||||
printf "Re-building tar archive (please wait)\n"
|
||||
mkrom_tarball "bin/$board" 1>/dev/null
|
||||
|
||||
) || err "Cannot re-generate '$archive'" "remktar" "$@"
|
||||
|
||||
mv "${tmpromdir%"/bin/$board"}/bin/${relname}_${board}.tar.xz" \
|
||||
"$archive" || \
|
||||
err "'$archive' -> Can't overwrite" "remktar" "$@"; :
|
||||
"$archive" || err "'$archive' -> Can't overwrite" "remktar" "$@"; :
|
||||
}
|
||||
@@ -4,11 +4,7 @@
|
||||
# Modifications in this version are Copyright 2021,2023-2025 Leah Rowe.
|
||||
# Original copyright detailed in repo: https://review.coreboot.org/coreboot/
|
||||
|
||||
MRC_board=""
|
||||
MRC_hash=""
|
||||
MRC_url=""
|
||||
MRC_url_bkup=""
|
||||
SHELLBALL=""
|
||||
eval "`newvar MRC_board MRC_hash MRC_url MRC_url_bkup SHELLBALL`"
|
||||
|
||||
extract_refcode()
|
||||
{
|
||||
@@ -18,43 +14,33 @@ extract_refcode()
|
||||
# and refcode is extracted from an image using the old scheme. we use
|
||||
# cbfstool from coreboot 4.11_branch, the tree used by ASUS KGPE-D16:
|
||||
|
||||
if [ -z "$cbfstoolref" ]; then
|
||||
|
||||
[ -z "$cbfstoolref" ] && \
|
||||
err "cbfstoolref not set" "extract_refcode" "$@"
|
||||
fi
|
||||
|
||||
x_ xbmkdir "${_pre_dest%/*}"
|
||||
x_ mkdir -p "${_pre_dest%/*}"
|
||||
|
||||
x_ "$cbfstoolref" "$appdir/bios.bin" extract \
|
||||
-m x86 -n fallback/refcode -f "$appdir/ref" -r RO_SECTION
|
||||
|
||||
# enable the Intel GbE device, if told by offset MRC_refcode_gbe:
|
||||
|
||||
if [ -n "$MRC_refcode_gbe" ]; then
|
||||
|
||||
# enable the Intel GbE device, if told by offset MRC_refcode_gbe
|
||||
[ -n "$MRC_refcode_gbe" ] && \
|
||||
x_ dd if="config/ifd/hp820g2/1.bin" of="$appdir/ref" bs=1 \
|
||||
seek=$MRC_refcode_gbe count=1 conv=notrunc; :
|
||||
fi
|
||||
|
||||
x_ mv "$appdir/ref" "$_pre_dest"
|
||||
}
|
||||
|
||||
extract_mrc()
|
||||
{
|
||||
if [ -z "$MRC_board" ]; then
|
||||
|
||||
[ -z "$MRC_board" ] && \
|
||||
err "MRC_board unset" "extract_mrc" "$@"
|
||||
|
||||
elif [ -z "$CONFIG_MRC_FILE" ]; then
|
||||
|
||||
[ -z "$CONFIG_MRC_FILE" ] && \
|
||||
err "CONFIG_MRC_FILE unset" "extract_mrc" "$@"
|
||||
fi
|
||||
|
||||
SHELLBALL="chromeos-firmwareupdate-$MRC_board"
|
||||
|
||||
(
|
||||
x_ cd "$appdir"
|
||||
|
||||
extract_partition "${MRC_url##*/}"
|
||||
extract_archive "$SHELLBALL" .
|
||||
|
||||
@@ -72,7 +58,6 @@ extract_partition()
|
||||
parted "${1%.zip}" 2>/dev/null | grep "ROOT-A" )
|
||||
|
||||
START=$(( $( echo $ROOTP | cut -f2 -d\ | tr -d "B" ) ))
|
||||
|
||||
SIZE=$(( $( echo $ROOTP | cut -f4 -d\ | tr -d "B" ) ))
|
||||
|
||||
x_ dd if="${1%.zip}" of="root-a.ext2" bs=1024 \
|
||||
@@ -11,29 +11,20 @@ grubdata="config/data/grub"
|
||||
buildser()
|
||||
{
|
||||
if [ "$1" = "pico" ]; then
|
||||
|
||||
x_ cmake -DPICO_BOARD="$2" \
|
||||
-DPICO_SDK_PATH="$picosdk" -B "$sersrc/build" "$sersrc"
|
||||
|
||||
x_ cmake --build "$sersrc/build"
|
||||
|
||||
elif [ "$1" = "stm32" ]; then
|
||||
|
||||
x_ make -C "$sersrc" libopencm3-just-make BOARD=$2
|
||||
|
||||
x_ make -C "$sersrc" BOARD=$2
|
||||
fi
|
||||
|
||||
x_ xbmkdir "bin/serprog_$1"
|
||||
|
||||
x_ mkdir -p "bin/serprog_$1"
|
||||
x_ mv "$serx" "bin/serprog_$1/serprog_$2.${serx##*.}"
|
||||
}
|
||||
|
||||
copyps1bios()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
remkdir "bin/playstation"
|
||||
x_ cp src/pcsx-redux/src/mips/openbios/openbios.bin bin/playstation
|
||||
|
||||
@@ -47,11 +38,7 @@ copyps1bios()
|
||||
|
||||
mkpayload_grub()
|
||||
{
|
||||
grub_modules=""
|
||||
grub_install_modules=""
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
eval "`newvar grub_modules grub_install_modules`"
|
||||
|
||||
. "$grubdata/module/$tree" || \
|
||||
err "Can't read '$grubdata/module/$tree'" "mkpayload_grub" "$@"
|
||||
@@ -69,112 +56,65 @@ mkpayload_grub()
|
||||
|
||||
corebootpremake()
|
||||
{
|
||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
||||
[ "$release" = "n" ]; then
|
||||
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
$if_not_dry_build \
|
||||
cook_coreboot_config
|
||||
|
||||
fx_ check_coreboot_util printf "cbfstool\nifdtool\n"
|
||||
|
||||
printf "%s\n" "${version%%-*}" > "$srcdir/.coreboot-version" || \
|
||||
err "!mk $srcdir .coreboot-version" "corebootpremake" "$@"
|
||||
|
||||
if [ -z "$mode" ] && \
|
||||
[ "$target" != "$tree" ]; then
|
||||
|
||||
x_ ./mk download "$target"
|
||||
fi
|
||||
}
|
||||
|
||||
cook_coreboot_config()
|
||||
{
|
||||
if [ -z "$mode" ] && \
|
||||
[ -f "$srcdir/.config" ]; then
|
||||
|
||||
printf "CONFIG_CCACHE=y\n" >> "$srcdir/.config" || \
|
||||
err "can't cook '$srcdir'" "cook_coreboot_config" "$@"
|
||||
fi
|
||||
[ "$target" != "$tree" ] && \
|
||||
x_ "$mk" download "$target"; :
|
||||
}
|
||||
|
||||
check_coreboot_util()
|
||||
{
|
||||
if [ "$badhash" = "y" ]; then
|
||||
|
||||
[ "$badhash" = "y" ] && \
|
||||
x_ rm -f "elf/coreboot/$tree/$1"
|
||||
fi
|
||||
|
||||
if e "elf/coreboot/$tree/$1" f; then
|
||||
|
||||
e "elf/coreboot/$tree/$1" f && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
utilelfdir="elf/coreboot/$tree"
|
||||
utilsrcdir="src/coreboot/$tree/util/$1"
|
||||
|
||||
utilmode=""
|
||||
|
||||
if [ -n "$mode" ]; then
|
||||
|
||||
[ -n "$mode" ] && \
|
||||
utilmode="clean"
|
||||
fi
|
||||
|
||||
x_ make -C "$utilsrcdir" $utilmode -j$XBMK_THREADS $makeargs
|
||||
|
||||
if [ -n "$mode" ]; then
|
||||
|
||||
# TODO: is this rm command needed?
|
||||
x_ rm -Rf "$utilelfdir"
|
||||
|
||||
return 0
|
||||
|
||||
elif [ -n "$mode" ] || \
|
||||
[ -f "$utilelfdir/$1" ]; then
|
||||
|
||||
elif [ -n "$mode" ] || [ -f "$utilelfdir/$1" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
x_ xbmkdir "$utilelfdir"
|
||||
|
||||
x_ mkdir -p "$utilelfdir"
|
||||
x_ cp "$utilsrcdir/$1" "$utilelfdir"
|
||||
|
||||
if [ "$1" = "cbfstool" ]; then
|
||||
|
||||
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"
|
||||
fi
|
||||
[ "$1" = "cbfstool" ] && \
|
||||
x_ cp "$utilsrcdir/rmodtool" "$utilelfdir"; :
|
||||
}
|
||||
|
||||
coreboot_pad_one_byte()
|
||||
{
|
||||
if [ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ]; then
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
$if_not_dry_build \
|
||||
pad_one_byte "$srcdir/build/coreboot.rom"
|
||||
pad_one_byte "$srcdir/build/coreboot.rom"
|
||||
}
|
||||
|
||||
mkcorebootbin()
|
||||
{
|
||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
||||
[ "$release" = "n" ]; then
|
||||
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
$if_not_dry_build \
|
||||
check_coreboot_util cbfstool
|
||||
|
||||
$if_not_dry_build \
|
||||
check_coreboot_util ifdtool
|
||||
forx 'check_coreboot_util %s' cbfstool ifdtool
|
||||
|
||||
for y in "$target_dir/config"/*; do
|
||||
|
||||
defconfig="$y"
|
||||
|
||||
mkcorebootbin_real
|
||||
done
|
||||
|
||||
@@ -183,138 +123,78 @@ mkcorebootbin()
|
||||
|
||||
mkcorebootbin_real()
|
||||
{
|
||||
if [ "$target" = "$tree" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ "$target" = "$tree" ] && return 0
|
||||
|
||||
tmprom="$xbtmp/coreboot.rom"
|
||||
|
||||
initmode="${defconfig##*/}"
|
||||
displaymode="${initmode##*_}"
|
||||
|
||||
if [ "$displaymode" = "$initmode" ]; then
|
||||
|
||||
# blank it for "normal" or "fspgop" configs:
|
||||
|
||||
displaymode=""
|
||||
fi
|
||||
|
||||
initmode="${initmode%%_*}"
|
||||
|
||||
cbfstool="elf/coreboot/$tree/cbfstool"
|
||||
|
||||
# cbfstool option backends, if they exist
|
||||
cbfscfg="config/coreboot/$target/cbfs.cfg"
|
||||
|
||||
elfrom="elf/coreboot/$tree/$target/$initmode"
|
||||
|
||||
if [ -n "$displaymode" ]; then
|
||||
|
||||
[ -n "$displaymode" ] && \
|
||||
elfrom="${elfrom}_$displaymode"
|
||||
fi
|
||||
|
||||
elfrom="$elfrom/coreboot.rom"
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ cp "$elfrom" "$tmprom"
|
||||
x_ cp "$elfrom" "$tmprom"
|
||||
unpad_one_byte "$tmprom"
|
||||
|
||||
$if_not_dry_build \
|
||||
unpad_one_byte "$tmprom"
|
||||
|
||||
if [ -n "$payload_uboot" ] && \
|
||||
[ "$payload_uboot" != "amd64" ] && \
|
||||
[ "$payload_uboot" != "i386" ] && \
|
||||
[ "$payload_uboot" != "arm64" ]; then
|
||||
|
||||
err "'$target' defines bad u-boot type '$payload_uboot'" \
|
||||
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "amd64" ] && \
|
||||
[ "$payload_uboot" != "i386" ] && [ "$payload_uboot" != "arm64" ] \
|
||||
&& err "'$target' defines bad u-boot type '$payload_uboot'" \
|
||||
"mkcorebootbin_real" "$@"
|
||||
fi
|
||||
|
||||
if [ -n "$payload_uboot" ] && \
|
||||
[ "$payload_uboot" != "arm64" ]; then
|
||||
|
||||
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
|
||||
payload_seabios="y"
|
||||
fi
|
||||
|
||||
if [ -z "$uboot_config" ]; then
|
||||
|
||||
[ -z "$uboot_config" ] && \
|
||||
uboot_config="default"
|
||||
fi
|
||||
|
||||
if [ "$payload_grub" = "y" ]; then
|
||||
|
||||
[ "$payload_grub" = "y" ] && \
|
||||
payload_seabios="y"
|
||||
fi
|
||||
|
||||
if [ "$payload_seabios" = "y" ] && \
|
||||
[ "$payload_uboot" = "arm64" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
||||
"mkcorebootbin_real" "$@"
|
||||
fi
|
||||
|
||||
if [ -z "$grub_scan_disk" ]; then
|
||||
[ "$payload_seabios" = "y" ] && [ "$payload_uboot" = "arm64" ] && \
|
||||
err "$target: U-Boot arm / SeaBIOS/GRUB both enabled" \
|
||||
"mkcorebootbin_real" "$@"
|
||||
|
||||
[ -z "$grub_scan_disk" ] && \
|
||||
grub_scan_disk="nvme ahci ata"
|
||||
fi
|
||||
|
||||
if [ -z "$grubtree" ]; then
|
||||
|
||||
[ -z "$grubtree" ] && \
|
||||
grubtree="default"
|
||||
fi
|
||||
|
||||
grubelf="elf/grub/$grubtree/$grubtree/payload/grub.elf"
|
||||
|
||||
if [ "$payload_memtest" != "y" ]; then
|
||||
|
||||
[ "$payload_memtest" != "y" ] && \
|
||||
payload_memtest="n"
|
||||
fi
|
||||
|
||||
if [ "$(uname -m)" != "x86_64" ]; then
|
||||
|
||||
[ "$(uname -m)" != "x86_64" ] && \
|
||||
payload_memtest="n"
|
||||
fi
|
||||
|
||||
if [ "$payload_grubsea" = "y" ] && \
|
||||
[ "$initmode" = "normal" ]; then
|
||||
|
||||
[ "$payload_grubsea" = "y" ] && [ "$initmode" = "normal" ] && \
|
||||
payload_grubsea="n"
|
||||
fi
|
||||
|
||||
if [ "$payload_grub" != "y" ]; then
|
||||
|
||||
[ "$payload_grub" != "y" ] && \
|
||||
payload_grubsea="n"
|
||||
fi
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if [ -f "$cbfscfg" ]; then
|
||||
|
||||
[ -f "$cbfscfg" ] && \
|
||||
dx_ add_cbfs_option "$cbfscfg"
|
||||
fi
|
||||
|
||||
if grep "CONFIG_PAYLOAD_NONE=y" "$defconfig"; then
|
||||
|
||||
if [ "$payload_seabios" = "y" ]; then
|
||||
|
||||
pname="seabios"
|
||||
|
||||
add_seabios
|
||||
fi
|
||||
|
||||
if [ "$payload_uboot" = "arm64" ]; then
|
||||
|
||||
pname="uboot"
|
||||
|
||||
add_uboot
|
||||
add_uboot "" fallback/payload default \
|
||||
"$target" u-boot.elf
|
||||
fi
|
||||
else
|
||||
|
||||
pname="custom"
|
||||
|
||||
cprom
|
||||
fi; :
|
||||
}
|
||||
@@ -323,15 +203,10 @@ mkcorebootbin_real()
|
||||
|
||||
add_cbfs_option()
|
||||
{
|
||||
# TODO: input sanitization (currently mitigated by careful config)
|
||||
|
||||
op_name="`printf "%s\n" "$1" | awk '{print $1}'`"
|
||||
|
||||
op_arg="`printf "%s\n" "$1" | awk '{print $2}'`"
|
||||
|
||||
if [ -z "$op_name" ] || \
|
||||
[ -z "$op_arg" ]; then
|
||||
|
||||
if [ -z "$op_name" ] || [ -z "$op_arg" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
@@ -350,92 +225,53 @@ add_cbfs_option()
|
||||
|
||||
add_seabios()
|
||||
{
|
||||
if [ -n "$payload_uboot" ] && \
|
||||
[ "$payload_uboot" != "arm64" ]; then
|
||||
|
||||
# we must add u-boot first, because it's added as a flat
|
||||
# binary at a specific offset for secondary program loader
|
||||
|
||||
$if_not_dry_build \
|
||||
add_uboot
|
||||
fi
|
||||
[ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ] && \
|
||||
[ "$displaymode" != "txtmode" ] && [ "$initmode" != "normal" ] && \
|
||||
add_uboot_x86 # u-boot first, due to fixed cbfs offset
|
||||
|
||||
_seabioself="elf/seabios/default/default/$initmode/bios.bin.elf"
|
||||
|
||||
if [ "$initmode" = "fspgop" ]; then
|
||||
|
||||
[ "$initmode" = "fspgop" ] && \
|
||||
_seabioself="elf/seabios/default/default/libgfxinit/bios.bin.elf"
|
||||
fi
|
||||
|
||||
_seaname="fallback/payload"
|
||||
|
||||
if [ "$payload_grubsea" = "y" ]; then
|
||||
|
||||
[ "$payload_grubsea" = "y" ] && \
|
||||
_seaname="seabios.elf"
|
||||
fi
|
||||
|
||||
cbfs "$tmprom" "$_seabioself" "$_seaname"
|
||||
|
||||
x_ "$cbfstool" "$tmprom" add-int -i 3000 -n etc/ps2-keyboard-spinup
|
||||
|
||||
opexec="2"
|
||||
|
||||
if [ "$initmode" = "vgarom" ]; then
|
||||
|
||||
[ "$initmode" = "vgarom" ] && \
|
||||
opexec="0"
|
||||
fi
|
||||
|
||||
x_ "$cbfstool" "$tmprom" add-int -i $opexec -n etc/pci-optionrom-exec
|
||||
|
||||
x_ "$cbfstool" "$tmprom" add-int -i 0 -n etc/optionroms-checksum
|
||||
|
||||
if [ "$initmode" = "libgfxinit" ] || \
|
||||
[ "$initmode" = "fspgop" ]; then
|
||||
|
||||
if [ "$initmode" = "libgfxinit" ] || [ "$initmode" = "fspgop" ]; then
|
||||
cbfs "$tmprom" "$seavgabiosrom" vgaroms/seavgabios.bin raw
|
||||
fi
|
||||
|
||||
if [ "$payload_memtest" = "y" ]; then
|
||||
|
||||
# because why not have memtest?
|
||||
# we can have it. we are entitled to it.
|
||||
# so we shall have it, yes. having memtest86+
|
||||
# in your boot flash makes you a better person.
|
||||
|
||||
[ "$payload_memtest" = "y" ] && \
|
||||
cbfs "$tmprom" "elf/memtest86plus/memtest.bin" img/memtest
|
||||
fi
|
||||
|
||||
if [ "$payload_grub" = "y" ]; then
|
||||
|
||||
[ "$payload_grub" = "y" ] && \
|
||||
add_grub
|
||||
fi
|
||||
|
||||
if [ "$payload_grubsea" != "y" ]; then
|
||||
[ "$payload_grubsea" != "y" ] && \
|
||||
cprom # seabios, but don't load grub/u-boot first
|
||||
|
||||
# ROM image where SeaBIOS doesn't load grub/u-boot first.
|
||||
# U-Boot/GRUB available in ESC menu if enabled for the board
|
||||
|
||||
cprom
|
||||
fi
|
||||
|
||||
# now make "SeaUBoot" and "SeaGRUB" images, where SeaBIOS auto-loads
|
||||
# SeaBIOS or U-Boot first; users can bypass this by pressing ESC
|
||||
# in the SeaBIOS menu, to boot devices using SeaBIOS itself instead
|
||||
# now make seauboot(u-boot loaded by seabios) and SeaGRUB (GRUB loaded
|
||||
# by SeaBIOS) images; users can bypass via ESC to boot from SeaBIOS
|
||||
|
||||
if [ "$payload_uboot" = "amd64" ] && \
|
||||
[ "$displaymode" != "txtmode" ] && \
|
||||
[ "$initmode" != "normal" ] && \
|
||||
[ "$payload_grubsea" != "y" ]; then
|
||||
|
||||
[ "$initmode" != "normal" ] && [ "$payload_grubsea" != "y" ]; then
|
||||
pname="seauboot"
|
||||
|
||||
cprom "seauboot"
|
||||
fi
|
||||
|
||||
if [ "$payload_grub" = "y" ]; then
|
||||
|
||||
pname="seagrub"
|
||||
|
||||
mkseagrub
|
||||
fi
|
||||
}
|
||||
@@ -444,11 +280,8 @@ add_grub()
|
||||
{
|
||||
# path in CBFS for the GRUB payload
|
||||
_grubname="img/grub2"
|
||||
|
||||
if [ "$payload_grubsea" = "y" ]; then
|
||||
|
||||
[ "$payload_grubsea" = "y" ] && \
|
||||
_grubname="fallback/payload"
|
||||
fi
|
||||
|
||||
cbfs "$tmprom" "$grubelf" "$_grubname"
|
||||
|
||||
@@ -458,107 +291,44 @@ add_grub()
|
||||
|
||||
cbfs "$tmprom" "$xbtmp/tmpcfg" scan.cfg raw
|
||||
|
||||
if [ "$initmode" != "normal" ] && \
|
||||
[ "$displaymode" != "txtmode" ]; then
|
||||
|
||||
[ "$initmode" != "normal" ] && [ "$displaymode" != "txtmode" ] && \
|
||||
cbfs "$tmprom" "$grubdata/background/background1280x800.png" \
|
||||
"background.png" raw
|
||||
fi
|
||||
"background.png" raw; :
|
||||
}
|
||||
|
||||
mkseagrub()
|
||||
{
|
||||
if [ "$payload_grubsea" = "y" ]; then
|
||||
|
||||
pname="grub"
|
||||
else
|
||||
|
||||
cbfs "$tmprom" "$grubdata/bootorder" bootorder raw
|
||||
fi
|
||||
|
||||
fx_ cprom x_ find "$grubdata/keymap" -type f -name "*.gkb"
|
||||
}
|
||||
|
||||
add_uboot_x86()
|
||||
{
|
||||
[ "$payload_uboot" = "amd64" ] && \
|
||||
add_uboot "-l 0x1110000 -e 0x1110000" "img/u-boot" \
|
||||
"x86_64" "amd64coreboot" "u-boot-x86-with-spl.bin"
|
||||
[ "$payload_uboot" = "i386" ] && \
|
||||
add_uboot "-l 0x1110000 -e 0x1110000" "u-boot" "x86" \
|
||||
"i386coreboot" "u-boot-dtb.bin"; :
|
||||
}
|
||||
|
||||
add_uboot()
|
||||
{
|
||||
if [ "$displaymode" = "txtmode" ]; then
|
||||
ubootelf="elf/u-boot/$3/$4/$uboot_config/$5"
|
||||
[ ! -f "$ubootelf" ] && \
|
||||
ubootelf="${ubootelf%.elf}" # hack (fix arm64 build)
|
||||
|
||||
printf "cb/%s: Can't use U-Boot in text mode\n" "$target" 1>&2
|
||||
|
||||
return 0
|
||||
|
||||
elif [ "$initmode" = "normal" ]; then
|
||||
|
||||
printf "cb/%s: Can't use U-Boot in normal initmode\n" \
|
||||
"$target" 1>&2
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
# TODO: re-work to allow each coreboot target to say which ub tree
|
||||
# instead of hardcoding as in the current logic below:
|
||||
|
||||
# aarch64 targets:
|
||||
ubcbfsargs=""
|
||||
ubpath="fallback/payload"
|
||||
ubtree="default"
|
||||
ubtarget="$target"
|
||||
|
||||
# override for x86/x86_64 targets:
|
||||
if [ -n "$payload_uboot" ] && [ "$payload_uboot" != "arm64" ]; then
|
||||
|
||||
ubcbfsargs="-l 0x1110000 -e 0x1110000" # 64-bit and 32-bit
|
||||
# on 64-bit, 0x1120000 is the SPL, with a stub that
|
||||
# loads it, located at 0x1110000
|
||||
|
||||
ubpath="img/u-boot" # 64-bit
|
||||
|
||||
ubtree="x86_64"
|
||||
ubtarget="amd64coreboot"
|
||||
|
||||
if [ "$payload_uboot" = "i386" ]; then
|
||||
|
||||
# override for 32-bit
|
||||
|
||||
ubpath="u-boot"
|
||||
|
||||
ubtree="x86"
|
||||
ubtarget="i386coreboot"; :
|
||||
fi
|
||||
fi
|
||||
|
||||
ubdir="elf/u-boot/$ubtree/$ubtarget/$uboot_config"
|
||||
|
||||
# aarch64 targets:
|
||||
|
||||
ubootelf="$ubdir/u-boot.elf"
|
||||
|
||||
if [ ! -f "$ubootelf" ]; then
|
||||
|
||||
ubootelf="$ubdir/u-boot"
|
||||
fi
|
||||
|
||||
# override for x86/x86_64 targets:
|
||||
|
||||
if [ "$payload_uboot" = "i386" ]; then
|
||||
|
||||
ubootelf="$ubdir/u-boot-dtb.bin"
|
||||
|
||||
elif [ "$payload_uboot" = "amd64" ]; then
|
||||
|
||||
ubootelf="$ubdir/u-boot-x86-with-spl.bin" # EFI-compatible
|
||||
fi
|
||||
|
||||
cbfs "$tmprom" "$ubootelf" "$ubpath" $ubcbfsargs
|
||||
|
||||
if [ "$payload_seabios" != "y" ]; then
|
||||
|
||||
cprom
|
||||
fi
|
||||
cbfs "$tmprom" "$ubootelf" "$2" $1
|
||||
[ "$payload_seabios" != "y" ] && \
|
||||
cprom; :
|
||||
}
|
||||
|
||||
# prepare the final image in bin/ for user installation:
|
||||
|
||||
cprom()
|
||||
{
|
||||
cpcmd="cp"
|
||||
@@ -566,14 +336,9 @@ cprom()
|
||||
tmpnew=""
|
||||
newrom="bin/$target/${pname}_${target}_$initmode.rom"
|
||||
|
||||
if [ -n "$displaymode" ]; then
|
||||
|
||||
[ -n "$displaymode" ] && \
|
||||
newrom="${newrom%.rom}_$displaymode.rom"
|
||||
fi
|
||||
|
||||
if [ $# -gt 0 ] && \
|
||||
[ "${1%.gkb}" != "$1" ]; then
|
||||
|
||||
if [ $# -gt 0 ] && [ "${1%.gkb}" != "$1" ]; then
|
||||
tmpnew="${1##*/}"
|
||||
newrom="${newrom%.rom}_${tmpnew%.gkb}.rom"
|
||||
fi
|
||||
@@ -581,26 +346,21 @@ cprom()
|
||||
irom="$tmprom"
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
|
||||
irom="$(mktemp || err "!mk irom, $(echo "$@")")" || \
|
||||
err "can't copy rom" "cprom" "$@"
|
||||
|
||||
x_ cp "$tmprom" "$irom" && cpcmd="mv"
|
||||
|
||||
if [ "${1%.gkb}" != "$1" ]; then
|
||||
|
||||
cbfs "$irom" "$grubdata/keymap/$tmpnew" keymap.gkb raw
|
||||
|
||||
elif [ "$1" = "seauboot" ]; then
|
||||
|
||||
cbfs "$irom" "$grubdata/bootorder_uboot" bootorder raw
|
||||
fi
|
||||
fi
|
||||
|
||||
printf "Creating new %s image: '%s'\n" "$projectname" "$newrom"
|
||||
|
||||
x_ xbmkdir "bin/$target"
|
||||
|
||||
x_ mkdir -p "bin/$target"
|
||||
x_ $cpcmd "$irom" "$newrom"
|
||||
}
|
||||
|
||||
@@ -609,15 +369,10 @@ cbfs()
|
||||
ccmd="add-payload"
|
||||
lzma="-c lzma"
|
||||
|
||||
if [ $# -gt 3 ] && \
|
||||
[ $# -lt 5 ]; then
|
||||
|
||||
if [ $# -gt 3 ] && [ $# -lt 5 ]; then
|
||||
ccmd="add"
|
||||
lzma="-t $4"
|
||||
|
||||
elif [ $# -gt 4 ] && \
|
||||
[ "$5" = "0x1110000" ]; then
|
||||
|
||||
elif [ $# -gt 4 ] && [ "$5" = "0x1110000" ]; then
|
||||
ccmd="add-flat-binary" && \
|
||||
lzma="-c lzma -l 0x1110000 -e 0x1110000"
|
||||
fi
|
||||
@@ -629,17 +384,11 @@ cbfs()
|
||||
|
||||
mkcoreboottar()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if [ "$target" = "$tree" ] || \
|
||||
[ "$XBMK_RELEASE" != "y" ] || \
|
||||
if [ "$target" = "$tree" ] || [ "$XBMK_RELEASE" != "y" ] || \
|
||||
[ "$release" = "n" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
mkrom_tarball "bin/$target"
|
||||
|
||||
x_ ./mk inject "bin/${relname}_${target}.tar.xz" nuke
|
||||
x_ "$mk" inject "bin/${relname}_${target}.tar.xz" nuke
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
# These are variables and functions, extending the functionality of
|
||||
# inject.sh, to be used with lbmk; they are kept separate here, so that
|
||||
@@ -36,147 +36,63 @@ checkvarsxbmk="CONFIG_ME_BIN_PATH CONFIG_SMSC_SCH5545_EC_FW_FILE \
|
||||
CONFIG_FSP_FD_PATH CONFIG_IFD_BIN_PATH CONFIG_MRC_FILE CONFIG_FSP_M_CBFS"
|
||||
|
||||
# lbmk-specific extensions; general variables
|
||||
cbdir=""
|
||||
cbfstoolref=""
|
||||
has_hashes=""
|
||||
hashfile=""
|
||||
kbc1126_ec_dump=""
|
||||
mecleaner=""
|
||||
mfs=""
|
||||
nuke=""
|
||||
rom=""
|
||||
vcfg=""
|
||||
xromsize=""
|
||||
eval "`newvar cbdir cbfstoolref has_hashes hashfile kbc1126_ec_dump mecleaner \
|
||||
mfs nuke rom vcfg xromsize _7ztest _dest _dl _dl_bin _me _metmp _pre_dest`"
|
||||
|
||||
_7ztest=""
|
||||
_dest=""
|
||||
_dl=""
|
||||
_dl_bin=""
|
||||
_me=""
|
||||
_metmp=""
|
||||
_pre_dest=""
|
||||
|
||||
# lbmk-specific extensions; declared in pkg.cfg files in config/vendor/
|
||||
DL_hash=""
|
||||
DL_url=""
|
||||
DL_url_bkup=""
|
||||
E6400_VGA_bin_hash=""
|
||||
E6400_VGA_DL_hash=""
|
||||
E6400_VGA_DL_url=""
|
||||
E6400_VGA_DL_url_bkup=""
|
||||
E6400_VGA_offset=""
|
||||
E6400_VGA_romname=""
|
||||
EC_FW1_hash=""
|
||||
EC_FW2_hash=""
|
||||
EC_hash=""
|
||||
EC_url=""
|
||||
EC_url_bkup=""
|
||||
FSPFD_hash=""
|
||||
FSPM_bin_hash=""
|
||||
FSPS_bin_hash=""
|
||||
ME11bootguard=""
|
||||
ME11delta=""
|
||||
ME11pch=""
|
||||
ME11sku=""
|
||||
ME11version=""
|
||||
ME_bin_hash=""
|
||||
MEcheck=""
|
||||
MEclean=""
|
||||
MEshrink=""
|
||||
MRC_bin_hash=""
|
||||
MRC_refcode_cbtree=""
|
||||
MRC_refcode_gbe=""
|
||||
REF_bin_hash=""
|
||||
SCH5545EC_bin_hash=""
|
||||
SCH5545EC_DL_hash=""
|
||||
SCH5545EC_DL_url=""
|
||||
SCH5545EC_DL_url_bkup=""
|
||||
TBFW_bin_hash=""
|
||||
TBFW_hash=""
|
||||
TBFW_size=""
|
||||
TBFW_url=""
|
||||
TBFW_url_bkup=""
|
||||
XBMKmecleaner=""
|
||||
# lbmk-specific extensions; declared by pkg.cfg files in config/vendor/
|
||||
eval "`newvar DL_hash DL_url DL_url_bkup E6400_VGA_bin_hash E6400_VGA_DL_hash \
|
||||
E6400_VGA_DL_url E6400_VGA_DL_url_bkup E6400_VGA_offset E6400_VGA_romname \
|
||||
EC_FW1_hash EC_FW2_hash EC_hash EC_url EC_url_bkup FSPFD_hash \
|
||||
FSPM_bin_hash FSPS_bin_hash ME11bootguard ME11delta ME11pch ME11sku \
|
||||
ME11version ME_bin_hash MEcheck MEclean MEshrink MRC_bin_hash \
|
||||
MRC_refcode_cbtree MRC_refcode_gbe REF_bin_hash SCH5545EC_bin_hash \
|
||||
SCH5545EC_DL_hash SCH5545EC_DL_url SCH5545EC_DL_url_bkup TBFW_bin_hash \
|
||||
TBFW_hash TBFW_size TBFW_url TBFW_url_bkup XBMKmecleaner`"
|
||||
|
||||
download()
|
||||
{
|
||||
if [ $# -lt 1 ]; then
|
||||
|
||||
err "No argument given" "download" "$@"
|
||||
fi
|
||||
[ $# -lt 1 ] && err "No argument given" "download" "$@"
|
||||
|
||||
export PATH="$PATH:/sbin"
|
||||
board="$1"
|
||||
|
||||
if check_target; then
|
||||
|
||||
readkconfig download
|
||||
fi
|
||||
check_target && readkconfig download; :
|
||||
}
|
||||
|
||||
getfiles()
|
||||
{
|
||||
if [ -n "$CONFIG_HAVE_ME_BIN" ];then
|
||||
|
||||
[ -n "$CONFIG_HAVE_ME_BIN" ] && \
|
||||
fetch intel_me "$DL_url" "$DL_url_bkup" "$DL_hash" \
|
||||
"$CONFIG_ME_BIN_PATH" curl "$ME_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ]; then
|
||||
|
||||
[ -n "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" ] && \
|
||||
fetch sch5545ec "$SCH5545EC_DL_url" "$SCH5545EC_DL_url_bkup" \
|
||||
"$SCH5545EC_DL_hash" "$CONFIG_SMSC_SCH5545_EC_FW_FILE" \
|
||||
"curl" "$SCH5545EC_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
||||
|
||||
[ -n "$CONFIG_KBC1126_FW1" ] && \
|
||||
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
||||
"$CONFIG_KBC1126_FW1" curl "$EC_FW1_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
||||
|
||||
[ -n "$CONFIG_KBC1126_FW2" ] && \
|
||||
fetch kbc1126ec "$EC_url" "$EC_url_bkup" "$EC_hash" \
|
||||
"$CONFIG_KBC1126_FW2" curl "$EC_FW2_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ]; then
|
||||
|
||||
[ -n "$CONFIG_VGA_BIOS_FILE" ] && \
|
||||
fetch e6400vga "$E6400_VGA_DL_url" "$E6400_VGA_DL_url_bkup" \
|
||||
"$E6400_VGA_DL_hash" "$CONFIG_VGA_BIOS_FILE" "curl" \
|
||||
"$E6400_VGA_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_HAVE_MRC" ]; then
|
||||
|
||||
[ -n "$CONFIG_HAVE_MRC" ] && \
|
||||
fetch "mrc" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
||||
"$CONFIG_MRC_FILE" "curl" "$MRC_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_REFCODE_BLOB_FILE" ]; then
|
||||
|
||||
[ -n "$CONFIG_REFCODE_BLOB_FILE" ] && \
|
||||
fetch "refcode" "$MRC_url" "$MRC_url_bkup" "$MRC_hash" \
|
||||
"$CONFIG_REFCODE_BLOB_FILE" "curl" "$REF_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_LENOVO_TBFW_BIN" ]; then
|
||||
|
||||
[ -n "$CONFIG_LENOVO_TBFW_BIN" ] && \
|
||||
fetch "tbfw" "$TBFW_url" "$TBFW_url_bkup" "$TBFW_hash" \
|
||||
"$CONFIG_LENOVO_TBFW_BIN" "curl" "$TBFW_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_FSP_M_FILE" ]; then
|
||||
|
||||
[ -n "$CONFIG_FSP_M_FILE" ] && \
|
||||
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
||||
"$FSPFD_hash" "$CONFIG_FSP_M_FILE" "copy" "$FSPM_bin_hash"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_FSP_S_FILE" ]; then
|
||||
|
||||
[ -n "$CONFIG_FSP_S_FILE" ] && \
|
||||
fetch "fsp" "$CONFIG_FSP_FD_PATH" "$CONFIG_FSP_FD_PATH" \
|
||||
"$FSPFD_hash" "$CONFIG_FSP_S_FILE" "copy" "$FSPS_bin_hash"
|
||||
fi
|
||||
"$FSPFD_hash" "$CONFIG_FSP_S_FILE" copy "$FSPS_bin_hash"; :
|
||||
}
|
||||
|
||||
fetch()
|
||||
@@ -190,137 +106,74 @@ fetch()
|
||||
dlop="$6"
|
||||
binsum="$7"
|
||||
|
||||
if [ -z "$binsum" ]; then
|
||||
|
||||
err "binsum is empty (no checksum)" "fetch" "$@"
|
||||
fi
|
||||
[ -z "$binsum" ] && err "binsum is empty (no checksum)" "fetch" "$@"
|
||||
|
||||
_dl="$XBMK_CACHE/file/$dlsum" # internet file to extract from e.g. .exe
|
||||
_dl_bin="$XBMK_CACHE/file/$binsum" # extracted file e.g. me.bin
|
||||
|
||||
if [ "$5" = "/dev/null" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ "$5" = "/dev/null" ] && return 0 # fetch/extract disabled
|
||||
|
||||
# an extracted vendor file will be placed in pre_dest first, for
|
||||
# verifying its checksum. if it matches, it is later moved to _dest:
|
||||
|
||||
# verifying its checksum. if it matches, it is later moved to _dest
|
||||
remkdir "${_pre_dest%/*}" "$appdir"
|
||||
|
||||
# HACK: if grabbing fsp from coreboot, fix the path for lbmk:
|
||||
|
||||
if [ "$dl_type" = "fsp" ]; then
|
||||
|
||||
dl="${dl##*../}"
|
||||
_cdp="$dl"
|
||||
|
||||
if [ ! -f "$_cdp" ]; then
|
||||
# HACK: if grabbing fsp from coreboot, fix the path for lbmk
|
||||
[ "$dl_type" = "fsp" ] && for bkup in "" "_bkup"; do
|
||||
eval "dl$bkup=\"\${dl$bkup##*../}\""
|
||||
eval "_cdp=\"\$dl$bkup\""
|
||||
|
||||
[ ! -f "$_cdp" ] && \
|
||||
_cdp="$cbdir/$_cdp"
|
||||
fi
|
||||
|
||||
if [ -f "$_cdp" ]; then
|
||||
|
||||
dl="$_cdp"
|
||||
fi
|
||||
|
||||
dl_bkup="${dl_bkup##*../}"
|
||||
_cdp="$dl_bkup"
|
||||
|
||||
if [ ! -f "$_cdp" ]; then
|
||||
|
||||
_cdp="$cbdir/$_cdp"
|
||||
fi
|
||||
|
||||
if [ -f "$_cdp" ]; then
|
||||
|
||||
dl_bkup="$_cdp"; :
|
||||
fi
|
||||
fi
|
||||
[ -f "$_cdp" ] && \
|
||||
eval "dl$bkup=\"\$_cdp\""; :
|
||||
done; :
|
||||
|
||||
# download the file (from the internet) to extract from:
|
||||
|
||||
xbget "$dlop" "$dl" "$dl_bkup" "$_dl" "$dlsum"
|
||||
x_ rm -Rf "${_dl}_extracted"
|
||||
|
||||
# skip extraction if a cached extracted file exists:
|
||||
|
||||
( xbget copy "$_dl_bin" "$_dl_bin" "$_dest" "$binsum" 2>/dev/null ) || :
|
||||
|
||||
if [ -f "$_dest" ]; then
|
||||
|
||||
[ -f "$_dest" ] && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
x_ xbmkdir "${_dest%/*}"
|
||||
|
||||
if [ "$dl_type" != "fsp" ]; then
|
||||
x_ mkdir -p "${_dest%/*}"
|
||||
|
||||
[ "$dl_type" = "fsp" ] || \
|
||||
extract_archive "$_dl" "$appdir" || \
|
||||
[ "$dl_type" = "e6400vga" ] || \
|
||||
err "$_dest $dl_type: !extract" "fetch" "$@"
|
||||
fi
|
||||
|
||||
x_ extract_$dl_type "$_dl" "$appdir"
|
||||
|
||||
set -u -e
|
||||
|
||||
# some functions don't output directly to the given file, _pre_dest.
|
||||
# instead, they put multiple files there, but we need the one matching
|
||||
# the given hashsum. So, search for a matching file via bruteforce:
|
||||
|
||||
( fx_ "mkdst $binsum" x_ find "${_pre_dest%/*}" -type f ) || :
|
||||
|
||||
if ! bad_checksum "$binsum" "$_dest"; then
|
||||
bad_checksum "$binsum" "$_dest" || \
|
||||
[ ! -f "$_dest" ] || return 0; :
|
||||
|
||||
if [ -f "$_dest" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$binsum" ]; then
|
||||
|
||||
printf "'%s': checksum undefined\n" "$_dest" 1>&2
|
||||
fi
|
||||
|
||||
if [ -L "$_dest" ]; then
|
||||
|
||||
printf "WARNING: '%s' is a link!\n" "$_dest" 1>&2
|
||||
|
||||
else
|
||||
|
||||
x_ rm -f "$_dest"
|
||||
fi
|
||||
x_ rm -f "$_dest"
|
||||
|
||||
[ -z "$binsum" ] && printf "WARNING: %s: no checksum\n" "$_dest" 1>&2
|
||||
err "Can't safely extract '$_dest', for board '$board'" "fetch" "$@"
|
||||
}
|
||||
|
||||
mkdst()
|
||||
{
|
||||
if bad_checksum "$1" "$2" 2>/dev/null; then
|
||||
|
||||
x_ rm -f "$2"
|
||||
|
||||
else
|
||||
|
||||
if ! bad_checksum "$1" "$2" 2>/dev/null; then
|
||||
x_ mv "$2" "$_dl_bin"
|
||||
x_ cp "$_dl_bin" "$_dest"
|
||||
|
||||
exit 1
|
||||
fi
|
||||
x_ rm -f "$2"
|
||||
}
|
||||
|
||||
extract_intel_me()
|
||||
{
|
||||
if e "$mecleaner" f missing; then
|
||||
|
||||
err "$cbdir: me_cleaner missing" "extract_intel_me" "$@"
|
||||
fi
|
||||
|
||||
mfs=""
|
||||
|
||||
_7ztest="$xbtmp/metmp/a"
|
||||
_metmp="$xbtmp/me.bin"
|
||||
|
||||
@@ -328,31 +181,20 @@ extract_intel_me()
|
||||
x_ rm -Rf "$_7ztest"
|
||||
|
||||
# maintain compatibility with older configs
|
||||
# because in the past, shrink was assumed:
|
||||
|
||||
if [ -z "$MEshrink" ]; then
|
||||
|
||||
# because in the past, shrink was assumed
|
||||
[ -z "$MEshrink" ] && \
|
||||
MEshrink="y"
|
||||
fi
|
||||
|
||||
if [ "$MEshrink" != "y" ] && \
|
||||
[ "$MEshrink" != "n" ]; then
|
||||
|
||||
[ "$MEshrink" != "y" ] && [ "$MEshrink" != "n" ] && \
|
||||
err "MEshrink set badly on '$board' vendor config"
|
||||
fi
|
||||
|
||||
if [ "$ME11bootguard" = "y" ]; then
|
||||
|
||||
if [ -z "$ME11delta" ] || \
|
||||
[ -z "$ME11version" ] || \
|
||||
[ -z "$ME11sku" ] || \
|
||||
[ -z "$ME11pch" ]; then
|
||||
|
||||
if [ -z "$ME11delta" ] || [ -z "$ME11version" ] || \
|
||||
[ -z "$ME11sku" ] || [ -z "$ME11pch" ]; then
|
||||
err "$board: ME11delta/ME11version/ME11sku/ME11pch" \
|
||||
"extract_intel_me" "$@"
|
||||
fi
|
||||
|
||||
x_ ./mk -f deguard
|
||||
x_ "$mk" -f deguard
|
||||
fi
|
||||
|
||||
set +u +e
|
||||
@@ -362,11 +204,8 @@ extract_intel_me()
|
||||
set -u -e
|
||||
|
||||
if [ "$ME11bootguard" != "y" ]; then
|
||||
|
||||
x_ mv "$_metmp" "$_pre_dest"
|
||||
|
||||
else
|
||||
|
||||
( apply_deguard_hack ) || \
|
||||
err "deguard error on '$_dest'" "extract_intel_me" "$@"; :
|
||||
fi
|
||||
@@ -376,101 +215,47 @@ extract_intel_me()
|
||||
# must be called inside a subshell.
|
||||
find_me()
|
||||
{
|
||||
if [ -f "$_metmp" ]; then
|
||||
|
||||
# we found me.bin, so we stop searching
|
||||
|
||||
exit 1
|
||||
|
||||
elif [ -L "$1" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ -f "$_metmp" ] && exit 1 # me.bin found
|
||||
[ -L "$1" ] && return 0 # symlinks disabled for security reasons
|
||||
|
||||
_7ztest="${_7ztest}a"
|
||||
|
||||
_keep="" # -k: keep fptr modules even if they can be removed
|
||||
_pass="" # -p: skip fptr check
|
||||
_r="-r" # re-locate modules
|
||||
_trunc="-t" # -t: truncate the ME size
|
||||
eval "`newvar _keep _pass`" # -k (keep fptr modules), -p (skip checks)
|
||||
|
||||
if [ "$ME11bootguard" = "y" ]; then
|
||||
|
||||
[ "$ME11bootguard" = "y" ] && \
|
||||
mfs="--whitelist MFS"
|
||||
fi
|
||||
|
||||
if [ "$MEclean" = "n" ]; then
|
||||
|
||||
MEshrink="n"
|
||||
|
||||
_keep="-k" # keep ME modules, don't delete anything
|
||||
mfs="" # no MFS whitelist needed, due to -r:
|
||||
fi
|
||||
|
||||
if [ "$MEclean" = "n" ] || \
|
||||
[ "$MEshrink" != "y" ]; then
|
||||
|
||||
# MEclean can still be y, this just means don't shrink,
|
||||
# so deleted modules would become padded space. this
|
||||
# could also be used alongside --whitelist, if
|
||||
# MEclean is otherwise enabled.
|
||||
|
||||
_r="" # don't re-locate ME modules
|
||||
_trunc="" # don't shrink the me.bin file size
|
||||
if [ "$MEclean" = "n" ] || [ "$MEshrink" != "y" ]; then
|
||||
eval "`newvar _r _trunc`"
|
||||
fi
|
||||
|
||||
if [ "$MEcheck" = "n" ]; then
|
||||
|
||||
[ "$MEcheck" = "n" ] && \
|
||||
_pass="-p" # skip fptr check
|
||||
fi
|
||||
|
||||
if [ -n "$mfs" ]; then
|
||||
|
||||
[ -n "$mfs" ] && \
|
||||
_r="" # cannot re-locate modules if using --whitelist MFS
|
||||
fi
|
||||
|
||||
if "$mecleaner" $mfs $_r $_keep $_pass $_trunc -O "$xbtmp/a" \
|
||||
-M "$_metmp" "$1" \
|
||||
|| \
|
||||
-M "$_metmp" "$1" || [ -f "$_metmp" ]; then
|
||||
: # me.bin extracted from a full image with ifd, then shrunk
|
||||
elif "$mecleaner" $mfs $_r $_pass $_keep $_trunc -O "$_metmp" "$1" || \
|
||||
[ -f "$_metmp" ]; then
|
||||
|
||||
# me.bin extracted from a full image with ifd, then shrunk
|
||||
:
|
||||
|
||||
elif "$mecleaner" $mfs $_r $_pass $_keep $_trunc -O "$_metmp" "$1" \
|
||||
|| \
|
||||
[ -f "$_metmp" ]; then
|
||||
|
||||
# me.bin image already present, and we shrunk it
|
||||
:
|
||||
|
||||
: # me.bin image already present, and we shrunk it
|
||||
elif "$me7updateparser" $_keep -O "$_metmp" "$1"; then
|
||||
|
||||
# thinkpad sandybridge me.bin image e.g. x220/t420
|
||||
:
|
||||
|
||||
: # thinkpad sandybridge me.bin image e.g. x220/t420
|
||||
elif extract_archive "$1" "$_7ztest"; then
|
||||
|
||||
# scan newly extracted archive within extracted archive
|
||||
:
|
||||
|
||||
: # scan newly extracted archive within extracted archive
|
||||
else
|
||||
|
||||
# could not extract anything, so we'll try the next file
|
||||
return 0
|
||||
return 0 # can't extract, so try the next file
|
||||
fi
|
||||
|
||||
if [ -f "$_metmp" ]; then
|
||||
[ -f "$_metmp" ] && exit 1 # me.bin found
|
||||
|
||||
# we found me.bin, so we stop searching
|
||||
|
||||
exit 1
|
||||
else
|
||||
|
||||
# if the subshell does exit 1, we found me.bin, so exit 1
|
||||
|
||||
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; :
|
||||
fi
|
||||
( fx_ find_me x_ find "$_7ztest" -type f ) || exit 1; : # 1==me found
|
||||
}
|
||||
|
||||
apply_deguard_hack()
|
||||
@@ -484,35 +269,15 @@ apply_deguard_hack()
|
||||
|
||||
extract_archive()
|
||||
{
|
||||
if innoextract "$1" -d "$2"; then
|
||||
|
||||
:
|
||||
|
||||
elif python "$pfs_extract" "$1" -e; then
|
||||
|
||||
:
|
||||
|
||||
elif 7z x "$1" -o"$2"; then
|
||||
|
||||
:
|
||||
|
||||
elif "$bsdtar" -C "$2" -xf "$1"; then
|
||||
|
||||
:
|
||||
|
||||
elif "$bsdunzip" "$1" -d "$2"; then
|
||||
|
||||
:
|
||||
|
||||
else
|
||||
|
||||
innoextract "$1" -d "$2" || \
|
||||
python "$pfs_extract" "$1" -e || \
|
||||
7z x "$1" -o"$2" || \
|
||||
"$bsdtar" -C "$2" -xf "$1" || \
|
||||
"$bsdunzip" "$1" -d "$2" || \
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -d "${_dl}_extracted" ]; then
|
||||
|
||||
x_ cp -R "${_dl}_extracted" "$2"
|
||||
fi
|
||||
[ -d "${_dl}_extracted" ] && \
|
||||
x_ cp -R "${_dl}_extracted" "$2"; :
|
||||
}
|
||||
|
||||
extract_kbc1126ec()
|
||||
@@ -531,45 +296,23 @@ extract_kbc1126ec_dump()
|
||||
{
|
||||
x_ cd "$appdir/"
|
||||
|
||||
if mv Rompaq/68*.BIN ec.bin; then
|
||||
|
||||
:
|
||||
|
||||
elif unar -D ROM.CAB Rom.bin; then
|
||||
|
||||
:
|
||||
|
||||
elif unar -D Rom.CAB Rom.bin; then
|
||||
|
||||
:
|
||||
|
||||
elif unar -D 68*.CAB Rom.bin; then
|
||||
|
||||
:
|
||||
|
||||
else
|
||||
|
||||
mv Rompaq/68*.BIN ec.bin || \
|
||||
unar -D ROM.CAB Rom.bin || \
|
||||
unar -D Rom.CAB Rom.bin || \
|
||||
unar -D 68*.CAB Rom.bin || \
|
||||
err "!kbc1126 unar" "extract_kbc1126ec" "$@"
|
||||
fi
|
||||
|
||||
if [ ! -f "ec.bin" ]; then
|
||||
[ -f "ec.bin" ] || x_ mv Rom.bin ec.bin
|
||||
|
||||
x_ mv Rom.bin ec.bin
|
||||
fi
|
||||
|
||||
if x_ e ec.bin f; then
|
||||
|
||||
x_ "$kbc1126_ec_dump" ec.bin
|
||||
fi
|
||||
x_ e ec.bin f
|
||||
x_ "$kbc1126_ec_dump" ec.bin
|
||||
}
|
||||
|
||||
extract_e6400vga()
|
||||
{
|
||||
set +u +e
|
||||
|
||||
if [ -z "$E6400_VGA_offset" ] || \
|
||||
[ -z "$E6400_VGA_romname" ]; then
|
||||
|
||||
if [ -z "$E6400_VGA_offset" ] || [ -z "$E6400_VGA_romname" ]; then
|
||||
err "$board: E6400_VGA_romname/E6400_VGA_offset unset" \
|
||||
"extract_e6400vga" "$@"
|
||||
fi
|
||||
@@ -577,15 +320,14 @@ extract_e6400vga()
|
||||
tail -c +$E6400_VGA_offset "$_dl" | gunzip > "$appdir/bios.bin" || :
|
||||
|
||||
(
|
||||
|
||||
x_ cd "$appdir"
|
||||
x_ e "bios.bin" f
|
||||
|
||||
"$e6400_unpack" bios.bin || printf "TODO: fix dell extract util\n"
|
||||
|
||||
) || err "can't extract e6400 vga rom" "extract_e6400vga" "$@"
|
||||
|
||||
x_ cp "$appdir/$E6400_VGA_romname" "$_pre_dest"
|
||||
|
||||
set -u -e
|
||||
}
|
||||
|
||||
extract_sch5545ec()
|
||||
@@ -599,7 +341,6 @@ extract_sch5545ec()
|
||||
_sch5545ec_fw="$_sch5545ec_fw/0 Raw section/body.bin" # <-- this!
|
||||
|
||||
x_ "$uefiextract" "$_bios"
|
||||
|
||||
x_ cp "$_sch5545ec_fw" "$_pre_dest"
|
||||
}
|
||||
|
||||
@@ -607,19 +348,14 @@ extract_sch5545ec()
|
||||
# https://pcsupport.lenovo.com/us/en/products/laptops-and-netbooks/thinkpad-t-series-laptops/thinkpad-t480-type-20l5-20l6/20l5/solutions/ht508988
|
||||
extract_tbfw()
|
||||
{
|
||||
if [ -z "$TBFW_size" ]; then
|
||||
|
||||
err "$board: TBFW_size unset" "extract_tbfw" "$@"
|
||||
fi
|
||||
[ -z "$TBFW_size" ] && err "$board: TBFW_size unset" extract_tbfw "$@"
|
||||
|
||||
fx_ copytb x_ find "$appdir" -type f -name "TBT.bin"
|
||||
}
|
||||
|
||||
copytb()
|
||||
{
|
||||
if [ -f "$1" ] && \
|
||||
[ ! -L "$1" ]; then
|
||||
|
||||
if [ -f "$1" ] && [ ! -L "$1" ]; then
|
||||
x_ dd if=/dev/null of="$1" bs=1 seek=$TBFW_size
|
||||
x_ mv "$1" "$_pre_dest"
|
||||
|
||||
@@ -635,31 +371,23 @@ extract_fsp()
|
||||
|
||||
setvfile()
|
||||
{
|
||||
[ -n "$vcfg" ] && for c in $checkvarschk; do
|
||||
|
||||
[ -n "$vcfg" ] && for c in $checkvarschk
|
||||
do
|
||||
do_getvfile="n"
|
||||
|
||||
vcmd="[ \"\${$c}\" != \"/dev/null\" ] && [ -n \"\${$c}\" ]"
|
||||
|
||||
eval "$vcmd && do_getvfile=\"y\""
|
||||
|
||||
if [ "$do_getvfile" = "y" ]; then
|
||||
|
||||
if getvfile "$@"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
[ "$do_getvfile" = "y" ] && \
|
||||
getvfile "$@" && \
|
||||
return 0; :
|
||||
done && return 1; :
|
||||
}
|
||||
|
||||
getvfile()
|
||||
{
|
||||
if e "config/vendor/$vcfg/pkg.cfg" f missing; then
|
||||
|
||||
e "config/vendor/$vcfg/pkg.cfg" f missing && \
|
||||
return 1
|
||||
fi
|
||||
|
||||
. "config/vendor/$vcfg/pkg.cfg" || \
|
||||
err "Can't read 'config/vendor/$vcfg/pkg.cfg'" "getvfile" "$@"
|
||||
@@ -667,16 +395,10 @@ getvfile()
|
||||
bootstrap
|
||||
|
||||
if [ $# -gt 0 ]; then
|
||||
|
||||
# download vendor files
|
||||
|
||||
getfiles
|
||||
else
|
||||
|
||||
# inject vendor files
|
||||
|
||||
fx_ prep x_ find "$tmpromdir" -maxdepth 1 -type f -name "*.rom"
|
||||
|
||||
getfiles # ./mk download
|
||||
else # ./mk inject
|
||||
fx_ prep x_ find "$tmpromdir" -mindepth 1 -maxdepth 1 \
|
||||
-type f -name "*.rom"
|
||||
( check_vendor_hashes ) || \
|
||||
err "$archive: Can't verify hashes" "getvfile" "$@"; :
|
||||
fi
|
||||
@@ -691,29 +413,20 @@ bootstrap()
|
||||
rmodtool="elf/coreboot/$tree/rmodtool"
|
||||
|
||||
mecleaner="$xbmkpwd/$cbdir/util/me_cleaner/me_cleaner.py"
|
||||
|
||||
if [ "$XBMKmecleaner" = "y" ]; then
|
||||
|
||||
[ "$XBMKmecleaner" = "y" ] && \
|
||||
mecleaner="$xbmkpwd/src/me_cleaner/me_cleaner.py"
|
||||
fi
|
||||
|
||||
x_ ./mk -f coreboot "${cbdir##*/}"
|
||||
x_ ./mk -f me_cleaner
|
||||
x_ "$mk" -f coreboot "${cbdir##*/}"
|
||||
x_ "$mk" -f me_cleaner
|
||||
|
||||
x_ ./mk -b bios_extract
|
||||
x_ ./mk -b biosutilities
|
||||
x_ ./mk -b uefitool
|
||||
x_ ./mk -b libarchive # for bsdtar and bsdunzip
|
||||
|
||||
if [ -d "${kbc1126_ec_dump%/*}" ]; then
|
||||
forx 'x_ \"$mk\" -b %s' bios_extract biosutilities uefitool libarchive
|
||||
|
||||
[ -d "${kbc1126_ec_dump%/*}" ] && \
|
||||
x_ make -C "$cbdir/util/kbc1126"
|
||||
fi
|
||||
|
||||
if [ -n "$MRC_refcode_cbtree" ]; then
|
||||
|
||||
cbfstoolref="elf/coreboot/$MRC_refcode_cbtree/cbfstool"
|
||||
x_ ./mk -d coreboot "$MRC_refcode_cbtree"; :
|
||||
x_ "$mk" -d coreboot "$MRC_refcode_cbtree"; :
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -723,24 +436,18 @@ prep()
|
||||
_xromname="${1##*/}"
|
||||
_xromnew="${_xrom%/*}/${_xromname#"$vfix"}"
|
||||
|
||||
if [ "$nuke" = "nuke" ]; then
|
||||
|
||||
[ "$nuke" = "nuke" ] && \
|
||||
_xromnew="${_xrom%/*}/$vfix${_xrom##*/}"
|
||||
fi
|
||||
|
||||
if e "$_xrom" f missing; then
|
||||
|
||||
e "$_xrom" f missing && \
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "${_xromname#"$vfix"}" ]; then
|
||||
|
||||
[ -z "${_xromname#"$vfix"}" ] && \
|
||||
err "$_xromname / $vfix: name match" "prep" "$@"
|
||||
fi
|
||||
|
||||
# Remove the prefix and 1-byte pad
|
||||
if [ "${_xromname#"$vfix"}" != "$_xromname" ] && \
|
||||
[ "$nuke" != "nuke" ]; then
|
||||
if [ "${_xromname#"$vfix"}" != "$_xromname" ] \
|
||||
&& [ "$nuke" != "nuke" ]; then
|
||||
|
||||
unpad_one_byte "$_xrom"
|
||||
x_ mv "$_xrom" "$_xromnew"
|
||||
@@ -749,34 +456,23 @@ prep()
|
||||
fi
|
||||
|
||||
if [ "$nuke" = "nuke" ]; then
|
||||
|
||||
( mksha512 "$_xrom" "vendorhashes" ) || err; :
|
||||
fi
|
||||
|
||||
if ! add_vfiles "$_xrom"; then
|
||||
|
||||
# no need to insert files. we will later
|
||||
# still process MAC addresses as required
|
||||
|
||||
return 1
|
||||
fi
|
||||
add_vfiles "$_xrom" || return 1 # no need to insert files
|
||||
|
||||
if [ "$nuke" = "nuke" ]; then
|
||||
|
||||
pad_one_byte "$_xrom"
|
||||
|
||||
x_ mv "$_xrom" "$_xromnew"
|
||||
fi
|
||||
}
|
||||
|
||||
mksha512()
|
||||
{
|
||||
build_sbase
|
||||
|
||||
if [ "${1%/*}" != "$1" ]; then
|
||||
eval "$build_sbase"
|
||||
|
||||
[ "${1%/*}" != "$1" ] && \
|
||||
x_ cd "${1%/*}"
|
||||
fi
|
||||
|
||||
x_ "$sha512sum" ./"${1##*/}" >> "$2" || \
|
||||
err "!sha512sum \"$1\" > \"$2\"" "mksha512" "$@"
|
||||
@@ -787,70 +483,37 @@ add_vfiles()
|
||||
rom="$1"
|
||||
|
||||
if [ "$has_hashes" != "y" ] && [ "$nuke" != "nuke" ]; then
|
||||
|
||||
printf "'%s' has no hash file. Skipping.\n" "$archive" 1>&2
|
||||
|
||||
return 1
|
||||
|
||||
elif [ "$has_hashes" = "y" ] && [ "$nuke" = "nuke" ]; then
|
||||
|
||||
printf "'%s' has a hash file. Skipping nuke.\n" "$archive" 1>&2
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_HAVE_REFCODE_BLOB" ]; then
|
||||
|
||||
[ -n "$CONFIG_HAVE_REFCODE_BLOB" ] && \
|
||||
vfile "fallback/refcode" "$CONFIG_REFCODE_BLOB_FILE" "stage"
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_HAVE_MRC" = "y" ]; then
|
||||
|
||||
[ "$CONFIG_HAVE_MRC" = "y" ] && \
|
||||
vfile "mrc.bin" "$CONFIG_MRC_FILE" "mrc" "0xfffa0000"
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_HAVE_ME_BIN" = "y" ]; then
|
||||
|
||||
[ "$CONFIG_HAVE_ME_BIN" = "y" ] && \
|
||||
vfile IFD "$CONFIG_ME_BIN_PATH" me
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_KBC1126_FW1" ]; then
|
||||
|
||||
[ -n "$CONFIG_KBC1126_FW1" ] && \
|
||||
vfile ecfw1.bin "$CONFIG_KBC1126_FW1" raw \
|
||||
"$CONFIG_KBC1126_FW1_OFFSET"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_KBC1126_FW2" ]; then
|
||||
|
||||
[ -n "$CONFIG_KBC1126_FW2" ] && \
|
||||
vfile ecfw2.bin "$CONFIG_KBC1126_FW2" raw \
|
||||
"$CONFIG_KBC1126_FW2_OFFSET"
|
||||
fi
|
||||
|
||||
if [ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ]; then
|
||||
|
||||
[ -n "$CONFIG_VGA_BIOS_FILE" ] && [ -n "$CONFIG_VGA_BIOS_ID" ] && \
|
||||
vfile "pci$CONFIG_VGA_BIOS_ID.rom" "$CONFIG_VGA_BIOS_FILE" \
|
||||
optionrom
|
||||
fi
|
||||
|
||||
if [ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
||||
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ]; then
|
||||
|
||||
[ "$CONFIG_INCLUDE_SMSC_SCH5545_EC_FW" = "y" ] && \
|
||||
[ -n "$CONFIG_SMSC_SCH5545_EC_FW_FILE" ] && \
|
||||
vfile sch5545_ecfw.bin "$CONFIG_SMSC_SCH5545_EC_FW_FILE" raw
|
||||
fi
|
||||
|
||||
if [ -z "$CONFIG_FSP_USE_REPO" ] && \
|
||||
[ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||
[ -n "$CONFIG_FSP_M_FILE" ]; then
|
||||
|
||||
[ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||
[ -n "$CONFIG_FSP_M_FILE" ] && \
|
||||
vfile "$CONFIG_FSP_M_CBFS" "$CONFIG_FSP_M_FILE" fsp --xip
|
||||
fi
|
||||
|
||||
if [ -z "$CONFIG_FSP_USE_REPO" ] && \
|
||||
[ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||
[ -n "$CONFIG_FSP_S_FILE" ]; then
|
||||
|
||||
[ -z "$CONFIG_FSP_USE_REPO" ] && [ -z "$CONFIG_FSP_FULL_FD" ] && \
|
||||
[ -n "$CONFIG_FSP_S_FILE" ] && \
|
||||
vfile "$CONFIG_FSP_S_CBFS" "$CONFIG_FSP_S_FILE" fsp
|
||||
fi
|
||||
|
||||
xchanged="y"
|
||||
|
||||
@@ -859,10 +522,7 @@ add_vfiles()
|
||||
|
||||
vfile()
|
||||
{
|
||||
if [ "$2" = "/dev/null" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ "$2" = "/dev/null" ] && return 0
|
||||
|
||||
cbfsname="$1"
|
||||
_dest="${2##*../}"
|
||||
@@ -870,50 +530,33 @@ vfile()
|
||||
|
||||
_offset=""
|
||||
|
||||
if [ "$blobtype" = "fsp" ] && \
|
||||
[ $# -gt 3 ]; then
|
||||
|
||||
if [ "$blobtype" = "fsp" ] && [ $# -gt 3 ]; then
|
||||
_offset="$4"
|
||||
|
||||
elif [ $# -gt 3 ] && \
|
||||
_offset="-b $4" && [ -z "$4" ]; then
|
||||
|
||||
elif [ $# -gt 3 ] && _offset="-b $4" && [ -z "$4" ]; then
|
||||
err "$rom: offset given but empty (undefined)" "vfile" "$@"
|
||||
fi
|
||||
|
||||
if [ "$nuke" != "nuke" ]; then
|
||||
|
||||
[ "$nuke" != "nuke" ] && \
|
||||
x_ e "$_dest" f
|
||||
fi
|
||||
|
||||
if [ "$cbfsname" = "IFD" ]; then
|
||||
|
||||
if [ "$nuke" = "nuke" ]; then
|
||||
|
||||
x_ "$ifdtool" $ifdprefix --nuke $blobtype "$rom" \
|
||||
-O "$rom"
|
||||
else
|
||||
|
||||
x_ "$ifdtool" $ifdprefix -i $blobtype:$_dest "$rom" \
|
||||
-O "$rom"
|
||||
fi
|
||||
|
||||
elif [ "$nuke" = "nuke" ]; then
|
||||
|
||||
x_ "$cbfstool" "$rom" remove -n "$cbfsname"
|
||||
|
||||
elif [ "$blobtype" = "stage" ]; then
|
||||
|
||||
# the only stage we handle is refcode
|
||||
|
||||
x_ rm -f "$xbtmp/refcode"
|
||||
|
||||
x_ "$rmodtool" -i "$_dest" -o "$xbtmp/refcode"
|
||||
x_ "$cbfstool" "$rom" add-stage -f "$xbtmp/refcode" \
|
||||
-n "$cbfsname" -t stage
|
||||
|
||||
else
|
||||
|
||||
x_ "$cbfstool" "$rom" add -f "$_dest" -n "$cbfsname" \
|
||||
-t $blobtype $_offset
|
||||
fi
|
||||
@@ -924,13 +567,11 @@ vfile()
|
||||
# must be called from a subshell
|
||||
check_vendor_hashes()
|
||||
{
|
||||
build_sbase
|
||||
eval "$build_sbase"
|
||||
|
||||
x_ cd "$tmpromdir"
|
||||
|
||||
if [ "$has_hashes" != "n" ] && \
|
||||
[ "$nuke" != "nuke" ]; then
|
||||
|
||||
if [ "$has_hashes" != "n" ] && [ "$nuke" != "nuke" ]; then
|
||||
( x_ "$sha512sum" -c "$hashfile" ) || \
|
||||
x_ sha1sum -c "$hashfile"
|
||||
fi
|
||||
+30
-180
@@ -2,16 +2,23 @@
|
||||
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
# Copyright (c) 2020-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2025 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||
|
||||
cbfstool="elf/coreboot/default/cbfstool"
|
||||
rmodtool="elf/coreboot/default/rmodtool"
|
||||
|
||||
build_sbase="[ ! -f \"\$sha512sum\" ] && x_ make -C util/sbase"
|
||||
|
||||
newvar()
|
||||
{
|
||||
printf "%s\n" "$*" | \
|
||||
awk '{ for (i=1; i<=NF; i++) $i = $i "=;"; print }'; :
|
||||
}
|
||||
|
||||
mkrom_tarball()
|
||||
{
|
||||
update_xbmkver "$1"
|
||||
|
||||
mktarball "$1" "${1%/*}/${relname}_${1##*/}.tar.xz"
|
||||
|
||||
x_ rm -Rf "$1"
|
||||
@@ -21,6 +28,10 @@ update_xbmkver()
|
||||
{
|
||||
xbmk_sanitize_version
|
||||
|
||||
if [ -z "${version-}" ] || [ -z "${versiondate-}" ]; then
|
||||
err "version and/or versiondate unset" "update_xbmkver" "$@"
|
||||
fi
|
||||
|
||||
printf "%s\n" "$version" > "$1/.version" || \
|
||||
err "can't write '$1'" "update_xbmkver" "$@"; :
|
||||
|
||||
@@ -28,36 +39,26 @@ update_xbmkver()
|
||||
err "can't write '$versiondate'" "update_xbmkver" "$@"; :
|
||||
}
|
||||
|
||||
version()
|
||||
{
|
||||
printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
|
||||
}
|
||||
|
||||
xbmk_sanitize_version()
|
||||
{
|
||||
if [ -z "$version" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
version="`printf "%s\n" "$version" | sed -e 's/\t//g'`"
|
||||
version="`printf "%s\n" "$version" | sed -e 's/\ //g'`"
|
||||
version="`printf "%s\n" "$version" | sed -e 's/\.\.//g'`"
|
||||
version="`printf "%s\n" "$version" | sed -e 's/\.\///g'`"
|
||||
version="`printf "%s\n" "$version" | sed -e 's/\//-/g'`"
|
||||
|
||||
version="${version#-}"
|
||||
|
||||
if [ -z "$version" ]; then
|
||||
|
||||
[ -n "$version" ] && version="`printf '%s\n' "$version" | sed \
|
||||
's/[[:space:]]//g; s/\.\.//g; s/\.\///g; s/\//-/g; s/^-//'`" \
|
||||
&& [ -z "$version" ] && \
|
||||
err "'version' empty after sanitization" \
|
||||
"xbmk_sanitize_version" "$@"
|
||||
fi
|
||||
"xbmk_sanitize_version" "$@"; :
|
||||
}
|
||||
|
||||
mktarball()
|
||||
{
|
||||
printf "Creating tar archive '%s' from directory '%s'\n" "$2" "$1"
|
||||
|
||||
if [ "${2%/*}" != "$2" ]; then
|
||||
|
||||
x_ xbmkdir "${2%/*}"
|
||||
fi
|
||||
[ "${2%/*}" != "$2" ] && \
|
||||
x_ mkdir -p "${2%/*}"
|
||||
|
||||
x_ tar -c "$1" | xz -T$XBMK_THREADS -9e > "$2" || \
|
||||
err "can't make tarball '$1'" "mktarball" "$@"
|
||||
@@ -66,78 +67,27 @@ mktarball()
|
||||
e()
|
||||
{
|
||||
es_t="e"
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
|
||||
[ $# -gt 1 ] && \
|
||||
es_t="$2"
|
||||
fi
|
||||
|
||||
es2="already exists"
|
||||
estr="[ -$es_t \"\$1\" ] || return 1"
|
||||
|
||||
if [ $# -gt 2 ]; then
|
||||
|
||||
estr="[ -$es_t \"\$1\" ] && return 1"
|
||||
es2="missing"
|
||||
fi
|
||||
|
||||
eval "$estr"
|
||||
|
||||
printf "%s %s\n" "$1" "$es2" 1>&2
|
||||
}
|
||||
|
||||
setvars()
|
||||
{
|
||||
_setvars=""
|
||||
|
||||
if [ $# -lt 2 ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
val="$1"
|
||||
|
||||
shift 1
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
printf "%s=\"%s\"\n" "$1" "$val"
|
||||
|
||||
shift 1
|
||||
done
|
||||
}
|
||||
|
||||
# return 0 if project is single-tree, otherwise 1
|
||||
# e.g. coreboot is multi-tree, so 1
|
||||
singletree()
|
||||
{
|
||||
( fx_ "eval exit 1 && err" find "config/$1/"*/ -type f \
|
||||
-name "target.cfg" ) || return 1; :
|
||||
}
|
||||
|
||||
findpath()
|
||||
{
|
||||
if [ $# -lt 1 ]; then
|
||||
|
||||
err "findpath: No arguments provided" "findpath" "$@"
|
||||
fi
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
found="`readlink -f "$1" 2>/dev/null`" || return 1; :
|
||||
|
||||
if [ -z "$found" ]; then
|
||||
|
||||
found="`realpath "$1" 2>/dev/null`" || \
|
||||
return 1
|
||||
fi
|
||||
|
||||
printf "%s\n" "$found"
|
||||
|
||||
shift 1
|
||||
done
|
||||
}
|
||||
|
||||
pad_one_byte()
|
||||
{
|
||||
paddedfile="`mktemp || err "mktemp pad_one_byte"`" || \
|
||||
@@ -154,58 +104,31 @@ unpad_one_byte()
|
||||
xromsize="$(expr $(stat -c '%s' "$1") - 1)" || \
|
||||
err "can't increment file size" "unpad_one_byte" "$@"
|
||||
|
||||
if [ $xromsize -lt 524288 ]; then
|
||||
|
||||
[ $xromsize -lt 524288 ] && \
|
||||
err "too small, $xromsize: $1" "unpad_one_byte" "$@"
|
||||
fi
|
||||
|
||||
unpaddedfile="`mktemp || err "mktemp unpad_one_byte"`" || \
|
||||
err "can't make tmp file" "unpad_one_byte" "$@"
|
||||
|
||||
x_ dd if="$1" of="$unpaddedfile" bs=$xromsize count=1
|
||||
|
||||
x_ mv "$unpaddedfile" "$1"
|
||||
}
|
||||
|
||||
build_sbase()
|
||||
{
|
||||
if [ ! -f "$sha512sum" ]; then
|
||||
|
||||
x_ make -C "$xbmkpwd/util/sbase"
|
||||
fi
|
||||
}
|
||||
|
||||
remkdir()
|
||||
{
|
||||
x_ rm -Rf "$@"
|
||||
|
||||
x_ xbmkdir "$@"
|
||||
}
|
||||
|
||||
xbmkdir()
|
||||
{
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
if [ ! -d "$1" ]; then
|
||||
|
||||
x_ mkdir -p "$1"
|
||||
fi
|
||||
|
||||
shift 1
|
||||
done
|
||||
x_ mkdir -p "$@"
|
||||
}
|
||||
|
||||
fx_()
|
||||
{
|
||||
xchk fx_ "$@"
|
||||
|
||||
xcmd="$1"
|
||||
|
||||
xfile="`mktemp || err "can't create tmpfile"`" || \
|
||||
err "can't make tmpfile" "fx_" "$@"
|
||||
|
||||
x_ rm -f "$xfile"
|
||||
|
||||
x_ touch "$xfile"
|
||||
|
||||
shift 1
|
||||
@@ -214,7 +137,6 @@ fx_()
|
||||
err "can't sort to '$xfile'" "fx_" "$xcmd" "$@"
|
||||
|
||||
dx_ "$xcmd" "$xfile" || :
|
||||
|
||||
x_ rm -f "$xfile"
|
||||
}
|
||||
|
||||
@@ -222,90 +144,18 @@ dx_()
|
||||
{
|
||||
xchk dx_ "$@"
|
||||
|
||||
if [ ! -f "$2" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
[ ! -f "$2" ] && return 0
|
||||
|
||||
while read -r fx; do
|
||||
|
||||
$1 "$fx" || return 1; :
|
||||
|
||||
done < "$2" \
|
||||
|| err "cannot read '$2'" "dx_" "$@"; :
|
||||
}
|
||||
|
||||
x_()
|
||||
{
|
||||
if [ $# -lt 1 ]; then
|
||||
|
||||
return 0
|
||||
|
||||
elif [ -z "$1" ]; then
|
||||
|
||||
err "Empty first arg" "x_" "$@"
|
||||
|
||||
else
|
||||
|
||||
"$@" || err "Unhandled error" "x_" "$@"
|
||||
fi
|
||||
done < "$2" || err "cannot read '$2'" "dx_" "$@"; :
|
||||
}
|
||||
|
||||
xchk()
|
||||
{
|
||||
if [ $# -lt 3 ]; then
|
||||
|
||||
err "$1 needs at least two arguments" "xchk" "$@"
|
||||
|
||||
elif [ -z "$2" ] || \
|
||||
[ -z "$3" ]; then
|
||||
|
||||
elif [ -z "$2" ] || [ -z "$3" ]; then
|
||||
err "arguments must not be empty" "xchk" "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
err()
|
||||
{
|
||||
if [ $# -eq 1 ]; then
|
||||
|
||||
printf "ERROR %s: %s\n" "$0" "$1" 1>&2 || :
|
||||
|
||||
elif [ $# -gt 1 ]; then
|
||||
|
||||
printf "ERROR %s: %s: in command with args: " "$0" "$1" 1>&2
|
||||
|
||||
shift 1
|
||||
|
||||
xprintf "$@" 1>&2
|
||||
|
||||
else
|
||||
|
||||
printf "ERROR, but no arguments provided to err\n" 1>&2
|
||||
fi
|
||||
|
||||
exit 1
|
||||
}
|
||||
|
||||
xprintf()
|
||||
{
|
||||
xprintfargs=0
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
|
||||
printf "\"%s\"" "$1"
|
||||
|
||||
if [ $# -gt 1 ]; then
|
||||
|
||||
printf " "
|
||||
fi
|
||||
|
||||
xprintfargs=1
|
||||
|
||||
shift 1
|
||||
done
|
||||
|
||||
if [ $xprintfargs -gt 0 ]; then
|
||||
|
||||
printf "\n"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1,71 +1,32 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2023-2026 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
reldest=""
|
||||
reldir=""
|
||||
relmode=""
|
||||
rsrc=""
|
||||
vdir=""
|
||||
eval "`newvar reldest reldir rsrc vdir`"
|
||||
|
||||
release()
|
||||
{
|
||||
export XBMK_RELEASE="y"
|
||||
|
||||
reldir="release"
|
||||
|
||||
while getopts m: option; do
|
||||
|
||||
if [ -z "$OPTARG" ]; then
|
||||
|
||||
err "empty argument not allowed" "release" "$@"
|
||||
fi
|
||||
|
||||
case "$option" in
|
||||
|
||||
m)
|
||||
relmode="$OPTARG"
|
||||
;;
|
||||
|
||||
*)
|
||||
err "invalid option '-$option'" "release" "$@"
|
||||
;;
|
||||
|
||||
esac
|
||||
done
|
||||
|
||||
reldest="$reldir/$version"
|
||||
|
||||
if [ -e "$reldest" ]; then
|
||||
|
||||
[ -e "$reldest" ] && \
|
||||
err "already exists: \"$reldest\"" "release" "$@"
|
||||
fi
|
||||
|
||||
vdir="`mktemp -d || err "can't make vdir"`" || \
|
||||
err "can't make tmp vdir" "release" "$@"
|
||||
|
||||
vdir="$vdir/$version"
|
||||
|
||||
rsrc="$vdir/${relname}_src"
|
||||
|
||||
remkdir "$vdir"
|
||||
|
||||
x_ git clone . "$rsrc"
|
||||
|
||||
update_xbmkver "$rsrc"
|
||||
|
||||
prep_release src
|
||||
prep_release tarball
|
||||
|
||||
if [ "$relmode" != "src" ]; then
|
||||
|
||||
prep_release bin
|
||||
fi
|
||||
forx 'prep_release %s' src tarball bin
|
||||
|
||||
x_ rm -Rf "$rsrc"
|
||||
|
||||
x_ xbmkdir "$reldir"
|
||||
|
||||
x_ mkdir -p "$reldir"
|
||||
x_ mv "$vdir" "$reldir"
|
||||
x_ rm -Rf "${vdir%"/$version"}"
|
||||
|
||||
@@ -75,17 +36,13 @@ release()
|
||||
prep_release()
|
||||
{
|
||||
(
|
||||
if [ "$1" != "tarball" ]; then
|
||||
if [ "$1" != "tarball" ]; then
|
||||
x_ cd "$rsrc"
|
||||
[ ! -e "cache" ] && \
|
||||
x_ ln -s "$XBMK_CACHE" "cache"; :
|
||||
fi
|
||||
|
||||
x_ cd "$rsrc"
|
||||
|
||||
if [ ! -e "cache" ]; then
|
||||
|
||||
x_ ln -s "$XBMK_CACHE" "cache"
|
||||
fi
|
||||
fi
|
||||
|
||||
prep_release_$1
|
||||
prep_release_$1
|
||||
|
||||
) || err "can't prep release $1" "prep_release" "$@"
|
||||
}
|
||||
@@ -96,23 +53,18 @@ prep_release_src()
|
||||
|
||||
x_ ./mk -f
|
||||
|
||||
fx_ "x_ rm -Rf" x_ find . -name ".git"
|
||||
fx_ "x_ rm -Rf" x_ find . -name ".gitmodules"
|
||||
forx 'fx_ \"x_ rm -Rf\" x_ find . -name \".%s\"' git gitmodules
|
||||
|
||||
# delete unwanted files from the release
|
||||
( fx_ nuke x_ find config -type f -name "nuke.list" ) || \
|
||||
err "can't prune project files" "prep_release_src" "$@"; :
|
||||
}
|
||||
|
||||
# delete unwanted files from the release
|
||||
nuke()
|
||||
{
|
||||
r="$rsrc/src/${1#config/}"
|
||||
|
||||
if [ -d "${r%/*}" ]; then
|
||||
|
||||
x_ cd "${r%/*}"
|
||||
|
||||
dx_ "x_ rm -Rf" "$rsrc/$1"
|
||||
fi
|
||||
}
|
||||
@@ -124,14 +76,12 @@ prep_release_tarball()
|
||||
err "can't create '$rsrc/CHANGELOG'" "prep_release_tarball" "$@"
|
||||
|
||||
x_ rm -f "$rsrc/lock" "$rsrc/cache"
|
||||
|
||||
x_ rm -Rf "$rsrc/xbmkwd" "$rsrc/util/sbase"
|
||||
|
||||
x_ mv "$rsrc/util/sbase2" "$rsrc/util/sbase"
|
||||
|
||||
(
|
||||
x_ cd "${rsrc%/*}"
|
||||
x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz"
|
||||
x_ cd "${rsrc%/*}"
|
||||
x_ mktarball "${rsrc##*/}" "${rsrc##*/}.tar.xz"
|
||||
|
||||
) || err "can't create src tarball" "prep_release_tarball" "$@"; :
|
||||
}
|
||||
@@ -139,15 +89,11 @@ prep_release_tarball()
|
||||
prep_release_bin()
|
||||
{
|
||||
x_ ./mk -d coreboot
|
||||
x_ ./mk -b coreboot
|
||||
|
||||
x_ ./mk -b pico-serprog
|
||||
forx 'x_ ./mk -b' coreboot pico-serprog stm32-vserprog pcsx-redux
|
||||
|
||||
x_ ./mk -b stm32-vserprog
|
||||
|
||||
x_ ./mk -b pcsx-redux
|
||||
|
||||
fx_ mkrom_tarball x_ find bin -maxdepth 1 -type d -name "serprog_*"
|
||||
fx_ mkrom_tarball x_ find bin -mindepth 1 -maxdepth 1 \
|
||||
-type d -name "serprog_*"
|
||||
|
||||
x_ mv bin ../roms
|
||||
}
|
||||
-927
@@ -1,927 +0,0 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
# Copyright (c) 2023-2025 Leah Rowe <leah@libreboot.org>
|
||||
|
||||
# flag e.g. ./mk -b <-- mkflag would be "b"
|
||||
flag=""
|
||||
|
||||
# macros, overridden depending on the flag
|
||||
if_do_make=""
|
||||
if_dry_build=":"
|
||||
if_not_do_make=":"
|
||||
if_not_dry_build=""
|
||||
|
||||
autoconfargs=""
|
||||
autogenargs=""
|
||||
badhash=""
|
||||
badtghash=""
|
||||
bootstrapargs=""
|
||||
build_depend=""
|
||||
buildtype=""
|
||||
cleanargs=""
|
||||
cmakedir=""
|
||||
cmd=""
|
||||
defconfig=""
|
||||
dest_dir=""
|
||||
elfdir=""
|
||||
forcepull=""
|
||||
gccdir=""
|
||||
gccfull=""
|
||||
gccver=""
|
||||
gnatdir=""
|
||||
gnatfull=""
|
||||
gnatver=""
|
||||
listfile=""
|
||||
makeargs=""
|
||||
mdir=""
|
||||
mkhelper=""
|
||||
mkhelpercfg=""
|
||||
mode=""
|
||||
postmake=""
|
||||
premake=""
|
||||
project=""
|
||||
release=""
|
||||
rev=""
|
||||
srcdir=""
|
||||
target=""
|
||||
target_dir=""
|
||||
targets=""
|
||||
tree=""
|
||||
xarch=""
|
||||
xgcctree=""
|
||||
xlang=""
|
||||
|
||||
trees()
|
||||
{
|
||||
flags="f:F:b:m:u:c:x:s:l:n:d:"
|
||||
|
||||
while getopts $flags option; do
|
||||
|
||||
if [ -n "$flag" ]; then
|
||||
|
||||
err "only one flag is permitted" "trees" "$@"
|
||||
fi
|
||||
|
||||
flag="$1"
|
||||
|
||||
# the "mode" variable is affixed to a make command, example:
|
||||
# ./mk -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||
|
||||
case "$flag" in
|
||||
|
||||
-d)
|
||||
# -d is similar to -b, except that
|
||||
# a large number of operations will be
|
||||
# skipped. these are "if_not_dry_build build" scenarios
|
||||
# where only a subset of build tasks are done,
|
||||
# and $if_not_dry_build is prefixed to skipped commands
|
||||
|
||||
if_dry_build=""
|
||||
if_not_dry_build=":"
|
||||
;;
|
||||
|
||||
-b) : ;;
|
||||
|
||||
-u) mode="oldconfig" ;;
|
||||
|
||||
-m) mode="menuconfig" ;;
|
||||
|
||||
-c) mode="distclean" ;;
|
||||
|
||||
-x) mode="crossgcc-clean" ;;
|
||||
|
||||
-f|-F) # download source code for a project
|
||||
# macros. colon means false.
|
||||
|
||||
if_do_make=":"
|
||||
if_dry_build=""
|
||||
if_not_do_make=""
|
||||
if_not_dry_build=":"
|
||||
if [ "$flag" = "-F" ]; then
|
||||
# don't skip git fetch/pull on cached src
|
||||
|
||||
forcepull="y"
|
||||
fi
|
||||
;;
|
||||
|
||||
-s) mode="savedefconfig" ;;
|
||||
|
||||
-l) mode="olddefconfig" ;;
|
||||
|
||||
-n) mode="nconfig" ;;
|
||||
|
||||
*) err "invalid option '-$option'" "trees" "$@" ;;
|
||||
|
||||
esac
|
||||
|
||||
if [ -z "${OPTARG+x}" ]; then
|
||||
|
||||
shift 1
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
project="${OPTARG#src/}"
|
||||
project="${project#config/git/}"
|
||||
|
||||
shift 2
|
||||
done
|
||||
|
||||
if [ -z "$flag" ]; then
|
||||
|
||||
err "missing flag ($flags)" "trees" "$@"
|
||||
|
||||
elif [ -z "$project" ]; then
|
||||
|
||||
fx_ "x_ ./mk $flag" x_ ls -1 config/git
|
||||
|
||||
return 1
|
||||
|
||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||
|
||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||
fi
|
||||
|
||||
elfdir="elf/$project"
|
||||
datadir="config/data/$project"
|
||||
configdir="config/$project"
|
||||
srcdir="src/$project"
|
||||
dest_dir="$elfdir"
|
||||
|
||||
listfile="$datadir/build.list"
|
||||
|
||||
if [ ! -f "$listfile" ]; then
|
||||
|
||||
listfile="" # build.list is optional on all projects
|
||||
fi
|
||||
|
||||
mkhelpercfg="$datadir/mkhelper.cfg"
|
||||
|
||||
if e "$mkhelpercfg" f missing; then
|
||||
|
||||
mkhelpercfg="$xbtmp/mkhelper.cfg"
|
||||
|
||||
x_ touch "$mkhelpercfg"
|
||||
fi
|
||||
|
||||
targets="$*"
|
||||
cmd="build_targets $targets"
|
||||
|
||||
if singletree "$project"; then
|
||||
|
||||
cmd="build_project"
|
||||
fi
|
||||
|
||||
remkdir "${tmpgit%/*}"
|
||||
}
|
||||
|
||||
build_project()
|
||||
{
|
||||
if ! configure_project "$configdir"; then
|
||||
|
||||
return 0
|
||||
|
||||
elif [ -f "$listfile" ]; then
|
||||
|
||||
if ! $if_not_dry_build elfcheck; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$mode" = "distclean" ]; then
|
||||
|
||||
mode="clean"
|
||||
fi
|
||||
|
||||
if ! run_make_command; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
copy_elf; :
|
||||
fi
|
||||
}
|
||||
|
||||
build_targets()
|
||||
{
|
||||
if [ ! -d "$configdir" ]; then
|
||||
|
||||
err "directory '$configdir' doesn't exist" "build_targets" "$@"
|
||||
|
||||
elif [ $# -lt 1 ]; then
|
||||
|
||||
targets="$(ls -1 "$configdir")" || \
|
||||
err "'$configdir': can't list targets" "build_targets" "$@"
|
||||
fi
|
||||
|
||||
for x in $targets; do
|
||||
|
||||
unset CROSS_COMPILE
|
||||
export PATH="$xbmkpath"
|
||||
|
||||
if [ "$x" = "list" ]; then
|
||||
|
||||
x_ ls -1 "config/$project"
|
||||
|
||||
listfile=""
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$x"
|
||||
|
||||
target="$x"
|
||||
|
||||
x_ handle_defconfig
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
x_ $postmake
|
||||
fi
|
||||
done; :
|
||||
}
|
||||
|
||||
handle_defconfig()
|
||||
{
|
||||
target_dir="$configdir/$target"
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
|
||||
fetch_project "$project"
|
||||
fi
|
||||
|
||||
if ! configure_project "$target_dir"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ -z "$tree" ]; then
|
||||
|
||||
err "$configdir: 'tree' not set" "handle_defconfig" "$@"
|
||||
fi
|
||||
|
||||
srcdir="src/$project/$tree"
|
||||
|
||||
if [ "$mode" = "${mode%clean}" ] && \
|
||||
[ ! -d "$srcdir" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
for y in "$target_dir/config"/*; do
|
||||
|
||||
if [ "$flag" != "-d" ] && \
|
||||
[ ! -f "$y" ]; then
|
||||
|
||||
continue
|
||||
|
||||
elif [ "$flag" != "-d" ]; then
|
||||
|
||||
defconfig="$y"
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
check_defconfig || continue; :
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
for _xarch in $xarch; do
|
||||
|
||||
$if_dry_build \
|
||||
break
|
||||
|
||||
if [ -n "$_xarch" ]; then
|
||||
|
||||
check_cross_compiler "$_xarch"
|
||||
fi
|
||||
done; :
|
||||
fi
|
||||
|
||||
handle_makefile
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
copy_elf
|
||||
fi
|
||||
done; :
|
||||
}
|
||||
|
||||
configure_project()
|
||||
{
|
||||
tcfg="$1/target.cfg"
|
||||
|
||||
autoconfargs=""
|
||||
badhash=""
|
||||
badtghash=""
|
||||
bootstrapargs=""
|
||||
build_depend=""
|
||||
buildtype=""
|
||||
cleanargs=""
|
||||
makeargs=""
|
||||
mkhelper=""
|
||||
postmake=""
|
||||
premake=""
|
||||
release=""
|
||||
xarch=""
|
||||
xgcctree=""
|
||||
xlang=""
|
||||
|
||||
if [ ! -f "$tcfg" ]; then
|
||||
|
||||
buildtype="auto"
|
||||
fi
|
||||
|
||||
# globally initialise all variables for a source tree / target:
|
||||
|
||||
if e "$datadir/mkhelper.cfg" f; then
|
||||
|
||||
. "$datadir/mkhelper.cfg" || \
|
||||
err "Can't read '$datadir/mkhelper.cfg'" \
|
||||
"configure_project" "$@"
|
||||
fi
|
||||
|
||||
# override target/tree specific variables from per-target config:
|
||||
|
||||
while e "$tcfg" f || \
|
||||
[ "$cmd" != "build_project" ]; do
|
||||
|
||||
# TODO: implement infinite loop detection here, caused
|
||||
# by project targets pointing to other targets/trees
|
||||
# when then ultimate point back repeatedly; this is
|
||||
# currently avoided simply by careful configuration.
|
||||
# temporary files per tree/target name could be created
|
||||
# per iteration, and then checked the next time
|
||||
|
||||
printf "Loading %s config: %s\n" "$project" "$tcfg"
|
||||
|
||||
rev=""
|
||||
tree=""
|
||||
|
||||
. "$tcfg" || \
|
||||
err "Can't read '$tcfg'" "configure_project" "$@"
|
||||
|
||||
if [ "$flag" = "-d" ]; then
|
||||
|
||||
build_depend="" # dry run
|
||||
fi
|
||||
|
||||
if [ "$cmd" = "build_project" ]; then
|
||||
|
||||
# single-tree, so it can't be a target pointing
|
||||
# to a main source tree
|
||||
|
||||
break
|
||||
fi
|
||||
|
||||
$if_do_make \
|
||||
break
|
||||
|
||||
if [ "${tcfg%/*/target.cfg}" = "${tcfg%"/$tree/target.cfg"}" ]
|
||||
then
|
||||
|
||||
# we have found the main source tree that
|
||||
# a given target uses; no need to continue
|
||||
|
||||
break
|
||||
|
||||
else
|
||||
|
||||
tcfg="${tcfg%/*/target.cfg}/$tree/target.cfg"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
if [ "$XBMK_RELEASE" = "y" ] && \
|
||||
[ "$release" = "n" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -n "$buildtype" ] && \
|
||||
[ "${mode%config}" != "$mode" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
build_dependencies
|
||||
fi
|
||||
|
||||
mdir="$xbmkpwd/config/submodule/$project"
|
||||
|
||||
if [ -n "$tree" ]; then
|
||||
|
||||
mdir="$mdir/$tree"
|
||||
fi
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
|
||||
delete_old_project_files
|
||||
|
||||
$if_not_do_make \
|
||||
fetch_${cmd#build_}
|
||||
fi
|
||||
|
||||
$if_not_do_make \
|
||||
return 1
|
||||
|
||||
x_ ./mk -f "$project" "$target"
|
||||
}
|
||||
|
||||
# projects can specify which other projects
|
||||
# to build first, as declared dependencies:
|
||||
|
||||
build_dependencies()
|
||||
{
|
||||
for bd in $build_depend; do
|
||||
|
||||
bd_project="${bd%%/*}"
|
||||
bd_tree="${bd##*/}"
|
||||
|
||||
if [ -z "$bd_project" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
err "$project/$tree: !bd '$bd'" \
|
||||
"build_dependencies" "$@"
|
||||
fi
|
||||
|
||||
if [ "${bd##*/}" = "$bd" ]; then
|
||||
|
||||
bd_tree=""
|
||||
fi
|
||||
|
||||
if [ -n "$bd_project" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ ./mk -b $bd_project $bd_tree; :
|
||||
fi
|
||||
done; :
|
||||
}
|
||||
|
||||
# delete_old_project_files along with project_up_to_date,
|
||||
# concatenates the sha512sum hashes of all files related to
|
||||
# a project, tree or target, then gets the sha512sum of that
|
||||
# concatenation. this is checked against any existing
|
||||
# calculation previously cached; if the result differs, or
|
||||
# nothing was previously stored, we know to delete resources
|
||||
# such as builds, project sources and so on, for auto-rebuild:
|
||||
|
||||
delete_old_project_files()
|
||||
{
|
||||
# delete an entire source tree along with its builds:
|
||||
if ! project_up_to_date hash "$tree" badhash "$datadir" \
|
||||
"$configdir/$tree" "$mdir"; then
|
||||
|
||||
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
||||
fi
|
||||
|
||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
||||
|
||||
if singletree "$project" || \
|
||||
[ -z "$target" ] || \
|
||||
[ "$target" = "$tree" ]; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
# delete only the builds of a given target, but not src.
|
||||
# this is useful when only the target config changes, for
|
||||
# example x200_8mb coreboot configs change, but not coreboot:
|
||||
|
||||
if ! project_up_to_date tghash "$target" badtghash "$configdir/$target"
|
||||
then
|
||||
|
||||
x_ rm -Rf "elf/$project/$tree/$target"
|
||||
fi
|
||||
|
||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
|
||||
}
|
||||
|
||||
project_up_to_date()
|
||||
{
|
||||
old_hash=""
|
||||
hash=""
|
||||
|
||||
hashdir="$1"
|
||||
hashname="$2"
|
||||
badhashvar="$3"
|
||||
|
||||
shift 3
|
||||
|
||||
x_ xbmkdir "$XBMK_CACHE/$hashdir"
|
||||
|
||||
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
|
||||
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|
||||
|| err \
|
||||
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
build_sbase
|
||||
|
||||
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||
err "!h $project $hashdir" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
hash="$(x_ "$sha512sum" "$xbtmp/tmp.hash" | awk '{print $1}' || \
|
||||
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
if [ "$hash" != "$old_hash" ] || \
|
||||
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
|
||||
eval "$badhashvar=\"y\""
|
||||
fi
|
||||
|
||||
printf "%s\n" "$hash" > "$xbtmp/new.hash" || \
|
||||
err "!mkhash $xbtmp/new.hash ($hashdir $hashname $badhashvar)" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
|
||||
}
|
||||
|
||||
check_cross_compiler()
|
||||
{
|
||||
cbdir="src/coreboot/$tree"
|
||||
|
||||
if [ "$project" != "coreboot" ]; then
|
||||
|
||||
cbdir="src/coreboot/default"
|
||||
fi
|
||||
|
||||
if [ -n "$xgcctree" ]; then
|
||||
|
||||
cbdir="src/coreboot/$xgcctree"
|
||||
fi
|
||||
|
||||
xfix="${1%-*}"
|
||||
|
||||
if [ "$xfix" = "x86_64" ]; then
|
||||
|
||||
xfix="x64"
|
||||
fi
|
||||
|
||||
xgccfile="elf/coreboot/$tree/xgcc_${xfix}_was_compiled"
|
||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||
|
||||
x_ ./mk -f coreboot "${cbdir#src/coreboot/}"
|
||||
|
||||
x_ xbmkdir "elf/coreboot/$tree" # TODO: is this needed?
|
||||
|
||||
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
||||
|
||||
export CROSS_COMPILE="${xarch% *}-"
|
||||
|
||||
if [ -n "$xlang" ]; then
|
||||
|
||||
export BUILD_LANGUAGES="$xlang"
|
||||
fi
|
||||
|
||||
if [ -f "$xgccfile" ]; then
|
||||
|
||||
# skip the build, because a build already exists:
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
check_gnu_path gcc gnat || x_ check_gnu_path gnat gcc
|
||||
|
||||
# try twice because xgcc sometimes fails for, like, no reason
|
||||
#
|
||||
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
||||
|
||||
# this tells subsequent runs that the build was already done:
|
||||
#
|
||||
x_ touch "$xgccfile"
|
||||
|
||||
# reset hostcc in PATH:
|
||||
#
|
||||
remkdir "$xbtmp/gnupath"
|
||||
}
|
||||
|
||||
# host toolchain version correction:
|
||||
|
||||
# fix mismatching gcc/gnat versions on debian trixie/sid. as of december 2024,
|
||||
# trixie/sid had gnat-13 as gnat and gcc-14 as gcc, but has gnat-14 in apt. in
|
||||
# some cases, gcc 13+14 and gnat-13 are present; or gnat-14 and gcc-14, but
|
||||
# gnat in PATH never resolves to gnat-14, because gnat-14 was "experimental"
|
||||
|
||||
# note that this was implemented for debian trixie-testing, but this same
|
||||
# issue will likely occur in future distros, including newer debian testing
|
||||
# releases. this just matches up the versions of each toolchain component.
|
||||
|
||||
check_gnu_path()
|
||||
{
|
||||
if ! command -v "$1" 1>/dev/null; then
|
||||
|
||||
err "Host '$1' unavailable" "check_gnu_path" "$@"
|
||||
fi
|
||||
|
||||
gccdir=""
|
||||
gccfull=""
|
||||
gccver=""
|
||||
gnatdir=""
|
||||
gnatfull=""
|
||||
gnatver=""
|
||||
|
||||
if host_gcc_gnat_match "$@"; then
|
||||
|
||||
return 0
|
||||
|
||||
elif ! match_gcc_gnat_versions "$@"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# check if gcc/gnat versions already match:
|
||||
|
||||
host_gcc_gnat_match()
|
||||
{
|
||||
if ! gnu_setver "$1" "$1"; then
|
||||
|
||||
err "Command '$1' unavailable." "check_gnu_path" "$@"
|
||||
fi
|
||||
|
||||
gnu_setver "$2" "$2" || :
|
||||
|
||||
eval "[ -z \"\$$1ver\" ] && err \"Cannot detect host '$1' version\""
|
||||
|
||||
if [ "$gnatfull" != "$gccfull" ]; then
|
||||
|
||||
# non-matching host gcc/gnat versions
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# find all host gcc/gnat versions, matching them up in PATH:
|
||||
|
||||
match_gcc_gnat_versions()
|
||||
{
|
||||
eval "$1dir=\"$(dirname "$(command -v "$1")")\""
|
||||
|
||||
eval "_gnudir=\"\$$1dir\""
|
||||
eval "_gnuver=\"\$$1ver\""
|
||||
|
||||
for _bin in "$_gnudir/$2-"*; do
|
||||
|
||||
if [ "${_bin#"$_gnudir/$2-"}" = "$_gnuver" ] && [ -x "$_bin" ]
|
||||
then
|
||||
|
||||
_gnuver="${_bin#"$_gnudir/$2-"}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if ! gnu_setver "$2" "$_gnudir/$2-$_gnuver"; then
|
||||
|
||||
return 1
|
||||
|
||||
elif [ "$gnatfull" != "$gccfull" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
( link_gcc_gnat_versions "$@" "$_gnudir" "$_gnuver" ) || \
|
||||
err "Can't link '$2-$_gnuver' '$_gnudir'" "check_gnu_path" "$@"; :
|
||||
}
|
||||
|
||||
# create symlinks in PATH, so that the GCC/GNAT versions match:
|
||||
|
||||
link_gcc_gnat_versions()
|
||||
{
|
||||
_gnudir="$3"
|
||||
_gnuver="$4"
|
||||
|
||||
remkdir "$xbtmp/gnupath"
|
||||
|
||||
x_ cd "$xbtmp/gnupath"
|
||||
|
||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do
|
||||
|
||||
_gnuutil="${_gnubin##*/}"
|
||||
|
||||
if [ -e "$_gnubin" ]; then
|
||||
|
||||
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
# get the gcc/gnat version
|
||||
# fail: return 1 if util not found
|
||||
gnu_setver()
|
||||
{
|
||||
eval "$2 --version 1>/dev/null 2>/dev/null || return 1"
|
||||
|
||||
eval "$1ver=\"`"$2" --version 2>/dev/null | head -n1`\""
|
||||
eval "$1ver=\"\${$1ver##* }\""
|
||||
eval "$1full=\"\$$1ver\""
|
||||
eval "$1ver=\"\${$1ver%%.*}\""; :
|
||||
}
|
||||
|
||||
check_defconfig()
|
||||
{
|
||||
if [ ! -f "$defconfig" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
err "$project/$target: no config" "check_defconfig" "$@"
|
||||
fi
|
||||
|
||||
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
||||
|
||||
# skip build if a previous one exists:
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if ! elfcheck; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
elfcheck()
|
||||
{
|
||||
# TODO: *STILL* very hacky check. do it properly (based on build.list)
|
||||
|
||||
# extremely hacky check that glues the entire universe together
|
||||
|
||||
# beware demons
|
||||
|
||||
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
|
||||
}
|
||||
|
||||
handle_makefile()
|
||||
{
|
||||
if $if_not_dry_build check_makefile "$srcdir"; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ make -C "$srcdir" $cleanargs clean
|
||||
fi
|
||||
|
||||
if [ -f "$defconfig" ]; then
|
||||
|
||||
x_ cp "$defconfig" "$srcdir/.config"
|
||||
fi
|
||||
|
||||
run_make_command || \
|
||||
err "no makefile!" "handle_makefile" "$@"
|
||||
|
||||
_copy=".config"
|
||||
|
||||
if [ "$mode" = "savedefconfig" ]; then
|
||||
|
||||
_copy="defconfig"
|
||||
fi
|
||||
|
||||
if [ "${mode%config}" != "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||
fi
|
||||
|
||||
if [ -e "$srcdir/.git" ] && \
|
||||
[ "$project" = "u-boot" ] && \
|
||||
[ "$mode" = "distclean" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ git -C "$srcdir" $cleanargs clean -fdx; :
|
||||
fi
|
||||
}
|
||||
|
||||
run_make_command()
|
||||
{
|
||||
if [ -z "$mode" ]; then
|
||||
x_ $premake
|
||||
fi
|
||||
|
||||
if $if_not_dry_build check_cmake "$srcdir"; then
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
$if_not_dry_build \
|
||||
check_autoconf "$srcdir"
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! $if_not_dry_build check_makefile "$srcdir"; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
|
||||
$if_not_dry_build \
|
||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
|
||||
x_ $mkhelper
|
||||
fi
|
||||
|
||||
if ! check_makefile "$srcdir"; then
|
||||
|
||||
return 0
|
||||
fi
|
||||
|
||||
if [ "$mode" = "clean" ]; then
|
||||
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if ! make -C "$srcdir" $cleanargs distclean; then
|
||||
|
||||
x_ make -C "$srcdir" $cleanargs clean
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
check_cmake()
|
||||
{
|
||||
$if_dry_build \
|
||||
return 0
|
||||
|
||||
if [ ! -n "$cmakedir" ]; then
|
||||
return 0
|
||||
|
||||
elif ! check_makefile "$1"; then
|
||||
|
||||
if ! cmake -B "$1" "$1/$cmakedir"; then
|
||||
|
||||
x_ check_makefile "$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
x_ check_makefile "$1"; :
|
||||
}
|
||||
|
||||
check_autoconf()
|
||||
{
|
||||
(
|
||||
x_ cd "$1"
|
||||
|
||||
if [ -f "bootstrap" ]; then
|
||||
|
||||
x_ ./bootstrap $bootstrapargs
|
||||
fi
|
||||
|
||||
if [ -f "autogen.sh" ]; then
|
||||
|
||||
x_ ./autogen.sh $autogenargs
|
||||
fi
|
||||
|
||||
if [ -f "configure" ]; then
|
||||
|
||||
x_ ./configure $autoconfargs; :
|
||||
fi
|
||||
|
||||
) || err "can't bootstrap project: $1" "check_autoconf" "$@"; :
|
||||
}
|
||||
|
||||
check_makefile()
|
||||
{
|
||||
if [ ! -f "$1/Makefile" ] && \
|
||||
[ ! -f "$1/makefile" ] && \
|
||||
[ ! -f "$1/GNUmakefile" ]; then
|
||||
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
copy_elf()
|
||||
{
|
||||
if [ -f "$listfile" ]; then
|
||||
|
||||
x_ xbmkdir "$dest_dir"
|
||||
fi
|
||||
|
||||
if [ -f "$listfile" ]; then
|
||||
|
||||
while read -r f; do
|
||||
|
||||
if [ -f "$srcdir/$f" ]; then
|
||||
|
||||
x_ cp "$srcdir/$f" "$dest_dir"
|
||||
fi
|
||||
|
||||
done < "$listfile" || err \
|
||||
"cannot read '$listfile'" "copy_elf" "$@"; :
|
||||
fi
|
||||
|
||||
( x_ make clean -C "$srcdir" $cleanargs ) || \
|
||||
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
|
||||
}
|
||||
@@ -1,82 +1,550 @@
|
||||
#!/usr/bin/env sh
|
||||
#!/bin/sh
|
||||
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
# Copyright (c) 2020-2025 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2020-2026 Leah Rowe <leah@libreboot.org>
|
||||
# Copyright (c) 2022 Caleb La Grange <thonkpeasant@protonmail.com>
|
||||
# Copyright (c) 2022-2023 Alper Nebi Yasak <alpernebiyasak@gmail.com>
|
||||
# Copyright (c) 2022 Ferass El Hafidi <vitali64pmemail@protonmail.com>
|
||||
|
||||
set -u -e
|
||||
|
||||
ispwd="true"
|
||||
findpath()
|
||||
{
|
||||
forx 'readlink -f \"%s\" 2>/dev/null || \
|
||||
x_ realpath \"%s\" 2>/dev/null' "$@"
|
||||
}
|
||||
|
||||
if [ "$0" != "./mk" ]; then
|
||||
printf "%s\n" "%s" | grep -o "%s" 1>/dev/null || exit 1 # safety (-o check)
|
||||
forx()
|
||||
{
|
||||
awkarg="{printf \"${1-};\""
|
||||
shift 1 2>/dev/null || :
|
||||
|
||||
ispwd="false"
|
||||
fi
|
||||
if [ "$ispwd" = "true" ] && [ -L "mk" ]; then
|
||||
scount="$(printf "%s\n" "$awkarg" | grep -o "%s" | wc -l)"
|
||||
while [ $scount -gt 0 ]; do
|
||||
awkarg="$awkarg,\$0"
|
||||
scount="$(expr $scount - 1 || :)"
|
||||
done
|
||||
|
||||
ispwd="false"
|
||||
fi
|
||||
if [ "$ispwd" = "false" ]; then
|
||||
while [ $# -gt 0 ]; do
|
||||
eval "$(printf '%s\n' "$1" | awk "$awkarg}")"
|
||||
shift 1
|
||||
done
|
||||
}
|
||||
|
||||
x_()
|
||||
{
|
||||
[ $# -lt 1 ] || "$@" || err "UNHANDLED ERROR" "x_" "$@"; :
|
||||
}
|
||||
|
||||
err()
|
||||
{
|
||||
printf '%s\n' "$@" | awk '{printf "\"%s\" ", $0}'
|
||||
printf "ERROR!\n"
|
||||
|
||||
printf "You must run this in the proper work directory.\n" 1>&2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
forx 'export %s=\"C.UTF-8\"' LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME \
|
||||
LC_COLLATE LC_MONETARY LC_MESSAGES LC_PAPER LC_NAME LC_ADDRESS \
|
||||
LC_TELEPHONE LC_MEASUREMENT LC_IDENTIFICATION LC_ALL
|
||||
|
||||
(
|
||||
mk="$0"
|
||||
[ "${mk##*/}" != "$mk" ] || \
|
||||
mk="$(x_ command -v "$mk")" || exit 1
|
||||
|
||||
mk="$(x_ findpath "$mk")" || exit 1
|
||||
xbmkpwd="$(x_ dirname "$mk")" || exit 1
|
||||
|
||||
x_ cd "$xbmkpwd"
|
||||
|
||||
. "include/lib.sh"
|
||||
. "include/init.sh"
|
||||
. "include/vendor.sh"
|
||||
. "include/mrc.sh"
|
||||
. "include/inject.sh"
|
||||
. "include/rom.sh"
|
||||
. "include/release.sh"
|
||||
. "include/get.sh"
|
||||
. "include/chromebook.sh"
|
||||
. "include/env/init.sh"
|
||||
x_ xbmk_init "$@"
|
||||
|
||||
. "include/env/get.sh"
|
||||
|
||||
. "include/fw/vendor.sh"
|
||||
. "include/fw/mrc.sh"
|
||||
. "include/fw/inject.sh"
|
||||
. "include/fw/rom.sh"
|
||||
|
||||
. "include/mk/release.sh"
|
||||
|
||||
_f="${1-}"
|
||||
shift 1 2>/dev/null || :
|
||||
|
||||
eval "$(printf "version release download inject\n" | awk '{ for (i=1; i<=NF; \
|
||||
i++) $i = "[ \""$i"\" = \"$_f\" ] && x_ "$i" \"$@\" && exit 0;"; print }')"
|
||||
|
||||
# macros, overridden depending on the flag
|
||||
if_not_do_make=":" # : means false
|
||||
if_make_config=":"
|
||||
if_build=":" # can be false even if make is true
|
||||
if_dry_build=":"
|
||||
if_single_tree=":"
|
||||
eval "`newvar if_do_make if_not_make_config if_not_build if_not_dry_build`"
|
||||
|
||||
eval "`newvar configureargs autogenargs badhash badtghash bootstrapargs \
|
||||
build_depend buildtype cleanargs cmakedir cmd defconfig dest_dir elfdir \
|
||||
flag forcepull listfile makeargs mdir mkhelper mkhelpercfg mode postmake \
|
||||
premake project release rev srcdir target target_dir tree xarch xgcctree \
|
||||
xlang`"
|
||||
|
||||
main()
|
||||
{
|
||||
cmd=""
|
||||
if [ $# -gt 0 ]; then
|
||||
flags="f:F:b:m:u:s:l:n:d:"
|
||||
|
||||
cmd="$1"
|
||||
shift 1
|
||||
while getopts $flags option
|
||||
do
|
||||
[ -n "$flag" ] && \
|
||||
err "only one flag is permitted" "trees" "$@"
|
||||
|
||||
flag="$1"
|
||||
|
||||
# the "mode" variable is affixed to a make command, example:
|
||||
# "$mk" -m coreboot does: make menuconfig -C src/coreboot/tree
|
||||
|
||||
case "$flag" in
|
||||
-b) : ;; # build a source tree
|
||||
-d) # dry builds. -d is like -b but skips many build steps
|
||||
if_dry_build=""
|
||||
if_not_dry_build=":"
|
||||
;;
|
||||
-f|-F) # download source code for a project
|
||||
eval "`newvar if_not_do_make if_dry_build`"
|
||||
if_do_make=":"
|
||||
if_not_dry_build=":"
|
||||
[ "$flag" = "-F" ] && \
|
||||
forcepull="y"; : # never skip git fetch/pull
|
||||
;;
|
||||
-u) mode="oldconfig" ;;
|
||||
-m) mode="menuconfig" ;;
|
||||
-s) mode="savedefconfig" ;;
|
||||
-l) mode="olddefconfig" ;;
|
||||
-n) mode="nconfig" ;;
|
||||
*) err "invalid option '-$option'" "trees" "$@" ;;
|
||||
esac
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
if_build=""
|
||||
if_not_build=":"
|
||||
fi
|
||||
if [ "${mode%config}" != "$mode" ]; then
|
||||
if_make_config=""
|
||||
if_not_make_config=":"
|
||||
fi
|
||||
|
||||
if [ -z "${OPTARG+x}" ]; then
|
||||
shift 1
|
||||
break
|
||||
fi
|
||||
|
||||
project="${OPTARG#src/}"
|
||||
project="${project#config/git/}"
|
||||
|
||||
shift 2
|
||||
done
|
||||
|
||||
if [ -z "$flag" ]; then
|
||||
err "missing flag ($flags)" "trees" "$@"
|
||||
elif [ -z "$project" ]; then
|
||||
fx_ "x_ "$mk" $flag" x_ ls -1 config/git
|
||||
return 0
|
||||
elif [ ! -f "config/git/$project/pkg.cfg" ]; then
|
||||
err "config/git/$project/pkg.cfg missing" "trees" "$@"
|
||||
fi
|
||||
|
||||
case "$cmd" in
|
||||
elfdir="elf/$project"
|
||||
datadir="config/data/$project"
|
||||
configdir="config/$project"
|
||||
srcdir="src/$project"
|
||||
dest_dir="$elfdir"
|
||||
|
||||
version)
|
||||
listfile="$datadir/build.list"
|
||||
[ ! -f "$listfile" ] && \
|
||||
listfile="" # build.list is optional on all projects
|
||||
|
||||
printf "%s\nWebsite: %s\n" "$relname" "$projectsite"
|
||||
;;
|
||||
mkhelpercfg="$datadir/mkhelper.cfg"
|
||||
if e "$mkhelpercfg" f missing; then
|
||||
mkhelpercfg="$xbtmp/mkhelper.cfg"
|
||||
x_ touch "$mkhelpercfg"
|
||||
fi
|
||||
|
||||
release|download|inject|prep_mr_import)
|
||||
if singletree "$project"; then
|
||||
cmd="mk_single_tree"
|
||||
if_single_tree=""
|
||||
else
|
||||
cmd="mk_multi_tree"
|
||||
fi
|
||||
|
||||
$cmd "$@"
|
||||
;;
|
||||
remkdir "${tmpgit%/*}"
|
||||
x_ touch "$mkhelpercfg"
|
||||
|
||||
-*)
|
||||
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
|
||||
err "bad command" main "$@"
|
||||
;;
|
||||
esac
|
||||
|
||||
# some commands disable them. turn them back on!
|
||||
set -u -e
|
||||
|
||||
return 1
|
||||
. "$mkhelpercfg"
|
||||
$cmd "$@"
|
||||
}
|
||||
|
||||
main "$@" || exit 0
|
||||
mk_single_tree()
|
||||
{
|
||||
configure_project "$configdir" || \
|
||||
return 0
|
||||
|
||||
. "include/tree.sh"
|
||||
[ ! -f "$listfile" ] || $if_not_dry_build \
|
||||
elfcheck || return 0
|
||||
|
||||
trees "$@" || exit 0
|
||||
run_make_command && $if_build $if_not_dry_build \
|
||||
copy_elf; :
|
||||
}
|
||||
|
||||
x_ touch "$mkhelpercfg"
|
||||
mk_multi_tree()
|
||||
{
|
||||
[ ! -d "$configdir" ] && err "missing '$configdir'" mk_multi_tree "$@"
|
||||
[ $# -lt 1 ] && fx_ mk_multi_tree find "$configdir" \
|
||||
-mindepth 1 -maxdepth 1 -type d
|
||||
|
||||
. "$mkhelpercfg"
|
||||
$cmd
|
||||
[ $# -gt 0 ] && for x in "$@"
|
||||
do
|
||||
unset CROSS_COMPILE
|
||||
export PATH="$xbmkpath"
|
||||
|
||||
if [ "$x" = "list" ]; then
|
||||
x_ ls -1 "config/$project"
|
||||
listfile=""
|
||||
break
|
||||
fi
|
||||
|
||||
printf "'make %s', '%s', '%s'\n" "$mode" "$project" "$x"
|
||||
|
||||
target="${x##*/}"
|
||||
|
||||
x_ handle_defconfig
|
||||
$if_build \
|
||||
x_ $postmake; :
|
||||
done; :
|
||||
}
|
||||
|
||||
handle_defconfig()
|
||||
{
|
||||
target_dir="$configdir/$target"
|
||||
|
||||
[ ! -f "CHANGELOG" ] && \
|
||||
single_tree_fetch "$project"
|
||||
|
||||
configure_project "$target_dir" || \
|
||||
return 0
|
||||
|
||||
[ -z "$tree" ] && err "$configdir: 'tree' unset" handle_defconfig "$@"
|
||||
|
||||
srcdir="src/$project/$tree"
|
||||
|
||||
[ -d "$srcdir" ] && for y in "$target_dir/config"/*
|
||||
do
|
||||
[ ! -f "$y" ] && \
|
||||
$if_not_dry_build \
|
||||
continue
|
||||
|
||||
$if_not_dry_build eval \
|
||||
defconfig="$y"
|
||||
|
||||
$if_build \
|
||||
prep_mk_multi_tree || continue
|
||||
|
||||
handle_makefile
|
||||
|
||||
$if_build $if_not_dry_build \
|
||||
copy_elf; :
|
||||
done; :
|
||||
}
|
||||
|
||||
configure_project()
|
||||
{
|
||||
_tcfg="$1/target.cfg"
|
||||
|
||||
eval "`newvar configureargs badhash badtghash bootstrapargs \
|
||||
build_depend buildtype cleanargs makeargs mkhelper postmake \
|
||||
premake release xarch xgcctree xlang`"
|
||||
|
||||
[ ! -f "$_tcfg" ] && buildtype="auto"
|
||||
|
||||
# globally initialise all variables for a source tree / target:
|
||||
if e "$datadir/mkhelper.cfg" f; then
|
||||
. "$datadir/mkhelper.cfg" || \
|
||||
err "Can't read '$datadir/mkhelper.cfg'" \
|
||||
"configure_project" "$@"
|
||||
fi
|
||||
|
||||
# override target/tree specific variables from per-target config:
|
||||
while e "$_tcfg" f || [ "$cmd" != "mk_single_tree" ]
|
||||
do
|
||||
printf "Loading %s config: %s\n" "$project" "$_tcfg"
|
||||
eval "`newvar rev tree`"
|
||||
|
||||
. "$_tcfg" || err "Can't read '$_tcfg'" configure_project "$@"
|
||||
|
||||
$if_dry_build eval \
|
||||
build_depend=""
|
||||
|
||||
$if_single_tree \
|
||||
break
|
||||
$if_do_make \
|
||||
break
|
||||
[ "${_tcfg%/*/target.cfg}" = "${_tcfg%"/$tree/target.cfg"}" ] \
|
||||
&& break # target and tree matching was successful
|
||||
|
||||
_tcfg="${_tcfg%/*/target.cfg}/$tree/target.cfg" # try next
|
||||
done
|
||||
|
||||
[ "$XBMK_RELEASE" = "y" ] && [ "$release" = "n" ] && \
|
||||
return 1
|
||||
[ -n "$buildtype" ] && $if_make_config \
|
||||
return 1
|
||||
|
||||
$if_build $if_not_dry_build \
|
||||
build_dependencies
|
||||
|
||||
mdir="$xbmkpwd/config/submodule/$project"
|
||||
[ -n "$tree" ] && mdir="$mdir/$tree"
|
||||
|
||||
if [ ! -f "CHANGELOG" ]; then
|
||||
delete_old_project_files
|
||||
$if_not_do_make \
|
||||
${cmd#mk_}_fetch
|
||||
fi
|
||||
$if_not_do_make \
|
||||
return 1
|
||||
|
||||
x_ "$mk" -f "$project" "$target"
|
||||
}
|
||||
|
||||
# projects can specify which other projects
|
||||
# to build first, as declared dependencies:
|
||||
|
||||
build_dependencies()
|
||||
{
|
||||
for bd in $build_depend
|
||||
do
|
||||
bd_project="${bd%%/*}"
|
||||
bd_tree="${bd##*/}"
|
||||
|
||||
[ -z "$bd_project" ] && \
|
||||
$if_not_dry_build \
|
||||
err "$project/$tree: !bd '$bd'" \
|
||||
"build_dependencies" "$@"
|
||||
|
||||
[ "${bd##*/}" = "$bd" ] && \
|
||||
bd_tree=""
|
||||
|
||||
[ -n "$bd_project" ] && \
|
||||
$if_not_dry_build \
|
||||
x_ "$mk" -b $bd_project $bd_tree; :
|
||||
done; :
|
||||
}
|
||||
|
||||
# delete_old_project_files along with project_up_to_date,
|
||||
# concatenates the sha512sum hashes of all files related to
|
||||
# a project, tree or target, then gets the sha512sum of that
|
||||
# concatenation. this is checked against any existing
|
||||
# calculation previously cached; if the result differs, or
|
||||
# nothing was previously stored, we know to delete resources
|
||||
# such as builds, project sources and so on, for auto-rebuild:
|
||||
|
||||
delete_old_project_files()
|
||||
{
|
||||
# delete an entire source tree along with its builds:
|
||||
project_up_to_date hash "$tree" badhash "$datadir" \
|
||||
"$configdir/$tree" "$mdir" || \
|
||||
x_ rm -Rf "src/$project/$tree" "elf/$project/$tree"
|
||||
|
||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/hash/$project$tree"
|
||||
|
||||
if singletree "$project" || [ -z "$target" ] || [ "$target" = "$tree" ]
|
||||
then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# delete only the builds of a given target, but not src.
|
||||
# this is useful when only the target config changes, for
|
||||
# example x200_8mb coreboot configs change, but not coreboot:
|
||||
|
||||
project_up_to_date tghash "$target" badtghash "$configdir/$target" || \
|
||||
x_ rm -Rf "elf/$project/$tree/$target"
|
||||
|
||||
x_ cp "$xbtmp/new.hash" "$XBMK_CACHE/tghash/$project$target"
|
||||
}
|
||||
|
||||
project_up_to_date()
|
||||
{
|
||||
eval "`newvar hash old_hash`"
|
||||
|
||||
hashdir="$1"
|
||||
hashname="$2"
|
||||
badhashvar="$3"
|
||||
|
||||
shift 3
|
||||
|
||||
x_ mkdir -p "$XBMK_CACHE/$hashdir"
|
||||
|
||||
if [ -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
read -r old_hash < "$XBMK_CACHE/$hashdir/$project$hashname" \
|
||||
|| err \
|
||||
"$hashdir: err '$XBMK_CACHE/$hashdir/$project$hashname'" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" \
|
||||
"$@"
|
||||
fi
|
||||
|
||||
eval "$build_sbase"
|
||||
fx_ "x_ util/sbase/sha512sum" find "$@" -type f -not -path \
|
||||
"*/.git*/*" | awk '{print $1}' > "$xbtmp/tmp.hash" || \
|
||||
err "!h $project $hashdir" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
hash="$(x_ "$sha512sum" "$xbtmp/tmp.hash" | awk '{print $1}' || \
|
||||
err)" || err "$hashname: Can't read sha512 of '$xbtmp/tmp.hash'" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
if [ "$hash" != "$old_hash" ] || \
|
||||
[ ! -f "$XBMK_CACHE/$hashdir/$project$hashname" ]; then
|
||||
eval "$badhashvar=\"y\""
|
||||
fi
|
||||
|
||||
printf "%s\n" "$hash" > "$xbtmp/new.hash" || \
|
||||
err "!mkhash $xbtmp/new.hash ($hashdir $hashname $badhashvar)" \
|
||||
"project_up_to_date" "$hashdir" "$hashname" "$badhashvar" "$@"
|
||||
|
||||
eval "[ \"\$$badhashvar\" = \"y\" ] && return 1"; :
|
||||
}
|
||||
|
||||
prep_mk_multi_tree()
|
||||
{
|
||||
dest_dir="$elfdir/$tree/$target/${defconfig#"$target_dir/config/"}"
|
||||
|
||||
$if_not_dry_build elfcheck || return 1 # skip if a build exists
|
||||
$if_not_dry_build eval "$(printf '%s\n' "$xarch" | awk \
|
||||
'{ for (i=1; i<=NF; i++) $i = "check_xgcc \""$i"\";"; print }')"
|
||||
}
|
||||
|
||||
check_xgcc()
|
||||
{
|
||||
cbdir="src/coreboot/$tree"
|
||||
|
||||
[ "$project" != "coreboot" ] && \
|
||||
cbdir="src/coreboot/default"
|
||||
[ -n "$xgcctree" ] && \
|
||||
cbdir="src/coreboot/$xgcctree"
|
||||
|
||||
cbelfdir="elf${cbdir#src}"
|
||||
|
||||
xfix="${1%-*}"
|
||||
[ "$xfix" = "x86_64" ] && xfix="x64"
|
||||
|
||||
xgccfile="$cbelfdir/xgcc_${xfix}_was_compiled"
|
||||
xgccargs="crossgcc-$xfix UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
|
||||
|
||||
x_ "$mk" -f coreboot "${cbdir#src/coreboot/}"
|
||||
x_ mkdir -p "$cbelfdir"
|
||||
|
||||
# tell build systems what cross-compiler to use
|
||||
export PATH="$xbmkpwd/$cbdir/util/crossgcc/xgcc/bin:$PATH"
|
||||
export CROSS_COMPILE="${xarch% *}-" # used by e.g. u-boot
|
||||
|
||||
# coreboot-specific (we disable gnat on some trees)
|
||||
[ -n "$xlang" ] && \
|
||||
export BUILD_LANGUAGES="$xlang"
|
||||
|
||||
[ -f "$xgccfile" ] && return 0 # skip (build already exists)
|
||||
|
||||
make -C "$cbdir" $xgccargs || x_ make -C "$cbdir" $xgccargs
|
||||
|
||||
x_ touch "$xgccfile" # prevent unnecessary re-build operations
|
||||
}
|
||||
|
||||
elfcheck()
|
||||
{
|
||||
# TODO: *STILL* very hacky check. do it properly (based on build.list)
|
||||
( fx_ "eval exit 1 && err" find "$dest_dir" -type f ) || return 1; :
|
||||
}
|
||||
|
||||
handle_makefile()
|
||||
{
|
||||
check_makefile "$srcdir" && $if_not_dry_build \
|
||||
x_ make -C "$srcdir" clean $cleanargs
|
||||
|
||||
[ -f "$defconfig" ] && \
|
||||
x_ cp "$defconfig" "$srcdir/.config"
|
||||
|
||||
run_make_command || err "no makefile!" "handle_makefile" "$@"
|
||||
|
||||
_copy=".config"
|
||||
[ "$mode" = "savedefconfig" ] && \
|
||||
_copy="defconfig"
|
||||
|
||||
$if_make_config \
|
||||
x_ cp "$srcdir/$_copy" "$defconfig"; :
|
||||
}
|
||||
|
||||
run_make_command()
|
||||
{
|
||||
$if_build \
|
||||
x_ $premake
|
||||
$if_not_dry_build \
|
||||
run_make_command_real || return 1
|
||||
$if_build \
|
||||
x_ $mkhelper; :
|
||||
}
|
||||
|
||||
run_make_command_real()
|
||||
{
|
||||
[ -z "$cmakedir" ] || \
|
||||
x_ cmake -B "$srcdir" "$srcdir/$cmakedir"
|
||||
$if_build \
|
||||
check_autoconf "$srcdir"
|
||||
|
||||
check_makefile "$srcdir" || return 1
|
||||
x_ make -C "$srcdir" $mode -j$XBMK_THREADS $makeargs
|
||||
}
|
||||
|
||||
check_autoconf()
|
||||
{
|
||||
(
|
||||
x_ cd "$1"
|
||||
|
||||
[ -f "bootstrap" ] && \
|
||||
x_ ./bootstrap $bootstrapargs
|
||||
[ -f "autogen.sh" ] && \
|
||||
x_ ./autogen.sh $autogenargs
|
||||
[ -f "configure" ] && \
|
||||
x_ ./configure $configureargs; :
|
||||
|
||||
) || err "can't bootstrap project: $1" check_autoconf "$@"; :
|
||||
}
|
||||
|
||||
check_makefile()
|
||||
{
|
||||
[ ! -f "$1/Makefile" ] && [ ! -f "$1/makefile" ] && \
|
||||
[ ! -f "$1/GNUmakefile" ] && return 1; :
|
||||
}
|
||||
|
||||
copy_elf()
|
||||
{
|
||||
[ -f "$listfile" ] && \
|
||||
x_ mkdir -p "$dest_dir"
|
||||
|
||||
if [ -f "$listfile" ]; then
|
||||
while read -r f; do
|
||||
[ -f "$srcdir/$f" ] && \
|
||||
x_ cp "$srcdir/$f" "$dest_dir"; :
|
||||
|
||||
done < "$listfile" || err \
|
||||
"cannot read '$listfile'" "copy_elf" "$@"; :
|
||||
fi
|
||||
|
||||
( x_ make -C "$srcdir" clean $cleanargs ) || \
|
||||
err "can't make-clean '$srcdir'" "copy_elf" "$@"; :
|
||||
}
|
||||
|
||||
x_ main "$_f" "$@"
|
||||
|
||||
) || exit 1; :
|
||||
|
||||
Reference in New Issue
Block a user