Skip to content

Commit 7007d18

Browse files
committed
- Addition of nvmutil (nvm) from osboot project to play with gbe (Thanks @githubisnonfree!)
- Addition of ifdtool from coreboot project to extract gbe - As of now, its implemented in a hacky way: - ifdtool dir is copied over ifdtool_cross at coreboot's module configure step - then initrd packing step checks for CONFIG_NVMUTIL and builds and pack ifdtool_cross/ifdtool - As a result, what is build under build/coreboot/$BOARD is coreboot's real, where build/coreboot/ content follows Makefile rules - CONFIG_NVMUTIL in board config adds both ifdtool_cross/ifdtool and nvmutil into initrd - Added CONFIG_NVMUTIL to all hotp-maximized boards (to test for size changes) Manually tested (working!): - backup rom from: `flashrom -p internal -r /tmp/backup.rom` - go to that dir: `cd /tmp` - extract gbe from ifdtool on backup.rom: `ifdtool -x backup.rom` - source shell functions: `. /etc/functions` - show current PHY mac address: `nvm showmac flashregion_3_gbe.bin` - generate mac address from sourced shell functions: `newmac=$(generate_random_mac_address)` - show new mac: `echo $newmac` - change mac from nvmtool on extracted gbe: `nvm flashregion_3_gbe.bin setmac $newmac` - insert modified gbe into backup.rom.new with ifdtool: `ifdtool -i gbe:flashregion_3_gbe.bin backup.rom` - flash back modified gbe only through flashrom: `flashrom -p internal --ifd -i gbe -w backup.rom.new` Signed-off-by: Thierry Laurion <insurgo@riseup.net>
1 parent c9e067c commit 7007d18

File tree

23 files changed

+62
-11
lines changed

23 files changed

+62
-11
lines changed

Makefile

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -358,19 +358,19 @@ define define_module =
358358
echo -n '$($1_repo)|$($1_commit_hash)' > "$$@"; \
359359
fi
360360
if [ ! -e "$(build)/$($1_base_dir)/.patched" ]; then \
361-
if [ -r patches/$($1_patch_name).patch ]; then \
361+
if [ -r patches/$($1_patch_name).patch ]; then \
362362
( git apply --verbose --reject --binary --directory build/$(CONFIG_TARGET_ARCH)/$($1_base_dir) ) \
363-
< patches/$($1_patch_name).patch \
364-
|| exit 1 ; \
363+
< patches/$($1_patch_name).patch \
364+
|| exit 1 ; \
365365
fi && \
366-
if [ -d patches/$($1_patch_name) ] && \
367-
[ -r patches/$($1_patch_name) ] ; then \
368-
for patch in patches/$($1_patch_name)/*.patch ; do \
369-
echo "Applying patch file : $$$$patch " ; \
366+
if [ -d patches/$($1_patch_name) ] && \
367+
[ -r patches/$($1_patch_name) ] ; then \
368+
for patch in patches/$($1_patch_name)/*.patch ; do \
369+
echo "Applying patch file : $$$$patch " ; \
370370
( git apply --verbose --reject --binary --directory build/$(CONFIG_TARGET_ARCH)/$($1_base_dir) ) \
371-
< $$$$patch \
372-
|| exit 1 ; \
373-
done ; \
371+
< $$$$patch \
372+
|| exit 1 ; \
373+
done ; \
374374
fi && \
375375
touch "$(build)/$($1_base_dir)/.patched"; \
376376
fi
@@ -573,6 +573,7 @@ bin_modules-$(CONFIG_ZSTD) += zstd
573573
bin_modules-$(CONFIG_E2FSPROGS) += e2fsprogs
574574
bin_modules-$(CONFIG_EXFATPROGS) += exfatprogs
575575
bin_modules-$(CONFIG_IOTOOLS) += iotools
576+
bin_modules-$(CONFIG_NVMUTIL) += nvmutil
576577

577578
$(foreach m, $(bin_modules-y), \
578579
$(call map,initrd_bin_add,$(call bins,$m)) \
@@ -584,7 +585,7 @@ $(foreach m, $(modules-y), \
584585
)
585586

586587
#
587-
# hack to build cbmem from coreboot
588+
# hack to build cbmem and ifdtool from coreboot
588589
# this must be built *AFTER* musl, but since coreboot depends on other things
589590
# that depend on musl it should be ok.
590591
#
@@ -593,11 +594,19 @@ ifeq ($(CONFIG_COREBOOT),y)
593594
$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/cbmem/cbmem))
594595
#$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/superiotool/superiotool))
595596
#$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/inteltool/inteltool))
597+
ifeq ($(CONFIG_NVMUTIL),y)
598+
#NVMUTIL(nvm) is applied on ifdtool extracted gbe.bin from a flashrom backup under Heads.
599+
# We consequently need ifdtool packed under initrd with cross-compiler
600+
# coreboot module copied ifdtool into ifdtool_cross at configure step
601+
# so that coreboot builds its own and we ask one to be cross-build and packed here
602+
$(eval $(call initrd_bin_add,$(COREBOOT_UTIL_DIR)/ifdtool_cross/ifdtool))
603+
endif
596604
endif
597605

598606
$(COREBOOT_UTIL_DIR)/cbmem/cbmem \
599607
$(COREBOOT_UTIL_DIR)/superiotool/superiotool \
600608
$(COREBOOT_UTIL_DIR)/inteltool/inteltool \
609+
$(COREBOOT_UTIL_DIR)/ifdtool_cross/ifdtool \
601610
: $(build)/$(coreboot_base_dir)/.canary musl-cross
602611
+$(call do,MAKE,$(notdir $@),\
603612
$(MAKE) -C "$(dir $@)" $(CROSS_TOOLS) \

boards/UNTESTED_t520-hotp-maximized/UNTESTED_t520-hotp-maximized.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ CONFIG_LINUX_E1000E=y
1818
CONFIG_CRYPTSETUP=y
1919
CONFIG_FLASHROM=y
2020
CONFIG_FLASHTOOLS=y
21+
CONFIG_NVMUTIL=y
2122
CONFIG_GPG2=y
2223
CONFIG_KEXEC=y
2324
CONFIG_UTIL_LINUX=y

boards/UNTESTED_t530-dgpu-hotp-maximized/UNTESTED_t530-dgpu-hotp-maximized.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONFIG_LINUX_E1000E=y
2121
CONFIG_CRYPTSETUP2=y
2222
CONFIG_FLASHROM=y
2323
CONFIG_FLASHTOOLS=y
24+
CONFIG_NVMUTIL=y
2425
CONFIG_GPG2=y
2526
CONFIG_KEXEC=y
2627
CONFIG_UTIL_LINUX=y

boards/UNTESTED_w530-dgpu-K1000m-hotp-maximized/UNTESTED_w530-dgpu-K1000m-hotp-maximized.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONFIG_LINUX_E1000E=y
2121
CONFIG_CRYPTSETUP2=y
2222
CONFIG_FLASHROM=y
2323
CONFIG_FLASHTOOLS=y
24+
CONFIG_NVMUTIL=y
2425
CONFIG_GPG2=y
2526
CONFIG_KEXEC=y
2627
CONFIG_UTIL_LINUX=y

boards/UNTESTED_w530-dgpu-K2000m-hotp-maximized/UNTESTED_w530-dgpu-K2000m-hotp-maximized.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ CONFIG_LINUX_E1000E=y
2121
CONFIG_CRYPTSETUP2=y
2222
CONFIG_FLASHROM=y
2323
CONFIG_FLASHTOOLS=y
24+
CONFIG_NVMUTIL=y
2425
CONFIG_GPG2=y
2526
CONFIG_KEXEC=y
2627
CONFIG_UTIL_LINUX=y

boards/nitropad-ns50/nitropad-ns50.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CONFIG_QRENCODE=y
1414
CONFIG_TPMTOTP=y
1515
CONFIG_POPT=y
1616
CONFIG_FLASHTOOLS=y
17+
CONFIG_NVMUTIL=y
1718
CONFIG_FLASHROM=y
1819
CONFIG_PCIUTILS=y
1920
CONFIG_UTIL_LINUX=y

boards/nitropad-nv41/nitropad-nv41.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ CONFIG_QRENCODE=y
1414
CONFIG_TPMTOTP=y
1515
CONFIG_POPT=y
1616
CONFIG_FLASHTOOLS=y
17+
CONFIG_NVMUTIL=y
1718
CONFIG_FLASHROM=y
1819
CONFIG_PCIUTILS=y
1920
CONFIG_UTIL_LINUX=y

boards/qemu-coreboot-fbwhiptail-tpm1-hotp/qemu-coreboot-fbwhiptail-tpm1-hotp.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ CONFIG_QRENCODE=y
2727
CONFIG_TPMTOTP=y
2828
CONFIG_POPT=y
2929
CONFIG_FLASHTOOLS=y
30+
CONFIG_NVMUTIL=y
3031
CONFIG_FLASHROM=y
3132
CONFIG_PCIUTILS=y
3233
CONFIG_UTIL_LINUX=y

boards/qemu-coreboot-fbwhiptail-tpm1/qemu-coreboot-fbwhiptail-tpm1.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CONFIG_QRENCODE=y
2828
CONFIG_TPMTOTP=y
2929
CONFIG_POPT=y
3030
CONFIG_FLASHTOOLS=y
31+
CONFIG_NVMUTIL=y
3132
CONFIG_FLASHROM=y
3233
CONFIG_PCIUTILS=y
3334
CONFIG_UTIL_LINUX=y

boards/qemu-coreboot-fbwhiptail-tpm2-hotp/qemu-coreboot-fbwhiptail-tpm2-hotp.config

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ CONFIG_QRENCODE=y
2828
CONFIG_TPMTOTP=y
2929
CONFIG_POPT=y
3030
CONFIG_FLASHTOOLS=y
31+
CONFIG_NVMUTIL=y
3132
CONFIG_FLASHROM=y
3233
CONFIG_PCIUTILS=y
3334
CONFIG_UTIL_LINUX=y

0 commit comments

Comments
 (0)