From a6d33c415884f109b4b040e92bea2d31730f3704 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Fri, 30 Aug 2024 02:36:57 +0100 Subject: [PATCH] update the 820 g2 hp guide make it easier to read Signed-off-by: Leah Rowe --- site/docs/hardware/hp820g2.md | 239 ++++++++-------------------------- 1 file changed, 51 insertions(+), 188 deletions(-) diff --git a/site/docs/hardware/hp820g2.md b/site/docs/hardware/hp820g2.md index f5bacb0..45b0bc5 100644 --- a/site/docs/hardware/hp820g2.md +++ b/site/docs/hardware/hp820g2.md @@ -59,6 +59,8 @@ P*: Partially works with blobs | **SeaBIOS with GRUB** | Works | +Brief board info: + Full hardware specifications can be found on HP's own website: @@ -66,151 +68,25 @@ Full hardware specifications can be found on HP's own website: Introduction ============ -**Unavailable in Libreboot 20231106 or earlier. You must [compile from -source](../build/), or use a release newer than 20231106.** - -This is a beastly 12.5" Broadwell machine from HP, the main benefit of which is -greater power efficiency (compared to Ivybridge and Haswell platforms), while -offering similar CPU performance but much higher graphics performance. - -Variants exist with either Intel Core i5-5200U, i5-5300U, i7-5500U or -i7-5600U and it comes with a plethora of ports; 3x USB 3.0, DisplayPort (which -can do 4K 60Hz), a VGA port, can be expanded to 32GB RAM, has *3* slots which -can take SSDs (PCIe, M2 and regular SATA), also has a side dock connector (for -a docking station). The screen is eDP type and can be upgraded to 1920x1080. - -This is a nice portable machine, with very reasonable performance. Most people -should be very satisfied with it, in daily use. It is widely available in -online market places. This page will tell you how to flash it! - -All variants of this mainboard will come with Intel HD 5500 graphics, which has -completely free software initialisation in coreboot, provided by *libgfxinit*. - -Build ROM image from source ---------------------------- - First, install the build dependencies and initialise git, using the instructions in [building from source](../build/). Unless you're using a release after Libreboot 20231106, you *must* use the latest `lbmk.git`. -The build target, when building from source, is thus: +Please build this from source with lbmk: ./mk -b coreboot hp820g2_12mb -NOTE: The actual flash is 16MB, but you must flash only the first 12MB of it. -The ROM images provided by Libreboot are 12MB. - -There is a separate 2MB *system* flash that you must *erase*, prior to -installing Libreboot. This, along with Libreboot's modified IFD, bypasses -the security (HP Sure Start) that the vendor put there, allowing you to -use coreboot-based firmware such as Libreboot. - -Installation -============ - -Insert binary files -------------------- - -If you're using a release ROM, please ensure that you've inserted extra firmware -required refer to the [guide](../install/ivy_has_common.md) for that. (**failure -to adhere to this advice will result in a bricked machine**) - -If you're *building* from source (using lbmk), the steps takes above are done -for you automatically, inserting all of the required files. The above link is -only relevant for *release* images, which lack some of these files. - -Set MAC address ---------------- - -This platform uses an Intel Flash Descriptor, and defines an Intel GbE NVM -region. As such, release/build ROMs will contain the same MAC address. To -change the MAC address, please read [nvmutil documentation](../install/nvmutil.md). - -Update an existing Libreboot installation ------------------ - -HP EliteBook 820 G2 - -NOTE: This section only applies if you haven't enabled write protection. You -can otherwise use the external flashing instructions (see below) for both the -initial installation and updates, but for updates you don't need to re-erase -the private flash, if it was already erased. - -If you're already running Libreboot, and you don't have flash protection -turned on, [internal flashing](../install/) is possible, but please note: - -You must *only* flash the first 12MB, and nothing in the final 4MB of the flash. -This is because the EC firmware is in flash, and we don't touch that during -initial installation or during updates. - -Update it like so: - -Create a dummy 16MB ROM like so: - -``` -dd if=/dev/zero of=new.bin bs=16M count=1 -``` - -Then insert your 12MB Libreboot ROM image into the dummy file: - -``` -dd if=libreboot.rom of=new.bin bs=12M count=1 conv=notrunc -``` - -The `libreboot.rom` file is the 12MB image from Libreboot. The `new.bin` -file is the Libreboot ROM, padded to 16MB. You will not flash the entire 16MB -file, but flashprog detects a 16MB flash IC. This just makes flashrom not -complain about mismatching ROM/chip size. - -NOTE: Libreboot standardises on [flashprog](https://flashprog.org/wiki/Flashprog) -now, as of 27 January 2024, which is a fork of flashrom. - -You should flash each region individually: - -``` -flashprog -p internal --ifd -i gbe -w new.bin --noverify-all -flashprog -p internal --ifd -i bios -w new.bin --noverify-all -flashprog -p internal --ifd -i me -w new.bin --noverify-all -flashprog -p internal --ifd -i ifd -w new.bin --noverify-all -``` - -NOTE: The `--ifd` option uses the regions defined in the *flashed* IFD, so -they must match the ROM. You can otherwise dump a layout file and use that, -using the instructions below (using `-l layout.txt` instead of `--ifd`). - -NOTE: If you already did an installation before, and you don't want to -[change the MAC address](../install/nvmutil.html) stored in the gbe region, -you can skip the gbe/ifd/me regions as above, and flash just the BIOS region. - -NOTE: Use of `--ifd` requires flashrom 1.2 or higher. If you have an older -version, or you don't have `--ifd`, you could instead do: - -``` -ifdtool -f layout.txt libreboot.rom -``` - -Then, instead of `--ifd` you would use `-l layout.txt`. - -ALSO: The `--ifd` option makes flashrom flash regions based on what's in -the *current* flashed IFD. - -Flashing Libreboot first time (hardware) -======================================== - -**PLEASE ENSURE that you dump a copy of both flash ICs (system flash and -private flash). Take two dumps of each, and make sure each has two good hashes. -This is because there are certain files that, while you may not need for a -regular Libreboot installation, may be useful for recovery purposes. You have -been warned!** - -This section is relevant to you if you're still running the original HP -firmware. You must [flash externally](../install/spi.md). - -Take stock of these further notes, because there are extra steps that you -must take. +More information is available in the [build guide](../build/), including how +to install build dependencies. Building from source is required, because there +aren't any ROM images for this board, in regular Libreboot releases. The +reason is that the vendor inject scripts don't currently work, because coreboot +compresses the refcode when inserting it at build time, and the process of +compression is not yet reproducible; it's not feasible to do so, and making +it not be compressed in flash would not be ideal either, so this is simply +a source-only port in Libreboot. HP Sure Start -------------- +============= There is a 16MB flash and a 2MB flash. Read this page for info: @@ -225,7 +101,9 @@ flash IC). You might want to dump the private flash first, just in case (use `-r priv.rom` or whatever filename you want to dump to, and take two dumps, ensuring that -the hashes match). The private (2MB) flash is inaccessible from your OS. The +the hashes match); one dump for the first erase, and another for the next +erase. If they match, then the erase was likely a success. The private (2MB) +flash is inaccessible from your OS. The system stores hashes of the IFD, GbE and a copy of IFD/GbE in private flash, restoring them if they were modified, but erasing the private flash disables this security mechanism. @@ -234,72 +112,56 @@ Here is a photo of the board, with the flashes: ![HP 820 G2 flash](https://av.libreboot.org/hp820g2/hp820g2_flash.jpg) -HP bootblock ------------- + -See: +Make sure to read and understand all of this first, before attempting +the Libreboot installation, because it's also important when updating +Libreboot later on. -In this page it talks about HP's own bootblock and EC firmware. These are in -the final 4MB of the flash. You must *not* modify these, because you will brick -your machine unless the IFD is modified; +Installation of Libreboot +========================= -This is why Libreboot provides 12MB images. The IFD in Libreboot is modified, as -per this coreboot documentation, to make the BIOS region *end* at the last byte -of the first 12MB in flash, bypassing HP's security entirely. In other words, -you can run whatever you want (such as Libreboot) in the first 12MB of flash, -so long as the upper 4MB is untouched and the private 2MB flash has been erased. +Make sure to set the MAC address in the flash: +[Modify MAC addresses with nvmutil](../install/nvmutil.md). -With Libreboot's modified IFD, HP's own bootblock is never executed, but the -EC firmware *is*, and must be left alone. You do not to insert it in your -Libreboot ROM because it's already in flash, within that last 4MB. +Refer to the [Libreboot flashing guides](../install/spi.md) -Flash a ROM image (hardware) ------------------ +Here are the flash ICs: -**REMOVE all power sources like battery, charger and so on, before doing this. -This is to prevent short circuiting and power surges while flashing.** +![](https://av.libreboot.org/hp820g2/hp820g2_flash.jpg) -For general information, please refer to [25xx NOR flash -instructions](../install/spi.md). +When you flash the 12MB image, please do the following with it: -Remove the bottom cover via the latch, and the flashes are accessible. -First, dump both flashes for backup, using the `-r` option (instead of `-w`) -in flashrom. Two dumps of each flash, make sure both dumps match for each chip. + dd if=/dev/zero of=4mb.bin bs=4M count=1 + cat libreboot.rom 4mb.bin > libreboot16.rom -We will assume that your system flash (16MB) dump is named `dump.bin`. This is -the dump of your 16MB flash, containing HP's firmware, including the final -bootblock and EC firmware. +Be careful: do not fully flash `libreboot16.rom` -This gives you everything, including the final 4MB. Now insert your new ROM -into a copy of `dump.bin`: +Flash it like this, instead: ``` -cp -R dump.bin new.bin -dd if=libreboot.rom of=new.bin bs=12M count=1 conv=notrunc +flashprog -p PROGRAMMER --ifd -i gbe -w libreboot16.rom --noverify-all +flashprog -p PROGRAMMER --ifd -i bios -w libreboot16.rom --noverify-all +flashprog -p PROGRAMMER --ifd -i me -w libreboot16.rom --noverify-all +flashprog -p PROGRAMMER --ifd -i ifd -w libreboot16.rom --noverify-all ``` -Flash `new.bin` to system flash (16MB IC) using the `-w` option in flashrom, -and erase the private (2MB) flash IC, -using the `--erase` option (instead of `-w filename.rom`) in flashrom. +Replace `PROGRAMMER` according to whichever flasher you're using. You could +also replace it with `internal`, if later flashing internally to update an +existing Libreboot installation. -In the above example, you replaced the first 12MB of the HP dump with that of -your Libreboot image, but leaving the final 4MB intact which contains the EC -firmware. Libreboot's custom IFD sets everything so that all regions, from -IFD to GbE, ME and then BIOS region, exist within the first 12MB of flash. -This makes the machine boot from the end of the 12MB section, containing the -coreboot bootblock, instead of the HP bootblock (which is never executed but -must remain intact). +If you're flashing internally, add `--noverify-all` to the flashprog +command. -It's very important that you *erase* the 2MB flash. Be careful *not* to -erase the system (16MB flash). This is yet another reason why you should keep -a backup of both flash ICs, just in case (dumped using `-r` in flashrom). +To erase the 2MB flash, do this: -![](https://av.libreboot.org/hp820g2/hp820g2.jpg) +``` +flashprog -p PROGRAMMER --erase +``` -![](https://av.libreboot.org/hp820g2/hp820g2_inside.jpg) - -And that's all. Refer to other documents on Libreboot's website for how -to handle Linux/BSD systems and generally use your machine. +Refer generally to the [main flashing guide](../install/) and to +the [external flashing guide](../install/spi.md) so that you can learn how +to actually flash it. TPM 2.0 potentially supported ============================== @@ -325,6 +187,7 @@ don't need to mess with this at all, when you build Libreboot yourself. You can see how this works, by looking at the patch which added 820 G2 support: -If you're using release builds, the MRC, refcode and (neutered) ME images are -missing from flash, and must be re-inserted, using the instructions -on [this page](../install/ivy_has_common.md). +![](https://av.libreboot.org/hp820g2/hp820g2.jpg) + +Yay. If you see this boot screen, you should be proud. This is a really +hard machine to flash.