summaryrefslogtreecommitdiff
path: root/resources/bios_extract/patches/0003-dell_inspiron_1100_unpacker-Add-module-type-0x52.patch
blob: 6de392be5f009b8db89c17354b03675c03deb1df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From b3868ed71a390f925eb22b926b9c735f7b84b383 Mon Sep 17 00:00:00 2001
From: Nicholas Chin <nic.c3.14@gmail.com>
Date: Sat, 6 May 2023 11:14:45 -0600
Subject: [PATCH 3/3] dell_inspiron_1100_unpacker: Add module type 0x52

The module with type 0x52 in the Latitude E6400 BIOS is the EC firmware,
and is not compressed. The current behavior tries to decompress this
module leading to an index out of bounds error at runtime, so add a new
condition to avoid decompressing it. This assumes type 0x52 is always
used for EC firmware.

The current behavior also assumes all the data before the first module
is EC firmware, which was probably true for the Inspiron 1100, but for
the E6400 the EC firmware is in module 0x52. However, for simplicity an
exception is not made for this behavior, so the extracted EC.bin should
just be treated as spurious data for the E6400.

TEST: Inspiron 1100 BIOS is still unpacked correctly, Latitude E6400
BIOS unpacks without runtime errors.

Signed-off-by: Nicholas Chin <nic.c3.14@gmail.com>
Change-Id: I3152150b7dea4d79840c61683692c65b1311cce2
---
 dell_inspiron_1100_unpacker.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/dell_inspiron_1100_unpacker.py b/dell_inspiron_1100_unpacker.py
index 5e43813..3589550 100755
--- a/dell_inspiron_1100_unpacker.py
+++ b/dell_inspiron_1100_unpacker.py
@@ -66,6 +66,7 @@ def dell_unpack(indata):
 mod_types = {
     0x01: "Main ROM",
     0x0C: "Microcode update",
+    0x52: "EC firmware"
 }
 
 print("Dell/Phoenix ROM BIOS PLUS unpacker")
@@ -107,7 +108,7 @@ while True:
         break
     data = f[offs:offs+leng]
     offs += leng
-    if type_id != 0xC:
+    if type_id != 0xC and type_id != 0x52:
         odata = dell_unpack(data)
     else:
         odata = data
-- 
2.40.1