Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WiP - W530: flash board config to externally flash single 8mb exposed spi flash chip (then flash whole 12mb internally) #1558

Conversation

tlaurion
Copy link
Collaborator

@tlaurion tlaurion commented Dec 19, 2023

Add flasher board config, coreboot config, ifd(s: to be modified) to permit under palmrest single 8mb flashing in the goal of permitting to flash whole combined 12mb internally with maximized images without need of total laptop disassembly to reach 4mb spi flash under reinforced case metal+plastic reinforcement (common thing for w530/t530 as reported under issue #1189)

Removal of plamrest and keyboard:
20231218_142518_4991553543739158827

Content:

  • blobs/xx30/ifd_w530_under_palmrest.bin: plainly extracted from ifd blobs/xx30/ifd_w530_under_palmrest_adjusted.bin adjusted by me_cleaner boards/x230-legacy-flash/x230-legacy-flash.config
  • config/coreboot-w530-maximized_flash_under_palmrest.config: currently 8mb BIOS. initrd/etc/layout_maximized_ivy.txt: shared layout of ivy maximized boards

Current status when internally flashing:
20231218_211344_2949341117452974357

Text output

read_flash: failed to read (0x001000..0xbffff)

When successful, will fix

…) to permit under palmrest single 8mb flashing in the goal of permitting to flash whole combined 12mb internally with maximized images.

blobs/xx30/ifd_w530_under_palmrest.bin: plainly extracted from ifd
blobs/xx30/ifd_w530_under_palmrest_adjusted.bin adjusted by me_cleaner
boards/x230-legacy-flash/x230-legacy-flash.config
config/coreboot-w530-maximized_flash_under_palmrest.config: currently 8mb BIOS.
initrd/etc/layout_maximized_ivy.txt: shared layout of ivy maximized boards

Error on flashrom read:
read_flash: dailed to read (0x001000..0xbffff)

Signed-off-by: Thierry Laurion <[email protected]>
@tlaurion tlaurion changed the title WiP - W530: WiP - W530: flash board config to externally flash single 8mb exposed spi flash chip (then flash whole 12mb internally) Dec 19, 2023
@tlaurion tlaurion self-assigned this Dec 19, 2023
- Here we add blobs/xx30/ifd_w530_under_palmrest_adjusted.bin.new
- We point config/coreboot-w530-maximized_flash_under_palmrest.config to it

Created by:
build/x86/coreboot-4.19/util/ifdtool/ifdtool -u blobs/xx30/ifd_w530_under_palmrest_adjusted.bin

diff -u <(build/x86/coreboot-4.19/util/ifdtool/ifdtool -d blobs/xx30/ifd_w530_under_palmrest_adjusted.bin) <(build/x86/coreboot-4.19/util/ifdtool/ifdtool -d blobs/xx30/ifd_w530_under_palmrest_adjusted.bin.new)
--- /dev/fd/63	2023-12-19 16:24:49.884000000 -0500
+++ /dev/fd/62	2023-12-19 16:24:49.886000000 -0500
@@ -1,4 +1,4 @@
-File blobs/xx30/ifd_w530_under_palmrest_adjusted.bin is 4096 bytes
+File blobs/xx30/ifd_w530_under_palmrest_adjusted.bin.new is 4096 bytes
 PCH Revision: 6 series Cougar Point
 FLMAP0:    0x03040103
   NR:      3
@@ -197,30 +197,30 @@
 AltMeDisable bit is set

 Found Master Section
-FLMSTR1:   0x0a0b0000 (Host CPU/BIOS)
-  Platform Data Region Write Access: disabled
+FLMSTR1:   0xffff0000 (Host CPU/BIOS)
+  Platform Data Region Write Access: enabled
   GbE Region Write Access:           enabled
-  Intel ME Region Write Access:      disabled
+  Intel ME Region Write Access:      enabled
   Host CPU/BIOS Region Write Access: enabled
-  Flash Descriptor Write Access:     disabled
-  Platform Data Region Read Access:  disabled
+  Flash Descriptor Write Access:     enabled
+  Platform Data Region Read Access:  enabled
   GbE Region Read Access:            enabled
-  Intel ME Region Read Access:       disabled
+  Intel ME Region Read Access:       enabled
   Host CPU/BIOS Region Read Access:  enabled
   Flash Descriptor Read Access:      enabled
   Requester ID:                      0x0000

-FLMSTR2:   0x04040000 (Intel ME)
-  Platform Data Region Write Access: disabled
-  GbE Region Write Access:           disabled
+FLMSTR2:   0xffff0000 (Intel ME)
+  Platform Data Region Write Access: enabled
+  GbE Region Write Access:           enabled
   Intel ME Region Write Access:      enabled
-  Host CPU/BIOS Region Write Access: disabled
-  Flash Descriptor Write Access:     disabled
-  Platform Data Region Read Access:  disabled
-  GbE Region Read Access:            disabled
+  Host CPU/BIOS Region Write Access: enabled
+  Flash Descriptor Write Access:     enabled
+  Platform Data Region Read Access:  enabled
+  GbE Region Read Access:            enabled
   Intel ME Region Read Access:       enabled
-  Host CPU/BIOS Region Read Access:  disabled
-  Flash Descriptor Read Access:      disabled
+  Host CPU/BIOS Region Read Access:  enabled
+  Flash Descriptor Read Access:      enabled
   Requester ID:                      0x0000

 FLMSTR3:   0x08080118 (GbE)
As of now for testing laptop, alternatives are:
- Will try to solder on cn100 pad/create 3dprinted gadget/something existing that could easily be plugged there to do first flash/unbrick
- Figure out the coreboot doc's "easy trick" that I don't find easy at all at https://doc.coreboot.org/mainboard/lenovo/w530.html
  - Connect cs pin to 4mb chip to be able to talk to 4mb chip instead of the 8mb one? Would be nice but don't know how to create gadget reproducibly without soldering

Current output of flashrom:
flashrom  on Linux 5.10.5-Heads (x86_64)
flashrom is free software, get the source code at https://flashrom.org

Calibrating delay loop... OK.
coreboot table found at 0x7feef000.
Found chipset "Intel QM77".
Enabling flash write... FREG0: Flash Descriptor region (0x00000000-0x00000fff) is read-write.
FREG1: BIOS region (0x0001b000-0x007fffff) is read-write.
FREG2: Management Engine region (0x00003000-0x0001afff) is read-write.
FREG3: Gigabit Ethernet region (0x00001000-0x00002fff) is read-write.
Enabling hardware sequencing due to multiple flash chips detected.
OK.
Multiple flash components detected, skipping flash identification.
Found Programmer flash chip "Opaque flash chip" (12288 kB, Programmer-specific) on internal.
Reading old flash chip contents... Transaction error between offset 0x00800000 and 0x0080003f (= 0x00800000 + 63)!
read_flash: failed to read (0x001000..0xbfffff).
FAILED.

Explanation: even if original firmware is not having bios protection on, even if OPTION_TABLE is disregarded by coreboot, eve if IFD is unlocked...
Flashrom is incapable of touching the 4mb chip in reading or writing. internal:laptop:force_Iwant_a_brick and all the other trics fail.
Bios lock is in action and seems to require exploit chain to be able to flash internally.

Signed-off-by: Thierry Laurion <[email protected]>
@tlaurion
Copy link
Collaborator Author

tlaurion commented Jan 9, 2024

This can't be done.

The only way forward here is to

  • 1vyprep from windows to put firmware in exploitable version.
  • backup exposed 8mb spi chip, ifdtool -u it and flash it back
  • 1vyrain it (run exploit chain up to flash prompt, where bios region is now unlocked which spans over 8mb+4mb spi chips), and then ctrl-c, and flashrom -p internal - r/-w 12mb.rom (-r for backup, -w to flash heads).

Reasoning is that there is no way a 8mb defined ifd can actually seek out of the 8mb flash to span over 4mb flash in opaque combined spi flash from internal programmer; therefore impossible to flash 12mb image internally from a 8mb defined boundary rom flashed over 8mb chip only. Would have been nice but simply technically impossible.

Todo for courageous:

  • use flashtools poke/peek instead but I would doubt it would work either since ifd+flashmap are for 8mb SPI with this PoC and basically 4mb SPI is out of reach.

@tlaurion tlaurion closed this Jan 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant