aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortdro <tdro@users.noreply.github.com>2021-06-13 04:22:05 -0400
committertdro <tdro@users.noreply.github.com>2021-06-13 04:32:56 -0400
commitc661b37908eec45121870b05d1248c31c9c7e015 (patch)
tree28f10c197ed4748769f3d5d9e2f0a42c40e61ca4
parent98352dd0aca72499bf914b4526c57dcc2f91d29a (diff)
downloaddotfiles-c661b37908eec45121870b05d1248c31c9c7e015.tar.gz
dotfiles-c661b37908eec45121870b05d1248c31c9c7e015.tar.bz2
dotfiles-c661b37908eec45121870b05d1248c31c9c7e015.zip
.config/nixpkgs/shells/coreboot: Condense help info
Patch payloads/libpayload/Makefile.payload strip
-rw-r--r--.config/nixpkgs/shells/coreboot.nix78
1 files 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
+
+ '
'';
}