From c661b37908eec45121870b05d1248c31c9c7e015 Mon Sep 17 00:00:00 2001 From: tdro Date: Sun, 13 Jun 2021 04:22:05 -0400 Subject: .config/nixpkgs/shells/coreboot: Condense help info Patch payloads/libpayload/Makefile.payload strip --- .config/nixpkgs/shells/coreboot.nix | 78 ++++++++++++++----------------------- 1 file changed, 30 insertions(+), 48 deletions(-) diff --git a/.config/nixpkgs/shells/coreboot.nix b/.config/nixpkgs/shells/coreboot.nix index 0ea776c..02a4366 100644 --- a/.config/nixpkgs/shells/coreboot.nix +++ b/.config/nixpkgs/shells/coreboot.nix @@ -66,57 +66,39 @@ in pkgs.mkShell { shellHook = '' export PS1='\h (${name}) \W \$ ' - mkdir -p '${project}' git clone '${url}' '${project}' || true cd '${project}' || exit 1 - - [ ! -L util/crossgcc ] && rm -rf util/crossgcc + rm -rf util/crossgcc ln -sf ${toolchain} util/crossgcc - - printf " - **** COMMANDS **** - - # view toolchain help - make help_toolchain - - # clear old configuration - make distclean - - # build i386, Aarch64, and RISC-V toolchain - make crossgcc-i386 CPUS=$(nproc) - make crossgcc-aarch64 CPUS=$(nproc) - make crossgcc-riscv CPUS=$(nproc) - - # build coreinfo payload - make -C payloads/coreinfo olddefconfig - make -C payloads/coreinfo - - # setup configurtion - make nconfig - select 'Mainboard' menu - Beside 'Mainboard vendor' should be '(Emulation)' - Beside 'Mainboard model' should be 'QEMU x86 i440fx/piix4' - select < Exit > - - select 'Payload' menu - select 'Add a Payload' - choose 'An Elf executable payload' - select 'Payload path and filename' - enter 'payloads/coreinfo/build/coreinfo.elf' - select < Exit > - select < Exit > - select < Yes > - - # check configuration - make savedefconfig - cat defconfig - - # build coreboot - make - - # test image in qemu - qemu-system-x86_64 -bios build/coreboot.rom -serial stdio - " + sed -i 's|$(OBJCOPY) --strip-$(STRIP) $< $@|$(OBJCOPY) --strip-debug $< $@|g' payloads/libpayload/Makefile.payload + + printf ' + flashrom --programmer internal # read BIOS chipset internally if possible + flashrom --programmer internal --read backup.rom --chip $chipset # read BIOS internally if possible with selected chipset + flashrom --programmer internal --read backup1.rom --chip $chipset + flashrom --programmer internal --read backup2.rom --chip $chipset + flashrom --programmer internal --read backup3.rom --chip $chipset + flashrom --programmer ch341a_spi --read backup.rom --chip $chipset # use an external programmer if internal does not work + sha256sum *.rom # check BIOS hashes for exactness + me_cleaner.py --soft-disable backup.rom # clean management engine and overwrite bios inplace + ifdtool --extract backup.rom # split regions of cleaned bios + + # Rename and move descriptor.bin, gbe.bin, me.bin into 3rdparty/blobs/mainboard/$vendor/$model where + # $vendor and $model are variable (for example lenovo/t420). Create folders if they do not exist. + # To test in qemu select model/vendor Emulation/QEMU x86 i440fx/piix4 in nconfig. + # In real world situations, one might only read and write internally to the bios region. + + flashrom --programmer internal --read bios.rom --chip $chipset --ifd --image bios + flashrom --programmer internal --write bios.rom --chip $chipset --ifd --image bios + + make distclean # clear old configuration + make clean # clear old compilation and keep configuration + make nconfig # setup configurtion + cat .config # check configuration + make # build coreboot + qemu-system-x86_64 -bios build/coreboot.rom -serial stdio # test image in qemu + + ' ''; } -- cgit v1.2.3