summaryrefslogtreecommitdiffstats
path: root/resources/utilities/ich9deblob/src/common
diff options
context:
space:
mode:
Diffstat (limited to 'resources/utilities/ich9deblob/src/common')
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.c30
-rw-r--r--resources/utilities/ich9deblob/src/common/descriptor_gbe.h1
2 files changed, 31 insertions, 0 deletions
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
index 6a87452..31cca1b 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.c
@@ -58,3 +58,33 @@ int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct,
return 0;
}
+
+/*
+ * create 4KiB file with descriptor
+ */
+int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName)
+{
+ FILE* fileStream = NULL;
+
+ /* delete old file before continuing */
+ remove(fileName);
+
+ /* open new file for writing the descriptor+gbe */
+ fileStream = fopen(fileName, "ab");
+
+ /* write the descriptor region into the first part */
+ if (DESCRIPTORREGIONSIZE != fwrite((uint8_t*)&descriptorStruct, 1, sizeof(descriptorStruct), fileStream))
+ {
+ printf("\nerror: writing descriptor region failed\n");
+ return 1;
+ }
+
+
+ fclose(fileStream);
+
+ printf("descriptor successfully written to the file: %s\n", fileName);
+ printf("Now do: dd if=%s of=yourrom.rom bs=1 count=4k conv=notrunc\n", fileName);
+ printf("(in other words, add the modified descriptor to your ROM image)\n\n");
+
+ return 0;
+}
diff --git a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
index d3e8977..94d4a24 100644
--- a/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
+++ b/resources/utilities/ich9deblob/src/common/descriptor_gbe.h
@@ -32,5 +32,6 @@
#include "../gbe/gbe.h" /* structs describing what's in the gbe region */
int notCreatedDescriptorGbeFile(struct DESCRIPTORREGIONRECORD descriptorStruct, struct GBEREGIONRECORD_8K gbeStruct8k, char* fileName);
+int notCreated4kDescriptorFile(struct DESCRIPTORREGIONRECORD descriptorStruct, char* fileName);
#endif